<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://daq00.triumf.ca/MidasWiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Suz</id>
	<title>MidasWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://daq00.triumf.ca/MidasWiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Suz"/>
	<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php/Special:Contributions/Suz"/>
	<updated>2026-04-29T12:20:06Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=/Experiment_ODB_tree&amp;diff=2862</id>
		<title>/Experiment ODB tree</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=/Experiment_ODB_tree&amp;diff=2862"/>
		<updated>2019-05-29T01:40:23Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[odbedit]]&lt;br /&gt;
* &lt;br /&gt;
*&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Creating the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt;  tree ==&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; ODB tree is created automatically when the &#039;&#039;&#039;[[odbedit #Creating the ODB|ODB is first created]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; ODB tree contains information relevent to the experiment. Other optional keys are added by &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039; or by &lt;br /&gt;
the user to customize their experiment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
When initially created, the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; tree contains the following keys:&lt;br /&gt;
 [local:midas:S]/&amp;gt;ls -lrt /experiment&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
 Experiment                      DIR&lt;br /&gt;
    Name                         STRING  1     32    14s  0   RWD  midas&lt;br /&gt;
    Buffer sizes                 DIR&lt;br /&gt;
        SYSMSG                   DWORD   1     4     11h  0   RWD  100000&lt;br /&gt;
    Security                     DIR&lt;br /&gt;
        Enable non-localhost RPC BOOL    1     4     46s  0   RWD  n&lt;br /&gt;
        RPC ports                DIR&lt;br /&gt;
           ODBEdit               DWORD   1     4     38m  0   RWD  0&lt;br /&gt;
        RPC hosts                DIR&lt;br /&gt;
           Allowed hosts         STRING  10    256   38m  3   RWD&lt;br /&gt;
                                         [0]             localhost&lt;br /&gt;
                                         [1]&lt;br /&gt;
                                         [2]&lt;br /&gt;
                                         [3]&lt;br /&gt;
                                         [4]&lt;br /&gt;
                                         [5]&lt;br /&gt;
                                         [6]&lt;br /&gt;
                                         [7]&lt;br /&gt;
                                         [8]&lt;br /&gt;
                                         [9]&lt;br /&gt;
        Disable RPC hosts check  BOOL    1     4     46s  0   RWD  n&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following example shows the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; tree for a typical experiment: &lt;br /&gt;
&lt;br /&gt;
 [local:midas:R]/&amp;gt;ls -lrt /experiment&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
 Experiment                      DIR&lt;br /&gt;
    Name                         STRING  1     32    7s   0   RWD  midas&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Buffer sizes&amp;lt;/span&amp;gt;                 DIR&lt;br /&gt;
        SYSMSG                   DWORD   1     4     23h  0   RWD  100000&lt;br /&gt;
        SYSTEM                   DWORD   1     4     23h  0   RWD  640000000&lt;br /&gt;
        BUF0                     DWORD   1     4     23h  0   RWD  80000000&lt;br /&gt;
        BUF1                     DWORD   1     4     23h  0   RWD  80000000&lt;br /&gt;
        .......    &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;&#039;&#039;other user-defined buffers not shown &#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Security&amp;lt;/span&amp;gt;                     DIR&lt;br /&gt;
        Enable non-localhost RPC BOOL    1     4     38m  0   RWD  n&lt;br /&gt;
        &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;RPC ports&amp;lt;/span&amp;gt;                DIR&lt;br /&gt;
            ODBEdit              DWORD   1     4     38m  0   RWD  0&lt;br /&gt;
            Logger               DWORD   1     4     35m  0   RWD  0&lt;br /&gt;
            mhttpd               DWORD   1     4     23m  0   RWD  0&lt;br /&gt;
        &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;RPC hosts&amp;lt;/span&amp;gt;                DIR&lt;br /&gt;
            Allowed hosts        STRING  10    256   38m  3   RWD&lt;br /&gt;
                                         [0]             localhost&lt;br /&gt;
                                         [1]&lt;br /&gt;
                                         [2]&lt;br /&gt;
                                         [3]&lt;br /&gt;
                                         [4]&lt;br /&gt;
                                         [5]&lt;br /&gt;
                                         [6]&lt;br /&gt;
                                         [7]&lt;br /&gt;
                                         [8]&lt;br /&gt;
                                         [9]&lt;br /&gt;
        Disable RPC hosts check  BOOL    1     4     38m  0   RWD  n&lt;br /&gt;
        &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;mhttpd hosts&amp;lt;/span&amp;gt;             DIR&lt;br /&gt;
            Allowed hosts        STRING  10    256   5h   0   RWD&lt;br /&gt;
                                         [0]&lt;br /&gt;
                                         [1]&lt;br /&gt;
                                         [2]&lt;br /&gt;
                                         [3]&lt;br /&gt;
                                         [4]&lt;br /&gt;
                                         [5]&lt;br /&gt;
                                         [6]&lt;br /&gt;
                                         [7]&lt;br /&gt;
                                         [8]&lt;br /&gt;
                                         [9]&lt;br /&gt;
    midas http port              INT     1     4     5h   0   RWD  8080&lt;br /&gt;
    midas https port             INT     1     4     5h   0   RWD  8443&lt;br /&gt;
    http redirect to https       BOOL    1     4     5h   0   RWD  y&lt;br /&gt;
    Start-Stop Buttons           BOOL    1     4     8h   0   RWD  y&lt;br /&gt;
    Pause-Resume Buttons         BOOL    1     4     8h   0   RWD  n&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Status items&amp;lt;/span&amp;gt;                DIR&lt;br /&gt;
        Experiment Name -&amp;gt; /Experiment/Name&lt;br /&gt;
    MAX_EVENT_SIZE               DWORD   1     4     23h  0   RWD  4194304&lt;br /&gt;
    Midas server port            DWORD   1     4     3m   0   RWD  1175&lt;br /&gt;
    Transition debug flag        INT     1     4     23h  0   RWD  0&lt;br /&gt;
    Transition connect timeout   INT     1     4     23h  0   RWD  10000&lt;br /&gt;
    Transition timeout           INT     1     4     23h  0   RWD  120000&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;edit on start&amp;lt;/span&amp;gt;                DIR&lt;br /&gt;
        experiment number        DWORD   1     4     2h   0   RWD  9499&lt;br /&gt;
        field                    STRING  1     32    2h   0   RWD  19000.2(0.0)G&lt;br /&gt;
        comment-&amp;gt; /Experiment/run parameters/comment&lt;br /&gt;
                                 STRING  1     80    2h   0   RWD  Testing with low beam&lt;br /&gt;
        Number of channels -&amp;gt; /Run Parameters/number of channels&lt;br /&gt;
                                 DWORD   1     4     2h   0   RWD  20&lt;br /&gt;
        Write Data -&amp;gt; /Logger/Write data&lt;br /&gt;
                                 BOOL    1     4     2h   0   RWD  n&lt;br /&gt;
        Number of cycles -&amp;gt; /Equipment/FIFO_acq/frontend/hardware/num cycles&lt;br /&gt;
                                 DWORD   1     4     2h   0   RWD  0&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Parameter Comments&amp;lt;/span&amp;gt;           DIR                   &lt;br /&gt;
        field                    STRING  1     32    &amp;gt;99d 0   RWD  &amp;lt;i&amp;gt;Entered in Tesla unit&amp;lt;/i&amp;gt;&lt;br /&gt;
        Num cycles               STRING  1     80    &amp;gt;99d 0   RWD  &amp;lt;i&amp;gt;Stop run after num cycles is reached. Enter 0 to disable (free running)&amp;lt;/i&amp;gt;&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Run Parameters&amp;lt;/span&amp;gt;               DIR&lt;br /&gt;
        Comment                  STRING  1     80    2h   0   RWD  Testing with low beam&lt;br /&gt;
        Run Description          STRING  1     256   7h   0   RWD  Sequencer Tests&lt;br /&gt;
        Number of channels       DWORD   1     4     2h   0   RWD  20&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Lock when running&amp;lt;/span&amp;gt;            DIR&lt;br /&gt;
        Num channels -&amp;gt; /Run Parameters/number of channels&lt;br /&gt;
                                 DWORD   1     4     2h   0   RWD  20&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;edit on sequence&amp;lt;/span&amp;gt;             DIR&lt;br /&gt;
        title                    STRING  1     128   2h   0   RWD  none&lt;br /&gt;
        experiment number        DWORD   1     4     2h   0   RWD  9438&lt;br /&gt;
        experimenter             STRING  1     32    2h   0   RWD  gls&lt;br /&gt;
        sample                   STRING  1     36    2h   0   RWD  NA&lt;br /&gt;
        run description -&amp;gt; /Experiment/run parameters/run description&lt;br /&gt;
                                 STRING  1     256   7h   0   RWD  Sequencer Tests&lt;br /&gt;
        Write Data -&amp;gt; /Logger/Write data&lt;br /&gt;
                                 BOOL    1     4     2h   0   RWD  n&lt;br /&gt;
        Number of cycles -&amp;gt; /Equipment/FIFO_acq/frontend/hardware/num cycles&lt;br /&gt;
                                 DWORD   1     4     2h   0   RWD  0&lt;br /&gt;
    Prevent start on alarms      BOOL    1     4     22h  0   RWD  n&lt;br /&gt;
    Prevent start on required    BOOL    1     4     22h  0   RWD  n&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Status items&amp;lt;/span&amp;gt;                 DIR&lt;br /&gt;
        Experiment Name -&amp;gt; /Experiment/Name&lt;br /&gt;
                                 STRING  1     32    7s   0   RWD  midas&lt;br /&gt;
    Start-Stop Buttons           BOOL    1     4     5h   0   RWD  y&lt;br /&gt;
    Pause-Resume Buttons         BOOL    1     4     5h   0   RWD  n&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Keys in &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; tree==&lt;br /&gt;
&lt;br /&gt;
The keys in the ODB &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment tree&#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
are described in the following sections.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Name &#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]]&lt;br /&gt;
contains the name of the experiment. It is created by the MIDAS system when the ODB is created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Buffer Sizes &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&lt;br /&gt;
This key in the [[#top|/Experiment tree]] is a subtree to contain the sizes of the &lt;br /&gt;
Midas Buffers for the experiment. Created by the MIDAS system with default values. The sizes can be changed to optimize the memory usage. See &#039;&#039;&#039;[[Event Buffer]]&#039;&#039;&#039; Size(s) for details.  Other user-defined&lt;br /&gt;
buffers may be present (e.g. for &#039;&#039;&#039;[[event filtering]]&#039;&#039;&#039;).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;SYSMSG &#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  100000 Bytes&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#Buffer Sizes|/Experiment/Buffer Sizes subtree]]&lt;br /&gt;
contains the size of SYSMSG buffer. This buffer is used for MIDAS messages.&lt;br /&gt;
The default value of this key is defined by MESSAGE_BUFFER_SIZE in $MIDASSYS/include/msystem.h .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;SYSTEM &#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  32MiBytes&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#Buffer Sizes|/Experiment/Buffer Sizes subtree]]&lt;br /&gt;
contains the size of SYSTEM buffer.  The default value of this key is&lt;br /&gt;
DEFAULT_BUFFER_SIZE = 32 MiB (defined in [http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/html/midas_8h_source.html midas.h]). &lt;br /&gt;
The actual SYSTEM buffer size is set by this key. To increase the SYSTEM buffer size (e.g. for very large events), see [[Event Buffer]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;MAX_EVENT_SIZE &#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  4MiBytes&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]]&lt;br /&gt;
specifies the maximum event size that can be acquired. The default value of this key is&lt;br /&gt;
DEFAULT_MAX_EVENT_SIZE =  4 MiB  (defined in [http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/html/midas_8h_source.html midas.h]). &lt;br /&gt;
The actual maximum event size is set by this key, and can be increased for larger events if needed (see  [[Event Buffer]] for more information).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;midas http port&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  8080&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is created when [[mhttpd]] is run for the first time. It contains the listening port for the HTTP server (default 8080). This will be redirected to the secure HTTPS port given by [[#midas https port|midas https port]] if the key [[#http redirect to https|http redirect to https]] is set to &amp;quot;y&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If the http port are supplied with the &amp;quot;--http&amp;quot; option when starting  {{Utility|name=mhttpd}}, the port supplied will overwrite the default value stored in this key. See [[mhttpd]] for details. &lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This [[Security]] feature was added to  [[mhttpd]] in August 2015&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;midas https port&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  8443&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is created when [[mhttpd]] is run for the first time. It contains the listening port (default 8443) for the secure &lt;br /&gt;
HTTPS/SSL server ([https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose]). &lt;br /&gt;
&lt;br /&gt;
If the https port is supplied with the &amp;quot;--https&amp;quot; option when starting  {{Utility|name=mhttpd}}, the port supplied will overwrite the default value stored in this key. See [[mhttpd]] for details.&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This [[Security]] feature was added to [[mhttpd]] in August 2015&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;http redirect to https&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  y&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is created when [[mhttpd]] is run for the first time.  If set to &amp;quot;y&amp;quot;, connections to the http port (specified by the key [[#midas http port|midas http port]] will be redirected to hte https port (specified by the key [[#midas https port|midas https port]], i.e. the listening port for the secure &lt;br /&gt;
HTTPS/SSL server ([https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose]). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This [[Security]] feature was added to [[mhttpd]] in August 2015&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;midas server port&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  1175&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key is created when [[mserver]] is started for the first time. It contains the default value of the port used by [[mserver]]. This is set to MIDAS_TCP_PORT = 1175 ( midas.h).  A different port can be used by starting [[mserver]] with the -p argument.&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This key was added in May 2015 (see [[Security]]). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Start-Stop Buttons&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; y&lt;br /&gt;
 &amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is added automatically by &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039; to allow the user to suppress the Start or Stop buttons from appearing on the [[Status Page]]. By default, Start/Stop buttons are shown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Pause-Resume Buttons&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; n&lt;br /&gt;
 &amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is added automatically by &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039;.&lt;br /&gt;
By default the Pause/Resume menu buttons do not appear on the [[Status Page]]. The user can allow these buttons&lt;br /&gt;
to appear during the run by setting this key to &amp;quot;y&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition debug flag &#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains a flag that, if set to 1, causes messages reporting transition progress to be output.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition connect timeout&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  10000&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains the&lt;br /&gt;
value of timeout for remote rpc connect&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition timeout&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  120000&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains the&lt;br /&gt;
value of timeout for transition &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Prevent start on alarms&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;  &lt;br /&gt;
This key in the [[#top|/Experiment tree]] if set true &lt;br /&gt;
will prevent the run from starting if an [[Alarm System|alarm]] is true, i.e.&lt;br /&gt;
the run start procedure will fail if an alarm has been [[/Alarms ODB tree#Triggered|Triggered]] for a client, provided a valid [[/Alarms ODB tree#alarms class|alarms class]] has&lt;br /&gt;
been entered in the client&#039;s [[/Programs ODB tree#Alarm class|Alarm class]] key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Prevent start on required program&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] if set true (&amp;quot;y&amp;quot;)&lt;br /&gt;
will prevent the run from starting if one of the &#039;&#039;&#039;required&#039;&#039;&#039; clients is not running. A client is flagged as &amp;quot;required&amp;quot; by setting the ODB key &lt;br /&gt;
[[/Programs ODB tree#Required|Required]] to &amp;quot;y&amp;quot;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Edit on Sequence &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This  optional subdirectory  in the [[#top|/Experiment tree]] may&lt;br /&gt;
contain user-defined parameters which will be displayed for editing at the start of each [[Sequencer|Sequence]]. See [[Edit-on-Sequence Parameters]] for details. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Edit on Start &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This  optional subdirectory  in the [[#top|/Experiment tree]] may&lt;br /&gt;
contain user-defined parameters which will be displayed for editing at the beginning of each run. See &#039;&#039;&#039;[[Edit-on-start Parameters]]&#039;&#039;&#039; for details. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Lock when running &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This  optional subdirectory  in the [[#top|/Experiment tree]] contains user-defined links to ODB parameters to prevent them being changed when the run is in progress. See &#039;&#039;&#039;[[Lock when running]]&#039;&#039;&#039; for details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Parameter Comments &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This  optional subdirectory   in the [[#top|/Experiment tree]] may contain user-defined parameter comments that give more information about&lt;br /&gt;
the &#039;&#039;&#039;[[Edit-on-start Parameters]]&#039;&#039;&#039;.  See [[Edit-on-start Parameters#edit-on-start parameter comments|creating parameter comments]] for details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Run Parameters &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This  optional subdirectory   in the [[#top|/Experiment tree]] may contain user-defined parameters or parameter(s)&lt;br /&gt;
with reserved names (i.e. [[#Run Description|Run Description]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Run Description&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This ODB key is used by the [[Sequencer]] [[Sequencer#RUNDESCRIPTION|RUNDESCRIPTION]] command to store the&lt;br /&gt;
run description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;&amp;lt;parameter name&amp;gt;&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
The user may define parameters here e.g. for linking as  &#039;&#039;&#039;[[Edit-on-start Parameters|Edit-on-start]]&#039;&#039;&#039; or &#039;&#039;&#039;[[Edit-on-Sequence Parameters|Edit-on-Sequence]]&#039;&#039;&#039; parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Status items&#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This key in the [[#top|/Experiment tree]] is a subtree  which by default contains a link to the [[#Name|experiment name]]. Any links or keys&lt;br /&gt;
created by the user in this optional subdirectory will be displayed on the [[mhttpd]] main status page. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Security&#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This optional subtree   in the [[#top|/Experiment tree]] is created when the &#039;&#039;&#039;[[odbedit]]&#039;&#039;&#039; commands  &amp;lt;span style=&amp;quot;color:saddlebrown; font-style:bold; &amp;quot;&amp;gt;passwd&amp;lt;/span&amp;gt; or  &amp;lt;span style=&amp;quot;color:saddlebrown; font-style:bold; &amp;quot;&amp;gt;webpasswd&amp;lt;/span&amp;gt; are issued. It enables a user to set up security features. See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Disable RPC hosts check&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting the key to &amp;quot;n&amp;quot; (the default) causes access by unauthorized hosts to be prevented by the system checking the RPC access control list (see [[#RPC hosts subtree|RPC hosts/Allowed hosts]]).&lt;br /&gt;
&lt;br /&gt;
If MIDAS clients have to connect from random hosts (i.e. dynamically assigned random DHCP addresses), one can disable the host name checks by &lt;br /&gt;
setting this key to &amp;quot;y&amp;quot;. This configuration is insecure and should only be done on a private network behind a firewall. See [https://midas.triumf.ca/elog/Midas/1080 Note 1080].&lt;br /&gt;
&lt;br /&gt;
; NOTE&lt;br /&gt;
: This key was added August 2015. Used by [[mserver]] to improve network [[Security]] for the MIDAS experiment. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Enable non-localhost RPC&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The default value of this key is &amp;quot;n&amp;quot;, denying access by external network connections.  If running an experiment that requires external network connections, this key must be set to &amp;quot;y&amp;quot; and the key [[#RPC hosts|RPC hosts]] must be filled. See [https://midas.triumf.ca/elog/Midas/1080 Note 1080].&lt;br /&gt;
&lt;br /&gt;
; NOTE&lt;br /&gt;
: This key was added August 2015. Used by [[mserver]] to improve network [[Security]] for the MIDAS experiment. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;RPC ports&#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This subtree in the [[#Security subtree|/Experiment/Security subtree]] is new as of August 2015. It is created by the MIDAS system. &lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;). This subdirectory contains the names of MIDAS clients and their fixed TCP port numbers. When a client is started for the first time, an entry named for the client will be created in this subtree.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;&amp;lt;client-name&amp;gt;&#039;&#039;&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When a MIDAS client is started, a key will be created named for that client. It will contain the fixed TCP port number that the MIDAS client is using.&lt;br /&gt;
Clients started on the local host will have TCP port numbers of 0 (default).&lt;br /&gt;
&lt;br /&gt;
Once a remote [[Frontend Operation|frontend]] is bound to a fixed port, appropriate openings can be made in the firewall, etc. Default port number value &lt;br /&gt;
will be 0 meaning &amp;quot;use random port&amp;quot;, same as now. See [https://midas.triumf.ca/elog/Midas/1079].&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This feature was added  August 2015. It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;RPC hosts&#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This subtree in the [[#Security subtree|/Experiment/Security subtree]] is new as of August 2015. It is created by the MIDAS system. &lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Allowed hosts (rpc hosts)&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- need this because of duplicate &amp;quot;Allowed hosts&amp;quot; in &amp;quot;mhttpd hosts/&amp;quot; subtree --&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Allowed hosts&#039;&#039;&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING array&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;localhost&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This key in the [[#RPC hosts subtree|/Experiment/Security/RPC hosts subtree]] is new as of August 2015 and is created by the system (i.e. midas.c).&lt;br /&gt;
&lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;) and is used to maintain a Network Access Control list. &lt;br /&gt;
The access control list array is self-growing - it will have at least 10 empty entries at the end at all times.&lt;br /&gt;
&lt;br /&gt;
The default value for {{Odbpath|path=Allowed hosts[0]}} is &amp;quot;localhost&amp;quot;, which will reject all external connections, even when permitted by [[#Enable external RPC connections|Enable external RPC connections]].  The user will be required to enter the names of all machines that will run midas clients in this array. See [https://midas.triumf.ca/elog/Midas/1090].&lt;br /&gt;
&lt;br /&gt;
All clients&#039; db_watch() routines watch the access control list and automatically reload it when it is changed, so there is no need to restart clients.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;mhttpd hosts&#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This subtree in the [[#Security subtree|/Experiment/Security subtree]] is new as of August 2015. It is created by the MIDAS system. &lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Allowed hosts (mhttpd hosts)&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- need this because of duplicate &amp;quot;Allowed hosts&amp;quot; in &amp;quot;rpc hosts/&amp;quot; subtree --&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Allowed hosts&#039;&#039;&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING array&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;localhost&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This key in the [[#RPC hosts subtree|/Experiment/Security/mhttpd hosts subtree]] is new as of August 2015 and is created by the system (i.e. midas.c).&lt;br /&gt;
&lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;) and is used to maintain an access control list for [[mhttpd]].  An empty list means free access from everywhere. Access control is also controlled by the [[mhttpd]] &amp;quot;-a&amp;quot; command line arguments. Hosts supplied by the &amp;quot;-a&amp;quot; command line arguments are not added to the access control list by the system.&lt;br /&gt;
&lt;br /&gt;
The access control list is watched by  {{Utility|name=mhttpd}}, therefore there is no need to restart it after updating the list.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:silver&amp;quot;&amp;gt;&lt;br /&gt;
== &amp;lt;span style=&amp;quot;font-size:120%;&amp;quot;&amp;gt;The following keys in the /Experiment tree are OBSOLETE:&amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;CSS File&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Status: OBSOLETE&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;mhttpd.css&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains the name of the [[Custom Page Features#MIDAS stylesheet|MIDAS stylesheet]] file for the use of those writing [[Custom Page|Custom Web Pages]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: Serving resource file is now done differently.  See [[Custom Page Features#MIDAS resource files|serving MIDAS resource file]]. Also mhttpd.css has be replaced by midas.css.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;JS File&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Status: OBSOLETE&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;mhttpd.js&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains the name of the [[mhttpd.js|Javascript library]] file for the use of those writing [[Custom Page|Custom Web Pages]].&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: Serving resource file is now done differently. See [[Custom Page Features#MIDAS resource files|serving MIDAS resource files]]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Menu Buttons&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:2;-webkit-column-count:2&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Status: OBSOLETE&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;Status, ODB, Messages, ELog, Alarms, Programs, History, Sequencer, Chat, Config, Help&amp;quot;&lt;br /&gt;
 &amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]]&lt;br /&gt;
is added automatically by &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039; to allow the Menu buttons that appear on the &#039;&#039;&#039;[[mhttpd|Main Status Page]]&#039;&#039;&#039; to be customized by &lt;br /&gt;
removing unnecessary buttons or by changing their order. &lt;br /&gt;
&lt;br /&gt;
The Start/Stop/Pause/Resume buttons are not now included in  &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Menu Buttons&#039;&#039;&amp;lt;/span&amp;gt;. &lt;br /&gt;
* To suppress/display the Start/Stop buttons use key [[#Start-Stop Buttons|Start-Stop Buttons]].&lt;br /&gt;
* To display/suppress the Pause/Resume buttons, use key [[#Pause-Resume Buttons|Pause-Resume Buttons]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Note&lt;br /&gt;
:If [[MSCB Page#MIDAS with MSCB support|MSCB support]] is built into MIDAS, the default will also include the MSCB Menu button (see [[MSCB Page]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Mongoose listening_port&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Status: OBSOLETE&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;8080r,8443s&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:This key in the [[#top|/Experiment tree]] existed for a short time in midas versions May-August 2015. &lt;br /&gt;
: It has been &#039;&#039;&#039;replaced by the ODB keys [[#midas http port|midas http port]] and [[#midas https port|midas https port]].&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:80%&amp;quot;&amp;gt;&lt;br /&gt;
This key in the [[#top|/Experiment tree]] was created when [[mhttpd]] was run for the first time. It contained the listening ports for the secure &lt;br /&gt;
HTTPS/SSL server ([https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose]). The ports are the HTTP port (default 8080) which is to be redirected to the secure HTTPS port (default 8443). &lt;br /&gt;
If ports were supplied with the &amp;quot;--mg&amp;quot; option when starting  {{Utility|name=mhttpd}}, their values will overwrite the default values stored in this key. See [[mhttpd]] for details. &lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Mongoose access_control_list&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Status: OBSOLETE&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:This key in the [[#top|/Experiment tree]] existed for a short time in midas versions May-August 2015. &lt;br /&gt;
:&#039;&#039;&#039;Use the [[#mhttpd hosts subtree|mhttpd hosts/Allowed hosts]] access control list or the [[mhttpd]] &amp;quot;-a hostname&amp;quot; parameter to restrict access.&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:80%&amp;quot;&amp;gt;&lt;br /&gt;
This key in the [[#top|/Experiment tree]] is created when [[mhttpd]] is run for the first time. It contains the access control list (ACL) for the [https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose] web server.  By default, this key is empty and there is no access control.  The format of the ACL is described under access_control_list at [https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/Options.md?at=develop Mongoose Configuration Options].&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;font-size:120%; font-style:bold&amp;quot;&amp;gt;The following keys in the /Experiment/Security subdirectory are OBSOLETE - replaced by the [[Security|security features]] added Aug 2015&amp;lt;/span&amp;gt; ===&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Password &#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Status: OBSOLETE&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;This feature pre-dates the improved [[Security]] features (August 2015)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Do not set this key except through the {{Odbedit cmd|cmd=passwd}}. Setting an unencrypted password will lock you out of the ODB unless {{Utility|name=odbedit}} is listed in the [[#Allowed programs subtree|allowed programs subtree]].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;This security feature is not proof against malicious access. See [[Security]] for details.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This optional key in the [[#Security|/Experiment/Security subtree]]&lt;br /&gt;
contains the encrypted password. This Key is created when the {{Odbedit cmd|cmd=passwd}} is issued. See [[Security#Restrict user access|Restrict user access]] for details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Allowed Hosts&#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
* This subtree pre-dates the improved [[Security]] features (August 2015) and is not to be confused with  [[#RPC hosts subtree|RPC hosts/Allowed hosts]] array.&lt;br /&gt;
* This security feature is not proof against malicious access. See [[Security]] for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This subtree in the  [[#Security|/Experiment/Security subtree]] is created when the {{Odbedit cmd|cmd=passwd}} is issued. When created, this subtree is empty.&lt;br /&gt;
Optionally, it may contain  user-defined names of remote hosts allowed to have free access (i.e. without password) to the current experiment. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Allowed programs &#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
* This subtree pre-dates the improved [[Security]] features (August 2015)&lt;br /&gt;
* This feature is not proof against malicious access. See [[Security]] for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This optional subtree  in the  [[#Security|/Experiment/Security subtree]] is created when the {{Odbedit cmd|cmd=passwd}} is issued. When created, this subtree is empty.&lt;br /&gt;
Optionally, it may  contain user-defined names of clients allowed to have free access (i.e. without password) to the current experiment. See [[Security #Allowed programs]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Web Password&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Status: OBSOLETE&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
* This key pre-dates (and has been superceded by)  the improved [[Security]] features (August 2015)&lt;br /&gt;
* This feature is not proof against malicious access. See [[Security]] for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If [[Security#Restrict user access|restriction on user web access]] has been set up, this key in the  [[#Security|/Experiment/Security subtree]]&lt;br /&gt;
will contain an encrypted password for Web server access. This key is created by using the {{Odbedit cmd|cmd=webpasswd}}. &lt;br /&gt;
&lt;br /&gt;
If this key is present, the user will be requested to provide the &amp;quot;Web Password&amp;quot; when accessing the requested experiment in &amp;quot;Write Access&amp;quot; mode. The &amp;quot;Read Only Access&amp;quot; mode is still available (without a password) to all users.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- obsolete ..  silver --&amp;gt;&lt;br /&gt;
[[Category:ODB Tree]] [[Category:Experiment]] [[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=/Custom_ODB_tree&amp;diff=2861</id>
		<title>/Custom ODB tree</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=/Custom_ODB_tree&amp;diff=2861"/>
		<updated>2019-05-28T23:40:13Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[mhttpd |MIDAS web server (mhttpd)]] &lt;br /&gt;
* mhttpd [[Custom Page]]&lt;br /&gt;
* [[Custom Page Features]]&lt;br /&gt;
* mhttpd [[Status Page]]&lt;br /&gt;
* [[Mhttpd.js|MIDAS Javascript Library]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Purpose =&lt;br /&gt;
The {{Odbpath|path=/Custom}} ODB tree is required if the user wishes to create [[mhttpd]] custom pages. It contains essential data needed for [[mhttpd]] to display a custom page. The {{Odbpath|path=/images}} subtree is required if an imagefile (*.gif) is to be displayed on the custom page. Optionally, labels, bars and fills can be superimposed on the image.&lt;br /&gt;
&lt;br /&gt;
= Creating the &amp;lt;span style=&amp;quot;color:purple; font-style:italic;&amp;quot;&amp;gt;/Custom&amp;lt;/span&amp;gt;  tree =&lt;br /&gt;
The {{Odbpath|path=/Custom}} ODB tree is an optional tree that may be [[ODB#Creating ODB keys|created by the user]]. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Custom-Button&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div id=&amp;quot;Custom-Link&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
= Keys in the /Custom tree =&lt;br /&gt;
The optional ODB {{Odbpath|path=/Custom}} tree may contain any of the following :&lt;br /&gt;
&lt;br /&gt;
*  keys pointing to &#039;&#039;&#039;local&#039;&#039;&#039; external files containing custom web pages (html/javascript files)&lt;br /&gt;
*  keys pointing to &#039;&#039;&#039;local&#039;&#039;&#039; external files containing resources for custom web pages (e.g. .css style files, .js javascript file, images).&lt;br /&gt;
** Note: files that are have a &#039;.&#039; in the Key name are assumed to be resource files and are treated differently. See also the [[#Path key|Path key]] notes below.&lt;br /&gt;
** Note: .css, .js, .pdf, .jpg, .gif, .png, .svg, .ps, .eps, .xls, .doc, .txt, .asc, .zip files should get served up with the correct MIME types&lt;br /&gt;
*  keys containing the html code for [[Internal Custom Page#How to create an Internal Custom Page|internal custom webpages]] &lt;br /&gt;
*  &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Path&amp;lt;/span&amp;gt; variable, used to indicate where to look on host machine for external files.&lt;br /&gt;
*  &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/pwd&amp;lt;/span&amp;gt; subtree used to contain custom password keys&lt;br /&gt;
*  &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/images&amp;lt;/span&amp;gt; subtree used to specify images for custom pages&lt;br /&gt;
&lt;br /&gt;
Keys defined in this tree pointing to custom web pages of any kind are called &#039;&#039;&#039;&#039;&#039;custom-links&#039;&#039;&#039;&#039;&#039;.  &lt;br /&gt;
* External &#039;&#039;custom-links&#039;&#039; contain the path and filename of the external custom page file (or may be a symbolic link to a custom-link) &lt;br /&gt;
* Internal &#039;&#039;custom-links&#039;&#039; contain the code for an [[Internal Custom Page]]. &lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;custom-links&#039;&#039; are defined in this tree, except where [[#Key names|noted below]], the &#039;&#039;custom-links&#039;&#039; will appear as &#039;&#039;&#039;&#039;&#039;custom-buttons&#039;&#039;&#039;&#039;&#039;  on the [[mhttpd]] [[Status Page]]. By clicking on one of these &#039;&#039;custom-buttons&#039;&#039;, the custom page will be visible in a new frame (see also [[#Key names|Key names]]). &lt;br /&gt;
&lt;br /&gt;
We will note some of the subtleties of how the Custom tree keys are used in the following sub-sections. &lt;br /&gt;
&lt;br /&gt;
== Key names ==&lt;br /&gt;
The user chooses the names of any keys in the &amp;lt;span style=&amp;quot;color:purple; font-style:italic;&amp;quot;&amp;gt;/Custom&amp;lt;/span&amp;gt; ODB tree except for&lt;br /&gt;
* the key name &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Status&amp;lt;/span&amp;gt; is reserved (see [[Custom Page#Custom Status page|Custom Status Page]]). &lt;br /&gt;
* the key name &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;pwd&amp;lt;/span&amp;gt; is reserved (see optional  [[#Pwd subtree|Pwd subtree]] for custom passwords)&lt;br /&gt;
* the key name &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Path&amp;lt;/span&amp;gt; is reserved (see optional  [[#Path key|Path key] for details)&lt;br /&gt;
* keys in the  &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/images&amp;lt;/span&amp;gt; subtree have defined names except for the user-defined [[#&amp;lt;Image-name&amp;gt; subtree|&amp;lt;Image-name&amp;gt; subtree]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are two characters that have &#039;&#039;&#039;special meaning&#039;&#039;&#039; if they are the last character of a &#039;&#039;custom-link&#039;&#039; in the {{Odbpath|path=/Custom}} tree :&lt;br /&gt;
*    The character &amp;quot;&#039;&#039;&#039;&amp;amp;&#039;&#039;&#039;&amp;quot; forces the page to be opened within the current frame when the &#039;&#039;custom-button&#039;&#039; is pressed. If this character is omitted, the page will be opened in a new frame. The &amp;quot;&amp;amp;&amp;quot; character is omitted from the name of the button.&lt;br /&gt;
*    The character &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot; suppresses the &#039;&#039;custom-button&#039;&#039; from appearing on the [[Status Page]], forming a &#039;&#039;hidden-link&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;hidden-link&#039;&#039; feature can be used to provide external webpages hidden from the user, such as a stylesheet or a file of Javascript functions needed by other custom pages.&lt;br /&gt;
&lt;br /&gt;
The {{Odbpath|path=/Custom}} tree in the [[#Example|example]] below would produce one &#039;&#039;custom-button&#039;&#039;, i.e.{{Button|name=ppg&amp;amp;nbsp;cycle}}.&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: To avoid confusion, do not use custom-links that only differ by the special characters &amp;quot;&amp;amp;&amp;quot; and &amp;quot;!&amp;quot; (e.g. &amp;quot;test&amp;quot;, &amp;quot;test&amp;amp;&amp;quot; and &amp;quot;test!&amp;quot;) in the same ODB.&lt;br /&gt;
&lt;br /&gt;
= Path key =&lt;br /&gt;
&lt;br /&gt;
When creating custom external web pages you will usually want to use other resource files, like CSS style sheets or images.  &lt;br /&gt;
&lt;br /&gt;
One way to do that is to specify each of the files that you need to use in the  {{Odbpath|path=/Custom}} tree.  For instance, suppose you had a HTML file called  {{File|name=control.html}} that used an image called  {{File|name=valve.png}}.  You could &lt;br /&gt;
&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
 Control                         STRING  1     256   1h   0   RWD  /home/expt/online/custom/control.html&lt;br /&gt;
 valve.png!                      STRING  1     256   1h   0   RWD  /home/expt/online/custom/valve.png&lt;br /&gt;
&lt;br /&gt;
You would then be able to refer to that png normally in your HTML&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;img src=&amp;quot;valve.png!&amp;quot;&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
This approach can get tedious however, if you have a large number of resource files to add.&lt;br /&gt;
&lt;br /&gt;
An alternative is given by the {{Odbpath|path=Path}} ODB key.  This key can be used to specify a directory on the server file system where files should be searched for.  So, for instance, if the {{Odbpath|path=/Custom}} tree is set to &lt;br /&gt;
&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
 Path                            STRING  1     256   1h   0   RWD  /home/expt/online/custom/&lt;br /&gt;
 Control                         STRING  1     256   1h   0   RWD  control.html&lt;br /&gt;
&lt;br /&gt;
you can instruct  {{Utility|name=mhttpd}} to look in the directory  {{Filepath|path=/home/expt/online/custom/}} and then map the custom page &#039;Control&#039; to &lt;br /&gt;
 {{Filepath|path=/home/expt/online/custom/control.html}}.   &lt;br /&gt;
&lt;br /&gt;
One very important point: when the key {{Odbpath|path=/Custom/Path}} is defined, mhttpd will treat differently how it serves up resources, depending on whether there is a &#039;.&#039; in the resource web address.  So, for instance, for the custom page described above &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     https://myhost:8443/?cmd=custom&amp;amp;page=Control   &lt;br /&gt;
 or  http://myhost:8081/CS/Control   (very old MIDAS versions )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you will need to have a ODB key called  {{Odbpath|path=/Custom/Control}}, as described above.  &lt;br /&gt;
&lt;br /&gt;
However, if you have the ODB key  {{Odbpath|path=/Custom/Path}} and you access content like&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   https://myhost:8443/?cmd=custom&amp;amp;page=valve.png&lt;br /&gt;
or http://myhost:8081/CS/valve.png (very old MIDAS versions )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
then  {{Utility|name=mhttpd}} will automatically figure out that it should use the file&lt;br /&gt;
&lt;br /&gt;
 Value of &amp;quot;/Custom/Path&amp;quot; + valve.png&lt;br /&gt;
 i.e. /home/expt/online/custom/valve.png&lt;br /&gt;
&lt;br /&gt;
So the benefit is that with the   {{Odbpath|path=/Custom/Path}} key set, you can just place all your resource files in the directory pointed to by /Custom/Path and mhttpd will find them, &#039;&#039;&#039;without needing to specify them individually &#039;&#039;&#039;  {{Odbpath|path=/Custom}} as custom-links.&lt;br /&gt;
&lt;br /&gt;
See also [[Custom Page Features#Resource files]] for more examples.&lt;br /&gt;
&lt;br /&gt;
= Example  =	&lt;br /&gt;
The following example using the [[odbedit]] &#039;&#039;&#039;ls&#039;&#039;&#039; command shows the optional custom tree for an experiment. &lt;br /&gt;
&amp;lt;br&amp;gt;Note the use of the &amp;quot;&amp;amp;&amp;quot; and &amp;quot;!&amp;quot; characters in the names of the custom keys  (see [[#Key names|key names]] for details).&lt;br /&gt;
 [local:pol:S]/ls -lr /Custom&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
 custom                          DIR&lt;br /&gt;
    ppg_cycle&amp;amp;                  STRING  1    80    36h  0  RWD  /home/pol/online/pol/custom/pol_sc.html&lt;br /&gt;
    pol_functions!              STRING  1    80    36h  0  RWD  /home/pol/online/pol/custom/pol_functions.js&lt;br /&gt;
    style!                      STRING  1    80    36h  0  RWD  /home/pol/online/pol/custom/style.css&lt;br /&gt;
    images                      DIR&lt;br /&gt;
        pol_sc.gif              DIR&lt;br /&gt;
            background          STRING  1     80    36h  0   RWD  /home/pol/online/pol/custom/pol_sc.gif&lt;br /&gt;
            labels              DIR&lt;br /&gt;
                num bins        DIR&lt;br /&gt;
                    Src         STRING  1     256   36h  0   RWD  /Equipment/pol_acq/settings/output/num bins per cycle&lt;br /&gt;
                    Format      STRING  1     32    36h  0   RWD  %d&lt;br /&gt;
                    Font        STRING  1     32    36h  0   RWD  Medium&lt;br /&gt;
                    X           INT     1     4     36h  0   RWD  315&lt;br /&gt;
                    Y           INT     1     4     36h  0   RWD  502&lt;br /&gt;
                    Align       INT     1     4     36h  0   RWD  0&lt;br /&gt;
                    FGColor     STRING  1     8     36h  0   RWD  FFFFFF&lt;br /&gt;
                    BGColor     STRING  1     8     36h  0   RWD  0000FF&lt;br /&gt;
                dwell time      DIR&lt;br /&gt;
                    Src         STRING  1     256   36h  0   RWD  /Equipment/POL_ACQ/Settings/input/dwell time (ms)&lt;br /&gt;
                    Format      STRING  1     32    36h  0   RWD  %f ms&lt;br /&gt;
                    Font        STRING  1     32    36h  0   RWD  large&lt;br /&gt;
                    X           INT     1     4     36h  0   RWD  145&lt;br /&gt;
                    Y           INT     1     4     36h  0   RWD  430&lt;br /&gt;
                    Align       INT     1     4     36h  0   RWD  0&lt;br /&gt;
                    FGColor     STRING  1     8     36h  0   RWD  FFFFFF&lt;br /&gt;
                    BGColor     STRING  1     8     36h  0   RWD  0000FF&lt;br /&gt;
             fills              DIR&lt;br /&gt;
                    SSLevelBox  DIR&lt;br /&gt;
                    Src         STRING  1     256   36h  0   RWD  /Equipment/TpcGasPlc/GasCalc/Calculated[136]&lt;br /&gt;
                    X           INT     1     4     36h  0   RWD  578&lt;br /&gt;
                    Y           INT     1     4     36h  0   RWD  490&lt;br /&gt;
                    Limits      DOUBLE  3     8     2s   0   RWD&lt;br /&gt;
                                        [0]             0&lt;br /&gt;
                                        [1]             1&lt;br /&gt;
                                        [2]             2&lt;br /&gt;
                    Fillcolors  STRING  4     8     2s   0   RWD&lt;br /&gt;
                                        [0]             000000&lt;br /&gt;
                                        [1]             00FF00&lt;br /&gt;
                                        [2]             808080&lt;br /&gt;
             bars               DIR&lt;br /&gt;
                    temp        DIR&lt;br /&gt;
                    Src         STRING  1     256   36h  0   RWD  /Equipment/Temperature/Variables/Readback[5]&lt;br /&gt;
                    X           INT     1     4     36h  0   RWD  42&lt;br /&gt;
                    Y           INT     1     4     36h  0   RWD  68&lt;br /&gt;
                    Width       INT     1     4     36h  0   RWD  10&lt;br /&gt;
                    Height      INT     1     4     36h  0   RWD  50&lt;br /&gt;
                    Direction   INT     1     4     36h  0   RWD  0&lt;br /&gt;
                    Axis        INT     1     4     36h  0   RWD  1&lt;br /&gt;
                    Logscale    BOOL    1     4     &amp;gt;99d 0   RWD  n&lt;br /&gt;
                    Min         DOUBLE  1     8     &amp;gt;99d 0   RWD  0&lt;br /&gt;
                    Max         DOUBLE  1     8     &amp;gt;99d 0   RWD  0&lt;br /&gt;
                    FGcolor     STRING  1     8     2s   0   RWD  000000&lt;br /&gt;
                    BGcolor     STRING  1     8     2s   0   RWD  FFFFFF&lt;br /&gt;
                    BDcolor     STRING  1     8     2s   0   RWD  808080&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Pwd&amp;lt;/span&amp;gt; subtree=&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This optional subtree in the  [[#top|/Custom ODB tree]] is created by the user if [[Custom Page]] write access is to be  [[Custom Page Features#Password protection of ODB variables|password protected]].&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;&amp;lt;password&amp;gt;&amp;lt;/span&amp;gt; ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The &#039;&#039;&#039;name&#039;&#039;&#039; of the optional key(s) in the &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Pwd&amp;lt;/span&amp;gt; subtree defines a password that the user must specify to gain access to a [[Custom Page Features#Password protection of ODB variables|password-protected]]&lt;br /&gt;
item on a [[Custom Page]]. &lt;br /&gt;
&lt;br /&gt;
=== Password examples ===&lt;br /&gt;
If the password is &#039;&#039;CustomPwd&#039;&#039;, the ODB key &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Custom/Pwd/CustomPwd&amp;lt;/span&amp;gt; would be defined.&lt;br /&gt;
&lt;br /&gt;
By using an explicit name, one can use a single password for all controls on a page, or one could use several passwords on the same page. For example, a shift crew password for the less severe controls could be defined as &#039;&#039;ShiftPwd&#039;&#039;, and an &amp;quot;expert&amp;quot; password &#039;&#039;ExpertPwd&#039;&#039; for the critical things.&lt;br /&gt;
&lt;br /&gt;
In this case, the ODB would have two passwords defined, i.e.&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Custom/Pwd/ExpertPwd&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Custom/Pwd/ShiftPwd&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The password is of course not secure in the sense that it is placed in plain text into the ODB, but its purpose is to prevent accidental modification, rather than malicious interference.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Images&amp;lt;/span&amp;gt; subtree =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This optional subtree in the  [[#top|/Custom ODB tree]] is created by the user. It is required if an imagefile (*.gif) is to be displayed on a custom page.&lt;br /&gt;
This subtree is also required for any &#039;&#039;&#039;labels, bars&#039;&#039;&#039; or &#039;&#039;&#039;fills&#039;&#039;&#039; to be superimposed on the image.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;&amp;lt;Image-name&amp;gt;&amp;lt;/span&amp;gt; subtree ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
User-created subdirectory usually named for the corresponding gif-image, e.g. &amp;quot;pol_sc.gif&amp;quot; in the [[#Example|example]] above. For multiple images, multiple subdirectories may be defined. The user&lt;br /&gt;
chooses the name of this key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Background&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key in the  [[#&amp;lt;Image-name&amp;gt; subtree|&amp;lt;image-name&amp;gt; subtree]] contains the path and filename of the image file to be loaded into a custom page. Only &#039;&#039;&#039;gif&#039;&#039;&#039; format is supported for the image. This optional key is created by the user.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Labels&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
User-created subdirectory  in the  [[#&amp;lt;Image-name&amp;gt; subtree|&amp;lt;image-name&amp;gt; subtree]] required if &#039;&#039;&#039;labels&#039;&#039;&#039; are to be superimposed on an image on a custom page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;&amp;lt;label-name&amp;gt;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
User-created subdirectory  in the  [[#Labels subtree|Labels subtree]] containing keys to define this label as listed below. There will be a &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;&amp;lt;label-name&amp;gt;&amp;lt;/span&amp;gt; subtree for each label superimposed on the custom image.&lt;br /&gt;
&lt;br /&gt;
The user creates keys in this subtree with the names and types as listed below. See also the [[#Example|example]] above.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Labels Src&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Src&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING [256]&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This key in the [[#&amp;lt;label-name&amp;gt;subtree|&amp;lt;label-name&amp;gt; subtree]] contains the path of a valid ODB Key variable. This is the value to be used for this label on an image.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Format&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING [32]&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; &amp;quot;%1.1f&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;label-name&amp;gt;subtree|&amp;lt;label-name&amp;gt; subtree]] contains the format for this label on the image. Format specifications (c.f. &amp;quot;printf&amp;quot; in C) are used to convert the value specified by the [[#Labels Src|Src key]] into the output string that appears on the image. &lt;br /&gt;
For example, &lt;br /&gt;
* &amp;quot;Count Rate:%5d kB/s&amp;quot;  used to display an integer value&lt;br /&gt;
* &amp;quot;%5.2f%% iBu&amp;quot; used to display a floating point value. Note &amp;quot;%%&amp;quot; displays the &amp;quot;%&amp;quot; sign.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Font&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING[32]&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; &amp;quot;Medium&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;label-name&amp;gt;subtree|&amp;lt;label-name&amp;gt; subtree]] contains the font size for this label. Supported values are &amp;quot;small&amp;quot;,  &amp;quot;medium&amp;quot; or &amp;quot;giant&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Labels X&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;label-name&amp;gt;subtree|&amp;lt;label-name&amp;gt; subtree]] contains the X position for this label in pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Labels Y&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;label-name&amp;gt;subtree|&amp;lt;label-name&amp;gt; subtree]] contains the Y position for this label in pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Align&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;label-name&amp;gt;subtree|&amp;lt;label-name&amp;gt; subtree]] contains an integer representing Horizontal Alignment for this label. Set to one of 0 (left), 1 (center) or 2 (right). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Labels FGColor&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;FGColor&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING [8]&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; &amp;quot;000000&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;label-name&amp;gt;subtree|&amp;lt;label-name&amp;gt; subtree]] contains the foreground colour  for this label in the format RRGGBB (hex). See [[#Colour table|colour table]]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Labels BGColor&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;BGColor&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING [8]&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; &amp;quot;FFFFFF&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;label-name&amp;gt;subtree|&amp;lt;label-name&amp;gt; subtree]] contains the background colour  for this label in the format RRGGBB (hex). See [[#Colour table|colour table]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Bars&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
User-created subdirectory  in the  [[#&amp;lt;Image-name&amp;gt; subtree|&amp;lt;image-name&amp;gt; subtree]] required if &#039;&#039;&#039;bars&#039;&#039;&#039; are to be superimposed on an image on a custom page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;&amp;lt;bar-name&amp;gt;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
User-created subdirectory  in the  [[#Bars subtree|Fills subtree]] containing keys to define this &#039;&#039;&#039;bar&#039;&#039;&#039; as listed below. There will be a &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;&amp;lt;bar-name&amp;gt;&amp;lt;/span&amp;gt; subtree for each bar superimposed on the custom image.&lt;br /&gt;
&lt;br /&gt;
The user creates keys in this subtree with the names and types as listed below. See also the [[#Example|example]] above.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Bars Src&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Src&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING [256]&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] contains the path of a valid ODB Key variable. This is the value to be used for this bar. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Bars X&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] contains the X position for this bar in pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Bars Y&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] contains the Y position for this bar in pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Width&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 10&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] contains the width of this bar in pixels.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Height&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 100&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] contains the height of this bar in pixels.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Direction&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] contains an integer denoting the direction of this bar. It can be either 0 (vertical) or 1 (horizontal). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Axis&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 1&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] contains an integer specifying the axis of this bar. It can be either 0 (none), 1 (left) or 2 (right). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Logscale&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] specifies whether the axis of this bar is logarithmic. Set to &amp;quot;y&amp;quot; for logarithmic, otherwise &amp;quot;n&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Min&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DOUBLE&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] contains the minimum value for the axis of the bar. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Max&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DOUBLE&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 10&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] contains the maximum value for the axis of the bar. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Bars FGColor&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;FGColor&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING [8]&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; &amp;quot;000000&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] contains the foreground colour  for this bar in the format RRGGBB (hex). See [[#Colour table|colour table]]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Bars BGColor&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;BGColor&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING [8]&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; &amp;quot;FFFFFF&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] contains the background colour  for this bar in the format RRGGBB (hex). See [[#Colour table|colour table]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;BDColor&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING [8]&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; &amp;quot;808080&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;bar-name&amp;gt;subtree|&amp;lt;bar-name&amp;gt; subtree]] contains the border colour  for this bar in the format RRGGBB (hex). See [[#Colour table|colour table]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Fills&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
User-created subdirectory  in the  [[#&amp;lt;Image-name&amp;gt; subtree|&amp;lt;image-name&amp;gt; subtree]] required if &#039;&#039;&#039;fills&#039;&#039;&#039; are to be superimposed on an image on a custom page.&lt;br /&gt;
A &amp;quot;fill&amp;quot; can change the colour of a region on the image. The contents of the ODB key defined in [[#Fills Src|Src]] determines the colour as defined by the Limits and Fillcolors arrays.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;&amp;lt;fill-name&amp;gt;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
User-created subdirectory  in the  [[#Fills subtree|Fills subtree]] containing keys to define this fill as listed below. There will be a &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;&amp;lt;fill-name&amp;gt;&amp;lt;/span&amp;gt; subtree for each fill superimposed on the custom image.&lt;br /&gt;
&lt;br /&gt;
The user creates keys in this subtree with the names and types as listed below. See also the [[#Example|example]] above.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Fills Src&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Src&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This key in the [[#&amp;lt;fill-name&amp;gt;subtree|&amp;lt;fill-name&amp;gt; subtree]] contains the path of a valid ODB Key variable. Unless a [[#logic_calculation|logic calculation]] is included,  the contents of this key determines the value used for the fill &lt;br /&gt;
on the image defined by the key [[#Background|Background]] (see fill-name &amp;quot;SSLevelBox&amp;quot; in the [[#Example|example]] above).&lt;br /&gt;
&amp;lt;div id=&amp;quot;logic_calculation&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
If a &#039;&#039;&#039;logic calculation&#039;&#039;&#039; is included, up to two operators are permitted, and they must be either&lt;br /&gt;
;&lt;br /&gt;
:    &amp;quot;&amp;gt;&amp;gt;&amp;quot; (shift to the right) or&lt;br /&gt;
:    &amp;quot;&amp;amp;&amp;quot; (bitwise AND).&lt;br /&gt;
&lt;br /&gt;
A hexadecimal number preceded by &amp;quot;0x&amp;quot; is also supported.&lt;br /&gt;
This feature enables a SRC key that is actually a bit pattern to be used for a fill.&lt;br /&gt;
&lt;br /&gt;
In the following example, a gas valve is open if bit 14 of PLCR[136] is TRUE and closed if bit 15 is TRUE (bits are from 0-15). The contents of PLCR[136] are shifted to the right by 14 and then a logical AND is performed to clear all but the lowest 2 bits. The result is used to colour the valve body lime green if the valve is open, and black if it is closed. If neither bit is set (i.e. the valve is neither open nor closed) the valve body is coloured red to indicate an error. Anything else (i.e. both bits TRUE) will give a gray colour.&lt;br /&gt;
&lt;br /&gt;
 [local:t2kgas:S]/&amp;gt;ls /custom/images/Pump_20.gif/fills/d2vb3&lt;br /&gt;
 Src                             /Equipment/TpcGasPlc/Variables/PLCR[136] &amp;gt;&amp;gt; 14 &amp;amp; 0x3&lt;br /&gt;
 X                               905&lt;br /&gt;
 Y                               536&lt;br /&gt;
 limits&lt;br /&gt;
                                0&lt;br /&gt;
                                1&lt;br /&gt;
                                2&lt;br /&gt;
                                3&lt;br /&gt;
 Fillcolors&lt;br /&gt;
                                808080&lt;br /&gt;
                                00FF00&lt;br /&gt;
                                000000&lt;br /&gt;
                                808080&lt;br /&gt;
                   &lt;br /&gt;
&lt;br /&gt;
Any fill that requires a more complicated calculation than this will have to be done using Javascript in the custom page. The calculated value can then be stored in an ODB key, which is then defined as a Fill [[#Fills Src|Src]] key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Fills X&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;X&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;fill-name&amp;gt;subtree|&amp;lt;fill-name&amp;gt; subtree]] contains the X position for this fill in pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Fills Y&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Y&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;fill-name&amp;gt;subtree|&amp;lt;fill-name&amp;gt; subtree]] contains the Y position for this fill in pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Limits&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT array&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;fill-name&amp;gt;subtree|&amp;lt;fill-name&amp;gt; subtree]] is a variable-length array containing the values of the limits that when reached cause a colour change. Array length must match length of array &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Fillcolors&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Fillcolors&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT array&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;fill-name&amp;gt;subtree|&amp;lt;fill-name&amp;gt; subtree]] is a variable-length array containing the colours corresponding to the [[#Limits|Limits]] array.  The colours are defined in the format RRGGBB (hex). See [[#Colour table|colour table]].  Array length must match length of &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Limits&amp;lt;/span&amp;gt; array.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Colour Table =&lt;br /&gt;
For convenience, a colour reference table is shown here for some common colours:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;  style=&amp;quot;margin: auto; ext-align: left; width: 25%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;3&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; background-color: rgb(204, 204, 255); font-weight: bold;&amp;quot; | Colour&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; background-color: rgb(204, 204, 255); font-weight: bold;&amp;quot; | RGB Value&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; color: black; font-weight: normal;&amp;quot; | Black&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; color: black; font-weight: normal;&amp;quot; | 000000&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; background-color: silver; color: white; font-weight: normal;&amp;quot; | White&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; background-color: silver; color: white; font-weight: normal;&amp;quot; | FFFFFF&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; background-color: white; color: red; font-weight: normal;&amp;quot; | Red&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; color: black; font-weight: normal;&amp;quot; | FF0000&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; background-color: silver; color: lime; font-weight: normal;&amp;quot; | Lime green&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top;  background-color: silver; color: lime; font-weight: normal;&amp;quot; | 00FF00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; background-color: white; color: blue; font-weight: normal;&amp;quot; | Blue&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; color: black; font-weight: normal;&amp;quot; | 0000FF&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; background-color: silver; color: yellow; font-weight: normal;&amp;quot; | Yellow&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; background-color: silver; color: yellow; font-weight: normal;&amp;quot; | FFFF00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; background-color: white; color: grey; font-weight: normal;&amp;quot; | Grey&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;vertical-align: top; color: black; font-weight: normal;&amp;quot; | 808080&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:ODB Tree]] [[Category:Custom]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Custom_Page_Features&amp;diff=2860</id>
		<title>Custom Page Features</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Custom_Page_Features&amp;diff=2860"/>
		<updated>2019-05-28T23:25:19Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[Mhttpd|mhttpd MIDAS web server]]&lt;br /&gt;
* [[ODB Page]]&lt;br /&gt;
* [[Custom Page]]&lt;br /&gt;
* [[/Custom ODB tree]]&lt;br /&gt;
* [[Mhttpd.js|MIDAS Javascript library (mhttpd.js)]]&lt;br /&gt;
* [[mjsonrpc|MIDAS JSON RPC library functions (mjsonrpc)]]&lt;br /&gt;
* [[odbedit]] &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
;NOTE&lt;br /&gt;
: Since 2018, many of the features described here can now be implemented more simply using the  mod* JS functions (see [[Custom Page|Custom Web Page]]).&lt;br /&gt;
: &#039;&#039;&#039;If writing a new web page, it is strongly recommended you make use of the mod*JS features. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This page describes some of the special features provided for use on a user-created [[Custom Page|Custom Web Page]] using the [[#The MIDAS Javascript Library]], which was the recommended way to write Custom Pages before the [[Custom Page#modb* Javascript scheme]]  was available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= The MIDAS Javascript Library =&lt;br /&gt;
The MIDAS Javascript Library [[mhttpd.js]] includes routines written in Javascript and AJAX to provide features useful for writers of [[Custom Page]]s, such as access to the ODB. Recently asynchronous [[mjsonrpc|JSON-RPC functions]] using [[mjsonrpc#Javascript client library|Promises]]  has been added (January 2016).&lt;br /&gt;
;NOTE&lt;br /&gt;
:To use functions in this library, it &#039;&#039;&#039;must be [[mhttpd.js#include js lib|included in the HTML code]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Many of the older routines (ODBGet, ODBSet) use &#039;&#039;&#039;synchronous&#039;&#039;&#039; RPC requests. With synchronous request, a second RPC request must wait until the first request is complete. This can significantly slow down web pages where many calls to ODBGet are made. For this reason, functions were developed that can be synchronous or &#039;&#039;&#039;asynchronous&#039;&#039;&#039; (e.g. ODBMCopy) that include a callback mechanism. The data from ODBMCopy can be formatted in [[mjsonrpc#JSON general information|JSON]]. &lt;br /&gt;
&lt;br /&gt;
Web developers are moving away from synchronous RPC requests, which are now deprecated [https://midas.triumf.ca/elog/Midas/1128]. Some modern browsers return a warning on a synchronous RPC request. &lt;br /&gt;
&lt;br /&gt;
A new group of JSON-RPC functions using  [[mjsonrpc#Javascript client library|Promises]] has been added to the MIDAS Javascript Library (January 2016). These are asynchronous only, and they also provide more functionality and have better error handling than the older AJAX calls, which are also inconsistent in how they handle Booleans. They also have much improved handling of reading/writing arrays to the ODB. Before 2018 it was recommended that all new Custom Pages are written using these JSON-RPC functions.  {{Important|text=Since 2018 the [[Custom Page#modb* Javascript scheme]] is recommended for new Custom Pages}}.&lt;br /&gt;
&lt;br /&gt;
The MIDAS Javascript Library routines requires an up-to-date browser that supports Promises (see [https://midas.triumf.ca/elog/Midas/1145]). If using an older browser version, the asynchronous AJAX calls (e.g. ODBMCopy) should be used in order to avoid having to rewrite the web page at a later date to remove all synchronous calls.  &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Access the ODB using mjson-rpc asynchronous functions ==&lt;br /&gt;
&lt;br /&gt;
Access to the ODB is provided by the  [[Mhttpd.js|MIDAS Javascript Library]], which (since January 2016) includes the [[mjsonrpc]] functions.  It is [[#The MIDAS Javascript Library|recommended]] that these functions are used for &#039;&#039;&#039;new&#039;&#039;&#039; pages rather than the older AJAX calls (see below). &lt;br /&gt;
&lt;br /&gt;
To run these functions you need&lt;br /&gt;
# to  [[mhttpd.js#include js lib|include the Javascript library in the HTML code]]&#039;&#039;&#039;&lt;br /&gt;
# to use an up-to-date browser that supports Promises (see [https://midas.triumf.ca/elog/Midas/1145]). &lt;br /&gt;
&lt;br /&gt;
Examples showing how to read and write to the ODB can be found at [[mjsonrpc#examples]]. Also included are examples using arrays. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Access the ODB using asynchronous AJAX calls ==&lt;br /&gt;
;NOTE&lt;br /&gt;
: It is recommended that  asynchronous MIDAS JSON-RPC functions are used for new pages rather than the older AJAX calls (see [[#Access the ODB using mjson-rpc asynchronous functions|above]]).&lt;br /&gt;
&lt;br /&gt;
[[#Example 2 : Asynchronous calls using Javascript and AJAX|Example 2]] uses the asynchronous call ODBMCopy() with callback to read the data. The data are converted into JSON format. In this case, when accessing the JSON data, &#039;&#039;the ODB Keynames must be in the same case as they are in the ODB&#039;&#039;, even though the case is ignored by the ODB. If you find this feature annoying, use [[#Access the ODB using mjson-rpc asynchronous functions|mjson-rpc function db_get_values()]] as all keynames are converted to lower case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Access the ODB using synchronous AJAX requests ==&lt;br /&gt;
;NOTE&lt;br /&gt;
: Synchronous requests are now deprecated (see [[#The MIDAS Javascript Library|above]]). New pages should be written [[#Using mjson-rpc asynchronous functions]].&lt;br /&gt;
&lt;br /&gt;
See [[#Example 3 : Synchronous Calls using Javascript and AJAX]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Access the ODB with HTML-style &amp;lt;span style=&amp;quot;color:seagreen font-style:italic&amp;quot;&amp;gt;&amp;lt;odb&amp;gt;&amp;lt;/span&amp;gt; tags =&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This method pre-dates the [[Mhttpd.js|MIDAS Javascript Library]]. It is recommended that the [[Mhttpd.js|MIDAS Javascript Library]] be used for ODB access.&lt;br /&gt;
&lt;br /&gt;
If Javascript (JS) is not available, the older HTML-style  {{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tags are still available and provide limited functionality.&lt;br /&gt;
&lt;br /&gt;
The  HTML-style {{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tag has been defined for read/write access to the ODB under HTML. The {{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tags are declared within enclosing HTML {{HtmlTag|tag=&amp;lt;form...&amp;gt;....&amp;lt;/form&amp;gt;}} tags.&lt;br /&gt;
&lt;br /&gt;
{|  style=&amp;quot;text-align: left; width: 100%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;3&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
|+ Access to ODB from HTML&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;text-align: center; vertical-align: top; background-color: rgb(204, 204, 255); font-weight: bold;&amp;quot; | HTML ODB tag&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;text-align: center; vertical-align: top; background-color: rgb(204, 204, 255); font-weight: bold;&amp;quot; | Meaning&lt;br /&gt;
&lt;br /&gt;
|-   &lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;text-align: left; vertical-align: top; background-color: rgb(255, 255, 255); color: seagreen; font-style:italic&amp;quot;  |&amp;lt;odb src=&amp;quot;odb path&amp;quot;&amp;gt;&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;text-align: left; vertical-align: top; background-color: rgb(255, 255, 255); color: black&amp;quot;  |Display ODB field (read only)&lt;br /&gt;
	&lt;br /&gt;
|-   &lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;text-align: left; vertical-align: top; background-color: rgb(255, 255, 255); color: seagreen; font-style:italic&amp;quot;  |&amp;lt;odb src=&amp;quot;odb path&amp;quot; edit=1 pwd=&amp;quot;CustomPwd&amp;quot;&amp;gt;&lt;br /&gt;
| Display an Editable ODB field (inline style). Optional password protection with &#039;&#039;&#039;pwd&#039;&#039;&#039; .&lt;br /&gt;
&lt;br /&gt;
|-   &lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;text-align: left; vertical-align: top; background-color: rgb(255, 255, 255); color: seagreen; font-style:italic&amp;quot;  |&amp;lt;odb src=&amp;quot;odb path&amp;quot; edit=2 pwd=&amp;quot;CustomPwd&amp;quot;&amp;gt;&lt;br /&gt;
| Display an Editable ODB field (popup style). Optional password protection with &#039;&#039;&#039;pwd&#039;&#039;&#039; .&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: The Optional password protection with &#039;&#039;&#039;pwd&#039;&#039;&#039; (documented in the [http://ladd00.triumf.ca/~daqweb/doc/midas-old/html/RC_customize_ODB.html#RC_Access_Control| OldMidas Document]) may not be working.&lt;br /&gt;
: Use the  [[/Experiment ODB tree#Security subtree|Web Password security]] instead. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tags are included in the HTML code e.g.&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
 Experiment Name: &amp;lt;odb src=&amp;quot;/Experiment/Name&amp;quot;&amp;gt;&lt;br /&gt;
 Run Number: &amp;lt;odb src=&amp;quot;/runinfo/run number&amp;quot; edit=1&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
{{Html|text= Experiment Name: &amp;lt;odb src=&amp;quot;/Experiment/Name&amp;quot;&amp;gt; &amp;lt;br&amp;gt;  Run Number: &amp;lt;odb src=&amp;quot;/runinfo/run number&amp;quot; edit=1&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
See also [[Custom Page#How to write a Custom Page|HTML Custom Page example]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= ODB RPC access =&lt;br /&gt;
The [[Mhttpd.js|MIDAS Javascript Library]] function ODBRpc() defined for RPC access.&lt;br /&gt;
&lt;br /&gt;
This permits buttons on MIDAS &amp;quot;custom&amp;quot; web pages to invoke RPC calls directly into user frontend programs, for example to turn hardware modules on or off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= JSON support =&lt;br /&gt;
[[mjsonrpc#JSON general information|JSON]] support is provided with the [[Mhttpd.js|MIDAS Javascript Library]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=   Access to the MIDAS Menu buttons =&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: &#039;&#039;&#039;New (since 2018) custom pages using the [[Custom Page#modb* Javascript scheme]] should follow the instructions there to include the standard MIDAS Menu buttons.&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Access to the standard MIDAS Menu buttons can be provided with HTML {{HtmlTag|tag=&amp;lt;input...&amp;gt;}} tags of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&#039;&#039;&amp;lt;button-name&amp;gt;&#039;&#039; type=&amp;quot;submit&amp;quot; &amp;gt; --&amp;gt;&lt;br /&gt;
{{Html|text=&amp;lt;input name=&amp;quot;cmd&amp;quot; value=&#039;&#039;&amp;lt;button-name&amp;gt;&#039;&#039; type=&amp;quot;submit&amp;quot; &amp;gt;}}&lt;br /&gt;
Valid values are the standard MIDAS Menu buttons, i.e. (Start, Pause, Resume, Stop, ODB, Elog, Alarms, History, Programs etc). The {{HtmlTag|tag=&amp;lt;input...&amp;gt;}} tags must be declared within enclosing HTML {{HtmlTag|tag=&amp;lt;form...&amp;gt;....&amp;lt;/form&amp;gt;}} tags (see above).&lt;br /&gt;
&lt;br /&gt;
The following HTML fragment shows the inclusion of three of the standard buttons, giving access to the Main Status, ODB and Messages pages :&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 &amp;lt;form name=&amp;quot;form1&amp;quot; method=&amp;quot;Get&amp;quot; action=&amp;quot;/CS/MyExpt&amp;amp;&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;Status&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;ODB&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;Messages&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;/form&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
{{Html|text= &amp;lt;form name=&amp;quot;form1&amp;quot; method=&amp;quot;Get&amp;quot; action=&amp;quot;/CS/MyExpt&amp;amp;&amp;quot;&amp;gt; &amp;lt;br&amp;gt; &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;Status&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt; &amp;lt;br&amp;gt; &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;ODB&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt; &amp;lt;br&amp;gt; &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;Messages&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt; &amp;lt;br&amp;gt; ...  &amp;lt;br&amp;gt; &amp;lt;/form&amp;gt; }}&lt;br /&gt;
&lt;br /&gt;
See also [[#Redirect]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Redirect =&lt;br /&gt;
&lt;br /&gt;
When buttons are included on a Custom Page, after pressing a button (e.g. the Start or Stop button) it may be desirable to return to the same custom page, rather than returning to the [[Status Page]].&lt;br /&gt;
&lt;br /&gt;
This can be done by including an HTML {{HtmlTag|tag=&amp;lt;input...&amp;gt;}} tag with the attributes &#039;&#039;type&#039;&#039; set to &amp;quot;hidden&amp;quot; and &#039;&#039;name&#039;&#039; set to &amp;quot;redir&amp;quot;. This name (&amp;quot;redir&amp;quot;) is detected by [[Mhttpd]], causing a redirect to the specified custom link in the &#039;&#039;value&#039;&#039; attribute.&lt;br /&gt;
&lt;br /&gt;
For example, the following redirects the screen back to the custom page link   {{Odbpath|path=/Custom/my_custom_page&amp;amp;}} when buttons are pressed:&lt;br /&gt;
{{Html|text=&amp;lt;input type=hidden name=&amp;quot;redir&amp;quot; value=&amp;quot;my_custom_page&amp;amp;&amp;quot;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
See also [[#Replace Status Page by a Custom page|Redirect when a Custom Page replaces the Status Page]].&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CustomScript Buttons =&lt;br /&gt;
&lt;br /&gt;
[[/Customscript ODB tree#Customscript-button|CustomScript buttons]] can be provided on [[Custom Page|Custom Pages]]. These buttons are equivalent to optional &#039;&#039;&#039;script buttons&#039;&#039;&#039; on the [[Status Page]], which call a script to perform a particular action when the button is pressed. See [[/Script ODB tree#Script-button|script buttons]] for details. Customscript buttons can be set up through the [[/Customscript ODB tree]].&lt;br /&gt;
&lt;br /&gt;
Any key &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/CustomScript/test&amp;lt;/span&amp;gt; will appear as a customscript-button &lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #444444; background-color: #CCCCCC; font-style:italic; font-size: 90; padding:0.25em;padding-left: 0.5em;padding-right: 0.5em;border:1px solid #808080;border-radius: 5px;margin-bottom:1px;&amp;quot;&amp;gt;test&amp;lt;/span&amp;gt; on a custom page whose code includes an HTML {{HtmlTag|tag=&amp;lt;input...&amp;gt;}} tag of the form:&lt;br /&gt;
{{Html|text=&amp;lt;input type=submit name=customscript value=&amp;quot;test&amp;quot;&amp;gt;}}&lt;br /&gt;
where the action of the button &amp;lt;span style=&amp;quot;color: #444444; background-color: #CCCCCC; font-style:italic; font-size: 90; padding:0.25em;padding-left: 0.5em;padding-right: 0.5em;border:1px solid #808080;border-radius: 5px;margin-bottom:1px;&amp;quot;&amp;gt;test&amp;lt;/span&amp;gt; will be found in the &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/customscript/test&amp;lt;/span&amp;gt; subdirectory.&lt;br /&gt;
&lt;br /&gt;
After pressing a customscript-button, the &#039;&#039;type=submit&#039;&#039; in the HTML {{HtmlTag|tag=&amp;lt;input&amp;gt;}} will cause a page reload. This will result in a switch to the [[Status Page]], unless a [[#redirect]] input tag is included to redirect back to the original custom page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Customscript button without a page reload ==&lt;br /&gt;
To define a customscript button that does &#039;&#039;&#039;not&#039;&#039;&#039; cause a page reload, set the &#039;&#039;type&#039;&#039; in the HTML {{HtmlTag|tag=&amp;lt;input&amp;gt;}} to &amp;quot;button&amp;quot;, i.e. &lt;br /&gt;
{{Html|text=&amp;lt;input name=&amp;quot;customscript&amp;quot; value=&amp;quot;test&amp;quot; type=&amp;quot;button&amp;quot; onClick=cs_button(this.value)&amp;gt;  &amp;lt;!-- Customscript button does not reload page; no callback --&amp;gt;}}&lt;br /&gt;
and use &#039;&#039;&amp;quot;onClick&amp;quot;&#039;&#039; to call a function to [[#Send an Ajax Request]] instead. The following function sends an asynchronous request, with an optional callback.&lt;br /&gt;
{{HtmlTag|tag=&amp;lt;script&amp;gt;}}&lt;br /&gt;
 &amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
function cs_button(cmd, callback)&amp;lt;br&amp;gt;&lt;br /&gt;
{  // send a request to execute a custom script&lt;br /&gt;
:   var url;&lt;br /&gt;
:   var request = XMLHttpRequestGeneric();&lt;br /&gt;
:&lt;br /&gt;
:   url = ODBUrlBase&lt;br /&gt;
:   if(document.getElementById(&amp;quot;redir&amp;quot;) != null)&lt;br /&gt;
::     url +=  &#039;?redir=&#039;+document.getElementById(&#039;redir&#039;).value&lt;br /&gt;
:   url+=&#039;&amp;amp;customscript=&#039;+ encodeURIComponent(cmd);&lt;br /&gt;
:   request.open(&#039;GET&#039;, url, true); // asynchronous request&lt;br /&gt;
:   request.send(null);&lt;br /&gt;
:  if(callback!=undefined) {&lt;br /&gt;
::      request.onreadystatechange = function() {&lt;br /&gt;
:::         if (request.readyState == 4) { &lt;br /&gt;
::::            if (request.status == 200)&lt;br /&gt;
:::::                callback();&lt;br /&gt;
::::            else&lt;br /&gt;
:::::                alert(&#039;cs_button: Error after sending request to Custom Script &amp;quot;&#039;+cmd+&#039;&amp;quot; :\nHTTP Status: &#039;+request.status)&lt;br /&gt;
:::            }&lt;br /&gt;
::         }&lt;br /&gt;
:  }&lt;br /&gt;
:  else { &lt;br /&gt;
::   if (request.status != 200)&lt;br /&gt;
:::       alert(&#039;cs_button: Error after sending request to Custom Script &amp;quot;&#039;+cmd+&#039;&amp;quot; :\nHTTP Status: &#039;+request.status)&lt;br /&gt;
:	   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{HtmlTag|tag=&amp;lt;/script&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Resource files =&lt;br /&gt;
== MIDAS resource files ==&lt;br /&gt;
A number of resource files have been provided in the MIDAS packages under {{Filepath|path=../packages/midas/resources}}.  When including a MIDAS resource file, no key in  {{Odbpath|path=/Custom}} needs to be defined as the MIDAS resources directory is searched automatically. &lt;br /&gt;
&lt;br /&gt;
One such resource file is a condensed stylesheet {{File|name=midas.css}} for users who would like their custom pages to have a similar &amp;quot;look and feel&amp;quot; to that of the standard pages. To include the MIDAS stylesheet, in the HTML header, add &lt;br /&gt;
{{HtmlTag|tag=&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;midas.css&amp;quot;&amp;gt;}}&lt;br /&gt;
Other resource files can provide [[Custom Page#How to use the standard MIDAS navigation bars on your custom page|the standard MIDAS navigation bars]].&lt;br /&gt;
&lt;br /&gt;
== Custom resource files ==&lt;br /&gt;
It is often desirable to serve resource files (i.e. &#039;&#039;&#039;local files&#039;&#039;&#039; such as an external stylesheet, javascript files or images&#039;&#039;&#039;&amp;lt;sup&amp;gt;***&amp;lt;/sup&amp;gt;&#039;&#039;&#039;) to a custom page. The following sections describe two alternative ways of serving resource files to a custom page:&lt;br /&gt;
* [[#Resource files served WITH /custom/path key defined|with  /custom/path key defined]]&lt;br /&gt;
* [[#Resource files served WITHOUT /custom/path key defined|without  /custom/path key defined]]&lt;br /&gt;
See also serving resources to a [[#Replace Status Page by a Custom Status page|Custom Status page]].&lt;br /&gt;
;NOTE&lt;br /&gt;
:  &#039;&#039;&#039;&amp;lt;sup&amp;gt;***&amp;lt;/sup&amp;gt;&#039;&#039;&#039; To superimpose labels, bars or fills onto an image, the image cannot be served as a resource file. See [[#Image insertion]].&lt;br /&gt;
&lt;br /&gt;
=== Resource files served WITH &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;/custom/path&amp;lt;/span&amp;gt; key defined ===&lt;br /&gt;
When a number of resource files are required, it is convenient to place them in the same directory on the disk, and create a key  {{Odbpath|path=/Custom/Path}} to contain this directory. &lt;br /&gt;
&lt;br /&gt;
 $ ls  /home/midas/online/custom/&lt;br /&gt;
   custom_functions.js       custom_globals.js     custom_page.html    custom_stylesheet.css      test_image.png&lt;br /&gt;
With the  {{Odbpath|path=/Custom/Path}} key defined, [[/Custom ODB tree#Custom-Link|custom-links]] for individual resource files need not be created in the  {{Odbpath|path=/Custom/Path}} tree. The custom-link  {{Odbpath|path=custom_page&amp;amp;}} &#039;&#039;&#039;is&#039;&#039;&#039; required so that the custom page can be accessed from the [[/Custom ODB tree#Custom-Button|custom-button]]  {{Button|name=custom_page}} on the Status Page. The key name ends in the special character &amp;quot;&amp;amp;&amp;quot; so that it will open in the same window as the Status page (see [[/Custom ODB tree#Key names|key names]]).&lt;br /&gt;
 $ odbedit&lt;br /&gt;
   [local:exp:S] ls /custom&lt;br /&gt;
   path                           /home/midas/online/custom/&lt;br /&gt;
   custom_page&amp;amp;                   custom_page.html&lt;br /&gt;
 &lt;br /&gt;
A {{HtmlTag|tag=&amp;lt;script&amp;gt;}} tag for each resource file to be served (specifying the file name) is then placed in the header of  {{File|name=custom_page.html}} &lt;br /&gt;
i.e.&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;custom_functions.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;}}&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;custom_globals.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;}}&lt;br /&gt;
&amp;lt;br&amp;gt; and a {{HtmlTag|tag=&amp;lt;link&amp;gt;}} tag for an external stylesheet&lt;br /&gt;
{{Html|text=&amp;lt;link type=&amp;quot;text/css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;custom_stylesheet.css&amp;quot; title=&amp;quot;Stylesheet&amp;quot;&amp;gt;}}&lt;br /&gt;
An image tag is placed in the body of  {{File|name=custom_page.html}} &lt;br /&gt;
{{Html|text=&amp;lt;img src=&amp;quot;test_image.png&amp;quot;&amp;gt; }}&lt;br /&gt;
[[mhttpd]] then loads the resource file from the directory indicated by the Path key with the correct MIME type (see  [[/Custom ODB tree#Keys in the /Custom tree|Custom tree keys]] for supported MIME types). &lt;br /&gt;
&lt;br /&gt;
=== Resource files served WITHOUT &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;/custom/path&amp;lt;/span&amp;gt; key defined ===&lt;br /&gt;
Alternatively, resource files can be served to a [[Custom Page]] by creating a key for every resource file in the [[/Custom ODB tree]]. These keys must contain the full path of the file on the disk, and the key {{Odbpath|path=/Custom/Path}} must NOT be defined. The resource files can be in different directories on the disk. By defining the key names with an appropriate file extension, the resource files are served with the appropriate MIME types. The key names end in the special character &amp;quot;!&amp;quot; so that they will not appear on the Status page as custom-links (see [[/Custom ODB tree#Key names|key names]].&lt;br /&gt;
&lt;br /&gt;
Without the {{Odbpath|path=/Custom/Path}} key,  the links for the above example in the {{Odbpath|path=/Custom}} tree might look like&lt;br /&gt;
 $ odbedit&lt;br /&gt;
   [local:exp:S] ls /custom&lt;br /&gt;
   custom_page&amp;amp;                   /home/midas/online/custom/custom_page.html&lt;br /&gt;
   custom_functions.js!           /home/midas/online/resources/custom_functions.js&lt;br /&gt;
   globals.js!                    /home/midas/online/resources/custom_functions.js&lt;br /&gt;
   stylesheet.css!                /home/midas/online/stylesheets/custom_stylesheet.css&lt;br /&gt;
   image.png!                     /home/midas/images/test_image.png  &lt;br /&gt;
&lt;br /&gt;
assuming the resource files are now in the subdirectories indicated.&lt;br /&gt;
The {{HtmlTag|tag=&amp;lt;script&amp;gt;}} tag for each resource file to be served (specifying the custom-link) is then placed in the header of  {{File|name=custom_page.html}} &lt;br /&gt;
i.e.&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;custom_functions.js!&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;}}&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;globals.js!&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;}}&lt;br /&gt;
&amp;lt;br&amp;gt; and a {{HtmlTag|tag=&amp;lt;link&amp;gt;}} tag for an external stylesheet&lt;br /&gt;
{{Html|text=&amp;lt;link type=&amp;quot;text/css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;stylesheet.css!&amp;quot; title=&amp;quot;Stylesheet&amp;quot;&amp;gt;}}&lt;br /&gt;
An image tag is placed in the body of  {{File|name=custom_page.html}} &lt;br /&gt;
{{Html|text=&amp;lt;img src=&amp;quot;image.png!&amp;quot;&amp;gt; }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The resulting Demo custom page is shown in Figure 1, which can be compared with Figure 2 (no stylesheet). &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Figure 1  !! Figure 2&lt;br /&gt;
|-&lt;br /&gt;
| Demo Custom Page using MIDAS stylesheet || Demo Custom Page&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| [[File:Mhxcustom03.jpg|thumb|300px]] || [[File:Mhxcustom02.jpg|thumb|200px]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=  Alias-Buttons and Hyperlinks =&lt;br /&gt;
Any hyperlink can easily be included on a [[Custom Page]] by using the standard HTML anchor {{HtmlTag|tag=&amp;lt;a...&amp;gt;}} tag, e.g.&lt;br /&gt;
{{Html|text=&amp;lt;a href=&amp;quot;http://ladd00.triumf.ca/~daqweb/doc/midas/html/&amp;quot;&amp;gt;Midas Help&amp;lt;/a&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Links on a custom page equivalent to [[/Alias ODB tree#Alias-Buttons|alias-buttons]] can also be made e.g.&lt;br /&gt;
{{Html|text=&amp;lt;button type=&amp;quot;button&amp;quot; onclick=&amp;quot;document.location.href=&#039;/Alias/alias&amp;amp;&#039;;&amp;quot;&amp;gt;alias&amp;lt;/button&amp;gt;}}&lt;br /&gt;
See the [[/Alias ODB tree]] for details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=    Page refresh =&lt;br /&gt;
The following {{HtmlTag|tag=&amp;lt;meta...&amp;gt;}} tag included in the HTML header code will cause the whole custom page to refresh in 60 seconds :&lt;br /&gt;
{{Html|text=&amp;lt;meta http-equiv=&amp;quot;Refresh&amp;quot; content=&amp;quot;60&amp;quot;&amp;gt;}}&lt;br /&gt;
It is also possible to [[#Periodic update of parts of a custom page|periodically update parts]] of a custom page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Periodic update of parts of a custom page =&lt;br /&gt;
&lt;br /&gt;
The functionality of [[Mhttpd.js|ODBGet]] together with the window.setInterval() function&lt;br /&gt;
can be used to update parts of the web page periodically.&lt;br /&gt;
For example the Javascript fragment below contains a function which updates the current run number every 10 seconds in the background:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt; &amp;lt;!-- JS --&amp;gt;&lt;br /&gt;
window.setInterval(&amp;quot;Refresh()&amp;quot;, 10000);&amp;lt;br&amp;gt;&lt;br /&gt;
function Refresh() {&amp;lt;br&amp;gt;&lt;br /&gt;
:document.getElementById(&amp;quot;run_number&amp;quot;).innerHTML = ODBGet(&#039;/Runinfo/Run number&#039;);&amp;lt;br&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The custom page has to &lt;br /&gt;
* [[Mhttpd.js#include js lib|include the MIDAS JS library]] to access ODBGet&lt;br /&gt;
* contain an element with id=&amp;quot;run_number&amp;quot;, such as&lt;br /&gt;
{{Html|text=&amp;lt;td id=&amp;quot;run_number&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Display last MIDAS message(s) =&lt;br /&gt;
&lt;br /&gt;
The message log (see [[Message System]]) can be accessed from a custom page using a call to the JavaScript library function [[Mhttpd.js|ODBGetMsg]] (provided the [[Mhttpd.js#include js lib|JS library is included]]).&lt;br /&gt;
&lt;br /&gt;
This allows the inclusion of the &amp;quot;Last Midas message&amp;quot; on a custom page, e.g.&lt;br /&gt;
{{JS|text=document.write(&#039;Last message:&#039;+ODBGetMsg(&amp;quot;midas&amp;quot;,0,1))}}&lt;br /&gt;
More messages may be displayed by increasing the third parameter to ODBGetMsg.&lt;br /&gt;
;Note&lt;br /&gt;
: Parameters were changed August 2015. See [[Mhttpd.js|ODBGetMsg]] for older versions.&lt;br /&gt;
: Coming soon - a [[mjsonrpc]] function&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Generate a message log entry =&lt;br /&gt;
&lt;br /&gt;
A custom page can generate a message to be sent to the MIDAS message log (see [[Message System]]).  A call to mjsonrpc_cm_msg() will generate a message if using the [[mjsonrpc]] functions. Otherwise, use the AJAX function [[Mhttpd.js|ODBGenerateMsg]]. To use these functions, the  [[Mhttpd.js#include js lib|JS library must be included]] in the html code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=   Checkboxes =&lt;br /&gt;
;NOTE&lt;br /&gt;
: &#039;&#039;&#039;New  (since 2018) custom pages using the [[Custom Page#modb* Javascript scheme]] should use [[Custom Page#modbcheckbox|modbcheckbox]] to create a checkbox.&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;Br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function [[Mhttpd.js|ODBSet]] (provided the [[Mhttpd.js#include js lib|JS library is included]]) can be used when one clicks on a checkbox for example:&lt;br /&gt;
{{Html|text=&amp;lt;input  name=&amp;quot;box0&amp;quot;  type=&amp;quot;checkbox&amp;quot;  onClick=&amp;quot;ODBSet(my_path, this.checked?&#039;1&#039;:&#039;0&#039;)&amp;quot;&amp;gt;}}&lt;br /&gt;
If used as above, the state of the checkbox must be initialized when the page is loaded. This can be done with some JavaScript code called on initialization, e.g.&lt;br /&gt;
{{JS|text=document.form1.box0.checked= ODBGet(my_path));  // initialize to the correct value}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Replace Status Page by a Custom page =&lt;br /&gt;
&lt;br /&gt;
Click to enlarge thumbnail&lt;br /&gt;
[[File:Mhcustom_status.jpg|thumbnail|left|Figure 3: ODB /Custom/Status custom-link to a custom status page]]&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a custom-link with the [[/Custom ODB tree#Key names|reserved key name]] &#039;&#039;&#039;Status&#039;&#039;&#039;  (not &amp;quot;Status&amp;amp;&amp;quot; or &amp;quot;Status!&amp;quot;) is created in the [[/Custom ODB tree]] (as shown in  Figure 3), then that custom page will &#039;&#039;&#039;replace the default Status Page&#039;&#039;&#039;. &lt;br /&gt;
  &lt;br /&gt;
Clicking on the {{Button|name=Status}} button on any of the sub-pages (e.g. [[ODB Page]], [[Programs Page]] etc.) will now return to the Custom Status Page. If there are buttons on the Custom Status page, you &#039;&#039;&#039;must&#039;&#039;&#039; include a  [[#Redirect]] statement of the form&lt;br /&gt;
{{Html|text=&amp;lt;input type=hidden name=&amp;quot;redir&amp;quot; value=&amp;quot;../&amp;quot;&amp;gt;}}&lt;br /&gt;
or you will see the message &lt;br /&gt;
 Invalid custom page:NULL path&lt;br /&gt;
&lt;br /&gt;
If the Custom Status page includes [[#Resource files]] served on a regular custom page with a statement such as&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;cs_functions!&amp;quot;&amp;gt;}}&lt;br /&gt;
to serve them in a Custom Status page, the statement would be&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;&amp;lt;span style=&amp;quot;font-weight:bold&amp;quot;&amp;gt;/CS/&amp;lt;/span&amp;gt;cs_functions!&amp;quot;&amp;gt;}}&lt;br /&gt;
In fact, this statement can be used in a regular custom page, as the &amp;quot;/CS/&amp;quot; is ignored in that case.&lt;br /&gt;
&lt;br /&gt;
To return to the default Status Page, delete the &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;/Custom/Status&amp;lt;/span&amp;gt; key. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Start, Stop and Check if a program is running =&lt;br /&gt;
There are [[mjsonrpc]] functions that implemented all three program management functions - start program, &lt;br /&gt;
stop program and &amp;quot;is running?&amp;quot; as JSON-RPC methods.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Send an Ajax request =&lt;br /&gt;
By sending an Ajax request from a custom page, you can make a button perform a specific function. &lt;br /&gt;
  &lt;br /&gt;
All functions in midas are controlled through special URLs. So the URL&lt;br /&gt;
 http://&amp;lt;host:port&amp;gt;/?cmd=Start&amp;amp;value=10&lt;br /&gt;
will start run #10.&lt;br /&gt;
&lt;br /&gt;
Although it is easier to use an HTML input statement to [[#Access to the MIDAS Menu buttons]], &lt;br /&gt;
to send an Ajax request, you can use the function &#039;&#039;XMLHttpRequestGeneric&#039;&#039; which is in the MIDAS Javascript library [[mhttpd.js]].&lt;br /&gt;
Then the HTML code would be&lt;br /&gt;
&lt;br /&gt;
{{Html|text=&amp;lt;input type=&amp;quot;button&amp;quot; onclick=&amp;quot;start()&amp;quot;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
and in your JavaScript code add a function &#039;&#039;start()&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
function start()&lt;br /&gt;
{&lt;br /&gt;
:   var request = XMLHttpRequestGeneric();&lt;br /&gt;
&lt;br /&gt;
:   url = &#039;?cmd=Start&amp;amp;value=10&#039;;&lt;br /&gt;
:   request.open(&#039;GET&#039;, url, true);  // asynchronous request&lt;br /&gt;
:   request.send(null);&lt;br /&gt;
} &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
See also [[#Access to the MIDAS Menu buttons]]. Another example with optional callback can be found in [[#Customscript button without a page reload]].&lt;br /&gt;
&lt;br /&gt;
This mechanism can be used for starting a particular program, see for example (see [https://midas.triumf.ca/elog/Midas/1046]). However, this functionality is now provided by [[mjsonrpc]] functions - see [[#Start, Stop and Check if a program is running]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=    Image insertion  =&lt;br /&gt;
An image can be loaded from the web using an HTML {{HtmlTag|tag=&amp;lt;img...&amp;gt;}}, e.g.  &lt;br /&gt;
   {{Html|text=&amp;quot;TRIUMF logo&amp;quot; &amp;lt;img src=&amp;quot;https://lixenon.triumf.ca/InternalDocuments/Alice/figures/TRIUMF-logo.jpg/image_preview&amp;quot;&amp;gt;}}&lt;br /&gt;
or a MIDAS History image can be inserted into a custom page using an HTML {{HtmlTag|tag=&amp;lt;img...&amp;gt;}} tag of the following form:&lt;br /&gt;
 {{Html|text=blah&amp;lt;img src=&amp;quot;http://hostname.domain:port/HS/Meterdis.gif&amp;amp;scale=12h&amp;amp;width=300&amp;quot;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
If the image file is on the local disk, it can be loaded as a &#039;&#039;&#039;resource file&#039;&#039;&#039;. The image can be of format .pdf, .jpg, .gif, .png. See loading [[#Resource files]].&lt;br /&gt;
&lt;br /&gt;
If you wish to superimpose features such as &#039;&#039;&#039;labels and fills&#039;&#039;&#039;, the image file cannot be served as a [[#Resource files|resource file]]. Instead, the image file must be in &#039;&#039;&#039;gif&#039;&#039;&#039; format, and must be included in the {{Odbpath|path=/Custom/images}} subtree (Figure 4). Image insertion into a Custom page will be illustrated using the Demo custom page shown in [[#MIDAS stylesheet|Figure 2]]. All the files required for this demo can be found in the MIDAS package at $MIDASSYS/examples/custom. If you do not wish to create&lt;br /&gt;
the keys yourself, proceed to [[#Superimposing Labels, Bars and Fills onto a gif image]]. &lt;br /&gt;
&lt;br /&gt;
Make a [[/Custom ODB tree#Custom-Link|custom-link]] to the Demo custom page file &#039;&#039;myexpt.html&#039;&#039; , i.e.&lt;br /&gt;
 [local:js:S]/&amp;gt;ls /custom&lt;br /&gt;
    myexpt&amp;amp;                  /home/test/packages/midas/examples/custom/myexpt.html&lt;br /&gt;
 &lt;br /&gt;
To make the image &#039;&#039;myexpt.gif&#039;&#039; visible on the custom page, the path and filename of the image file must be defined in the   {{Odbpath|path=/Custom/images}} subtree. To do this, &lt;br /&gt;
create the  subtrees {{Odbpath|path=/Custom/images/myexpt.gif}} where the subtree name &amp;quot;myexpt.gif&amp;quot; is named for the image file you are going to use. Multiple images can be used, by creating multiple imagefile subtrees.&lt;br /&gt;
&lt;br /&gt;
In the imagefile subtree {{Odbpath|path=myexpt.gif}}, create the STRING key  {{Odbpath|path=Background}}, and set it to contain the path and name of the image file.  The tree structure should then look similar to Figure 4, minus the labels/bars/fill subtrees which will be added to the ODB later.&lt;br /&gt;
&lt;br /&gt;
The image must also be referenced in the custom HTML file &#039;&#039;myexpt.html&#039;&#039; in the &amp;quot;src&amp;quot; field of an HTML {{HtmlTag|tag=&amp;lt;img...&amp;gt;}} tag, e.g. &lt;br /&gt;
{{Html|text=&amp;lt;img &#039;&#039;&#039;src=&amp;quot;myexpt.gif&amp;quot;&#039;&#039;&#039;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Click to enlarge thumbnail&lt;br /&gt;
[[File:Mhcustom_images.jpg|thumbnail|left|Figure 4: /Custom/Images ODB Tree]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
Once the image is visible, enable [[#HTML mapping]], optionally [[#Display mouse position]] and proceed to  [[#Superimposing Labels, Bars and Fills onto a gif image]]. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== HTML mapping ==&lt;br /&gt;
Note that if additional features such as active clickable areas and labels, bars and fills superimposed on the image are also required, HTML mapping must also be activated with the HTML {{HtmlTag|tag=&amp;lt;map...&amp;gt;}} tag and the &amp;quot;usemap&amp;quot; attribute of the HTML {{HtmlTag|tag=&amp;lt;img&amp;gt;}} tag&lt;br /&gt;
{{Html|text=   &amp;lt;map &#039;&#039;&#039;name=&amp;quot;myexpt.map&amp;quot;&#039;&#039;&#039;&amp;gt; &amp;lt;br&amp;gt; &amp;lt;img src=&amp;quot;myexpt.gif&amp;quot; &#039;&#039;&#039;usemap=&amp;quot;#myexpt.map&amp;quot;&#039;&#039;&#039;&amp;gt; &amp;lt;br&amp;gt;...&amp;lt;br&amp;gt; &amp;lt;/map&amp;gt;&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Display mouse position ==&lt;br /&gt;
[[File:Cursor.png|thumbnail|left|Figure 5: MEG Gas System Custom Page showing cursor position]]&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When writing custom pages with large background images and labels and fills placed on that image, it is hard to figure out X and Y coordinates of the labels. This can now be simplified by using the function &#039;&#039;getMouseXY()&#039;&#039; in the development JavaScript built-in library [[develop.js]]. This function supplies the X,Y position of the cursor if an element of ID &amp;quot;&#039;&#039;&#039;refimg&#039;&#039;&#039;&amp;quot; is present. This JS library &#039;&#039;&#039;must be [[develop.js|included in the custom page]]&#039;&#039;&#039; in order to use it:&lt;br /&gt;
&lt;br /&gt;
Then, set the &amp;quot;id&amp;quot; attribute of the background HTML {{HtmlTag|tag=&amp;lt;img...&amp;gt;}} tag to &amp;quot;refimg&amp;quot;, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
: &amp;lt;img  &#039;&#039;&#039;id=&amp;quot;refimg&amp;quot;&#039;&#039;&#039; src=&amp;quot;ebit_pc.gif&amp;quot; usemap=&amp;quot;#Custom1&amp;quot;&amp;gt;   &amp;lt;!-- name=&amp;quot;refimg&amp;quot; makes crosshairs appear --&amp;gt;&lt;br /&gt;
: &amp;lt;map name=&amp;quot;Custom1&amp;quot;&amp;gt;&lt;br /&gt;
: .....&lt;br /&gt;
: &amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;&#039;&#039;&#039;refimg&#039;&#039;&#039;&amp;quot; tag is present, the cursor changes into a crosshair, and its absolute and relative locations in respect to the reference image are shown in the status bar (Figure 5).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
==  Superimposing Labels, Bars and Fills onto a gif image ==&lt;br /&gt;
You can enhance your custom page by superimposing multiple features based on ODB variables onto an image (e.g. [[#Display mouse position|Figure 5]]), such as&lt;br /&gt;
&lt;br /&gt;
*    labels: &amp;quot;live&amp;quot; ODB values positioned in a particular location of the page&lt;br /&gt;
*    bars : &amp;quot;bar level&amp;quot; showing graphically ODB values such as levels or rate etc.&lt;br /&gt;
*    fills : &amp;quot;color level&amp;quot; where colour is used as the level indicator.&lt;br /&gt;
&lt;br /&gt;
Each entry (label/bar/fill) will have an ODB tree associated to it defining the ODB variable path, X/Y position, colour, etc. Each time the page is updated, the latest ODB value/level/rate will be shown based on the ODB parameter to which the label, bar or fill is linked - hence the term &amp;quot;live&amp;quot;. The overlay of the requested features is done onto the selected image file.&lt;br /&gt;
&lt;br /&gt;
This powerful new extension brings the [[mhttpd]] capability closer to other experimental web controllers similar to EPICS.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:    Be sure to enable the feature to [[#Display mouse position]] in order to facilitate finding the X,Y positions of the various features.&lt;br /&gt;
: [[#HTML mapping]] must be activated for labels/bars/fills to work&lt;br /&gt;
&lt;br /&gt;
A Demo custom page showing labels, bars and fills superimposed on an image is shown in [[#MIDAS stylesheet|Figure 2]]. &lt;br /&gt;
All the files for this demo can be found in $MIDASSYS/examples/custom/. The file xcustom.odb contains the ODB keys required, including those to insert the image and superimpose the various labels, fills etc. This file can be loaded into the ODB with the  {{Odbedit cmd|cmd=load}}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=== Adding Labels ===&lt;br /&gt;
&lt;br /&gt;
 [[File:Mhcustom_label.jpg|thumbnail|left|Figure 6: /Custom/Images/Labels ODB subtree]]&lt;br /&gt;
&lt;br /&gt;
In order to include a readout of ODB values (i.e. labels), on the image, a further ODB subdirectory  {{Odbpath|path=/Custom/images/&amp;lt;imagefile.gif/Labels}} must be created. Creating a subdirectory for a particular label i.e. {{Odbpath|path=&amp;lt;label name&amp;gt;}} in the   {{Odbpath|path=Labels}} subtree will, at the next custom web page refresh, cause the complete structure for that label to be created and filled with default values. Once the {{Odbpath|path=&amp;lt;label name&amp;gt;}} subtree is created, the user fills the various keys as desired. See [[/Custom ODB tree#Labels subtree]] for details of the various fields. This procedure is repeated for all the labels required, using a unique {{Odbpath|path=&amp;lt;label name&amp;gt;}} subdirectory for each label. An example of a {{Odbpath|path=&amp;lt;label name&amp;gt;}} subtree is shown in Figure 6. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=== Adding Bars ===&lt;br /&gt;
 &lt;br /&gt;
[[File:Mhcustom_fill.jpg|thumbnail|left|Figure 7: /Custom/Images/Fills ODB subtree]]&lt;br /&gt;
&lt;br /&gt;
In a similar way, Bars can be superimposed on the image. Create  a new ODB subdirectory  {{Odbpath|path=/Custom/images/&amp;lt;imagefile.gif/Bars}}. Create a subdirectory for a particular Bar ({{Odbpath|path=&amp;lt;bar name&amp;gt;}}) in the {{Odbpath|path=Bars}}  subdirectory. Refresh the web page and fill the various keys as desired.  See [[/Custom ODB tree#Bars subtree]] for details of the various fields.  Examples of a &amp;lt;bar-name&amp;gt; subtree is shown in Figure 7.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=== Adding Fills ===&lt;br /&gt;
[[File:Mhcustom_bar.jpg|thumbnail|left|Figure 8: /Custom/Images/Bars ODB subtree]]&lt;br /&gt;
&lt;br /&gt;
In a similar way, Fills can be superimposed on the image. Create new ODB subdirectory   {{Odbpath|path=/Custom/images/&amp;lt;imagefile.gif/Fills}}. Create a subdirectory for a particular  Fill ({{Odbpath|path=&amp;lt;fill name&amp;gt;}}) in the {{Odbpath|path=Fills}} subdirectory. Refresh the web page and fill the various keys as desired.  See  [[/Custom ODB tree#Fills subtree]] for details of the various fields.  Examples of a ({{Odbpath|path=&amp;lt;fill name&amp;gt;}}  subtree is shown in Figure 8. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Mapping active areas onto the image ==&lt;br /&gt;
Provided [[#HTML mapping]] is activated, &amp;quot;clickable&amp;quot; areas can be created on the image.&lt;br /&gt;
&lt;br /&gt;
This can be done now with a new function like this:&lt;br /&gt;
{{Html|text= &amp;lt;area shape=&amp;quot;rect&amp;quot; coords=&amp;quot;40,200,100,300&amp;quot; alt=&amp;quot;Main Valve&amp;quot; href=&amp;quot;Custom1?cmd=Toggle&amp;amp;odb=/Equipment/Environment/Variables/Output[2]&amp;quot;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
This defines a clickable map on top of the custom image. The area(s) should match with some area(s) on the image, e.g. the box of a valve. Determining the co-ordinates of this area is simplified by using the Display mouse position feature.&lt;br /&gt;
&lt;br /&gt;
By clicking on this area, the supplied path to the ODB is used (in this case  {{Odbpath|path=/Equipment/Environment/Variables/Output[2]}}) and its value is toggled. If the valve value is then used in the image via a [[#Adding Fills|Fill]] statement to change the color of the valve, it can turn green or red depending on its state. This is illustrated in [[#Display mouse position|Figure 5]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking an active area can also be made to open a new custom page, for example:&lt;br /&gt;
{{Html|text=&amp;lt;area shape=rect coords=&amp;quot;687,530, 890,648&amp;quot; alt=&amp;quot;Pump detail&amp;quot; href = &amp;quot;Pump!&amp;quot; title=&amp;quot;Click for Details&amp;quot;&amp;gt;}}&lt;br /&gt;
{{Html|text=&amp;lt;area shape=rect coords=&amp;quot;560,574,775,662&amp;quot; alt=&amp;quot;Buffer Tank detail&amp;quot; href = &amp;quot;BufferTank!&amp;quot; title=&amp;quot;Click for Details&amp;quot;&amp;gt;}}&lt;br /&gt;
where &#039;&#039;Pump!&#039;&#039; and &#039;&#039;BufferTank!&#039;&#039; are defined as links to custom pages in the [[/Custom ODB tree]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Edit boxes floating on top of a graphic ==&lt;br /&gt;
&lt;br /&gt;
An edit box can be placed on top of a graphic in a particular position by means of an HTML  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&amp;amp;lt;div&amp;amp;gt;&amp;lt;/span&amp;gt; tag. Using the ODBEdit function from the Midas JS library [[Mhttpd.js]], the custom page code would look like this:&lt;br /&gt;
&amp;lt;!-- Complicated... have to use &amp;lt;pre&amp;gt; because of &amp;lt;div&amp;gt;, then a table to keep the background colour between &amp;lt;pre&amp;gt;s --&amp;gt;&lt;br /&gt;
{|  style=&amp;quot;text-align: left; width: 100%; background-color: floralwhite;&amp;quot; border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;pre style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;position:absolute; top:100px; left:50px;&amp;quot;&amp;gt;    &lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic;&amp;quot;&amp;gt;&lt;br /&gt;
document.write(&#039;Run number: &#039;)&lt;br /&gt;
path=&#039;/runinfo/run number&#039;&lt;br /&gt;
rn = ODBGet(path)&lt;br /&gt;
document.write(&#039;&amp;lt;a href=&amp;quot;#&amp;quot; onclick=&amp;quot;ODBEdit(path)&amp;quot; &amp;gt;&#039;)  &lt;br /&gt;
document.write(rn)&lt;br /&gt;
document.write(&#039;&amp;lt;/a&amp;gt;&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;custom.gif&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The same thing could be done with the HTML-style {{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tag :&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;position:absolute; top:100px; left:50px;&amp;quot;&amp;gt;&lt;br /&gt;
Run number:  &amp;lt;odb src=&amp;quot;/Runinfo/run number&amp;quot; edit=1&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;custom.gif&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Examples =&lt;br /&gt;
For more examples of accessing the ODB with the Javascript library [[mhttpd.js]] look at the example experiment in the MIDAS package $MIDASSYS/examples/javascript1/example.html.&lt;br /&gt;
&lt;br /&gt;
== Example 1 : Asynchronous calls using mjsonrpc functions ==&lt;br /&gt;
See [[mjsonrpc#examples]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 : Asynchronous calls using Javascript and AJAX ==&lt;br /&gt;
&lt;br /&gt;
Example 2 shows html code illustrating the use of ODBMCopy(), where innerHTML is used to display the data. On a page with images or a lot of data, innerHTML allows you to update variables without having to reload the whole page. In the example, a timer causes the page to update every 10s (reread the data). Often the ODB data for the whole page can be read by one asynchronous ODBMCopy() call, rather than scattering synchronous ODBGet() calls throughout the page.  &lt;br /&gt;
&lt;br /&gt;
Access to the ODB is provided by the  [[Mhttpd.js|MIDAS Javascript Library]], included with the line &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&amp;amp;lt;script src=&#039;mhttpd.js&#039;&amp;amp;gt;&amp;amp;lt;/script&amp;amp;gt;&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;MyTitle&amp;lt;/title&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;mhttpd.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
var updatePeriod = 10000; // in msec &amp;lt;br&amp;gt;&lt;br /&gt;
var updateTimerId = 0; &amp;lt;br&amp;gt;&lt;br /&gt;
var counter=0; &amp;lt;br&amp;gt;&lt;br /&gt;
function update()  {  &amp;lt;br&amp;gt;&lt;br /&gt;
:clearTimeout(updateTimerId); &amp;lt;br&amp;gt;&lt;br /&gt;
:      load(); &lt;br /&gt;
:      if (updatePeriod &amp;gt; 0) &lt;br /&gt;
:      updateTimerId = setTimeout(&#039;update()&#039;, updatePeriod); &lt;br /&gt;
} &amp;lt;br&amp;gt;&lt;br /&gt;
function load()  { &amp;lt;br&amp;gt;&lt;br /&gt;
: document.getElementById(&#039;LastUpdated&#039;).innerHTML = &amp;quot;Updating...&amp;quot; + new Date; &lt;br /&gt;
: var paths = [ &amp;quot;/Runinfo&amp;quot;, &amp;quot;/Experiment&amp;quot;]; &lt;br /&gt;
: var data_odb=ODBMCopy(paths, mcopy_callback, &amp;quot;json&amp;quot;) &lt;br /&gt;
: counter++; &lt;br /&gt;
: document.getElementById(&#039;counter&#039;).innerHTML = &#039;Counter: &#039;+ counter &lt;br /&gt;
} &amp;lt;br&amp;gt;&lt;br /&gt;
function mcopy_callback(data)  {  &amp;lt;br&amp;gt;&lt;br /&gt;
:    var obj= JSON.parse(data);&lt;br /&gt;
: var runinfo=obj[0];&lt;br /&gt;
: document.getElementById(&#039;rn&#039;).innerHTML = &#039;Run Number =&#039;+ parseInt(runinfo[&amp;quot;Run number&amp;quot;]);&lt;br /&gt;
: document.getElementById(&#039;state&#039;).innerHTML  =&#039;Run State= &#039;+ runinfo.State;&lt;br /&gt;
: var experiment=obj[1];&lt;br /&gt;
: document.getElementById(&#039;name&#039;).innerHTML=&#039;Experiment name = &#039;+ experiment.Name &amp;lt;br&amp;gt; &lt;br /&gt;
}&amp;lt;br&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/script&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;/head&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;body&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;b&amp;amp;gt;Javascript code using ODBMCopy with callback&amp;amp;lt;/b&amp;amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
The data on the page is updated every 10 sec using a timer&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;LastUpdated&amp;quot; &amp;amp;gt; Last updated: never&amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;rn&amp;quot;&amp;amp;gt; Run Number : unknown  &amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;state&amp;quot;&amp;amp;gt; State : unknown&amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;name&amp;quot;&amp;amp;gt; Experiment name : unknown  &amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;counter&amp;quot;&amp;amp;gt;Counter: zero  &amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt; &amp;lt;/div&amp;gt;  &lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
: if (updatePeriod &amp;gt; 0)&lt;br /&gt;
:  update(); &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/script&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;/body&amp;gt; &amp;lt;/html&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Example 3 : Synchronous Calls using Javascript and AJAX ==&lt;br /&gt;
In the following example, JS functions ODBGet and  ODBEdit from the [[Mhttpd.js|MIDAS Javascript Library]] are used to access the ODB.  &lt;br /&gt;
;NOTE&lt;br /&gt;
# Synchronous calls are now deprecated (see [[#The MIDAS Javascript Library|above]]).&lt;br /&gt;
# The Javascript library &#039;&#039;&#039;must be [[mhttpd.js#include js lib|included in the HTML code]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
{{Html|text=&amp;lt;script&amp;gt;}}&lt;br /&gt;
{{JS|text=document.write (&#039;Experiment Name: &#039;+ ODBGet(&amp;quot;/Experiment/Name&amp;quot;)) &amp;lt;br&amp;gt; var alarm_path=&amp;quot;/alarms/Alarm system active&amp;quot;; &amp;lt;br&amp;gt; var alarm_active=ODBGet(alarm_path); &amp;lt;br&amp;gt; document.write(&#039;&amp;lt;a href=&amp;quot;#&amp;quot; onclick=&amp;quot;ODBEdit(alarm_path)&amp;quot; &amp;gt;&#039;+alarm_active+&#039;&amp;lt;/a&amp;gt;&#039;)}}&lt;br /&gt;
{{Html|text=&amp;lt;/script&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Custom]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Custom_Page_Features&amp;diff=2859</id>
		<title>Custom Page Features</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Custom_Page_Features&amp;diff=2859"/>
		<updated>2019-05-28T22:03:51Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[Mhttpd|mhttpd MIDAS web server]]&lt;br /&gt;
* [[ODB Page]]&lt;br /&gt;
* [[Custom Page]]&lt;br /&gt;
* [[/Custom ODB tree]]&lt;br /&gt;
* [[Mhttpd.js|MIDAS Javascript library (mhttpd.js)]]&lt;br /&gt;
* [[mjsonrpc|MIDAS JSON RPC library functions (mjsonrpc)]]&lt;br /&gt;
* [[odbedit]] &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
;NOTE&lt;br /&gt;
: Since 2018, many of the features described here can now be implemented more simply using the  mod* JS functions (see [[Custom Page|Custom Web Page]]).&lt;br /&gt;
: &#039;&#039;&#039;If writing a new web page, it is strongly recommended you make use of the mod*JS features. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This page describes some of the special features provided for use on a user-created [[Custom Page|Custom Web Page]] using the [[#The MIDAS Javascript Library]], which was the recommended way to write Custom Pages before the [[Custom Page#modb* Javascript scheme]]  was available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= The MIDAS Javascript Library =&lt;br /&gt;
The MIDAS Javascript Library [[mhttpd.js]] includes routines written in Javascript and AJAX to provide features useful for writers of [[Custom Page]]s, such as access to the ODB. Recently asynchronous [[mjsonrpc|JSON-RPC functions]] using [[mjsonrpc#Javascript client library|Promises]]  has been added (January 2016).&lt;br /&gt;
;NOTE&lt;br /&gt;
:To use functions in this library, it &#039;&#039;&#039;must be [[mhttpd.js#include js lib|included in the HTML code]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Many of the older routines (ODBGet, ODBSet) use &#039;&#039;&#039;synchronous&#039;&#039;&#039; RPC requests. With synchronous request, a second RPC request must wait until the first request is complete. This can significantly slow down web pages where many calls to ODBGet are made. For this reason, functions were developed that can be synchronous or &#039;&#039;&#039;asynchronous&#039;&#039;&#039; (e.g. ODBMCopy) that include a callback mechanism. The data from ODBMCopy can be formatted in [[mjsonrpc#JSON general information|JSON]]. &lt;br /&gt;
&lt;br /&gt;
Web developers are moving away from synchronous RPC requests, which are now deprecated [https://midas.triumf.ca/elog/Midas/1128]. Some modern browsers return a warning on a synchronous RPC request. &lt;br /&gt;
&lt;br /&gt;
A new group of JSON-RPC functions using  [[mjsonrpc#Javascript client library|Promises]] has been added to the MIDAS Javascript Library (January 2016). These are asynchronous only, and they also provide more functionality and have better error handling than the older AJAX calls, which are also inconsistent in how they handle Booleans. They also have much improved handling of reading/writing arrays to the ODB. Before 2018 it was recommended that all new Custom Pages are written using these JSON-RPC functions.  {{Important|text=Since 2018 the [[Custom Page#modb* Javascript scheme]] is recommended for new Custom Pages}}.&lt;br /&gt;
&lt;br /&gt;
The MIDAS Javascript Library routines requires an up-to-date browser that supports Promises (see [https://midas.triumf.ca/elog/Midas/1145]). If using an older browser version, the asynchronous AJAX calls (e.g. ODBMCopy) should be used in order to avoid having to rewrite the web page at a later date to remove all synchronous calls.  &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Access the ODB using mjson-rpc asynchronous functions ==&lt;br /&gt;
&lt;br /&gt;
Access to the ODB is provided by the  [[Mhttpd.js|MIDAS Javascript Library]], which (since January 2016) includes the [[mjsonrpc]] functions.  It is [[#The MIDAS Javascript Library|recommended]] that these functions are used for &#039;&#039;&#039;new&#039;&#039;&#039; pages rather than the older AJAX calls (see below). &lt;br /&gt;
&lt;br /&gt;
To run these functions you need&lt;br /&gt;
# to  [[mhttpd.js#include js lib|include the Javascript library in the HTML code]]&#039;&#039;&#039;&lt;br /&gt;
# to use an up-to-date browser that supports Promises (see [https://midas.triumf.ca/elog/Midas/1145]). &lt;br /&gt;
&lt;br /&gt;
Examples showing how to read and write to the ODB can be found at [[mjsonrpc#examples]]. Also included are examples using arrays. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Access the ODB using asynchronous AJAX calls ==&lt;br /&gt;
;NOTE&lt;br /&gt;
: It is recommended that  asynchronous MIDAS JSON-RPC functions are used for new pages rather than the older AJAX calls (see [[#Access the ODB using mjson-rpc asynchronous functions|above]]).&lt;br /&gt;
&lt;br /&gt;
[[#Example 2 : Asynchronous calls using Javascript and AJAX|Example 2]] uses the asynchronous call ODBMCopy() with callback to read the data. The data are converted into JSON format. In this case, when accessing the JSON data, &#039;&#039;the ODB Keynames must be in the same case as they are in the ODB&#039;&#039;, even though the case is ignored by the ODB. If you find this feature annoying, use [[#Access the ODB using mjson-rpc asynchronous functions|mjson-rpc function db_get_values()]] as all keynames are converted to lower case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Access the ODB using synchronous AJAX requests ==&lt;br /&gt;
;NOTE&lt;br /&gt;
: Synchronous requests are now deprecated (see [[#The MIDAS Javascript Library|above]]). New pages should be written [[#Using mjson-rpc asynchronous functions]].&lt;br /&gt;
&lt;br /&gt;
See [[#Example 3 : Synchronous Calls using Javascript and AJAX]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Access the ODB with HTML-style &amp;lt;span style=&amp;quot;color:seagreen font-style:italic&amp;quot;&amp;gt;&amp;lt;odb&amp;gt;&amp;lt;/span&amp;gt; tags =&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This method pre-dates the [[Mhttpd.js|MIDAS Javascript Library]]. It is recommended that the [[Mhttpd.js|MIDAS Javascript Library]] be used for ODB access.&lt;br /&gt;
&lt;br /&gt;
If Javascript (JS) is not available, the older HTML-style  {{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tags are still available and provide limited functionality.&lt;br /&gt;
&lt;br /&gt;
The  HTML-style {{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tag has been defined for read/write access to the ODB under HTML. The {{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tags are declared within enclosing HTML {{HtmlTag|tag=&amp;lt;form...&amp;gt;....&amp;lt;/form&amp;gt;}} tags.&lt;br /&gt;
&lt;br /&gt;
{|  style=&amp;quot;text-align: left; width: 100%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;3&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
|+ Access to ODB from HTML&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;text-align: center; vertical-align: top; background-color: rgb(204, 204, 255); font-weight: bold;&amp;quot; | HTML ODB tag&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;text-align: center; vertical-align: top; background-color: rgb(204, 204, 255); font-weight: bold;&amp;quot; | Meaning&lt;br /&gt;
&lt;br /&gt;
|-   &lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;text-align: left; vertical-align: top; background-color: rgb(255, 255, 255); color: seagreen; font-style:italic&amp;quot;  |&amp;lt;odb src=&amp;quot;odb path&amp;quot;&amp;gt;&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;text-align: left; vertical-align: top; background-color: rgb(255, 255, 255); color: black&amp;quot;  |Display ODB field (read only)&lt;br /&gt;
	&lt;br /&gt;
|-   &lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;text-align: left; vertical-align: top; background-color: rgb(255, 255, 255); color: seagreen; font-style:italic&amp;quot;  |&amp;lt;odb src=&amp;quot;odb path&amp;quot; edit=1 pwd=&amp;quot;CustomPwd&amp;quot;&amp;gt;&lt;br /&gt;
| Display an Editable ODB field (inline style). Optional password protection with &#039;&#039;&#039;pwd&#039;&#039;&#039; .&lt;br /&gt;
&lt;br /&gt;
|-   &lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;text-align: left; vertical-align: top; background-color: rgb(255, 255, 255); color: seagreen; font-style:italic&amp;quot;  |&amp;lt;odb src=&amp;quot;odb path&amp;quot; edit=2 pwd=&amp;quot;CustomPwd&amp;quot;&amp;gt;&lt;br /&gt;
| Display an Editable ODB field (popup style). Optional password protection with &#039;&#039;&#039;pwd&#039;&#039;&#039; .&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: The Optional password protection with &#039;&#039;&#039;pwd&#039;&#039;&#039; (documented in the [http://ladd00.triumf.ca/~daqweb/doc/midas-old/html/RC_customize_ODB.html#RC_Access_Control| OldMidas Document]) may not be working.&lt;br /&gt;
: Use the  [[/Experiment ODB tree#Security subtree|Web Password security]] instead. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tags are included in the HTML code e.g.&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
 Experiment Name: &amp;lt;odb src=&amp;quot;/Experiment/Name&amp;quot;&amp;gt;&lt;br /&gt;
 Run Number: &amp;lt;odb src=&amp;quot;/runinfo/run number&amp;quot; edit=1&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
{{Html|text= Experiment Name: &amp;lt;odb src=&amp;quot;/Experiment/Name&amp;quot;&amp;gt; &amp;lt;br&amp;gt;  Run Number: &amp;lt;odb src=&amp;quot;/runinfo/run number&amp;quot; edit=1&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
See also [[Custom Page#How to write a Custom Page|HTML Custom Page example]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= ODB RPC access =&lt;br /&gt;
The [[Mhttpd.js|MIDAS Javascript Library]] function ODBRpc() defined for RPC access.&lt;br /&gt;
&lt;br /&gt;
This permits buttons on MIDAS &amp;quot;custom&amp;quot; web pages to invoke RPC calls directly into user frontend programs, for example to turn hardware modules on or off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= JSON support =&lt;br /&gt;
[[mjsonrpc#JSON general information|JSON]] support is provided with the [[Mhttpd.js|MIDAS Javascript Library]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=   Access to the MIDAS Menu buttons =&lt;br /&gt;
Access to the standard MIDAS Menu buttons can be provided with HTML {{HtmlTag|tag=&amp;lt;input...&amp;gt;}} tags of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&#039;&#039;&amp;lt;button-name&amp;gt;&#039;&#039; type=&amp;quot;submit&amp;quot; &amp;gt; --&amp;gt;&lt;br /&gt;
{{Html|text=&amp;lt;input name=&amp;quot;cmd&amp;quot; value=&#039;&#039;&amp;lt;button-name&amp;gt;&#039;&#039; type=&amp;quot;submit&amp;quot; &amp;gt;}}&lt;br /&gt;
Valid values are the standard MIDAS Menu buttons, i.e. (Start, Pause, Resume, Stop, ODB, Elog, Alarms, History, Programs etc). The {{HtmlTag|tag=&amp;lt;input...&amp;gt;}} tags must be declared within enclosing HTML {{HtmlTag|tag=&amp;lt;form...&amp;gt;....&amp;lt;/form&amp;gt;}} tags (see above).&lt;br /&gt;
&lt;br /&gt;
The following HTML fragment shows the inclusion of three of the standard buttons, giving access to the Main Status, ODB and Messages pages :&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 &amp;lt;form name=&amp;quot;form1&amp;quot; method=&amp;quot;Get&amp;quot; action=&amp;quot;/CS/MyExpt&amp;amp;&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;Status&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;ODB&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;Messages&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;/form&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
{{Html|text= &amp;lt;form name=&amp;quot;form1&amp;quot; method=&amp;quot;Get&amp;quot; action=&amp;quot;/CS/MyExpt&amp;amp;&amp;quot;&amp;gt; &amp;lt;br&amp;gt; &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;Status&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt; &amp;lt;br&amp;gt; &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;ODB&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt; &amp;lt;br&amp;gt; &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;Messages&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt; &amp;lt;br&amp;gt; ...  &amp;lt;br&amp;gt; &amp;lt;/form&amp;gt; }}&lt;br /&gt;
&lt;br /&gt;
See also [[#Redirect]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Redirect =&lt;br /&gt;
&lt;br /&gt;
When buttons are included on a Custom Page, after pressing a button (e.g. the Start or Stop button) it may be desirable to return to the same custom page, rather than returning to the [[Status Page]].&lt;br /&gt;
&lt;br /&gt;
This can be done by including an HTML {{HtmlTag|tag=&amp;lt;input...&amp;gt;}} tag with the attributes &#039;&#039;type&#039;&#039; set to &amp;quot;hidden&amp;quot; and &#039;&#039;name&#039;&#039; set to &amp;quot;redir&amp;quot;. This name (&amp;quot;redir&amp;quot;) is detected by [[Mhttpd]], causing a redirect to the specified custom link in the &#039;&#039;value&#039;&#039; attribute.&lt;br /&gt;
&lt;br /&gt;
For example, the following redirects the screen back to the custom page link   {{Odbpath|path=/Custom/my_custom_page&amp;amp;}} when buttons are pressed:&lt;br /&gt;
{{Html|text=&amp;lt;input type=hidden name=&amp;quot;redir&amp;quot; value=&amp;quot;my_custom_page&amp;amp;&amp;quot;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
See also [[#Replace Status Page by a Custom page|Redirect when a Custom Page replaces the Status Page]].&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CustomScript Buttons =&lt;br /&gt;
&lt;br /&gt;
[[/Customscript ODB tree#Customscript-button|CustomScript buttons]] can be provided on [[Custom Page|Custom Pages]]. These buttons are equivalent to optional &#039;&#039;&#039;script buttons&#039;&#039;&#039; on the [[Status Page]], which call a script to perform a particular action when the button is pressed. See [[/Script ODB tree#Script-button|script buttons]] for details. Customscript buttons can be set up through the [[/Customscript ODB tree]].&lt;br /&gt;
&lt;br /&gt;
Any key &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/CustomScript/test&amp;lt;/span&amp;gt; will appear as a customscript-button &lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #444444; background-color: #CCCCCC; font-style:italic; font-size: 90; padding:0.25em;padding-left: 0.5em;padding-right: 0.5em;border:1px solid #808080;border-radius: 5px;margin-bottom:1px;&amp;quot;&amp;gt;test&amp;lt;/span&amp;gt; on a custom page whose code includes an HTML {{HtmlTag|tag=&amp;lt;input...&amp;gt;}} tag of the form:&lt;br /&gt;
{{Html|text=&amp;lt;input type=submit name=customscript value=&amp;quot;test&amp;quot;&amp;gt;}}&lt;br /&gt;
where the action of the button &amp;lt;span style=&amp;quot;color: #444444; background-color: #CCCCCC; font-style:italic; font-size: 90; padding:0.25em;padding-left: 0.5em;padding-right: 0.5em;border:1px solid #808080;border-radius: 5px;margin-bottom:1px;&amp;quot;&amp;gt;test&amp;lt;/span&amp;gt; will be found in the &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/customscript/test&amp;lt;/span&amp;gt; subdirectory.&lt;br /&gt;
&lt;br /&gt;
After pressing a customscript-button, the &#039;&#039;type=submit&#039;&#039; in the HTML {{HtmlTag|tag=&amp;lt;input&amp;gt;}} will cause a page reload. This will result in a switch to the [[Status Page]], unless a [[#redirect]] input tag is included to redirect back to the original custom page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Customscript button without a page reload ==&lt;br /&gt;
To define a customscript button that does &#039;&#039;&#039;not&#039;&#039;&#039; cause a page reload, set the &#039;&#039;type&#039;&#039; in the HTML {{HtmlTag|tag=&amp;lt;input&amp;gt;}} to &amp;quot;button&amp;quot;, i.e. &lt;br /&gt;
{{Html|text=&amp;lt;input name=&amp;quot;customscript&amp;quot; value=&amp;quot;test&amp;quot; type=&amp;quot;button&amp;quot; onClick=cs_button(this.value)&amp;gt;  &amp;lt;!-- Customscript button does not reload page; no callback --&amp;gt;}}&lt;br /&gt;
and use &#039;&#039;&amp;quot;onClick&amp;quot;&#039;&#039; to call a function to [[#Send an Ajax Request]] instead. The following function sends an asynchronous request, with an optional callback.&lt;br /&gt;
{{HtmlTag|tag=&amp;lt;script&amp;gt;}}&lt;br /&gt;
 &amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
function cs_button(cmd, callback)&amp;lt;br&amp;gt;&lt;br /&gt;
{  // send a request to execute a custom script&lt;br /&gt;
:   var url;&lt;br /&gt;
:   var request = XMLHttpRequestGeneric();&lt;br /&gt;
:&lt;br /&gt;
:   url = ODBUrlBase&lt;br /&gt;
:   if(document.getElementById(&amp;quot;redir&amp;quot;) != null)&lt;br /&gt;
::     url +=  &#039;?redir=&#039;+document.getElementById(&#039;redir&#039;).value&lt;br /&gt;
:   url+=&#039;&amp;amp;customscript=&#039;+ encodeURIComponent(cmd);&lt;br /&gt;
:   request.open(&#039;GET&#039;, url, true); // asynchronous request&lt;br /&gt;
:   request.send(null);&lt;br /&gt;
:  if(callback!=undefined) {&lt;br /&gt;
::      request.onreadystatechange = function() {&lt;br /&gt;
:::         if (request.readyState == 4) { &lt;br /&gt;
::::            if (request.status == 200)&lt;br /&gt;
:::::                callback();&lt;br /&gt;
::::            else&lt;br /&gt;
:::::                alert(&#039;cs_button: Error after sending request to Custom Script &amp;quot;&#039;+cmd+&#039;&amp;quot; :\nHTTP Status: &#039;+request.status)&lt;br /&gt;
:::            }&lt;br /&gt;
::         }&lt;br /&gt;
:  }&lt;br /&gt;
:  else { &lt;br /&gt;
::   if (request.status != 200)&lt;br /&gt;
:::       alert(&#039;cs_button: Error after sending request to Custom Script &amp;quot;&#039;+cmd+&#039;&amp;quot; :\nHTTP Status: &#039;+request.status)&lt;br /&gt;
:	   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{HtmlTag|tag=&amp;lt;/script&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Resource files =&lt;br /&gt;
It is often desirable to serve resource files (i.e. &#039;&#039;&#039;local files&#039;&#039;&#039; such as an external stylesheet, javascript files or images&#039;&#039;&#039;&amp;lt;sup&amp;gt;***&amp;lt;/sup&amp;gt;&#039;&#039;&#039;) to a custom page. The following sections describe two alternative ways of serving resource files to a custom page:&lt;br /&gt;
* [[#Resource files served WITH /custom/path key defined|with  /custom/path key defined]]&lt;br /&gt;
* [[#Resource files served WITHOUT /custom/path key defined|without  /custom/path key defined]]&lt;br /&gt;
See also serving resources to a [[#Replace Status Page by a Custom Status page|Custom Status page]].&lt;br /&gt;
;NOTE&lt;br /&gt;
:  &#039;&#039;&#039;&amp;lt;sup&amp;gt;***&amp;lt;/sup&amp;gt;&#039;&#039;&#039; To superimpose labels, bars or fills onto an image, the image cannot be served as a resource file. See [[#Image insertion]].&lt;br /&gt;
&lt;br /&gt;
== Resource files served WITH &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;/custom/path&amp;lt;/span&amp;gt; key defined ==&lt;br /&gt;
When a number of resource files are required, it is convenient to place them in the same directory on the disk, and create a key  {{Odbpath|path=/Custom/Path}} to contain this directory. &lt;br /&gt;
&lt;br /&gt;
 $ ls  /home/midas/online/custom/&lt;br /&gt;
   custom_functions.js       custom_globals.js     custom_page.html    custom_stylesheet.css      test_image.png&lt;br /&gt;
With the  {{Odbpath|path=/Custom/Path}} key defined, [[/Custom ODB tree#Custom-Link|custom-links]] for individual resource files need not be created in the  {{Odbpath|path=/Custom/Path}} tree. The custom-link  {{Odbpath|path=custom_page&amp;amp;}} &#039;&#039;&#039;is&#039;&#039;&#039; required so that the custom page can be accessed from the [[/Custom ODB tree#Custom-Button|custom-button]]  {{Button|name=custom_page}} on the Status Page. The key name ends in the special character &amp;quot;&amp;amp;&amp;quot; so that it will open in the same window as the Status page (see [[/Custom ODB tree#Key names|key names]]).&lt;br /&gt;
 $ odbedit&lt;br /&gt;
   [local:exp:S] ls /custom&lt;br /&gt;
   path                           /home/midas/online/custom/&lt;br /&gt;
   custom_page&amp;amp;                   custom_page.html&lt;br /&gt;
 &lt;br /&gt;
A {{HtmlTag|tag=&amp;lt;script&amp;gt;}} tag for each resource file to be served (specifying the file name) is then placed in the header of  {{File|name=custom_page.html}} &lt;br /&gt;
i.e.&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;custom_functions.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;}}&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;custom_globals.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;}}&lt;br /&gt;
&amp;lt;br&amp;gt; and a {{HtmlTag|tag=&amp;lt;link&amp;gt;}} tag for an external stylesheet&lt;br /&gt;
{{Html|text=&amp;lt;link type=&amp;quot;text/css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;custom_stylesheet.css&amp;quot; title=&amp;quot;Stylesheet&amp;quot;&amp;gt;}}&lt;br /&gt;
An image tag is placed in the body of  {{File|name=custom_page.html}} &lt;br /&gt;
{{Html|text=&amp;lt;img src=&amp;quot;test_image.png&amp;quot;&amp;gt; }}&lt;br /&gt;
[[mhttpd]] then loads the resource file from the directory indicated by the Path key with the correct MIME type (see  [[/Custom ODB tree#Keys in the /Custom tree|Custom tree keys]] for supported MIME types). &lt;br /&gt;
&lt;br /&gt;
== Resource files served WITHOUT &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;/custom/path&amp;lt;/span&amp;gt; key defined ==&lt;br /&gt;
Alternatively, resource files can be served to a [[Custom Page]] by creating a key for every resource file in the [[/Custom ODB tree]]. These keys must contain the full path of the file on the disk, and the key {{Odbpath|path=/Custom/Path}} must NOT be defined. The resource files can be in different directories on the disk. By defining the key names with an appropriate file extension, the resource files are served with the appropriate MIME types. The key names end in the special character &amp;quot;!&amp;quot; so that they will not appear on the Status page as custom-links (see [[/Custom ODB tree#Key names|key names]].&lt;br /&gt;
&lt;br /&gt;
Without the {{Odbpath|path=/Custom/Path}} key,  the links for the above example in the {{Odbpath|path=/Custom}} tree might look like&lt;br /&gt;
 $ odbedit&lt;br /&gt;
   [local:exp:S] ls /custom&lt;br /&gt;
   custom_page&amp;amp;                   /home/midas/online/custom/custom_page.html&lt;br /&gt;
   custom_functions.js!           /home/midas/online/resources/custom_functions.js&lt;br /&gt;
   globals.js!                    /home/midas/online/resources/custom_functions.js&lt;br /&gt;
   stylesheet.css!                /home/midas/online/stylesheets/custom_stylesheet.css&lt;br /&gt;
   image.png!                     /home/midas/images/test_image.png  &lt;br /&gt;
&lt;br /&gt;
assuming the resource files are now in the subdirectories indicated.&lt;br /&gt;
The {{HtmlTag|tag=&amp;lt;script&amp;gt;}} tag for each resource file to be served (specifying the custom-link) is then placed in the header of  {{File|name=custom_page.html}} &lt;br /&gt;
i.e.&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;custom_functions.js!&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;}}&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;globals.js!&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;}}&lt;br /&gt;
&amp;lt;br&amp;gt; and a {{HtmlTag|tag=&amp;lt;link&amp;gt;}} tag for an external stylesheet&lt;br /&gt;
{{Html|text=&amp;lt;link type=&amp;quot;text/css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;stylesheet.css!&amp;quot; title=&amp;quot;Stylesheet&amp;quot;&amp;gt;}}&lt;br /&gt;
An image tag is placed in the body of  {{File|name=custom_page.html}} &lt;br /&gt;
{{Html|text=&amp;lt;img src=&amp;quot;image.png!&amp;quot;&amp;gt; }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= MIDAS stylesheet =&lt;br /&gt;
&lt;br /&gt;
The MIDAS package provides a condensed stylesheet &lt;br /&gt;
: {{Filepath|path=/home/midas/packages/midas/resources/}}{{File|name=mhttpd.css}} &lt;br /&gt;
for users who would like their custom pages to have a similar &amp;quot;look and feel&amp;quot; to that of the standard pages.&lt;br /&gt;
&lt;br /&gt;
To include the MIDAS stylesheet, in the HTML header, add &lt;br /&gt;
{{HtmlTag|tag=&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;mhttpd.css&amp;quot;&amp;gt;}}&lt;br /&gt;
No &#039;&#039;custom link&#039;&#039; needs to be defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting Demo custom page is shown in Figure 1, which can be compared with Figure 2 (no stylesheet). &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Figure 1  !! Figure 2&lt;br /&gt;
|-&lt;br /&gt;
| Demo Custom Page using MIDAS stylesheet || Demo Custom Page&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| [[File:Mhxcustom03.jpg|thumb|300px]] || [[File:Mhxcustom02.jpg|thumb|200px]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=  Alias-Buttons and Hyperlinks =&lt;br /&gt;
Any hyperlink can easily be included on a [[Custom Page]] by using the standard HTML anchor {{HtmlTag|tag=&amp;lt;a...&amp;gt;}} tag, e.g.&lt;br /&gt;
{{Html|text=&amp;lt;a href=&amp;quot;http://ladd00.triumf.ca/~daqweb/doc/midas/html/&amp;quot;&amp;gt;Midas Help&amp;lt;/a&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Links on a custom page equivalent to [[/Alias ODB tree#Alias-Buttons|alias-buttons]] can also be made e.g.&lt;br /&gt;
{{Html|text=&amp;lt;button type=&amp;quot;button&amp;quot; onclick=&amp;quot;document.location.href=&#039;/Alias/alias&amp;amp;&#039;;&amp;quot;&amp;gt;alias&amp;lt;/button&amp;gt;}}&lt;br /&gt;
See the [[/Alias ODB tree]] for details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=    Page refresh =&lt;br /&gt;
The following {{HtmlTag|tag=&amp;lt;meta...&amp;gt;}} tag included in the HTML header code will cause the whole custom page to refresh in 60 seconds :&lt;br /&gt;
{{Html|text=&amp;lt;meta http-equiv=&amp;quot;Refresh&amp;quot; content=&amp;quot;60&amp;quot;&amp;gt;}}&lt;br /&gt;
It is also possible to [[#Periodic update of parts of a custom page|periodically update parts]] of a custom page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Periodic update of parts of a custom page =&lt;br /&gt;
&lt;br /&gt;
The functionality of [[Mhttpd.js|ODBGet]] together with the window.setInterval() function&lt;br /&gt;
can be used to update parts of the web page periodically.&lt;br /&gt;
For example the Javascript fragment below contains a function which updates the current run number every 10 seconds in the background:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt; &amp;lt;!-- JS --&amp;gt;&lt;br /&gt;
window.setInterval(&amp;quot;Refresh()&amp;quot;, 10000);&amp;lt;br&amp;gt;&lt;br /&gt;
function Refresh() {&amp;lt;br&amp;gt;&lt;br /&gt;
:document.getElementById(&amp;quot;run_number&amp;quot;).innerHTML = ODBGet(&#039;/Runinfo/Run number&#039;);&amp;lt;br&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The custom page has to &lt;br /&gt;
* [[Mhttpd.js#include js lib|include the MIDAS JS library]] to access ODBGet&lt;br /&gt;
* contain an element with id=&amp;quot;run_number&amp;quot;, such as&lt;br /&gt;
{{Html|text=&amp;lt;td id=&amp;quot;run_number&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Display last MIDAS message(s) =&lt;br /&gt;
&lt;br /&gt;
The message log (see [[Message System]]) can be accessed from a custom page using a call to the JavaScript library function [[Mhttpd.js|ODBGetMsg]] (provided the [[Mhttpd.js#include js lib|JS library is included]]).&lt;br /&gt;
&lt;br /&gt;
This allows the inclusion of the &amp;quot;Last Midas message&amp;quot; on a custom page, e.g.&lt;br /&gt;
{{JS|text=document.write(&#039;Last message:&#039;+ODBGetMsg(&amp;quot;midas&amp;quot;,0,1))}}&lt;br /&gt;
More messages may be displayed by increasing the third parameter to ODBGetMsg.&lt;br /&gt;
;Note&lt;br /&gt;
: Parameters were changed August 2015. See [[Mhttpd.js|ODBGetMsg]] for older versions.&lt;br /&gt;
: Coming soon - a [[mjsonrpc]] function&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Generate a message log entry =&lt;br /&gt;
&lt;br /&gt;
A custom page can generate a message to be sent to the MIDAS message log (see [[Message System]]).  A call to mjsonrpc_cm_msg() will generate a message if using the [[mjsonrpc]] functions. Otherwise, use the AJAX function [[Mhttpd.js|ODBGenerateMsg]]. To use these functions, the  [[Mhttpd.js#include js lib|JS library must be included]] in the html code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=   Checkboxes =&lt;br /&gt;
The function [[Mhttpd.js|ODBSet]] (provided the [[Mhttpd.js#include js lib|JS library is included]]) can be used when one clicks on a checkbox for example:&lt;br /&gt;
{{Html|text=&amp;lt;input  name=&amp;quot;box0&amp;quot;  type=&amp;quot;checkbox&amp;quot;  onClick=&amp;quot;ODBSet(my_path, this.checked?&#039;1&#039;:&#039;0&#039;)&amp;quot;&amp;gt;}}&lt;br /&gt;
If used as above, the state of the checkbox must be initialized when the page is loaded. This can be done with some JavaScript code called on initialization, e.g.&lt;br /&gt;
{{JS|text=document.form1.box0.checked= ODBGet(my_path));  // initialize to the correct value}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Replace Status Page by a Custom page =&lt;br /&gt;
&lt;br /&gt;
Click to enlarge thumbnail&lt;br /&gt;
[[File:Mhcustom_status.jpg|thumbnail|left|Figure 3: ODB /Custom/Status custom-link to a custom status page]]&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a custom-link with the [[/Custom ODB tree#Key names|reserved key name]] &#039;&#039;&#039;Status&#039;&#039;&#039;  (not &amp;quot;Status&amp;amp;&amp;quot; or &amp;quot;Status!&amp;quot;) is created in the [[/Custom ODB tree]] (as shown in  Figure 3), then that custom page will &#039;&#039;&#039;replace the default Status Page&#039;&#039;&#039;. &lt;br /&gt;
  &lt;br /&gt;
Clicking on the {{Button|name=Status}} button on any of the sub-pages (e.g. [[ODB Page]], [[Programs Page]] etc.) will now return to the Custom Status Page. If there are buttons on the Custom Status page, you &#039;&#039;&#039;must&#039;&#039;&#039; include a  [[#Redirect]] statement of the form&lt;br /&gt;
{{Html|text=&amp;lt;input type=hidden name=&amp;quot;redir&amp;quot; value=&amp;quot;../&amp;quot;&amp;gt;}}&lt;br /&gt;
or you will see the message &lt;br /&gt;
 Invalid custom page:NULL path&lt;br /&gt;
&lt;br /&gt;
If the Custom Status page includes [[#Resource files]] served on a regular custom page with a statement such as&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;cs_functions!&amp;quot;&amp;gt;}}&lt;br /&gt;
to serve them in a Custom Status page, the statement would be&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;&amp;lt;span style=&amp;quot;font-weight:bold&amp;quot;&amp;gt;/CS/&amp;lt;/span&amp;gt;cs_functions!&amp;quot;&amp;gt;}}&lt;br /&gt;
In fact, this statement can be used in a regular custom page, as the &amp;quot;/CS/&amp;quot; is ignored in that case.&lt;br /&gt;
&lt;br /&gt;
To return to the default Status Page, delete the &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;/Custom/Status&amp;lt;/span&amp;gt; key. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Start, Stop and Check if a program is running =&lt;br /&gt;
There are [[mjsonrpc]] functions that implemented all three program management functions - start program, &lt;br /&gt;
stop program and &amp;quot;is running?&amp;quot; as JSON-RPC methods.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Send an Ajax request =&lt;br /&gt;
By sending an Ajax request from a custom page, you can make a button perform a specific function. &lt;br /&gt;
  &lt;br /&gt;
All functions in midas are controlled through special URLs. So the URL&lt;br /&gt;
 http://&amp;lt;host:port&amp;gt;/?cmd=Start&amp;amp;value=10&lt;br /&gt;
will start run #10.&lt;br /&gt;
&lt;br /&gt;
Although it is easier to use an HTML input statement to [[#Access to the MIDAS Menu buttons]], &lt;br /&gt;
to send an Ajax request, you can use the function &#039;&#039;XMLHttpRequestGeneric&#039;&#039; which is in the MIDAS Javascript library [[mhttpd.js]].&lt;br /&gt;
Then the HTML code would be&lt;br /&gt;
&lt;br /&gt;
{{Html|text=&amp;lt;input type=&amp;quot;button&amp;quot; onclick=&amp;quot;start()&amp;quot;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
and in your JavaScript code add a function &#039;&#039;start()&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
function start()&lt;br /&gt;
{&lt;br /&gt;
:   var request = XMLHttpRequestGeneric();&lt;br /&gt;
&lt;br /&gt;
:   url = &#039;?cmd=Start&amp;amp;value=10&#039;;&lt;br /&gt;
:   request.open(&#039;GET&#039;, url, true);  // asynchronous request&lt;br /&gt;
:   request.send(null);&lt;br /&gt;
} &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
See also [[#Access to the MIDAS Menu buttons]]. Another example with optional callback can be found in [[#Customscript button without a page reload]].&lt;br /&gt;
&lt;br /&gt;
This mechanism can be used for starting a particular program, see for example (see [https://midas.triumf.ca/elog/Midas/1046]). However, this functionality is now provided by [[mjsonrpc]] functions - see [[#Start, Stop and Check if a program is running]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=    Image insertion  =&lt;br /&gt;
An image can be loaded from the web using an HTML {{HtmlTag|tag=&amp;lt;img...&amp;gt;}}, e.g.  &lt;br /&gt;
   {{Html|text=&amp;quot;TRIUMF logo&amp;quot; &amp;lt;img src=&amp;quot;https://lixenon.triumf.ca/InternalDocuments/Alice/figures/TRIUMF-logo.jpg/image_preview&amp;quot;&amp;gt;}}&lt;br /&gt;
or a MIDAS History image can be inserted into a custom page using an HTML {{HtmlTag|tag=&amp;lt;img...&amp;gt;}} tag of the following form:&lt;br /&gt;
 {{Html|text=blah&amp;lt;img src=&amp;quot;http://hostname.domain:port/HS/Meterdis.gif&amp;amp;scale=12h&amp;amp;width=300&amp;quot;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
If the image file is on the local disk, it can be loaded as a &#039;&#039;&#039;resource file&#039;&#039;&#039;. The image can be of format .pdf, .jpg, .gif, .png. See loading [[#Resource files]].&lt;br /&gt;
&lt;br /&gt;
If you wish to superimpose features such as &#039;&#039;&#039;labels and fills&#039;&#039;&#039;, the image file cannot be served as a [[#Resource files|resource file]]. Instead, the image file must be in &#039;&#039;&#039;gif&#039;&#039;&#039; format, and must be included in the {{Odbpath|path=/Custom/images}} subtree (Figure 4). Image insertion into a Custom page will be illustrated using the Demo custom page shown in [[#MIDAS stylesheet|Figure 2]]. All the files required for this demo can be found in the MIDAS package at $MIDASSYS/examples/custom. If you do not wish to create&lt;br /&gt;
the keys yourself, proceed to [[#Superimposing Labels, Bars and Fills onto a gif image]]. &lt;br /&gt;
&lt;br /&gt;
Make a [[/Custom ODB tree#Custom-Link|custom-link]] to the Demo custom page file &#039;&#039;myexpt.html&#039;&#039; , i.e.&lt;br /&gt;
 [local:js:S]/&amp;gt;ls /custom&lt;br /&gt;
    myexpt&amp;amp;                  /home/test/packages/midas/examples/custom/myexpt.html&lt;br /&gt;
 &lt;br /&gt;
To make the image &#039;&#039;myexpt.gif&#039;&#039; visible on the custom page, the path and filename of the image file must be defined in the   {{Odbpath|path=/Custom/images}} subtree. To do this, &lt;br /&gt;
create the  subtrees {{Odbpath|path=/Custom/images/myexpt.gif}} where the subtree name &amp;quot;myexpt.gif&amp;quot; is named for the image file you are going to use. Multiple images can be used, by creating multiple imagefile subtrees.&lt;br /&gt;
&lt;br /&gt;
In the imagefile subtree {{Odbpath|path=myexpt.gif}}, create the STRING key  {{Odbpath|path=Background}}, and set it to contain the path and name of the image file.  The tree structure should then look similar to Figure 4, minus the labels/bars/fill subtrees which will be added to the ODB later.&lt;br /&gt;
&lt;br /&gt;
The image must also be referenced in the custom HTML file &#039;&#039;myexpt.html&#039;&#039; in the &amp;quot;src&amp;quot; field of an HTML {{HtmlTag|tag=&amp;lt;img...&amp;gt;}} tag, e.g. &lt;br /&gt;
{{Html|text=&amp;lt;img &#039;&#039;&#039;src=&amp;quot;myexpt.gif&amp;quot;&#039;&#039;&#039;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Click to enlarge thumbnail&lt;br /&gt;
[[File:Mhcustom_images.jpg|thumbnail|left|Figure 4: /Custom/Images ODB Tree]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
Once the image is visible, enable [[#HTML mapping]], optionally [[#Display mouse position]] and proceed to  [[#Superimposing Labels, Bars and Fills onto a gif image]]. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== HTML mapping ==&lt;br /&gt;
Note that if additional features such as active clickable areas and labels, bars and fills superimposed on the image are also required, HTML mapping must also be activated with the HTML {{HtmlTag|tag=&amp;lt;map...&amp;gt;}} tag and the &amp;quot;usemap&amp;quot; attribute of the HTML {{HtmlTag|tag=&amp;lt;img&amp;gt;}} tag&lt;br /&gt;
{{Html|text=   &amp;lt;map &#039;&#039;&#039;name=&amp;quot;myexpt.map&amp;quot;&#039;&#039;&#039;&amp;gt; &amp;lt;br&amp;gt; &amp;lt;img src=&amp;quot;myexpt.gif&amp;quot; &#039;&#039;&#039;usemap=&amp;quot;#myexpt.map&amp;quot;&#039;&#039;&#039;&amp;gt; &amp;lt;br&amp;gt;...&amp;lt;br&amp;gt; &amp;lt;/map&amp;gt;&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Display mouse position ==&lt;br /&gt;
[[File:Cursor.png|thumbnail|left|Figure 5: MEG Gas System Custom Page showing cursor position]]&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When writing custom pages with large background images and labels and fills placed on that image, it is hard to figure out X and Y coordinates of the labels. This can now be simplified by using the function &#039;&#039;getMouseXY()&#039;&#039; in the development JavaScript built-in library [[develop.js]]. This function supplies the X,Y position of the cursor if an element of ID &amp;quot;&#039;&#039;&#039;refimg&#039;&#039;&#039;&amp;quot; is present. This JS library &#039;&#039;&#039;must be [[develop.js|included in the custom page]]&#039;&#039;&#039; in order to use it:&lt;br /&gt;
&lt;br /&gt;
Then, set the &amp;quot;id&amp;quot; attribute of the background HTML {{HtmlTag|tag=&amp;lt;img...&amp;gt;}} tag to &amp;quot;refimg&amp;quot;, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
: &amp;lt;img  &#039;&#039;&#039;id=&amp;quot;refimg&amp;quot;&#039;&#039;&#039; src=&amp;quot;ebit_pc.gif&amp;quot; usemap=&amp;quot;#Custom1&amp;quot;&amp;gt;   &amp;lt;!-- name=&amp;quot;refimg&amp;quot; makes crosshairs appear --&amp;gt;&lt;br /&gt;
: &amp;lt;map name=&amp;quot;Custom1&amp;quot;&amp;gt;&lt;br /&gt;
: .....&lt;br /&gt;
: &amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;&#039;&#039;&#039;refimg&#039;&#039;&#039;&amp;quot; tag is present, the cursor changes into a crosshair, and its absolute and relative locations in respect to the reference image are shown in the status bar (Figure 5).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
==  Superimposing Labels, Bars and Fills onto a gif image ==&lt;br /&gt;
You can enhance your custom page by superimposing multiple features based on ODB variables onto an image (e.g. [[#Display mouse position|Figure 5]]), such as&lt;br /&gt;
&lt;br /&gt;
*    labels: &amp;quot;live&amp;quot; ODB values positioned in a particular location of the page&lt;br /&gt;
*    bars : &amp;quot;bar level&amp;quot; showing graphically ODB values such as levels or rate etc.&lt;br /&gt;
*    fills : &amp;quot;color level&amp;quot; where colour is used as the level indicator.&lt;br /&gt;
&lt;br /&gt;
Each entry (label/bar/fill) will have an ODB tree associated to it defining the ODB variable path, X/Y position, colour, etc. Each time the page is updated, the latest ODB value/level/rate will be shown based on the ODB parameter to which the label, bar or fill is linked - hence the term &amp;quot;live&amp;quot;. The overlay of the requested features is done onto the selected image file.&lt;br /&gt;
&lt;br /&gt;
This powerful new extension brings the [[mhttpd]] capability closer to other experimental web controllers similar to EPICS.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:    Be sure to enable the feature to [[#Display mouse position]] in order to facilitate finding the X,Y positions of the various features.&lt;br /&gt;
: [[#HTML mapping]] must be activated for labels/bars/fills to work&lt;br /&gt;
&lt;br /&gt;
A Demo custom page showing labels, bars and fills superimposed on an image is shown in [[#MIDAS stylesheet|Figure 2]]. &lt;br /&gt;
All the files for this demo can be found in $MIDASSYS/examples/custom/. The file xcustom.odb contains the ODB keys required, including those to insert the image and superimpose the various labels, fills etc. This file can be loaded into the ODB with the  {{Odbedit cmd|cmd=load}}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=== Adding Labels ===&lt;br /&gt;
&lt;br /&gt;
 [[File:Mhcustom_label.jpg|thumbnail|left|Figure 6: /Custom/Images/Labels ODB subtree]]&lt;br /&gt;
&lt;br /&gt;
In order to include a readout of ODB values (i.e. labels), on the image, a further ODB subdirectory  {{Odbpath|path=/Custom/images/&amp;lt;imagefile.gif/Labels}} must be created. Creating a subdirectory for a particular label i.e. {{Odbpath|path=&amp;lt;label name&amp;gt;}} in the   {{Odbpath|path=Labels}} subtree will, at the next custom web page refresh, cause the complete structure for that label to be created and filled with default values. Once the {{Odbpath|path=&amp;lt;label name&amp;gt;}} subtree is created, the user fills the various keys as desired. See [[/Custom ODB tree#Labels subtree]] for details of the various fields. This procedure is repeated for all the labels required, using a unique {{Odbpath|path=&amp;lt;label name&amp;gt;}} subdirectory for each label. An example of a {{Odbpath|path=&amp;lt;label name&amp;gt;}} subtree is shown in Figure 6. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=== Adding Bars ===&lt;br /&gt;
 &lt;br /&gt;
[[File:Mhcustom_fill.jpg|thumbnail|left|Figure 7: /Custom/Images/Fills ODB subtree]]&lt;br /&gt;
&lt;br /&gt;
In a similar way, Bars can be superimposed on the image. Create  a new ODB subdirectory  {{Odbpath|path=/Custom/images/&amp;lt;imagefile.gif/Bars}}. Create a subdirectory for a particular Bar ({{Odbpath|path=&amp;lt;bar name&amp;gt;}}) in the {{Odbpath|path=Bars}}  subdirectory. Refresh the web page and fill the various keys as desired.  See [[/Custom ODB tree#Bars subtree]] for details of the various fields.  Examples of a &amp;lt;bar-name&amp;gt; subtree is shown in Figure 7.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=== Adding Fills ===&lt;br /&gt;
[[File:Mhcustom_bar.jpg|thumbnail|left|Figure 8: /Custom/Images/Bars ODB subtree]]&lt;br /&gt;
&lt;br /&gt;
In a similar way, Fills can be superimposed on the image. Create new ODB subdirectory   {{Odbpath|path=/Custom/images/&amp;lt;imagefile.gif/Fills}}. Create a subdirectory for a particular  Fill ({{Odbpath|path=&amp;lt;fill name&amp;gt;}}) in the {{Odbpath|path=Fills}} subdirectory. Refresh the web page and fill the various keys as desired.  See  [[/Custom ODB tree#Fills subtree]] for details of the various fields.  Examples of a ({{Odbpath|path=&amp;lt;fill name&amp;gt;}}  subtree is shown in Figure 8. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Mapping active areas onto the image ==&lt;br /&gt;
Provided [[#HTML mapping]] is activated, &amp;quot;clickable&amp;quot; areas can be created on the image.&lt;br /&gt;
&lt;br /&gt;
This can be done now with a new function like this:&lt;br /&gt;
{{Html|text= &amp;lt;area shape=&amp;quot;rect&amp;quot; coords=&amp;quot;40,200,100,300&amp;quot; alt=&amp;quot;Main Valve&amp;quot; href=&amp;quot;Custom1?cmd=Toggle&amp;amp;odb=/Equipment/Environment/Variables/Output[2]&amp;quot;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
This defines a clickable map on top of the custom image. The area(s) should match with some area(s) on the image, e.g. the box of a valve. Determining the co-ordinates of this area is simplified by using the Display mouse position feature.&lt;br /&gt;
&lt;br /&gt;
By clicking on this area, the supplied path to the ODB is used (in this case  {{Odbpath|path=/Equipment/Environment/Variables/Output[2]}}) and its value is toggled. If the valve value is then used in the image via a [[#Adding Fills|Fill]] statement to change the color of the valve, it can turn green or red depending on its state. This is illustrated in [[#Display mouse position|Figure 5]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking an active area can also be made to open a new custom page, for example:&lt;br /&gt;
{{Html|text=&amp;lt;area shape=rect coords=&amp;quot;687,530, 890,648&amp;quot; alt=&amp;quot;Pump detail&amp;quot; href = &amp;quot;Pump!&amp;quot; title=&amp;quot;Click for Details&amp;quot;&amp;gt;}}&lt;br /&gt;
{{Html|text=&amp;lt;area shape=rect coords=&amp;quot;560,574,775,662&amp;quot; alt=&amp;quot;Buffer Tank detail&amp;quot; href = &amp;quot;BufferTank!&amp;quot; title=&amp;quot;Click for Details&amp;quot;&amp;gt;}}&lt;br /&gt;
where &#039;&#039;Pump!&#039;&#039; and &#039;&#039;BufferTank!&#039;&#039; are defined as links to custom pages in the [[/Custom ODB tree]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Edit boxes floating on top of a graphic ==&lt;br /&gt;
&lt;br /&gt;
An edit box can be placed on top of a graphic in a particular position by means of an HTML  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&amp;amp;lt;div&amp;amp;gt;&amp;lt;/span&amp;gt; tag. Using the ODBEdit function from the Midas JS library [[Mhttpd.js]], the custom page code would look like this:&lt;br /&gt;
&amp;lt;!-- Complicated... have to use &amp;lt;pre&amp;gt; because of &amp;lt;div&amp;gt;, then a table to keep the background colour between &amp;lt;pre&amp;gt;s --&amp;gt;&lt;br /&gt;
{|  style=&amp;quot;text-align: left; width: 100%; background-color: floralwhite;&amp;quot; border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;pre style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;position:absolute; top:100px; left:50px;&amp;quot;&amp;gt;    &lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic;&amp;quot;&amp;gt;&lt;br /&gt;
document.write(&#039;Run number: &#039;)&lt;br /&gt;
path=&#039;/runinfo/run number&#039;&lt;br /&gt;
rn = ODBGet(path)&lt;br /&gt;
document.write(&#039;&amp;lt;a href=&amp;quot;#&amp;quot; onclick=&amp;quot;ODBEdit(path)&amp;quot; &amp;gt;&#039;)  &lt;br /&gt;
document.write(rn)&lt;br /&gt;
document.write(&#039;&amp;lt;/a&amp;gt;&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;custom.gif&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The same thing could be done with the HTML-style {{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tag :&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;position:absolute; top:100px; left:50px;&amp;quot;&amp;gt;&lt;br /&gt;
Run number:  &amp;lt;odb src=&amp;quot;/Runinfo/run number&amp;quot; edit=1&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;custom.gif&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Examples =&lt;br /&gt;
For more examples of accessing the ODB with the Javascript library [[mhttpd.js]] look at the example experiment in the MIDAS package $MIDASSYS/examples/javascript1/example.html.&lt;br /&gt;
&lt;br /&gt;
== Example 1 : Asynchronous calls using mjsonrpc functions ==&lt;br /&gt;
See [[mjsonrpc#examples]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 : Asynchronous calls using Javascript and AJAX ==&lt;br /&gt;
&lt;br /&gt;
Example 2 shows html code illustrating the use of ODBMCopy(), where innerHTML is used to display the data. On a page with images or a lot of data, innerHTML allows you to update variables without having to reload the whole page. In the example, a timer causes the page to update every 10s (reread the data). Often the ODB data for the whole page can be read by one asynchronous ODBMCopy() call, rather than scattering synchronous ODBGet() calls throughout the page.  &lt;br /&gt;
&lt;br /&gt;
Access to the ODB is provided by the  [[Mhttpd.js|MIDAS Javascript Library]], included with the line &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&amp;amp;lt;script src=&#039;mhttpd.js&#039;&amp;amp;gt;&amp;amp;lt;/script&amp;amp;gt;&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;MyTitle&amp;lt;/title&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;mhttpd.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
var updatePeriod = 10000; // in msec &amp;lt;br&amp;gt;&lt;br /&gt;
var updateTimerId = 0; &amp;lt;br&amp;gt;&lt;br /&gt;
var counter=0; &amp;lt;br&amp;gt;&lt;br /&gt;
function update()  {  &amp;lt;br&amp;gt;&lt;br /&gt;
:clearTimeout(updateTimerId); &amp;lt;br&amp;gt;&lt;br /&gt;
:      load(); &lt;br /&gt;
:      if (updatePeriod &amp;gt; 0) &lt;br /&gt;
:      updateTimerId = setTimeout(&#039;update()&#039;, updatePeriod); &lt;br /&gt;
} &amp;lt;br&amp;gt;&lt;br /&gt;
function load()  { &amp;lt;br&amp;gt;&lt;br /&gt;
: document.getElementById(&#039;LastUpdated&#039;).innerHTML = &amp;quot;Updating...&amp;quot; + new Date; &lt;br /&gt;
: var paths = [ &amp;quot;/Runinfo&amp;quot;, &amp;quot;/Experiment&amp;quot;]; &lt;br /&gt;
: var data_odb=ODBMCopy(paths, mcopy_callback, &amp;quot;json&amp;quot;) &lt;br /&gt;
: counter++; &lt;br /&gt;
: document.getElementById(&#039;counter&#039;).innerHTML = &#039;Counter: &#039;+ counter &lt;br /&gt;
} &amp;lt;br&amp;gt;&lt;br /&gt;
function mcopy_callback(data)  {  &amp;lt;br&amp;gt;&lt;br /&gt;
:    var obj= JSON.parse(data);&lt;br /&gt;
: var runinfo=obj[0];&lt;br /&gt;
: document.getElementById(&#039;rn&#039;).innerHTML = &#039;Run Number =&#039;+ parseInt(runinfo[&amp;quot;Run number&amp;quot;]);&lt;br /&gt;
: document.getElementById(&#039;state&#039;).innerHTML  =&#039;Run State= &#039;+ runinfo.State;&lt;br /&gt;
: var experiment=obj[1];&lt;br /&gt;
: document.getElementById(&#039;name&#039;).innerHTML=&#039;Experiment name = &#039;+ experiment.Name &amp;lt;br&amp;gt; &lt;br /&gt;
}&amp;lt;br&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/script&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;/head&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;body&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;b&amp;amp;gt;Javascript code using ODBMCopy with callback&amp;amp;lt;/b&amp;amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
The data on the page is updated every 10 sec using a timer&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;LastUpdated&amp;quot; &amp;amp;gt; Last updated: never&amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;rn&amp;quot;&amp;amp;gt; Run Number : unknown  &amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;state&amp;quot;&amp;amp;gt; State : unknown&amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;name&amp;quot;&amp;amp;gt; Experiment name : unknown  &amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;counter&amp;quot;&amp;amp;gt;Counter: zero  &amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt; &amp;lt;/div&amp;gt;  &lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
: if (updatePeriod &amp;gt; 0)&lt;br /&gt;
:  update(); &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/script&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;/body&amp;gt; &amp;lt;/html&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Example 3 : Synchronous Calls using Javascript and AJAX ==&lt;br /&gt;
In the following example, JS functions ODBGet and  ODBEdit from the [[Mhttpd.js|MIDAS Javascript Library]] are used to access the ODB.  &lt;br /&gt;
;NOTE&lt;br /&gt;
# Synchronous calls are now deprecated (see [[#The MIDAS Javascript Library|above]]).&lt;br /&gt;
# The Javascript library &#039;&#039;&#039;must be [[mhttpd.js#include js lib|included in the HTML code]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
{{Html|text=&amp;lt;script&amp;gt;}}&lt;br /&gt;
{{JS|text=document.write (&#039;Experiment Name: &#039;+ ODBGet(&amp;quot;/Experiment/Name&amp;quot;)) &amp;lt;br&amp;gt; var alarm_path=&amp;quot;/alarms/Alarm system active&amp;quot;; &amp;lt;br&amp;gt; var alarm_active=ODBGet(alarm_path); &amp;lt;br&amp;gt; document.write(&#039;&amp;lt;a href=&amp;quot;#&amp;quot; onclick=&amp;quot;ODBEdit(alarm_path)&amp;quot; &amp;gt;&#039;+alarm_active+&#039;&amp;lt;/a&amp;gt;&#039;)}}&lt;br /&gt;
{{Html|text=&amp;lt;/script&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Custom]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Custom_Page&amp;diff=2858</id>
		<title>Custom Page</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Custom_Page&amp;diff=2858"/>
		<updated>2019-05-28T21:40:50Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
{{mhttpdpages3|[[Custom Page Features]]|[[/Custom ODB tree]]|[[Mhttpd.js|MIDAS Javascript library]]}}&lt;br /&gt;
&lt;br /&gt;
= Purpose =&lt;br /&gt;
A user-created [[mhttpd]] Custom Web Page accessible from the [[Status Page]] allows the user additional flexibility. For example, a custom page may present the essential parameters of the controlled experiment in a more compact way. A custom page may even replace the default [[Status Page]]. &lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
Custom web pages provide the user with a means of creating secondary user-created web page(s) activated within the standard MIDAS web interface. These custom pages usually display ODB parameters or data to the user. They can contain specific links to the ODB so the user may also input information relevant to the experiment. Users create Custom Pages when the standard pages do not meet their requirements completely.&lt;br /&gt;
&lt;br /&gt;
We note that MIDAS has provided a number of different ways of providing custom pages over the years.  A new scheme of custom pages making use of modern HTML5 techniques has been introduced in 2017. This page will mostly only be providing documentation for the new scheme of custom pages.&lt;br /&gt;
&lt;br /&gt;
= Examples of Custom Pages =&lt;br /&gt;
&lt;br /&gt;
Click on the thumbnails to enlarge.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Capture_sgas.png|thumb|left|Figure 1: MEG Gas System]] || &#039;&#039;&#039;Example 1&#039;&#039;&#039;&lt;br /&gt;
This page (Figure 1) from the MEG experiment at PSI shows a complex gas system. This shows the use of &amp;quot;fills&amp;quot; and &amp;quot;labels&amp;quot;. Open valves are represented as green circles, closed valves as red circles. If, for example, an open valve is clicked, the valve closes, and the circle turns red (provided the user successfully supplied the correct password).&lt;br /&gt;
|-&lt;br /&gt;
| [[File:custom_ROOT_analyzer_page.png|thumb|left|Figure 2: ROOT Analyzer (MEG Experiment)]] || &#039;&#039;&#039;Example 2&#039;&#039;&#039;&lt;br /&gt;
Many MIDAS experiments work with ROOT based analyzers today. One problem is that the graphical output of the root analyzer can only be seen through the X server and not through the web. At the MEG experiment, this problem was solved in an elegant way: The ROOT analyzer runs in the background, using a &amp;quot;virtual&amp;quot; X server called Xvfb. It plots its output (several panels) normally using this X server, then saves this panels every ten seconds into GIF files. These GIF files are then served through mhttpd using a custom page. The output is shown in Figure 2.&lt;br /&gt;
&lt;br /&gt;
The buttons on the left sides are actually HTML buttons on that custom page overlaid to the GIF image, which in this case shows one of the 800 PMT channels digitized at 1.6 GSPS. With these buttons one can cycle through the different GIF images, which then automatically update ever ten seconds. Of course it is not possible to feed interaction back to the analyzer (i.e. the waveform cannot be fitted interactively) but for monitoring an experiment in production mode this tool is extremely helpful, since it is seamlessly integrated into mhttpd. All the magic is done with JavaScript, and the buttons are overlaid on the graphics using CSS with absolute positioning. The analysis ratio on the top right is also done with JavaScript accessing the required information from the ODB. &lt;br /&gt;
&lt;br /&gt;
For details using Xvfb server, please contact Ryu Sawada &amp;lt;sawada@icepp.s.u-tokyo.ac.jp&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| [[File:deap_custom_scb.png|thumb|left|Figure 3: SCB Setup (Deap Experiment)]] || &#039;&#039;&#039;Example 3&#039;&#039;&#039;&lt;br /&gt;
This custom page from the Deap Experiment (Figure 3) allows the users to easily set individual channels, or a group of channels, or all channels of the SCB modules to a particular value.   &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Access a Custom Page from the Regular MIDAS pages =&lt;br /&gt;
Access to a Custom Page is set up through the [[/Custom ODB tree]] (see [[/Custom ODB tree#Keys in the /Custom tree|custom-link]]). This associates a custom page file on the disk with a menu item on the left navigation bar. Clicking on the resulting link will display that custom page.&lt;br /&gt;
&lt;br /&gt;
Often a custom page requires resources such as *.css (stylesheets) or *.js (javascript) files. It is convenient to store all such files with the custom page file (*.html) in&lt;br /&gt;
a particular directory, e.g. /home/expt/online/custom. By creating an ODB key /Custom/Path, all the custom page files and resources can be served easily from this directory.&lt;br /&gt;
See [[Custom Page Features#Resource files]] for more information.&lt;br /&gt;
&lt;br /&gt;
If the key  {{Odbpath|path=/Custom/myPage&amp;amp;}}  (see Note) is created, e.g.&lt;br /&gt;
 odbedit&amp;gt; ls /Custom&lt;br /&gt;
    Path                              /home/expt/online/custom&lt;br /&gt;
    myPage&amp;amp;                           mypage.html&lt;br /&gt;
&lt;br /&gt;
the custom link on the left navigation bar will be &amp;lt;code&amp;gt;myPage&amp;lt;/code&amp;gt; and the URL for the resulting custom page will be of the form &amp;lt;code&amp;gt;http://myhost.mydomain:myport/cmd=?Custom&amp;amp;page=myPage&amp;lt;/code&amp;gt; (see also [[mhttpd#usage]]).  &lt;br /&gt;
Clicking on &amp;lt;code&amp;gt;myPage&amp;lt;/code&amp;gt; will display the custom page in the same window.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: Without the &amp;quot;&amp;amp;&amp;quot; symbol in the key name, the page would appear in a new window. See [[/Custom ODB tree#Key names|Key names]] for more information.&lt;br /&gt;
&lt;br /&gt;
= How to write a custom page =&lt;br /&gt;
A custom page is usually written in a combination of HTML and Javascript. It can contain any of the features described below. A [[Mjsonrpc | Javascript MjsonRPC Library]] has been written to provide access to the ODB and other functions.&lt;br /&gt;
&lt;br /&gt;
In what follows, we describe a scheme for writing custom pages with the set of modb* javascript functions.  The advantages of using these modb* javascript functions are&lt;br /&gt;
&lt;br /&gt;
* modb* functions hide details about the underlying MjsonRPC calls, which should allow a user to write pretty and sophisticated custom pages quickly and cleanly.&lt;br /&gt;
* modb* functions ensure that all the periodic updates of the ODB value (and other MIDAS information) are done in a single MjsonRPC batch call, which should ensure optimal page loading speed.&lt;br /&gt;
* modb* functions encapsulate the underlying communication. Should the communication change in the future, the custom pages do not have to be changed.&lt;br /&gt;
&lt;br /&gt;
It is also possible for users to write their custom pages using only the underlying [[Mjsonrpc | MjsonRPC library]] calls, but they then need to ensure on their own that the page loading remains efficient.  In particular, if you combine the standard MIDAS navigation bars (described in next section) with your own periodic MjsonRPC calls then you will probably need at least two separate periodic RPC calls to populate the custom page (instead of one call).  It will also require more coding to implement the custom page with only MjsonRPC calls.&lt;br /&gt;
&lt;br /&gt;
== How to use the standard MIDAS navigation bars on your custom page == &lt;br /&gt;
&lt;br /&gt;
If you want to have your custom page use the same header and navigation bars as the standard MIDAS pages, you need to use the following syntax &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html lang=&amp;quot;en&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
   &amp;lt;meta charset=&amp;quot;UTF-8&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;midas.css&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;script src=&amp;quot;controls.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
   &amp;lt;script src=&amp;quot;midas.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
   &amp;lt;script src=&amp;quot;mhttpd.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
   &amp;lt;title&amp;gt;myPage&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body class=&amp;quot;mcss&amp;quot; onload=&amp;quot;mhttpd_init(&#039;myPage&#039;);&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- header and side navigation will be filled in mhttpd_start --&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;mheader&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;msidenav&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;mmain&amp;quot;&amp;gt;&lt;br /&gt;
 ADD YOUR HTML/JS  CODE here...&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The call &amp;lt;code&amp;gt;mhttpd_init(&#039;myPage&#039;)&amp;lt;/code&amp;gt; is executed when the page is loaded, and  &amp;lt;code&amp;gt;myPage&amp;lt;/code&amp;gt; is the name of the page shown on the left menu bar. This corresponds to an ODB entry /Custom/myPage.&lt;br /&gt;
This pattern will allow you to use the standard MIDAS navigation whether you are using the modb* functions or the underlying [[Mjsonrpc | javascript libraries]].&lt;br /&gt;
&lt;br /&gt;
= modb* Javascript scheme = &lt;br /&gt;
&lt;br /&gt;
The general scheme of the custom page scheme is to write &amp;lt;code&amp;gt;&amp;amp;lt;div name=&amp;quot;modb...&amp;quot;&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;&amp;amp;lt;span name=&amp;quot;modb...&amp;quot;&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&amp;lt;/code&amp;gt; tags with special names, most of them starting with &amp;quot;modb...&amp;quot; (&amp;quot;MIDAS-ODB&amp;quot;). Use a &amp;lt;code&amp;gt;&amp;amp;lt;div&amp;amp;gt;&amp;lt;/code&amp;gt; tag if you want the element to appear in a separate line, and use the &amp;lt;code&amp;gt;&amp;amp;lt;span&amp;amp;gt;&amp;lt;/code&amp;gt; tag if you want to display the element in-line. The following description uses only &amp;lt;code&amp;gt;&amp;amp;lt;div&amp;amp;gt;&amp;lt;/code&amp;gt; tags, but all of them can be changed to &amp;lt;code&amp;gt;&amp;amp;lt;span&amp;amp;gt;&amp;lt;/code&amp;gt;. All HTML tags with &amp;quot;modb...&amp;quot; names are scanned by the &amp;lt;code&amp;gt;mhttp_init(&#039;name&#039;)&amp;lt;/code&amp;gt; function upon page load, and their inner contents is replaced by the requested ODB value or some graphics. The contents is then updated regularly. Updates are once per second by default. This can be changed by passing a second argument to &amp;lt;code&amp;gt;mhttpd_init(&#039;name&#039;, interval)&amp;lt;/code&amp;gt; where &amp;quot;interval&amp;quot; is in milliseconds.&lt;br /&gt;
&lt;br /&gt;
== modbset(path, value) ==&lt;br /&gt;
&lt;br /&gt;
To set values in the ODB, the midas JavaScript function mjsonrpc_db_paste() is usually called. This function is implemented as a JavaScript promise, which lets you chain several request in order to change values inside the ODB in a certain order. If that functionality is not required, the simplified modbset() function can be called, which also implements standard error handling. Two versions of this function exist, one which accepts a single ODB path and a single value, and one which accepts an array of ODB paths and values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
modbset(&amp;quot;odb path&amp;quot;, value)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
modbset([&amp;quot;odb path1&amp;quot;, &amp;quot;odb path2&amp;quot;, ...], [value1, value2, ...])&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These functions are typically used by custom JavaScript code, like when some value in an experiment exceeds some limit and some action has to be taken like to close a valve. If the call fails (like if mhttpd is dead), a window with an error description is shown.&lt;br /&gt;
&lt;br /&gt;
== modb ==&lt;br /&gt;
&lt;br /&gt;
This special HTML div tag (abbreviation stands for Midas ODB) &amp;lt;code&amp;gt;&amp;amp;lt;div name=&amp;quot;modb&amp;quot; data-odb-path=&amp;quot;/Some/Path&amp;quot; onchange=&amp;quot;func()&amp;quot;&amp;amp;gt;&amp;lt;/code&amp;gt; can be used to call a user-defined function func() if a value in the ODB changes. This function must be defined inline or in a separate &amp;amp;lt;script&amp;amp;gt;...&amp;amp;lt;/script&amp;amp;gt; section, and can execute any operation, such as opening a dialog box, hiding/unhiding parts of the custom page, or changing colors and styles of page elements.&lt;br /&gt;
&lt;br /&gt;
The current value of the ODB entry is available inside the &amp;quot;onchange&amp;quot; function as &#039;&#039;&#039;this.value&#039;&#039;&#039;. Following tag will call a function which logs the current run number in the JavaScript console window:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;div name=&amp;quot;modb&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; onchange=&amp;quot;func(this.value)&amp;quot;&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;script&amp;amp;gt;function func(value) {&lt;br /&gt;
console.log(value);&lt;br /&gt;
}&amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
If the ODB path does not point to an individual value but to a subdirectory, the whole subdirectory is mapped to &#039;&#039;&#039;this.value&#039;&#039;&#039; as a JavaSctipt object such as&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;div name=&amp;quot;modb&amp;quot; data-odb-path=&amp;quot;/Runinfo&amp;quot; onchange=&amp;quot;func(this.value)&amp;quot;&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;script&amp;amp;gt;function func(value) {&lt;br /&gt;
console.log(value[&amp;quot;run number&amp;quot;]);&lt;br /&gt;
}&amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Note that ODB entries are mapped to JavaScript objects without change. So if an ODB entry name contains a blank, it must be accessed via the JS square bracket &#039;&#039;&#039;value[&amp;quot;run number&amp;quot;]&#039;&#039;&#039; as shown in the above example. Otherwise, the entry can be accessed via the dot notation, such as &#039;&#039;&#039;value.state&#039;&#039;&#039; for /Runinfo/State for example.&lt;br /&gt;
&lt;br /&gt;
== modbvalue ==&lt;br /&gt;
&lt;br /&gt;
This special HTML div tag (abbreviation stands for &amp;quot;Midas ODB VALUE&amp;quot;) &lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;div name=&amp;quot;modbvalue&amp;quot; data-odb-path=&amp;quot;/Some/Path&amp;quot;&amp;amp;gt;&amp;lt;/code&amp;gt; &lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
is now automatically replaced by the value in the ODB found at the given path and updated regularly as described above Following options are valid for this tag:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: List of valid options for modbvalue tag&lt;br /&gt;
|-&lt;br /&gt;
! Option !! Example !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| name || name=&amp;quot;modbvalue&amp;quot; || Tells the framework to replace this tag with an ODB value&lt;br /&gt;
|-&lt;br /&gt;
| data-odb-path || data-odb-path = &amp;quot;/Runinfo/Run number&amp;quot; || Path to the value in the ODB&lt;br /&gt;
|-&lt;br /&gt;
| data-odb-editable || data-odb-editable=&amp;quot;1&amp;quot; || If set, the value is not only shown, but is also clickable for in-line editing. Hitting return send the new value to the ODB.&lt;br /&gt;
|-&lt;br /&gt;
| data-format || data-format=&amp;quot;f3&amp;quot; || Specify format of data shown. See Table 2 below for options.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Table 2 below lists the format specifiers supported with a modbvalue tag &amp;lt;code&amp;gt;data-format=&amp;quot;...&amp;quot;&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 2: Format specifiers for modbvalue tag &amp;lt;code&amp;gt;data-format=&amp;quot;...&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! Option !! Example !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| d || 1234 || Shows a number in decimal encoding&lt;br /&gt;
|-&lt;br /&gt;
| x || 0x4D2 || Shows a number in hexadecimal encoding&lt;br /&gt;
|-&lt;br /&gt;
| b || 10011010010b|| Shows a number in binary encoding. Options d, x, b can be combined, like &amp;lt;code&amp;gt;data-format=&amp;quot;dxb&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| f&amp;amp;lt;x&amp;amp;gt; || 1.234 || Shows a floating point number with &amp;amp;lt;x&amp;amp;gt; digits after the decimal. A value of f0 shows only the integer part.&lt;br /&gt;
|-&lt;br /&gt;
| p&amp;amp;lt;x&amp;amp;gt; || 1.23 || Shows a floating point number with &amp;amp;lt;x&amp;amp;gt; significant digits of precision, independent of the decimal. For example a value of p2 can render a number to 12000 or to 0.00012&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== modbbutton ==&lt;br /&gt;
&lt;br /&gt;
This tag generates a push-button which can set a certain ODB entry to a specific value. To set the &amp;quot;Run number&amp;quot; to 100, one can use the following tag:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;button name=&amp;quot;modbbutton&amp;quot; class=&amp;quot;mbutton&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-odb-value=&amp;quot;100&amp;quot;&amp;amp;gt;[Button Text]&amp;amp;lt;/button&amp;amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== modbcheckbox ==&lt;br /&gt;
&lt;br /&gt;
This tag generates a check box which can set a certain ODB entry to true or false. To set the &amp;quot;Write data&amp;quot; flag for the logger true or false, one can use the following tag:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;input type=&amp;quot;checkbox&amp;quot; name=&amp;quot;modbcheckbox&amp;quot; data-odb-path=&amp;quot;/Logger/Write data&amp;quot; /&amp;amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
If the ODB value changed by this control is of type integer, its value will be set to 1 or 0.&lt;br /&gt;
&lt;br /&gt;
== modbhbar ==&lt;br /&gt;
&lt;br /&gt;
The following tag:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;div name=&amp;quot;modbhbar&amp;quot; style=&amp;quot;width: 500px; height: 18px;&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-max-value=&amp;quot;10&amp;quot; data-color=&amp;quot;lightgreen&amp;quot; &amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
shows a horizontal bar with a total length of 500px. Depending on the ODB value {{Odbpath|path=Run number}}. If {{Odbpath|path=Run number}} is 10, then the bar is filled all the way to the right, if {{Odbpath|path=Run number}} is 5, the bar is only filled halfway. Following options are possible:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Setting !! Meaning !! Required&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 500px&amp;quot; || Total width of the horizontal bar || Yes&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;height: 18px&amp;quot; || Height of the horizontal bar || Yes&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;color: red&amp;quot; || Color of horizontal bar || Transparent if not present&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background-color: red&amp;quot; || Background color of horizontal bar || Transparent if not present&lt;br /&gt;
|-&lt;br /&gt;
| data-odb-path || ODB path of value being displayed || Yes&lt;br /&gt;
|-&lt;br /&gt;
| data-min-value || Left limit of bar range || 0 if not present&lt;br /&gt;
|-&lt;br /&gt;
| data-max-value || Right limit of bar range || 1 if not present&lt;br /&gt;
|-&lt;br /&gt;
| data-log || Logarithmic display || No&lt;br /&gt;
|-&lt;br /&gt;
| data-print-value || If &amp;quot;1&amp;quot;, data value is shown as text overlay || No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== mhaxis ==&lt;br /&gt;
&lt;br /&gt;
A horizontal bar can be combined with an axis with tick marks and labels. The axis can be above or below the bar.&lt;br /&gt;
&lt;br /&gt;
The following tag:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;div name=&amp;quot;mhaxis&amp;quot; style=&amp;quot;width: 500px; height: 22px;&amp;quot; data-min-value=&amp;quot;0&amp;quot; data-max-value=&amp;quot;10&amp;quot; &amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
shows a horizontal axis next to the bar. Following options are possible:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Setting !! Meaning !! Required&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 500px&amp;quot; || Total width of the axis, must match the width of the horizontal bar || Yes&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;height: 18px&amp;quot; || Height of the axis, must be enough to display labels  || Yes&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;vertical-align: top&amp;quot; || Must be &amp;quot;top&amp;quot; if the axis is below the bar || &amp;quot;bottom&amp;quot; if not given&lt;br /&gt;
|-&lt;br /&gt;
| data-min-value || Left limit of axis range || Yes&lt;br /&gt;
|-&lt;br /&gt;
| data-max-value || Right limit of axis range || Yes&lt;br /&gt;
|-&lt;br /&gt;
| data-log || Logarithmic display || No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== modbvbar ==&lt;br /&gt;
&lt;br /&gt;
Same as &amp;lt;code&amp;gt;modbhbar&amp;lt;/code&amp;gt;, except the bar grows vertically instead of horizontally.&lt;br /&gt;
&lt;br /&gt;
== mvaxis ==&lt;br /&gt;
&lt;br /&gt;
Same as &amp;lt;code&amp;gt;mhaxis&amp;lt;/code&amp;gt;, except the axis is shown vertically instead of horizontally.&lt;br /&gt;
&lt;br /&gt;
== modbthermo ==&lt;br /&gt;
&lt;br /&gt;
The following tag:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;div name=&amp;quot;modbthermo&amp;quot; style=&amp;quot;width: 30px; height: 100px;&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-min-value=&amp;quot;-10&amp;quot; data-max-value=&amp;quot;30&amp;quot; data-color=&amp;quot;blue&amp;quot; data-print-value=&amp;quot;1&amp;quot; &amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
shows a vertical thermometer ranging from -10 to 30. Depending on the ODB value {{Odbpath|path=Run number}}. The run number was chosen instead of a real temperature since this ODB variable exists in all midas installations by default, so it&#039;s good for testing. Following options are possible:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Setting !! Meaning !! Required&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 30px&amp;quot; || Width of the thermometer || Yes&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;height: 100px&amp;quot; || Total height of the thermometer || Yes&lt;br /&gt;
|-&lt;br /&gt;
| data-odb-path || ODB path of value being displayed || Yes&lt;br /&gt;
|-&lt;br /&gt;
| data-max-value || Upper range || Yes&lt;br /&gt;
|-&lt;br /&gt;
| data-min-value || Lower range || 0 if not present&lt;br /&gt;
|-&lt;br /&gt;
| data-color || Color of thermometer || Black if not present&lt;br /&gt;
|-&lt;br /&gt;
| data-background-color || Color of thermometer background || Transparent if not present&lt;br /&gt;
|-&lt;br /&gt;
| data-print-value || If &amp;quot;1&amp;quot;, data value is shown below the thermometer || No&lt;br /&gt;
|-&lt;br /&gt;
| data-format || Specifies format of temperature shown below gauge. See Table 2 for options. || No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== modbgauge ==&lt;br /&gt;
&lt;br /&gt;
The following tag:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;div name=&amp;quot;modbgauge&amp;quot; style=&amp;quot;width: 100px; height: 50px;&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-min-value=&amp;quot;0&amp;quot; data-max-value=&amp;quot;10&amp;quot; data-color=&amp;quot;darkgreen&amp;quot;&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
shows a circular gauge ranging from 0 to 10. Depending on the ODB value &amp;quot;Run number&amp;quot;. Following options are possible:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Setting !! Meaning !! Required&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 100px&amp;quot; || Width of the gauge || Yes&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;height: 50px&amp;quot; || Total height of the gauge || Yes&lt;br /&gt;
|-&lt;br /&gt;
| data-odb-path || ODB path of value being displayed || Yes&lt;br /&gt;
|-&lt;br /&gt;
| data-max-value || Upper range || Yes&lt;br /&gt;
|-&lt;br /&gt;
| data-min-value || Lower range || 0 if not present&lt;br /&gt;
|-&lt;br /&gt;
| data-color || Color of gauge || Black if not present&lt;br /&gt;
|-&lt;br /&gt;
| data-background-color || Color of gauge background || Transparent if not present&lt;br /&gt;
|-&lt;br /&gt;
| data-print-value || If &amp;quot;1&amp;quot;, data value is shown below the gauge || No&lt;br /&gt;
|-&lt;br /&gt;
| data-format || Specifies format of temperature shown below gauge. See Table 2 for options. || No&lt;br /&gt;
|-&lt;br /&gt;
| data-scale || If &amp;quot;1&amp;quot;, the min and max values of the range are shown below the gauge || No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If the gauge scale is not shown, the gauge height should be half the gauge width. If the scale is shown, 15px must be added to the height.&lt;br /&gt;
&lt;br /&gt;
= mhistory =&lt;br /&gt;
&lt;br /&gt;
Custom pages can contain one or more specific history panels usually shown on the &amp;quot;History&amp;quot; page. This makes it easy to combine current readings of values together with the history of these values.&lt;br /&gt;
&lt;br /&gt;
The following tag:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;div name=&amp;quot;mhistory&amp;quot; data-group=&amp;quot;&amp;lt;group&amp;gt;&amp;quot; data-panel=&amp;quot;&amp;lt;panel&amp;gt;&amp;quot; style=&amp;quot;width: 320px; height: 200px;&amp;quot; &amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
shows a history panel defined in the ODB under /History/Display/&amp;amp;lt;group&amp;amp;gt;/&amp;amp;lt;panel&amp;amp;gt; (replace &amp;amp;lt;group&amp;amp;gt;/&amp;amp;lt;panel&amp;amp;gt; with groups and panels from your experiment).&lt;br /&gt;
&lt;br /&gt;
Following options are possible:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| data-group || ODB group of history. Has to match a group under /History/Display || Yes&lt;br /&gt;
|-&lt;br /&gt;
| data-panel || ODB panel name of history. Has to match a panel name under /History/Display/&amp;amp;lt;group&amp;amp;gt;/ || Yes&lt;br /&gt;
|-&lt;br /&gt;
| data-scale || Time scale of history plot. Use 10m for 10 minutes and 5h for 5 hours. If not specified, the value from the ODB under /History/Display/&amp;amp;lt;group&amp;amp;gt;/&amp;amp;lt;panel&amp;amp;gt;/Timescale is used. || No&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 320px&amp;quot; || Width of the history panel || No&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;height: 200px&amp;quot; || Height of the history panel || No&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border: 1px solid black&amp;quot; || Border around the history panel || No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If width and height are omitted, the default values of 320px and 200px are used. History panels are automatically updated every 30 seconds.&lt;br /&gt;
&lt;br /&gt;
NOTE: It is planned to change the static history panels to dynamic ones using JavaScript. This will allow users to interactively zoom and scroll through the history with the mouse. The syntax of the &amp;quot;mhistory&amp;quot; tag will however stay the same so it is safe to use this tag now without having to change it after dynamic panels are implemented.&lt;br /&gt;
&lt;br /&gt;
== Changing properties of controls dynamically ==&lt;br /&gt;
&lt;br /&gt;
All custom controls can be changed dynamically (meaning depending on their value) by implementing a &#039;&#039;&#039;onchange&#039;&#039;&#039; function. This function has access to the current value and can change any of the parameters of the control. Following callback for example changes the color of a thermometer to red if the value is above 30 and to blue if it is below:&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;onchange=&amp;quot;this.dataset.color=this.value &amp;gt; 30?&#039;red&#039;:&#039;blue&#039;;&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Complete Example =&lt;br /&gt;
&lt;br /&gt;
The following code shows an example page (contained in {{Filepath|path=resources/a_example.html}} in the MIDAS distribution) of a custom page implementing most of the new features. You activate this page by putting in the ODB:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/Custom&lt;br /&gt;
  Path     /midas/resources&lt;br /&gt;
  Test     a_example.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
The file &#039;&#039;&#039;a_example.html&#039;&#039;&#039; contains the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html class=&amp;quot;mcss&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
   &amp;lt;meta charset=&amp;quot;UTF-8&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;midas.css&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;script src=&amp;quot;controls.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
   &amp;lt;script src=&amp;quot;midas.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
   &amp;lt;script src=&amp;quot;mhttpd.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
   &amp;lt;title&amp;gt;Example&amp;lt;/title&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;style&amp;gt;&lt;br /&gt;
      .mtable td { padding: 10px; }&lt;br /&gt;
   &amp;lt;/style&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body class=&amp;quot;mcss&amp;quot; onload=&amp;quot;mhttpd_init(&#039;Example&#039;);&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- header and side navigation will be filled in mhttpd_init --&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;mheader&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;msidenav&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;mmain&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;table class=&amp;quot;mtable&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;th colspan=&amp;quot;2&amp;quot; class=&amp;quot;mtableheader&amp;quot;&amp;gt;Status&amp;lt;/th&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td style=&amp;quot;width: 200px;&amp;quot;&amp;gt;&lt;br /&gt;
            Run number:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbvalue&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-odb-editable=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            Last run start:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbvalue&amp;quot; data-odb-path=&amp;quot;/Runinfo/Start time&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            Last run stop:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbvalue&amp;quot; data-odb-path=&amp;quot;/Runinfo/Stop time&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            Check box:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;!-- checkbox changes /Logger/Write data, fire dialog box on change (even if changed by odbedit) --&amp;gt;&lt;br /&gt;
            &amp;lt;input type=&amp;quot;checkbox&amp;quot; name=&amp;quot;modbcheckbox&amp;quot; data-odb-path=&amp;quot;/Logger/Write data&amp;quot;&amp;gt;&amp;lt;/input&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modb&amp;quot; data-odb-path=&amp;quot;/Logger/Write data&amp;quot; onchange=&amp;quot;dlgAlert(&#039;Flag has changed&#039;);&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            Color box:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;!-- box changes color according to /Logger/Write data --&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbbox&amp;quot; style=&amp;quot;width: 30px; height: 30px;&amp;quot; data-odb-path=&amp;quot;/Logger/Write data&amp;quot;&lt;br /&gt;
                 data-color=&amp;quot;lightgreen&amp;quot; data-background-color=&amp;quot;red&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            Horizontal bars:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbhbar&amp;quot; style=&amp;quot;width:300px;height:20px;color:orange;&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot;&lt;br /&gt;
                 data-max-value=&amp;quot;10&amp;quot; data-print-value=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;div name=&amp;quot;mhaxis&amp;quot; style=&amp;quot;width:500px;height:22px;&amp;quot; data-min-value=&amp;quot;0&amp;quot; data-max-value=&amp;quot;10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbhbar&amp;quot; style=&amp;quot;width: 500px; height: 18px;color:lightblue&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot;&lt;br /&gt;
                 data-max-value=&amp;quot;10&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbhbar&amp;quot; style=&amp;quot;width: 200px; height: 10px;color:lightgreen;background-color:white&amp;quot;&lt;br /&gt;
                 data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-min-value=&amp;quot;0.1&amp;quot; data-max-value=&amp;quot;10&amp;quot; data-log=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;mhaxis&amp;quot; style=&amp;quot;width:200px;height:22px;vertical-align:top;&amp;quot; data-min-value=&amp;quot;0.1&amp;quot;&lt;br /&gt;
                 data-max-value=&amp;quot;10&amp;quot; data-line=&amp;quot;0&amp;quot; data-log=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            Vertical bars:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;span name=&amp;quot;mvaxis&amp;quot; style=&amp;quot;width:100px;height:200px;text-align:right;&amp;quot; data-min-value=&amp;quot;0&amp;quot; data-max-value=&amp;quot;20&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span name=&amp;quot;modbvbar&amp;quot;&lt;br /&gt;
                  style=&amp;quot;width:20px;height:200px;color:yellow;&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot;&lt;br /&gt;
                  data-min-value=&amp;quot;0&amp;quot; data-max-value=&amp;quot;20&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;span name=&amp;quot;modbvbar&amp;quot; style=&amp;quot;width:10px;height:200px;vertical-align:top;color:red&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-min-value=&amp;quot;0.1&amp;quot;&lt;br /&gt;
                  data-max-value=&amp;quot;10&amp;quot; data-log=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span name=&amp;quot;mvaxis&amp;quot; style=&amp;quot;width:100px;height:200px;text-align:left;&amp;quot; data-min-value=&amp;quot;0.1&amp;quot;&lt;br /&gt;
                                                                data-max-value=&amp;quot;10&amp;quot; data-log=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            Thermometer:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbthermo&amp;quot; style=&amp;quot;width:30px;height:100px;&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-min-value=&amp;quot;-10&amp;quot; data-max-value=&amp;quot;30&amp;quot;&lt;br /&gt;
                 data-color=&amp;quot;darkgreen&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbthermo&amp;quot; style=&amp;quot;width:60px;height:100px;&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-min-value=&amp;quot;-10&amp;quot; data-max-value=&amp;quot;30&amp;quot;&lt;br /&gt;
                 data-color=&amp;quot;blue&amp;quot; data-scale=&amp;quot;1&amp;quot;&lt;br /&gt;
                 onchange=&amp;quot;this.dataset.color=this.value &amp;gt; 9?&#039;red&#039;:&#039;blue&#039;;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbthermo&amp;quot; style=&amp;quot;width:30px;height:100px;&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-min-value=&amp;quot;-10&amp;quot; data-max-value=&amp;quot;30&amp;quot;&lt;br /&gt;
                 data-color=&amp;quot;blue&amp;quot; data-background-color=&amp;quot;white&amp;quot; data-value=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            Gauges:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbgauge&amp;quot; style=&amp;quot;width:100px;height:50px;&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-min-value=&amp;quot;0&amp;quot; data-max-value=&amp;quot;10&amp;quot;&lt;br /&gt;
                 data-color=&amp;quot;darkgreen&amp;quot; data-background-color=&amp;quot;lightgrey&amp;quot; &amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbgauge&amp;quot; style=&amp;quot;width:100px;height:65px;&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-min-value=&amp;quot;0&amp;quot; data-max-value=&amp;quot;10&amp;quot;&lt;br /&gt;
                 data-color=&amp;quot;red&amp;quot; data-value=&amp;quot;1&amp;quot; data-scale=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td colspan=&amp;quot;2&amp;quot; style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;!-- div around image with &amp;quot;relative&amp;quot; position as anchor for labels and bars --&amp;gt;&lt;br /&gt;
            &amp;lt;div style=&amp;quot;position:relative;width:300px;margin:auto&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;img src=&amp;quot;tank.gif&amp;quot;&amp;gt; &amp;lt;!-- background image of tank --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;!-- label next to valve --&amp;gt;&lt;br /&gt;
               &amp;lt;div name=&amp;quot;modbvalue&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-odb-editable=&amp;quot;1&amp;quot;&lt;br /&gt;
                    style=&amp;quot;position:absolute;top:157px;left:288px;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;!-- vertical bar inside tank, render red if value &amp;gt; 9 --&amp;gt;&lt;br /&gt;
               &amp;lt;div name=&amp;quot;modbvbar&amp;quot; style=&amp;quot;position:absolute;top:80px;left:10px;width:104px;height:170px;&amp;quot;&lt;br /&gt;
                    data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-max-value=&amp;quot;11&amp;quot; data-color=&amp;quot;green&amp;quot;&lt;br /&gt;
                    onchange=&amp;quot;this.firstChild.style.backgroundColor=(this.value &amp;gt; 9)?&#039;red&#039;:&#039;green&#039;;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;!-- thermometer inside tank --&amp;gt;&lt;br /&gt;
               &amp;lt;div name=&amp;quot;modbthermo&amp;quot; style=&amp;quot;position:absolute;top:140px;left:20px;width:20px;height:100px;&amp;quot;&lt;br /&gt;
                    data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-min-value=&amp;quot;-10&amp;quot; data-max-value=&amp;quot;30&amp;quot;&lt;br /&gt;
                    data-color=&amp;quot;blue&amp;quot; data-value=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td colspan=&amp;quot;2&amp;quot; style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;!-- three buttons to change an ODB entry (run number in this example) --&amp;gt;&lt;br /&gt;
            &amp;lt;button name=&amp;quot;modbbutton&amp;quot; class=&amp;quot;mbutton&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-odb-value=&amp;quot;1&amp;quot;&amp;gt;Set run&lt;br /&gt;
               number to 1&lt;br /&gt;
            &amp;lt;/button&amp;gt;&lt;br /&gt;
            &amp;lt;button name=&amp;quot;modbbutton&amp;quot; class=&amp;quot;mbutton&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-odb-value=&amp;quot;5&amp;quot;&amp;gt;Set run&lt;br /&gt;
               number to 5&lt;br /&gt;
            &amp;lt;/button&amp;gt;&lt;br /&gt;
            &amp;lt;button name=&amp;quot;modbbutton&amp;quot; class=&amp;quot;mbutton&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-odb-value=&amp;quot;10&amp;quot;&amp;gt;Set run&lt;br /&gt;
               number to 10&lt;br /&gt;
            &amp;lt;/button&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
   &amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which results in the page shown in Figure 1 below:&lt;br /&gt;
&lt;br /&gt;
[[File:Custom17.png|frame|left|Figure 1  Example custom page using most features]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Old custom page feature =&lt;br /&gt;
&lt;br /&gt;
There are a number of deprecated custom page features, which can be seen here: [[Old Custom Page Features]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:mhttpd Pages]] [[Category:Custom]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Keys_in_the_ODB_/Logger/Channels_subtree&amp;diff=2853</id>
		<title>Keys in the ODB /Logger/Channels subtree</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Keys_in_the_ODB_/Logger/Channels_subtree&amp;diff=2853"/>
		<updated>2019-05-22T23:09:27Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== Links ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[Keys in the ODB /Logger tree| /Logger tree]] &lt;br /&gt;
* [[Keys in the ODB /Logger/SQL subtree |/Logger/SQL subtree]]&lt;br /&gt;
* [[/Logger ODB tree #Example | Example /Logger tree]]&lt;br /&gt;
* [[mlogger]] &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels&#039;&#039;&amp;lt;/span&amp;gt; subtree ==&lt;br /&gt;
&lt;br /&gt;
The ODB &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels&#039;&#039;&amp;lt;/span&amp;gt;  subtree is a subdirectory of the [[Keys in the ODB /Logger tree | ODB /Logger tree]], created&lt;br /&gt;
when the MIDAS logger utility [[mlogger]] is started for the first time. The keys will be filled with default values which users may change as required to customize their experiments. &lt;br /&gt;
&lt;br /&gt;
By default, only &#039;&#039;&#039;one&#039;&#039;&#039; logging channel with the value 0  if defined (i.e. Logging Channel 0). [[#Multiple Logging Channels | Multiple logging channels]] may be defined by the user.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multiple Logging Channels ==&lt;br /&gt;
&lt;br /&gt;
By default, only one logging channel is created (Logging Channel 0). To create multiple logging channels, an existing Channel subtree can be copied.&lt;br /&gt;
&lt;br /&gt;
e.g. to create a second logging channel (Channel 1) using [[odbedit]]&lt;br /&gt;
&lt;br /&gt;
 [local]cd /Logger&lt;br /&gt;
 [loca]]logger&amp;gt;cd channels&lt;br /&gt;
 [local]Channels&amp;gt;ls &lt;br /&gt;
 0&lt;br /&gt;
 [local]Channels&amp;gt;copy 0 1&lt;br /&gt;
 [local]Channels&amp;gt;ls &lt;br /&gt;
 0&lt;br /&gt;
 1&lt;br /&gt;
&lt;br /&gt;
If more than one logging channel is defined, there will be a multiple subtrees &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels/0/&#039;&#039;&amp;lt;/span&amp;gt;, &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels/1/&#039;&#039;&amp;lt;/span&amp;gt;,&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;...&amp;lt;/span&amp;gt;&lt;br /&gt;
present, each with a &lt;br /&gt;
[[#Settings subtree|Settings]]  and [[#Statistics subtree|Statistics]]  subtree. &lt;br /&gt;
&lt;br /&gt;
Thus &#039;&#039;&#039;the parameters for each logging channel can be set individually.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To send different events to different logging channels, they may be selected by [[#Event ID | Event ID key]] or &lt;br /&gt;
[[#Trigger mask | Trigger mask key]]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Settings&#039;&#039;&amp;lt;/span&amp;gt; subtree ==&lt;br /&gt;
&lt;br /&gt;
The keys in the ODB &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels/&amp;lt;logging-channel-number&amp;gt;/Settings&#039;&#039;&amp;lt;/span&amp;gt; subtree are shown below&lt;br /&gt;
for the default logging channel 0.&lt;br /&gt;
&lt;br /&gt;
For a single logging channel 0, one subtree&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels/0/Settings&#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
will be present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If [[#Multiple Logging Channels | multiple logging channels]] are defined, each&lt;br /&gt;
will contain its own ODB &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Settings&#039;&#039;&amp;lt;/span&amp;gt;  subtree, &lt;br /&gt;
&lt;br /&gt;
i.e. &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels/0/Settings&#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels/1/Settings&#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Active&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;y&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;	&lt;br /&gt;
&lt;br /&gt;
If this ODB key in the  [[#Settings subtree|Settings subtree]] is set to &amp;quot;y&amp;quot;, this logging channel is active. Data are only logged from channels that are active.&lt;br /&gt;
Set to &amp;quot;n&amp;quot; to disable data logging from this channel.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that for data to be logged from any active logging channel, the  [[Keys in the ODB /Logger tree #/Logger/Write data |/Logger/Write data key]]&lt;br /&gt;
must &#039;&#039;&#039;also&#039;&#039;&#039;  be set to &amp;quot;y&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Type&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;Disk&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key  in the [[#Settings subtree|Settings subtree]] specifies the type of media on which the logging should take place. It can be &amp;quot;Disk&amp;quot;, &amp;quot;Tape&amp;quot; or &amp;quot;FTP&amp;quot; (see [[#/Logger/Channels/0/Settings/Filename |Filename key]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
----------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Filename&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;run%05d.mid&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key in the [[#Settings subtree|Settings subtree]] is set up as follows: &lt;br /&gt;
&lt;br /&gt;
; For &#039;&#039;&#039;disk&#039;&#039;&#039; logging : ODB key &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Filename&#039;&#039;&amp;lt;/span&amp;gt; specifies the name of a file to contain the data. Default value is &amp;quot;run%05d.mid&amp;quot; where &amp;quot;%05d&amp;quot; is replaced by the current run number in the same way as described for the ODB key [[Keys in the ODB /Logger tree #/Logger/Dump File |/Logger/Dump File]]. If subruns are enabled, the filename may be of the form &amp;quot;run%05d_%02d.mid&amp;quot;. See [[subruns]] for details.&lt;br /&gt;
; : The key &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Filename&#039;&#039;&amp;lt;/span&amp;gt; may contain a directory string in addition to a filename, so that different logging channels may have their data logged into specific directories. If the key does NOT also contain a directory string, the directory given in the key [[Keys in the ODB /Logger tree #/Logger/Data dir|/Logger/Data dir key]] will be used. The  contents of the key &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Filename&#039;&#039;&amp;lt;/span&amp;gt; must match that of the [[#/Logger/Channels/0/Settings/Format |Format key]].&lt;br /&gt;
&lt;br /&gt;
;For &#039;&#039;&#039;tape&#039;&#039;&#039; logging : key &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Filename&#039;&#039;&amp;lt;/span&amp;gt; specifies a tape device i.e.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
       &amp;lt;li&amp;gt;  /dev/nrmt0 or /dev/nst0 under UNIX or &amp;lt;/li&amp;gt;&lt;br /&gt;
       &amp;lt;li&amp;gt;   \\.\tape0 under Windows NT. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:mistyrose&amp;quot;&amp;gt;WARNING: tape logging is no longer maintained&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; FTP mode :  the data is written directly to a remote computer via FTP. Key &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Filename&#039;&#039;&amp;lt;/span&amp;gt; specifies the access information for the FTP server. It has the following format:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;host name&amp;gt;, &amp;lt;port number&amp;gt;, &amp;lt;user name&amp;gt;, &amp;lt;password&amp;gt;, &amp;lt;directory&amp;gt;, &amp;lt;file name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: for example&lt;br /&gt;
&lt;br /&gt;
  myhost.my.domain,21,john,password,/usr/users/data,run%05d.mid&lt;br /&gt;
&lt;br /&gt;
The normal FTP port number is 21, or 1021 for a Unitree Archive like the one used at the Paul Scherrer Institute.&lt;br /&gt;
&lt;br /&gt;
By using the FTP mode, a back-end computer can write directly to the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Format&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;MIDAS&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key  in the [[#Settings subtree|Settings subtree]] specifies the format to be used for writing the data to the logging channel. It can take one of four values: MIDAS, ROOT, ASCII and DUMP.&lt;br /&gt;
&lt;br /&gt;
For disk logging, the extension for the [[#Filename|Filename]] key above must match one of the following:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; .mid for MIDAS (or .mid.gz - see [[#Compression | Compression]] key)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; .root for ROOT&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; .asc for ASCII&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; .txt for DUMP&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For [[ROOT]] format the data logger will automatically convert the format specified in the [[Explanation of Equipment List Parameters#Format|frontend equipment list]] to ROOT format (see format for details). The ASCII format converts events into readable text format which can be easily analyzed by programs that have problems reading binary data. While the ASCII format tries to minimize the file size by printing one event per line, the DUMP format gives a very detailed ASCII representation of the event including bank information, serial numbers etc., so it should be used mainly for diagnostics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Compression&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
This ODB key in the [[#Settings subtree|Settings subtree]] defines the Compression Level of the data. If set to 0, compression is turned off. If set &amp;gt; 0, the data files are compressed before being written. In this case,&lt;br /&gt;
&lt;br /&gt;
*   the file extension &amp;quot;.gz&amp;quot; must be appended to the [[#/Logger/Channels/0/Settings/Filename |Filename key]] (see also  [[#Format |Format]] key)&lt;br /&gt;
*   and ZLIB support must be compiled into the MIDAS package (see [[Compilation &amp;amp; Build #NEED_ZLIB |NEED_ZLIB]] ).&lt;br /&gt;
&lt;br /&gt;
This feature applies only to files saved onto disk in [[Event Structure|MIDAS format]]. ROOT format is already compressed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;ODB Dump&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;y&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If this ODB key in the [[#Settings subtree|Settings subtree]] is set to &amp;quot;y&amp;quot;, a complete dump of the ODB is performed to this logging channel before and after every run.  The format of the ODB dump is set by the key [[#ODB dump format]]. The ODB content is  reflects the status at begin-of-run event and at end-of-run event. These special events have an ID of EVENTID_BOR (0x8000) and EVENTID_EOR (0x8001) (defined in  &lt;br /&gt;
[http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/html/midas_8h.html midas.h]) and a serial number equal to the current run number, and are not visible using the [[mdump]] utility. An analyzer in the off-line analysis stage can use these special events to restore the ODB to its online state. &lt;br /&gt;
&lt;br /&gt;
The dump of the ODB into the event stream for this logger channel is independent of the [[Keys in the ODB /Logger tree #/Logger/ODB Dump  |/Logger/ODB Dump key]], which is used to dump the ODB to a file on disk in the [[#ODB dump format|specified format]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;ODB dump format&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;json&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key in the [[#Settings subtree|Settings subtree]] defines the format of the ODB Dump file, providing&lt;br /&gt;
the ODB key [[#ODB Dump]] is set to &amp;quot;y&amp;quot;. The default is now &amp;quot;json&amp;quot; (since March 2019) and the filename of the odb dump file&lt;br /&gt;
saved at end-of-run is  is &amp;quot;last.json&amp;quot;.  &lt;br /&gt;
&lt;br /&gt;
Users who wish to use &amp;quot;xml&amp;quot; should set this key to &amp;quot;xml&amp;quot; and [[Keys in the ODB /Logger tree#ODB Last Dump File]] to &amp;quot;last.xml&amp;quot;.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Log messages&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0 &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key in the [[#Settings subtree|Settings subtree]] is a bit-field for logging system messages as message events along with the event data from the experiment.&lt;br /&gt;
If a bit in this field is set, the respective system message is written to the logging channel as a message event with an ID of EVENTID_MESSAGE (0x8002) (defined in  &lt;br /&gt;
[http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/html/midas_8h.html midas.h]). The bits are 1 for error, 2 for info, 4 for debug, 8 for user, 16 for log, 32 for talk, 64 for call messages and 255 to log all messages. For an explanation of these messages refer to [[Buffer Manager]] , &lt;br /&gt;
[[#Event ID | Event ID]] key and &lt;br /&gt;
[[#Trigger mask | Trigger mask]] key. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Buffer&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; &amp;quot;SYSTEM&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This ODB key in the [[#Settings subtree|Settings subtree]]  specifies the buffer where the logger will find the event. It is usually set to &amp;quot;SYSTEM&amp;quot; and is specified in the equipment list for this event.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;EventFiltering&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;EventID&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Event ID &#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; -1 &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This ODB key in the [[#Settings subtree|Settings subtree]] contains the ID of the event(s) to be logged (see [[MIDAS Event Structure|EventID]]). It is specified in the [[Equipment List Parameters#EventID|Equipment List]] for this event.&lt;br /&gt;
&lt;br /&gt;
To log events with any ID, &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Event ID&amp;lt;/span&amp;gt; is set to -1 (EVENTID_ALL).  &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Event ID&amp;lt;/span&amp;gt; key and/or [[#/Logger/Channels/0/Settings/Trigger mask | Trigger mask ]] key may be used to select events to be sent to different logging channels, or as an [[Event Filtering]] system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Trigger mask&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; -1 &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key in the [[#Settings subtree|Settings subtree]] specifies which events to log based on the [[MIDAS Event Structure|Trigger Mask]] of the event. It is specified in the [[Equipment List Parameters#TriggerMask|Equipment List]] of this event. &lt;br /&gt;
&lt;br /&gt;
For a logging channel to receive all events, -1 is used for both the &lt;br /&gt;
[[#/Logger/Channels/0/Settings/Event ID | Event ID key]] &lt;br /&gt;
and the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Trigger mask&#039;&#039;&amp;lt;/span&amp;gt; key .&lt;br /&gt;
&lt;br /&gt;
Either the &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Trigger Mask&amp;lt;/span&amp;gt; or  &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Event ID&amp;lt;/span&amp;gt; key may be used to select events to be sent to particular logging channels, or for [[Event Filtering]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Event limit&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DOUBLE&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The  value of this ODB key &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Event limit&amp;lt;/span&amp;gt;  in the [[#Settings subtree|Settings subtree]]  can be used to stop a run when set to a non-zero value. The statistics value [[#Events written|Events written]] is checked against the &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Event limit&amp;lt;/span&amp;gt; value. When this condition is reached, the run is stopped automatically by the data logger [[Mlogger|mlogger]]. The next run can then be started automatically if desired (see [[Keys in the ODB /Logger tree #/Logger/Auto restart|Auto restart]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Byte limit&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DOUBLE&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
The  value of this ODB key &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Byte limit&amp;lt;/span&amp;gt;  in the [[#Settings subtree|Settings subtree]]  can be used to stop a run when set non-zero. The statistics value [[#Bytes written|Bytes written]] is checked against the &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Byte limit&amp;lt;/span&amp;gt; value. When this conditions is reached, the run is stopped automatically by the data logger [[Mlogger|mlogger]]. The next run can then be started automatically if desired (see [[Keys in the ODB /Logger tree #/Logger/Auto restart|Auto restart]]). ).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Subrun Byte limit&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DOUBLE&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The value of the ODB key &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Subrun Byte limit&amp;lt;/span&amp;gt;  in the [[#Settings subtree|Settings subtree]] can be used to stop a [[subruns|subrun]] when set non-zero. When this condition is reached, the run is stopped automatically by the data logger ([[mlogger]]). The next run can then be started automatically if desired (see [[Keys in the ODB /Logger tree #/Logger/Auto restart |Auto restart]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Tape capacity&#039;&#039;&amp;lt;/span&amp;gt; (obsolete) ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DOUBLE&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The value of the ODB key &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Tape capacity&amp;lt;/span&amp;gt;  in the [[#Settings subtree|Settings subtree]]   can be used to stop a run when set to non-zero. The value in the key [[#Bytes written total|Bytes written total]] is checked against the limit set by &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Tape capacity&amp;lt;/span&amp;gt;. When this condition is reached, the run is stopped automatically by the data logger.&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:mistyrose;&amp;quot;&amp;gt;Warning: writing directly to tape is not maintained&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Subdir format&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This ODB key  in the [[#Settings subtree|Settings subtree]] optionally specifies a subdirectory, which is appended to the directory string in the key  [[Keys in the ODB /Logger/Channels tree #Filename | Filename]].&lt;br /&gt;
&lt;br /&gt;
It is used to place the data log file into a date-stamped subdirectory. This is useful where a large numbers of data files are produced, or experiments are active for a long time, and it is desirable to store the data in sub-directories according to their date. This can be done automatically using the &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Subdir format&amp;lt;/span&amp;gt; key.&lt;br /&gt;
&lt;br /&gt;
If the  &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Subdir format&#039;&#039;&amp;lt;/span&amp;gt; key is not empty, the data log file will be placed in a subdirectory. The name of this subdirectory is composed by the given &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Subdir format&#039;&#039;&amp;lt;/span&amp;gt;  string. Its format follows the definition of the system call strftime() . (See man strftime). Ordinary characters placed in the format string are copied to the output character array &amp;quot;s&amp;quot; without conversion. Conversion specifiers are introduced by a &#039;%&#039; character, and are replaced in &amp;quot;s&amp;quot; as follows for the most common ones:&lt;br /&gt;
&lt;br /&gt;
*    %Y : Year (ex: 2002)&lt;br /&gt;
*    %y : Year (range:00..99)&lt;br /&gt;
*    %m : Month (range: 01..12)&lt;br /&gt;
*    %d : Day (range: 00..31)&lt;br /&gt;
&lt;br /&gt;
The other characters are: %a, %A, %b, %B, %c, %C, %d, %D, %e, %E, %G, %g, %h, %H, %I, %j, %k, %l, %m, %M, %n, %O, %p, %P, %r, %R, %s, %S, %t, %T, %u, %U, %V, %w, %W, %x, %X, %y, %Y, %z, %Z, %+. (See man strftime for explanation).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Current filename&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key in the [[#Settings subtree|Settings subtree]]  will reflect the full path of the current saved data file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Data checksum&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; CRC32C&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key in the [[#Settings subtree|Settings subtree]] can be set to &lt;br /&gt;
one of: NONE CRC32C SHA256 SHA512 ZLIB.&lt;br /&gt;
&lt;br /&gt;
See Note on defaults under [[#Compress]] below.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;File checksum&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; CRC32C&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key in the [[#Settings subtree|Settings subtree]] can be set to one of: NONE CRC32C SHA256 SHA512 ZLIB.&lt;br /&gt;
&lt;br /&gt;
See Note on defaults under [[#Compress]] below&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Compress&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; lz4&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key in the [[#Settings subtree|Settings subtree]] can be set to one of :  none gzip lz4 bzip2 pbzip2.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
The defaults of &amp;quot;free&amp;quot; compression (LZ4) and output file data integrity protected by checksums (CRC32C) &lt;br /&gt;
are &amp;quot;free&amp;quot; in the sense that turning&lt;br /&gt;
them off would not noticeably improve the system performance. (Some users may want to enable better compression,&lt;br /&gt;
such as BZIP2 or PBZIP2 and better checksums, such as SHA256 or SHA512 - both choices that have significant CPU-use cost).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Output&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; FILE&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key in the [[#Settings subtree|Settings subtree]] can be set to one of: NULL FILE FTP ROOT PIPE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Statistics&#039;&#039;&amp;lt;/span&amp;gt; subtree ==&lt;br /&gt;
The keys in the ODB &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels/&amp;lt;logging-channel-number&amp;gt;/Statistics&#039;&#039;&amp;lt;/span&amp;gt; subtree are shown below&lt;br /&gt;
for the default logging channel 0.&lt;br /&gt;
&lt;br /&gt;
For a single logging channel 0, one ODB subtree&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels/0/Statistics&#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
will be present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If [[#Multiple Logging Channels | multiple logging channels]] are defined, each&lt;br /&gt;
will contain its own ODB &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Statistics&#039;&#039;&amp;lt;/span&amp;gt;  subtree, &lt;br /&gt;
&lt;br /&gt;
i.e. &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels/0/Statistics&#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels/1/Statistics&#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Events written&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DOUBLE&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key  in the [[#Statistics subtree|Statistics subtree]]  contains the number of events written. Cleared at begin-of-run. &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Events written&#039;&#039;&amp;lt;/span&amp;gt;  statistics are used to determine when to stop a run automatically by checking against the [[#/Logger/Channels/0/Settings/Event limit|Event limit key]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Bytes written&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DOUBLE&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This ODB key   in the [[#Statistics subtree|Statistics subtree]] contains the number of bytes written. Cleared at begin-of-run. &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Bytes written&#039;&#039;&amp;lt;/span&amp;gt; statistics are used to determine when to stop a run automatically by checking against the [[#Byte limit|Byte limit]] key.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Bytes written uncompressed&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DOUBLE&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If [[#Compression |Compression level]]  is 0 (i.e. data not compressed), the values of the ODB keys  in the [[#Statistics subtree|Statistics subtree]] &lt;br /&gt;
&amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Bytes written uncompressed&#039;&#039;&amp;lt;/span&amp;gt; and [[#/Logger/Channels/0/Settings/Bytes written|Bytes written]] will be identical. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Bytes written total&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DOUBLE&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This ODB key  in the [[#Statistics subtree|Statistics subtree]] contains the total number of bytes written. Cleared only when a tape is rewound with the [[odbedit]] command &#039;&#039;rewind&#039;&#039;. The &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Bytes written total&#039;&#039;&amp;lt;/span&amp;gt; entry can therefore be used as an indicator of when a tape is full by checking against the limit [[#/Logger/Channels/0/Settings/Tape Capacity|Tape Capacity]].&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:mistyrose;&amp;quot;&amp;gt;Warning: writing directly to tape is not maintained&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Files written&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This ODB key in the [[#Statistics subtree|Statistics subtree]]  contains the number of files written. Cleared only when a tape is rewound with the [[odbedit]] command &#039;&#039;rewind&#039;&#039;. &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Files written&#039;&#039;&amp;lt;/span&amp;gt; value can be used off-line to determine how many files on a tape have to be skipped in order to reach a specific run.&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:mistyrose;&amp;quot;&amp;gt;Warning: writing directly to tape is not maintained&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Logger Tree]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Keys_in_the_ODB_/Logger_tree&amp;diff=2852</id>
		<title>Keys in the ODB /Logger tree</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Keys_in_the_ODB_/Logger_tree&amp;diff=2852"/>
		<updated>2019-05-22T22:44:17Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
==== Links ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:4;-moz-column-count:4;-webkit-column-count:4&amp;quot;&amp;gt;&lt;br /&gt;
* [[/Logger ODB tree| /Logger tree]] &lt;br /&gt;
* [[Logging to a mySQL database]]&lt;br /&gt;
* [[Keys in the ODB /Logger/Channels subtree| /Logger/Channels subtree]] &lt;br /&gt;
* [[Keys in the ODB /Logger/SQL subtree| /Logger/SQL subtree]] &lt;br /&gt;
* [[Keys in the ODB /Logger/History subtree |/Logger/History subtree]]&lt;br /&gt;
* [[/History ODB tree]]&lt;br /&gt;
* [[mlogger |MIDAS logger (mlogger)]] &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Keys in the  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger&#039;&#039;&amp;lt;/span&amp;gt; tree  ==&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Data dir&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;lt;Path of experiment given in [[exptab]] &amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This key in the  ODB  [[#top|/Logger tree]] specifies in which directory files produced by the MIDAS logger utility ([[mlogger]]) should be written. &lt;br /&gt;
Once mlogger is running , the key &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Data dir&#039;&#039;&amp;lt;/span&amp;gt; will be pointing to the location of&lt;br /&gt;
&lt;br /&gt;
* the data file(s) (unless overruled by the [[Keys in the ODB /Logger/Channels tree #/Logger/Channels/0/Settings/Filename | Filename ]] key(s) ), &lt;br /&gt;
* the message log file (unless overruled by [[#/Logger/Message File | Message File]]),&lt;br /&gt;
* the ODB dump files (unless overruled by [[#/Logger/ODB Dump File | ODB Dump File]]),&lt;br /&gt;
&lt;br /&gt;
* and the optional&lt;br /&gt;
** elog files (unless overruled by [[#/Logger/Elog dir|Elog dir]]),&lt;br /&gt;
** [[History System|MIDAS history files]] (unless overruled by [[#/Logger/History dir | History Dir]])&lt;br /&gt;
&lt;br /&gt;
It is preferable to use a full directory path for this key (i.e. &amp;quot;&#039;&#039;/home/username/online/data&#039;&#039;&amp;quot; rather than a relative path, such as the current directory &amp;quot;&#039;&#039;./&#039;&#039;&amp;quot;). If set to the current directory, running a client such as [[odbedit]] from a different directory will result in a second midas.log file created in that directory.&lt;br /&gt;
  &lt;br /&gt;
When &#039;&#039;&#039;[[#Multiple Logging Channels| multiple logging channels]]&#039;&#039;&#039; are enabled,&lt;br /&gt;
by default, the data path for &amp;lt;b&amp;gt;all&amp;lt;/b&amp;gt; the defined logging channels is set to the same location, given by the  &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Data dir&#039;&#039;&amp;lt;/span&amp;gt; key.&lt;br /&gt;
However, the data from individual logging channels can also be saved in different locations, using&lt;br /&gt;
the ODB key &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels/&amp;amp;lt;channel-number&amp;amp;gt;/Settings/Filename&#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
for each defined logging channel (channel number 0,1...).&lt;br /&gt;
&lt;br /&gt;
The [[Keys in the ODB /Logger/Channels tree #/Logger/Channels/0/Settings/Filename | Filename key]] for each enabled logging channel can contain the full path of the location of the &#039;&#039;.mid, .ybs, .asc&#039;&#039;  data file.&lt;br /&gt;
&lt;br /&gt;
If the latter key contains the full directory path (i.e. contains the OS specific &amp;lt;b&amp;gt;DIR_SEPARATOR&amp;lt;/b&amp;gt; (e.g. &amp;quot;/&amp;quot; for Linux or &amp;quot;\&amp;quot; for Windows), &lt;br /&gt;
then the global key &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Data dir&#039;&#039;&amp;lt;/span&amp;gt;  will be overruled by the setting for that particular channel.&lt;br /&gt;
 &lt;br /&gt;
For example,&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If key [[Keys in the ODB /Logger/Channels tree #/Logger/Channels/0/Settings/Filename | Filename ]]  contains &amp;lt;em&amp;gt;&amp;quot;run%05.mid&amp;quot;&amp;lt;/em&amp;gt;.  key &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Data dir&#039;&#039;&amp;lt;/span&amp;gt;  will &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; be overruled&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If key  [[Keys in the ODB /Logger/Channels tree #/Logger/Channels/0/Settings/Filename | Filename ]]  contains &amp;lt;em&amp;gt;&amp;quot;/data1/ch1log/run%05.mid&amp;quot;&amp;lt;/em&amp;gt;.  key &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Data dir&#039;&#039;&amp;lt;/span&amp;gt;   &amp;lt;b&amp;gt;will&amp;lt;/b&amp;gt; be overruled   &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Message File&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This key in the  ODB  [[#top|/Logger tree]] specifies the filename of the [[Message System#MIDAS Log file|MIDAS Message log file]] . &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Auto restart&#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When this key in the  ODB  [[#top|/Logger tree]]  is set to &amp;quot;y&amp;quot; (i.e. TRUE), a new run is automatically restarted when the previous run has been stopped by the MIDAS logger ([[mlogger]]) &lt;br /&gt;
due to an event or byte limit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Auto restart delay &#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Providing [[#Auto restart|Auto restart key]] is set TRUE, the automatic start of the next run will be delayed by the number of milliseconds specified by this key in the  ODB  [[#top|/Logger tree]]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Run duration &#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This key in the  ODB  [[#top|/Logger tree]] allows for runs with a certain duration. To use this option, the user creates and sets this variable to a non-zero &#039;&#039;&#039;integer&#039;&#039;&#039; value (in seconds). After a run has lasted for this duration, it will be stopped automatically by  the MIDAS logger ([[mlogger]]). To automatically produce sequences of runs all with the same duration, also set the &lt;br /&gt;
[[#/Logger/Auto restart|/Logger/Auto restart key]]  to &amp;quot;y&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Write data &#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;y&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Data logging is enabled when this key in the  ODB  [[#top|/Logger tree]]  is set to &amp;quot;y&amp;quot;. It can be set to &amp;quot;n&amp;quot; (FALSE) temporarily to make a short test run without data logging. &lt;br /&gt;
This key is a predefined key for enabling data logging.  &lt;br /&gt;
&lt;br /&gt;
Note that the  [[Keys in the ODB /Logger/Channels tree #Active | Active key]] (in the appropriate  &lt;br /&gt;
[[Keys in the ODB /Logger/Channels tree #Settings subtree |logging channel subtree ]] )&lt;br /&gt;
must &amp;lt;b&amp;gt;also&amp;lt;/b&amp;gt; &lt;br /&gt;
be set to &amp;quot;y&amp;quot; for the data from that channel to be logged.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;ODB Dump&#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If this  key in the  ODB  [[#top|/Logger tree]]  is set to &amp;quot;y&amp;quot;, a dump of the complete ODB will be written to the file specified by the key [[#ODB Dump file|ODB Dump file]] at the end of each run.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
&amp;lt;li&amp;gt;The ODB contents is &amp;lt;b&amp;gt;always&amp;lt;/b&amp;gt; saved into a file (default is &amp;quot;last.json&amp;quot;) at the beginning of each run regardless of the setting of this key.&amp;lt;/li&amp;gt; The format is specified by the [[Keys in the ODB /Logger/Channels subtree#ODB dump format]] key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;The ODB contents can also be saved into the data stream as an event (see [[Keys in the ODB /Logger/Channels tree #ODB Dump|ODB Dump per logging channel]]).  &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;ODB Dump File &#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;run%05d.json&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This key in the  ODB  [[#top|/Logger tree]] specifies the filename in which the dump of the complete ODB will be &lt;br /&gt;
written at the end of each run if the [[#ODB Dump]] key is set to &amp;quot;y&amp;quot;. The default for the format of the file &lt;br /&gt;
is now json (since March 2019). Previously it was &amp;quot;run%05d.odb&amp;quot;, with the format being xml by default.&lt;br /&gt;
&lt;br /&gt;
If this filename contains a &amp;quot;%&amp;quot;, the &amp;quot;%&amp;quot; will be replaced by the current run number (cf. format string of printf() C function). The format specifier &amp;quot;%05d&amp;quot; from the example would be evaluated to a five digit run number with leading zeros e.g. run00002.json. The ODB dump file can be used for off-line analysis to check run parameters etc. (See also &lt;br /&gt;
[[Keys in the ODB /Logger/Channels tree #/Logger/Channels/0/Settings/ODB Dump | ODB Dump per logging channel]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; The location of the ODB dump files can also be specified in this field. If the ODB Dump File string contains a DIR_SEPARATOR, &lt;br /&gt;
it is considered as an absolute path. If no DIR_SEPARATOR is present, the dump file will be written to the location given by [[#Data dir |Data dir key]].&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;ODB Last Dump File &#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;last.json&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key in the  ODB  [[#top|/Logger tree]] contains the filename of the odb dump file last saved. It is always saved, independent of the setting of the key [[#ODB Dump]]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;WriteFileHistory&#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;y&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key in the  ODB  [[#top|/Logger tree]] is obsolete. Use [[Keys in the ODB /Logger/History subtree#/Logger/History/0/Active|Active]] key instead.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Tape message&#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If this key in the  ODB  [[#top|/Logger tree]] is set to &amp;quot;y&amp;quot;, MIDAS messages during mounting tapes and writing of EOF marks are generated. This can be useful all users in a counting house to be informed about the tape status.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;ODBC Debug&#039;&#039;&amp;lt;/span&amp;gt;  (obsolete)  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key  in the  ODB  [[#top|/Logger tree]]  is now obsolete. It has been replaced by [[Keys in the ODB /Logger/History subtree#/Logger/History/1/Debug|Debug]] key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;ODBC DSN&#039;&#039;&amp;lt;/span&amp;gt;  (obsolete)  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key  in the  ODB  [[#top|/Logger tree]]  is now obsolete. It has been replaced by [[Keys in the ODB /Logger/History subtree#/Logger/History/1/Writer_ODBC_DSN|Writer_ODBC_DSN]] key.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;History dir&#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This key  in the  ODB  [[#top|/Logger tree]]  is used to reassign the location of the saved [[Keys in the ODB /Logger/History subtree#/Logger/History/0/Type|MIDAS type]]  history files from the default location given by the [[#Data dir |Data dir key]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Elog dir&#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This optional key in the  ODB  [[#top|/Logger tree]] is used to reassign the location of the saved Elog files from the default location given by the [[#Data dir |Data dir key]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Subrun duration&#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 0 &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This optional key in the  ODB  [[#top|/Logger tree]]  contains the duration in seconds for each [[subruns|subrun]]. After this time, a new subrun will be started by the MIDAS logger [[mlogger]].  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Next subrun &#039;&#039;&amp;lt;/span&amp;gt;   ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This key  in the  ODB  [[#top|/Logger tree]] allows the user to  manually request a new [[subruns|subrun]]. The MIDAS logger ([[mlogger]]) will stop the present subrun and start a new one. The key   &lt;br /&gt;
&amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Next subrun&#039;&#039;&amp;lt;/span&amp;gt; will be set false.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Channels&#039;&#039;&amp;lt;/span&amp;gt;  subtree ==&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039;  DIR  &lt;br /&gt;
&lt;br /&gt;
This subdirectory is created and used by the [[mlogger]] utility for data logging. See [[Keys in the ODB /Logger/Channels subtree| /Logger/Channels subtree]]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/SQL&#039;&#039;&amp;lt;/span&amp;gt;  subtree ==&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039;  DIR  &lt;br /&gt;
&lt;br /&gt;
Optional directory in the  ODB  [[#top|/Logger tree]]  for [[logging to a mySQL database]]. This ODB subtree will be created if mySQL support has been [[Building options |built into]] the [[mlogger|MIDAS logger]].&lt;br /&gt;
&lt;br /&gt;
See [[Keys in the ODB /Logger/SQL subtree| /Logger/SQL subtree]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/History&#039;&#039;&amp;lt;/span&amp;gt;  subtree ==&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039;  DIR  &lt;br /&gt;
&lt;br /&gt;
This subdirectory  in the [[#top|/Logger tree]] is created by the [[mlogger]] utility and used by the [[History System]]. &lt;br /&gt;
&lt;br /&gt;
See [[Keys in the ODB /Logger/History subtree |keys in /Logger/History subtree]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Data Logging]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Template:Pagelinks&amp;diff=2803</id>
		<title>Template:Pagelinks</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Template:Pagelinks&amp;diff=2803"/>
		<updated>2018-12-12T00:32:40Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
Usage: {{Pagelinks}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:7;-moz-column-count:6;-webkit-column-count:6&amp;quot;&amp;gt;&lt;br /&gt;
* [[Midas_documentation|Midas Doc]]&lt;br /&gt;
* [[Feature_listing|Feature Listing]]&lt;br /&gt;
* [[Application_listing|Application Listing]]&lt;br /&gt;
* [[Online_Database|Online Database]]&lt;br /&gt;
* [[FAQ|FAQ]]&lt;br /&gt;
* [[:Category:Contents|Index]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=FAQ&amp;diff=2802</id>
		<title>FAQ</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=FAQ&amp;diff=2802"/>
		<updated>2018-11-29T22:30:29Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Frequently Asked Questions =&lt;br /&gt;
&lt;br /&gt;
There is a related page of [[Installation/Compilation problems|Common Installation Problems]].&lt;br /&gt;
__FORCETOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How to recover from a corrupted ODB ==&lt;br /&gt;
&lt;br /&gt;
* Stop your front-ends, [[mlogger]], [[mhttpd]], etc.&lt;br /&gt;
* Remove the shared memory associated to ODB buffer. Find the shared memory segment by doing &lt;br /&gt;
 ls -l /dev/shm&lt;br /&gt;
then remove the segment that will be something like /dev/shm/*_test_ODB_SHM&lt;br /&gt;
where &amp;quot;test&amp;quot; is the experiment name.&lt;br /&gt;
* Move the old ODB files. These will be in the location given by [[Exptab]], e.g. ~/online&lt;br /&gt;
 cd online&lt;br /&gt;
 mv .ODB.SHM .ODB.SHM.BAD&lt;br /&gt;
* Restart ODB with larger size using [[odbedit]] e.g.&lt;br /&gt;
 odbedit -s 100000000&lt;br /&gt;
* Reload the last saved ODB dump you have (see [[ODB#Save and reload the ODB|save and reload the ODB]]). These dumps are typically called something like &#039;online/history/*.xml&#039;.&lt;br /&gt;
So from  {{Utility|name=odbedit}} you do something like&lt;br /&gt;
 odbedit&amp;gt; load history/run00071.xml&lt;br /&gt;
* Your ODB should now be fixed.&lt;br /&gt;
&lt;br /&gt;
Note that sometimes it seems that you also need to remove the buffers associated with the system messages (called SYSMSG) as well as the buffers associated with the ODB.&lt;br /&gt;
&lt;br /&gt;
See also [[odbinit]].&lt;br /&gt;
&lt;br /&gt;
== How to get odbedit to show run state == &lt;br /&gt;
&lt;br /&gt;
Question: I&#039;ve seen the ODB prompt displaying the run state, how do you do that?&lt;br /&gt;
&lt;br /&gt;
Answer: Modify the /System/prompt field. The &amp;quot;S&amp;quot; is the trick.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 Fri&amp;gt; odb -e bnmr1 -h isdaq01&lt;br /&gt;
 [host:expt:Stopped]/cd /System/&lt;br /&gt;
 [host:expt:Stopped]/System&amp;gt;ls&lt;br /&gt;
 Clients&lt;br /&gt;
 Client Notify                   0&lt;br /&gt;
 Prompt                          [%h:%e:%S]%p&lt;br /&gt;
 Tmp&lt;br /&gt;
 [host:expt:Stopped]/System&lt;br /&gt;
 [host:expt:Stopped]/Systemset prompt [%h:%e:%S]%p&amp;gt;&lt;br /&gt;
 [host:expt:Stopped]/System&amp;gt;ls&lt;br /&gt;
 Clients&lt;br /&gt;
 Client Notify                   0&lt;br /&gt;
 Prompt                          [%h:%e:%S]%p&amp;gt;&lt;br /&gt;
 Tmp&lt;br /&gt;
 [host:expt:Stopped]/System&amp;gt;set Prompt [%h:%e:%s]%p&amp;gt;&lt;br /&gt;
 [host:expt:S]/System&amp;gt;set Prompt [%h:%e:%S]%p&amp;gt;&lt;br /&gt;
 [host:expt:Stopped]/System&amp;gt;     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[/System ODB tree#Prompt]].&lt;br /&gt;
&lt;br /&gt;
== Increasing Number of Hot-links ==&lt;br /&gt;
&lt;br /&gt;
MIDAS, by default, allows you to have a maximum of 256 individual [[Event Notification (Hot-Link)|hot-links]] to be registered.  If you find that you need more hot-links than that, follow the procedure below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use odbedit to save current ODB&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
odbedit&lt;br /&gt;
save current_odb.odb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Stop all the running MIDAS processes, including mlogger and mserver using the web&lt;br /&gt;
interface. Then stop mhttpd as well.  To stop mhttpd just do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
killall mhttpd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Remove your old ODB (we will recreate it after modifying MIDAS, using the backup you just&lt;br /&gt;
made).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv .ODB.SHM .ODB.SHM.20161104&lt;br /&gt;
rm /dev/shm/&amp;lt;expname&amp;gt;_ODB_SHM&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;expname&amp;gt; is the name of your experiment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Make the following modifications to midas.  In this particular case I have increased the&lt;br /&gt;
max number of open records from 256 to 1024.  You would need to change the constants if you&lt;br /&gt;
want to change to other values&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/include/midas.h b/include/midas.h&lt;br /&gt;
index 02b30dd..33be7be 100644&lt;br /&gt;
--- a/include/midas.h&lt;br /&gt;
+++ b/include/midas.h&lt;br /&gt;
@@ -254,7 +254,7 @@ typedef std::vector&amp;lt;std::string&amp;gt; STRING_LIST;&lt;br /&gt;
-#define MAX_OPEN_RECORDS       256           /**&amp;lt; number of open DB records   */&lt;br /&gt;
+#define MAX_OPEN_RECORDS       1024           /**&amp;lt; number of open DB records   */&lt;br /&gt;
diff --git a/src/odb.c b/src/odb.c&lt;br /&gt;
index 47ace8f..ac1bef3 100755&lt;br /&gt;
--- a/src/odb.c&lt;br /&gt;
+++ b/src/odb.c&lt;br /&gt;
@@ -699,8 +699,8 @@ static void db_validate_sizes()&lt;br /&gt;
-   assert(sizeof(DATABASE_CLIENT) == 2112);&lt;br /&gt;
-   assert(sizeof(DATABASE_HEADER) == 135232);&lt;br /&gt;
+   assert(sizeof(DATABASE_CLIENT) == 8256);&lt;br /&gt;
+   assert(sizeof(DATABASE_HEADER) == 528448);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The calculation is as follows (in case you want a different number of open records): &lt;br /&gt;
DATABASE_CLIENT = 64 + 8*MAX_OPEN_ERCORDS = 64 + 8*1024 = 8256&lt;br /&gt;
DATABASE_HEADER = 64 + 64*DATABASE_CLIENT = 64 + 64*8256 = 528448&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Rebuild MIDAS&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd $MIDASSYS&lt;br /&gt;
make clean; make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Create new ODB&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
odbedit -s 1000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note, you should change the size of the ODB to whatever you need.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; reload your original ODB &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[local:exp:Stopped] load  current_odb.odb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Rebuild all your frontend programs (and other user-specific programs) against new MIDAS; they should then work and you should be able to produce more open records.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Odbinit&amp;diff=2801</id>
		<title>Odbinit</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Odbinit&amp;diff=2801"/>
		<updated>2018-11-21T00:35:59Z</updated>

		<summary type="html">&lt;p&gt;Suz: Created page with &amp;quot;{{Pagelinks}}  = Links = &amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt; * odbedit command list * Odbedit examples * Using the ODB * ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[odbedit command list]]&lt;br /&gt;
* [[Odbedit examples]]&lt;br /&gt;
* [[ODB|Using the ODB]]&lt;br /&gt;
* [[mhttpd]] webserver&lt;br /&gt;
* [[Online Database|ODB structure]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Purpose = &lt;br /&gt;
The utility  {{Utility|name=odbinit}} initializes the ODB. &lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: Normally, &amp;lt;span style=&amp;quot;color:darkcyan;font-style:italic&amp;quot;&amp;gt;odbedit&amp;lt;/span&amp;gt; is sufficient to [[FAQ#How to recover from a corrupted ODB|recover from a corrupted ODB]]&lt;br /&gt;
&lt;br /&gt;
However, if this does not solve the problem, it may be necessary to use {{Utility|name=odbinit}}, then reload the contents of the ODB from a saved file.&lt;br /&gt;
= Usage =&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mpet@titan01 ~/online_npet]$ odbinit -h&lt;br /&gt;
Checking environment... experiment name is &amp;quot;npet&amp;quot;, remote hostname is &amp;quot;&amp;quot;&lt;br /&gt;
usage: odbinit [options...]&lt;br /&gt;
options:&lt;br /&gt;
  [-e Experiment] --- specify experiment name&lt;br /&gt;
  [-s size] --- specify new size of ODB in bytes, default is 1048576&lt;br /&gt;
  [--env] --- create new env.sh and env.csh files in the current directory&lt;br /&gt;
  [--exptab] --- create new exptab file in the current directory&lt;br /&gt;
  [--cleanup] --- cleanup (preserve) old (existing) ODB files&lt;br /&gt;
  [-n] --- dry run, report everything that will be done, but do not actually do anything&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Example =&lt;br /&gt;
In this case, the ODB shared memory is corrupted, and the .ODB.SHM has been recreated with a size of 0.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
[mpet@titan01 ~/online_npet]$ ls -l .ODB.SHM &lt;br /&gt;
-rw-r--r-- 1 mpet users 0 Nov 20 14:44 .ODB.SHM&lt;br /&gt;
&lt;br /&gt;
[mpet@titan01 ~/online_npet]$ odbinit &lt;br /&gt;
Checking environment... experiment name is &amp;quot;npet&amp;quot;, remote hostname is &amp;quot;&amp;quot;&lt;br /&gt;
Checking command line... experiment &amp;quot;npet&amp;quot;, cleanup 0, dry_run 0, create_exptab 0, create_env 0&lt;br /&gt;
Checking MIDASSYS....../home/mpet/packages/midas_nov2018&lt;br /&gt;
Checking exptab... experiments defined in exptab file &amp;quot;/home/mpet/online/exptab&amp;quot;:&lt;br /&gt;
0: &amp;quot;mpet&amp;quot;&lt;br /&gt;
1: &amp;quot;npet&amp;quot; &amp;lt;-- selected experiment&lt;br /&gt;
2: &amp;quot;test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Checking exptab... selected experiment &amp;quot;npet&amp;quot;, experiment directory &amp;quot;/home/mpet/online_npet/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Checking experiment directory &amp;quot;/home/mpet/online_npet/&amp;quot;&lt;br /&gt;
Found existing ODB save file: &amp;quot;/home/mpet/online_npet/.ODB.SHM&amp;quot;&lt;br /&gt;
Looks like this experiment ODB is already initialized.&lt;br /&gt;
To create new empty ODB, please rerun odbinit with the &amp;quot;--cleanup&amp;quot; option.&lt;br /&gt;
[mpet@titan01 ~/online_npet]$ &lt;br /&gt;
[mpet@titan01 ~/online_npet]$ odbinit --cleanup&lt;br /&gt;
Checking environment... experiment name is &amp;quot;npet&amp;quot;, remote hostname is &amp;quot;&amp;quot;&lt;br /&gt;
Checking command line... experiment &amp;quot;npet&amp;quot;, cleanup 1, dry_run 0, create_exptab 0, create_env 0&lt;br /&gt;
Checking MIDASSYS....../home/mpet/packages/midas_nov2018&lt;br /&gt;
Checking exptab... experiments defined in exptab file &amp;quot;/home/mpet/online/exptab&amp;quot;:&lt;br /&gt;
0: &amp;quot;mpet&amp;quot;&lt;br /&gt;
1: &amp;quot;npet&amp;quot; &amp;lt;-- selected experiment&lt;br /&gt;
2: &amp;quot;test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Checking exptab... selected experiment &amp;quot;npet&amp;quot;, experiment directory &amp;quot;/home/mpet/online_npet/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Checking experiment directory &amp;quot;/home/mpet/online_npet/&amp;quot;&lt;br /&gt;
Found existing ODB save file: &amp;quot;/home/mpet/online_npet/.ODB.SHM&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Checking shared memory...&lt;br /&gt;
Deleting old ODB shared memory...&lt;br /&gt;
Deleted existing ODB shared memory, please check that all MIDAS programs are stopped and try again.&lt;br /&gt;
[mpet@titan01 ~/online_npet]$ &lt;br /&gt;
[mpet@titan01 ~/online_npet]$ &lt;br /&gt;
[mpet@titan01 ~/online_npet]$ &lt;br /&gt;
[mpet@titan01 ~/online_npet]$ odbinit --cleanup&lt;br /&gt;
Checking environment... experiment name is &amp;quot;npet&amp;quot;, remote hostname is &amp;quot;&amp;quot;&lt;br /&gt;
Checking command line... experiment &amp;quot;npet&amp;quot;, cleanup 1, dry_run 0, create_exptab 0, create_env 0&lt;br /&gt;
Checking MIDASSYS....../home/mpet/packages/midas_nov2018&lt;br /&gt;
Checking exptab... experiments defined in exptab file &amp;quot;/home/mpet/online/exptab&amp;quot;:&lt;br /&gt;
0: &amp;quot;mpet&amp;quot;&lt;br /&gt;
1: &amp;quot;npet&amp;quot; &amp;lt;-- selected experiment&lt;br /&gt;
2: &amp;quot;test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Checking exptab... selected experiment &amp;quot;npet&amp;quot;, experiment directory &amp;quot;/home/mpet/online_npet/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Checking experiment directory &amp;quot;/home/mpet/online_npet/&amp;quot;&lt;br /&gt;
Found existing ODB save file: &amp;quot;/home/mpet/online_npet/.ODB.SHM&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Checking shared memory...&lt;br /&gt;
Deleting old ODB shared memory...&lt;br /&gt;
[system.c:1015:ss_shm_delete,ERROR] shm_unlink(/npet_ODB_SHM) errno 2 (No such file or directory)&lt;br /&gt;
Good: no ODB shared memory&lt;br /&gt;
Deleting old ODB semaphore...&lt;br /&gt;
Deleting old ODB semaphore... create status 1, delete status 1&lt;br /&gt;
Preserving old ODB save file /home/mpet/online_npet/.ODB.SHM&amp;quot; to &amp;quot;/home/mpet/online_npet/.ODB.SHM.1542755393&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Checking ODB size...&lt;br /&gt;
Requested ODB size is 0 bytes&lt;br /&gt;
ODB size file is &amp;quot;/home/mpet/online_npet//.ODB_SIZE.TXT&amp;quot;&lt;br /&gt;
ODB size file &amp;quot;/home/mpet/online_npet//.ODB_SIZE.TXT&amp;quot; does not exist, creating it...&lt;br /&gt;
Saved ODB size from &amp;quot;/home/mpet/online_npet//.ODB_SIZE.TXT&amp;quot; is 1048576 bytes&lt;br /&gt;
We will initialize ODB for experiment &amp;quot;npet&amp;quot; on host &amp;quot;&amp;quot; with size 1048576 bytes&lt;br /&gt;
&lt;br /&gt;
Creating ODB...&lt;br /&gt;
Creating ODB... db_open_database() status 302&lt;br /&gt;
Saving ODB...&lt;br /&gt;
Saving ODB... db_close_database() status 1&lt;br /&gt;
Connecting to experiment...&lt;br /&gt;
&lt;br /&gt;
Connected to ODB for experiment &amp;quot;npet&amp;quot; on host &amp;quot;&amp;quot; with size 1048576 bytes&lt;br /&gt;
Checking experiment name... status 1, found &amp;quot;npet&amp;quot;&lt;br /&gt;
Disconnecting from experiment...&lt;br /&gt;
&lt;br /&gt;
Done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now [[ODB Access and Use#Save and reload the ODB|reload the ODB]] from a saved file using the {{Utility|name=odbedit}} command &amp;quot;load&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Category:Utilities]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=ODB_Access_and_Use&amp;diff=2800</id>
		<title>ODB Access and Use</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=ODB_Access_and_Use&amp;diff=2800"/>
		<updated>2018-11-21T00:24:59Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[odbedit]]&lt;br /&gt;
* [[Odbedit command list]]&lt;br /&gt;
* [[mhttpd]] ODB page&lt;br /&gt;
* [[Online Database|ODB structure]]&lt;br /&gt;
* &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
= Purpose =&lt;br /&gt;
This page gives details on how users may access and use the ODB. &lt;br /&gt;
 &lt;br /&gt;
= Introduction =&lt;br /&gt;
The MIDAS Online Data Base (ODB) is the main communication platform between MIDAS applications. It contains all the information needed to run an experiment. A description of [[Online Database#The ODB Structure|the ODB Structure]] and a list of all the ODB trees used by the system can be found in [[Online Database]].&lt;br /&gt;
&lt;br /&gt;
= ODB Keys =&lt;br /&gt;
&lt;br /&gt;
The ODB is hierarchically structured, similar to a file system, with directories and sub-directories (or trees and subtrees). The data are stored in key/data pairs, similar to the Windows NT registry. ODB keys can be dynamically created and deleted. The data associated with a key can be of different types such as: byte, words, double words, float, strings, etc. or arrays of any of those.&lt;br /&gt;
&lt;br /&gt;
A key can also be a directory or a symbolic link. ODB Key names are &#039;&#039;&#039;case-independent&#039;&#039;&#039;, and &#039;&#039;&#039;may contain spaces&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
As of Jan 2017, ODB key names are now checked to ensure they are UTF-8 compliant.  This check will show up in (at least) two ways:&lt;br /&gt;
&lt;br /&gt;
# Attempts to create a new ODB variable if the ODB key is not UTF-8 compliant.  &lt;br /&gt;
#  When a program first connects to the ODB, it runs a check to ensure that the ODB is valid.  This will now include a check that all key names are UTF-8 compliant. Any non-UTF8 compliant key names will be replaced by a string of the pointer to the key.  &lt;br /&gt;
&lt;br /&gt;
This behaviour (checking UTF-8 compatibility and automatically fixing ODB names) can be disabled by setting an environment variable&lt;br /&gt;
&lt;br /&gt;
MIDAS_INVALID_STRING_IS_OK&lt;br /&gt;
&lt;br /&gt;
It doesn&#039;t matter what the environment variable is set to; it just needs to be set.  Note also that this variable is only checked once, when a program starts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Accessing the ODB =&lt;br /&gt;
&lt;br /&gt;
The MIDAS ODB can be accessed &#039;&#039;&#039;interactively&#039;&#039;&#039; in two ways:&lt;br /&gt;
*  [[odbedit|odbedit application]] command line.&lt;br /&gt;
*  Midas server [[mhttpd]] ODB page&lt;br /&gt;
&lt;br /&gt;
For non-interactive access,&lt;br /&gt;
* The MIDAS library provides a complete &#039;&#039;&#039;set of functions&#039;&#039;&#039; (in C/C++) to manage and operate on ODB keys (see [http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/html/group__odbfunctionc.html odb functions]). &lt;br /&gt;
Examples of many of these routines in use can be found in [[Frontend user code]].&lt;br /&gt;
&lt;br /&gt;
* Scripts can easily access the odb using the [[odbedit]] &#039;&#039;-c&#039;&#039; argument. Examples of this can be found in [[#Accessing the ODB from a script|Script Access]]&lt;br /&gt;
&lt;br /&gt;
* A set of Javascript functions are provided to allow the web server [[Custom Page|Custom Pages]] to access the ODB.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating the ODB =&lt;br /&gt;
&lt;br /&gt;
After installation of MIDAS, before any other applications are started, the ODB must be created by the user (see [[odbedit #Creating the ODB|creating the ODB ]]).  Running [[odbedit]] to create the ODB also causes the trees [[/Runinfo ODB tree|/Runinfo]], [[/Experiment ODB tree|/Experiment]], [[/System ODB tree|/System]] to be created and filled with default values. Other system applications will automatically create their own initial ODB structure&lt;br /&gt;
filled with default values (for example, the [[mlogger|data logger]] creates the  [[/Logger ODB tree]]. The user may then modify these configurations to fit  his/her requirements  (see [[#Customizing|customizing]]). A list of the trees in the ODB  used by the system can be found [[Online Database|here]]. &lt;br /&gt;
&lt;br /&gt;
== Shared-memory files ==&lt;br /&gt;
[[odbedit #Creating the ODB|Creating the ODB ]]also creates&lt;br /&gt;
all the shared-memory files needed for the experiment (see list below). By default, these files will be created in the area indicated in the [[exptab]] file for your experiment. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
.ALARM.SHM  .ELOG.SHM  .HISTORY.SHM  .MSG.SHM  .ODB.SHM  .SYSMSG.SHM  .SYSTEM.SHM&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Customizing the ODB =&lt;br /&gt;
The user customizes the ODB for their experiment by modifying the values of &amp;quot;system&amp;quot; parameters (e.g. [[Keys in the ODB /Logger tree]], or adding extra keys under existing trees as needed, e.g. &amp;quot;Edit on Start&amp;quot; parameters under the [[/Experiment ODB tree]].  The user may creates &amp;quot;optional&amp;quot; trees e.g. ([[/Script ODB tree]], [[/Custom ODB tree]]) populating them with keys as required.&lt;br /&gt;
The user is also free to create his/her own tree structure under root (/) for his/her own purposes. &lt;br /&gt;
&lt;br /&gt;
== Creating ODB keys ==&lt;br /&gt;
&lt;br /&gt;
The easiest way to create, set (and delete if necessary) [[#ODB Keys|ODB keys]] is to use the [[ODB Page]] of the web server [[mhttpd]]. This also includes creating &#039;&#039;&#039;subdirectories&#039;&#039;&#039; and &#039;&#039;&#039;symbolic links&#039;&#039;&#039;. See [[ODB Page#Create an ODB key]] for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, [[odbedit]] can be used as demonstrated in the following example. [[Odbedit]] is more powerful, also allowing the user to for example re-order, copy or rename  the keys (see [[odbedit command list]]).&lt;br /&gt;
&lt;br /&gt;
Once a directory is created, keys can be created of the types supported by MIDAS (see [[Midas Data Types]]), e.g. INT DWORD BOOL FLOAT DOUBLE STRING.  Arrays of all these types can also be created. Values are then assigned to the keys using the {{Odbedit cmd|cmd=set}}.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
This example shows how to create an ODB tree (&amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Custom&amp;lt;/span&amp;gt;) using [[odbedit]]. Creating the same tree using the [[ODB Page]] is easy (see [[ODB Page#Create an ODB key]] for more information).&lt;br /&gt;
 &lt;br /&gt;
The [[odbedit]] commands are shown in red. Comments are shown in green and preceded by a &amp;quot;#&amp;quot;.&lt;br /&gt;
 $ odbedit   &lt;br /&gt;
 [local:midas:S]/&amp;gt;pwd    &amp;lt;span style=&amp;quot;color:green; font-style:normal&amp;quot;&amp;gt;# show current directory (tree) &amp;lt;/span&amp;gt;&lt;br /&gt;
 /&lt;br /&gt;
 [local:midas:S]/&amp;gt;&amp;lt;span style=&amp;quot;color:red; font-style:normal&amp;quot;&amp;gt;mkdir custom/images&amp;lt;/span&amp;gt;    &amp;lt;span style=&amp;quot;color:green; font-style:normal&amp;quot;&amp;gt;# make directory &amp;quot;custom&amp;quot; and subdirectory &amp;quot;images&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
 [local:midas:S]/&amp;gt;&amp;lt;span style=&amp;quot;color:red; font-style:normal&amp;quot;&amp;gt;ls&amp;lt;/span&amp;gt;  &amp;lt;span style=&amp;quot;color:green; font-style:normal&amp;quot;&amp;gt;# list all keys&amp;lt;/span&amp;gt;&lt;br /&gt;
 System&lt;br /&gt;
 Programs&lt;br /&gt;
 Experiment&lt;br /&gt;
 Runinfo&lt;br /&gt;
 Alarms&lt;br /&gt;
 Custom&lt;br /&gt;
 [local:midas:S]/&amp;gt;&amp;lt;span style=&amp;quot;color:red; font-style:normal&amp;quot;&amp;gt;cd custom &amp;lt;/span&amp;gt;  &amp;lt;span style=&amp;quot;color:green; font-style:normal&amp;quot;&amp;gt;# change directory to &amp;quot;/custom&amp;quot; &amp;lt;/span&amp;gt;&lt;br /&gt;
 [local:midas:S]/custom&amp;gt;&amp;lt;span style=&amp;quot;color:red; font-style:normal&amp;quot;&amp;gt;ls&amp;lt;/span&amp;gt;&lt;br /&gt;
 images&lt;br /&gt;
 [local:midas:S]/custom&amp;gt;&amp;lt;span style=&amp;quot;color:red; font-style:normal&amp;quot;&amp;gt;create string &amp;quot;custom page&amp;amp;&amp;quot;&amp;lt;/span&amp;gt;  &amp;lt;span style=&amp;quot;color:green; font-style:normal&amp;quot;&amp;gt;# Create a key of type STRING. Note use of quotes as key name contains a space &amp;lt;/span&amp;gt;&lt;br /&gt;
 String length [32]: 128&lt;br /&gt;
 [local:midas:S]/custom&amp;gt;&amp;lt;span style=&amp;quot;color:red; font-style:normal&amp;quot;&amp;gt;set &amp;quot;custom page&amp;amp;&amp;quot; /home/midas/custom/custom.html&amp;lt;/span&amp;gt;  &amp;lt;span style=&amp;quot;color:green; font-style:normal&amp;quot;&amp;gt;# Set key to a value. &lt;br /&gt;
 #             Could type instead &amp;quot;set cus&amp;quot; followed by tab to demonstrate tab-completion &amp;lt;/span&amp;gt;&lt;br /&gt;
 [local:midas:S]/custom&amp;gt;&amp;lt;span style=&amp;quot;color:red; font-style:normal&amp;quot;&amp;gt;ls -r&amp;lt;/span&amp;gt;  &amp;lt;span style=&amp;quot;color:green; font-style:normal&amp;quot;&amp;gt;# list recursively &amp;lt;/span&amp;gt;&lt;br /&gt;
 custom&lt;br /&gt;
    images&lt;br /&gt;
    custom page&amp;amp;           /home/midas/custom/custom.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating arrays ==&lt;br /&gt;
Creating arrays in the ODB is simple using the [[ODB Page]] (see [[ODB Page#Create an ODB key]] for more information).&lt;br /&gt;
&lt;br /&gt;
The following example demonstrates the use of [[odbedit]] to create an array, set its elements to various value, and expand it. An array can be truncated using the [[odbedit]] &#039;&#039;trunc&#039;&#039; command.&lt;br /&gt;
 [local:pol:S]/test&amp;gt;create int fred[5]&lt;br /&gt;
 [local:pol:S]/test&amp;gt;set fred[*] 5&lt;br /&gt;
 [local:pol:S]/test&amp;gt;set fred[1..3] 6&lt;br /&gt;
 [local:pol:S]/test&amp;gt;set fred[8] 9&lt;br /&gt;
 [local:pol:S]/test&amp;gt;ls&lt;br /&gt;
 fred&lt;br /&gt;
                                5&lt;br /&gt;
                                6&lt;br /&gt;
                                6&lt;br /&gt;
                                6&lt;br /&gt;
                                5&lt;br /&gt;
                                0&lt;br /&gt;
                                0&lt;br /&gt;
                                0&lt;br /&gt;
                                9&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reordering ODB keys ==&lt;br /&gt;
Sometimes it may be desired to reorder the ODB keys once created. This must be done using [[odbedit]]. &lt;br /&gt;
&lt;br /&gt;
The  {{Odbedit cmd|cmd=move}} is used for this purpose as in the following example:&lt;br /&gt;
&lt;br /&gt;
The key &amp;quot;custom&amp;quot; can be moved to the top (or bottom) of the list, e.g.&lt;br /&gt;
 &lt;br /&gt;
 [local:midas:S]/&amp;gt;ls&lt;br /&gt;
 System&lt;br /&gt;
 Programs&lt;br /&gt;
 Experiment&lt;br /&gt;
 Runinfo&lt;br /&gt;
 Alarms&lt;br /&gt;
 Custom&lt;br /&gt;
&lt;br /&gt;
The key &amp;quot;Custom&amp;quot; can be moved to the top&lt;br /&gt;
&lt;br /&gt;
 [local:midas:S]/&amp;gt;move custom top&lt;br /&gt;
 [local:midas:S]/&amp;gt;ls&lt;br /&gt;
 Custom&lt;br /&gt;
 System&lt;br /&gt;
 Programs&lt;br /&gt;
 Experiment&lt;br /&gt;
 Runinfo&lt;br /&gt;
 Alarms&lt;br /&gt;
&lt;br /&gt;
or to any position, e.g.&lt;br /&gt;
&lt;br /&gt;
 [local:midas:Stopped]/&amp;gt;move custom 1&lt;br /&gt;
 [local:midas:Stopped]/&amp;gt;ls&lt;br /&gt;
 System&lt;br /&gt;
 Custom&lt;br /&gt;
 Programs&lt;br /&gt;
 Experiment&lt;br /&gt;
 Runinfo&lt;br /&gt;
 Alarms&lt;br /&gt;
&lt;br /&gt;
== Create a subdirectory in the ODB ==&lt;br /&gt;
Creating a subdirectory is very easy to do using the [[ODB Page]]. See [[ODB Page#Create an ODB key|Create an ODB key]].&lt;br /&gt;
&lt;br /&gt;
Using [[odbedit]], select the desired directory using {{Odbedit cmd|cmd=cd}} then make the directory with {{Odbedit cmd|cmd=mkdir}} e.g.&lt;br /&gt;
&lt;br /&gt;
 [local:test:S]cd /Experiment&lt;br /&gt;
 [local:test:S]mkdir &amp;quot;edit on start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Create a symbolic link in the ODB ==&lt;br /&gt;
Creating a symbolic link is easy to do using the [[ODB Page]]. See [[ODB Page#Create an ODB key|Create an ODB key]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Creating the same symbolic link with [[odbedit]]&lt;br /&gt;
 [local:test:S]cd /Experiment/edit on start&lt;br /&gt;
 [local:test:S]Edit on Start&amp;gt; ln &amp;quot;/logger/write data&amp;quot; &amp;quot;write data&amp;quot;&lt;br /&gt;
 [local:test:S]Edit on Start&amp;gt; ls&lt;br /&gt;
 write data -&amp;gt; /logger/write data&lt;br /&gt;
                                y&lt;br /&gt;
&lt;br /&gt;
= Save and reload the ODB =&lt;br /&gt;
The ODB can be saved at its current position in several formats (ascii, xml as a c structure) using the [[odbedit]] &#039;&#039;save&#039;&#039; command, and reloaded from a saved file with the [[odbedit]] &#039;&#039;load&#039;&#039; command.&lt;br /&gt;
; NOTE&lt;br /&gt;
: JSON format has been added (January 2016). See [[#JSON]].&lt;br /&gt;
&lt;br /&gt;
e.g. to save the ODB into a file in the local directory in ASCII format :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[local:exp:Stopped]/&amp;gt;save my_exp.odb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and to load the ODB from a previously saved file in the local directory :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[local:npet:Stopped]/&amp;gt;load saved.odb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since the ODB may become [[#Corrupted ODB|corrupted]],  a copy is saved automatically at the beginning of each run. Since this file is overwritten each time, users often also save a copy (that will not be overwritten) at the end of each run (see [[Keys in the ODB /Logger tree#ODB Dump|ODB Dump]]) along with the data for that run. (The ODB contents can also be sent to the logging channel and saved with the run data - see [[Keys in the ODB /Logger/Channels tree #ODB Dump|ODB Dump in /Logger/Channels subtree]]).&lt;br /&gt;
&lt;br /&gt;
Users can then return their ODB to the state it was in for any particular run.&lt;br /&gt;
&lt;br /&gt;
The entire database need not be loaded. Saved ASCII files can be made of just a part of the database, and these can be reloaded into the database. Since the full path is given in the saved file, the file can be loaded from any position in the database.&lt;br /&gt;
&lt;br /&gt;
The saved ASCII file may of course be edited prior to loading, if keynames or values need to be changed. If the keys in the load file do not exist, they will be created. If they do exist, the values from the file will be loaded.&lt;br /&gt;
&lt;br /&gt;
= &#039;&#039;&#039;experim.h&#039;&#039;&#039; include file =&lt;br /&gt;
&lt;br /&gt;
The [[odbedit]] &#039;&#039;&#039;make&#039;&#039;&#039; command creates &amp;quot;&#039;&#039;experim.h&#039;&#039;&amp;quot;, a file containing a C structure and ascii representation of part of the ODB. The file is created in the current directory. &lt;br /&gt;
e.g.&lt;br /&gt;
 [local:midas:S]/&amp;gt;make&lt;br /&gt;
 Analyzer &amp;quot;Analyzer&amp;quot; not found in ODB, skipping analyzer parameters.&lt;br /&gt;
 &amp;quot;experim.h&amp;quot; has been written to /home/midas/online&lt;br /&gt;
&lt;br /&gt;
The file &#039;&#039;experim.h&#039;&#039; contains C structures for the ODB trees &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Experiment, /Analyzer/Parameters&amp;lt;/span&amp;gt;, and &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Equipment/&amp;lt;equipment-name&amp;gt;/Settings&amp;lt;/span&amp;gt; if these trees are present.   All C structures are accompanied by a string representation which can be used in the &#039;&#039;db_create_record&#039;&#039; function to setup an ODB structure which matches the required C structure, ensuring that the required keys are present in the ODB (see&lt;br /&gt;
[[Frontend user code#Function begin_of_run|Frontend]] or [[Event Notification (Hot-Link)#How to set up a Hot-Link|setting up a hot link]]). &lt;br /&gt;
&lt;br /&gt;
If the name of the analyzer is not the default (i.e. &amp;quot;Analyzer&amp;quot;), then in order to include the analyzer section, the ODB key &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/&amp;lt;Analyzer-name&amp;gt;/Parameters&amp;lt;/span&amp;gt; has to be present, where &amp;lt;Analyzer-name&amp;gt; is the name of the analyzer. &lt;br /&gt;
&lt;br /&gt;
The command used is then &amp;quot;make &amp;lt;Analyzer-name&amp;gt; &amp;quot;.&lt;br /&gt;
&lt;br /&gt;
An example &#039;&#039;experim.h&#039;&#039; can be found at&lt;br /&gt;
[http://ladd00.triumf.ca/~daqweb/doc/midas/examples/Triumf/c/experim.h].&lt;br /&gt;
&lt;br /&gt;
= JSON =&lt;br /&gt;
New commands have been added (January 2016) which correspond to JSON encoding of ODB data see [[mjsonrpc#JSON encoding of ODB data]]. &lt;br /&gt;
The command  {{Odbedit cmd|cmd=json}} encodes all ODB data and metadata. ODB can be fully reloaded or restored from ODB JSON save files.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ odbedit&lt;br /&gt;
[local:js:S]&amp;gt;cd /Equipment/rpcexample/variables&lt;br /&gt;
[local:js:S]Variables&amp;gt;ls&lt;br /&gt;
SLOW&lt;br /&gt;
                                1273&lt;br /&gt;
                                1376610644&lt;br /&gt;
                                74.31448279461522&lt;br /&gt;
[local:js:S]Variables&amp;gt;json&lt;br /&gt;
status: 1, json: {&lt;br /&gt;
  &amp;quot;SLOW/key&amp;quot; : { &amp;quot;type&amp;quot; : 10, &amp;quot;num_values&amp;quot; : 3, &amp;quot;access_mode&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1448506616 },&lt;br /&gt;
  &amp;quot;SLOW&amp;quot; : [ 1273, 1376610644, 7.4314482794615216e+01 ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The {{Odbedit cmd|cmd=jsls}}  encodes a single ODB directory and returns the full information printed by the {{Odbedit cmd|cmd=ls -l}}.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[local:js:S]Variables&amp;gt;jsls&lt;br /&gt;
jsls &amp;quot;/Equipment/RpcExample/Variables&amp;quot;, status: 1, json: {&lt;br /&gt;
  &amp;quot;SLOW/key&amp;quot; : { &amp;quot;type&amp;quot; : 10, &amp;quot;num_values&amp;quot; : 3, &amp;quot;access_mode&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1448506616 },&lt;br /&gt;
  &amp;quot;SLOW&amp;quot; : [ 1273, 1376610644, 7.4314482794615216e+01 ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The {{Odbedit cmd|cmd=jsvalues}}  list the data in a format for exporting ODB data to web pages: links are followed to their final values and ODB key names are converted to lower case for use with case-sensitive languages such as Javascript.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[local:js:S]Variables&amp;gt;jsvalues&lt;br /&gt;
status: 1, json: {&lt;br /&gt;
  &amp;quot;slow/name&amp;quot; : &amp;quot;SLOW&amp;quot;,&lt;br /&gt;
  &amp;quot;slow/last_written&amp;quot; : 1448506616,&lt;br /&gt;
  &amp;quot;slow&amp;quot; : [ 1273, 1376610644, 7.4314482794615216e+01 ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Corrupted ODB =&lt;br /&gt;
If the ODB becomes corrupted, [[odbedit]] may no longer work, and other clients will also fail to open the database. In this case, the old ODB should be deleted and a new one created. The contents of the ODB can be reloaded from a [[#Save and reload the ODB|saved ODB file]].&lt;br /&gt;
Follow the instructions in [[Recovery from Corrupted ODB]].&lt;br /&gt;
&lt;br /&gt;
= Accessing the ODB from a script =&lt;br /&gt;
The external command feature of [[odbedit]] (see [[Odbedit#Using an external command]]) allows for sophisticated scripts to be created that can manipulate the ODB.&lt;br /&gt;
Such scripts can for example&lt;br /&gt;
&lt;br /&gt;
*    check ODB parameters prior to beginning of run&lt;br /&gt;
*    send run parameters to the electronic logbook&lt;br /&gt;
*    set some ODB parameters when a script button on the [[mhttpd]] main status page is pressed&lt;br /&gt;
*    load a particular saved odb file when a button on a custom page is pressed (e.g. load a &amp;quot;tune&amp;quot;) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Examples of shell scripts that may send [[odbedit]] commands :&lt;br /&gt;
&lt;br /&gt;
*    script run at end-of-run or begin-of-run  (see [[#Example end-of-run script|below]])&lt;br /&gt;
*    script run when a [[/Script ODB tree#Script-button|script-button]] or [[Custom Page Features#CustomScript Buttons|Customscript button]] is pressed&lt;br /&gt;
&lt;br /&gt;
Script writers may find it useful to [#Message Page and message log|send messages to the MIDAS message log]] to indicate progress or error.&lt;br /&gt;
&lt;br /&gt;
== Example end-of-run script ==&lt;br /&gt;
The following is part of a script run at end-of-run, where it reads some parameters from the odb and saves them in a temporary file to be sent to the elog.&lt;br /&gt;
&lt;br /&gt;
To make the script run at end of run, the name of the script is entered in the ODB key {{Odbpath|path=/Programs/Execute on stop run}} (see [[/Programs ODB tree#Execute on stop run]]). Similarly, a script may be made to run at the beginning of run by entering its name in the ODB key  {{Odbpath|path=/Programs/Execute on start run}} (see [[/Programs ODB tree#Execute on start run]]). &lt;br /&gt;
&lt;br /&gt;
 #!/bin/tcsh&lt;br /&gt;
 # This script is started at the end of each run. It takes some parameters&lt;br /&gt;
 # from the odb and creates an entry in the elog &lt;br /&gt;
 .....&lt;br /&gt;
 # Start collecting information from ODB first&lt;br /&gt;
 set Run_number = `odb -e $MIDAS_EXPT_NAME -c &#039;ls &amp;quot;/Runinfo/Run number&amp;quot;&#039;`&lt;br /&gt;
 set number = `echo $Run_number | awk &#039;{print $3}&#039;`&lt;br /&gt;
 set sample = `odb -e $MIDAS_EXPT_NAME -c &#039;ls &amp;quot;/Experiment/Edit on Start/sample&amp;quot;&#039;`&lt;br /&gt;
 set Sample = `echo $sample | awk &#039;{print $2}&#039;`&lt;br /&gt;
 .....&lt;br /&gt;
 # Now create the temporary file to be sent to the elog&lt;br /&gt;
 echo &amp;quot;Run # $number&amp;quot; &amp;gt;&amp;gt; $fin&lt;br /&gt;
 odb -e $MIDAS_EXPT_NAME -c &#039;ls &amp;quot;/Runinfo/Start time&amp;quot;&#039; &amp;gt;&amp;gt; $fin&lt;br /&gt;
 odb -e $MIDAS_EXPT_NAME -c &#039;ls &amp;quot;/Runinfo/Stop time&amp;quot;&#039; &amp;gt;&amp;gt; $fin&lt;br /&gt;
 echo &amp;quot;$Sample at T = $T K, H = $H T and RF = $RF mW&amp;quot;&amp;gt;&amp;gt; $fin&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
= Chat command =&lt;br /&gt;
The  {{Odbedit cmd|cmd=chat}} can be used to communicate between users, each running  {{Utility|name=odbedit}} clients. The chat messages are also (sing Aug 2016) sent to the  {{Utility|name=mhttpd}} [[Chat Page]]. The  {{Odbedit cmd|cmd=msg}} can be also be used interactively to generate chat messages. If chat messages do not appear in the [[Chat Page]] see [[#Troubleshooting]].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[local:js:S]/&amp;gt;chat&lt;br /&gt;
Your name&amp;gt; george&lt;br /&gt;
Exit chat mode with empty line.&lt;br /&gt;
&amp;gt; Are you there?&lt;br /&gt;
[george,USER] Are you there?&lt;br /&gt;
19:33:59 [fred,USER] Hallo George&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Msg command - send a message  =&lt;br /&gt;
The parameters of the {{Odbedit cmd|cmd=msg}} have been changed (August 2016). The  {{Odbedit cmd|cmd=msg}} now works differently &#039;&#039;&#039;interactively&#039;&#039;&#039; than from the [[odbedit#Using an external command|command line]]. A hidden parameter &amp;quot;facility&amp;quot; has been added, which is either set to &amp;quot;chat&amp;quot; or &amp;quot;midas&amp;quot;.&lt;br /&gt;
== To web server Chat page ==&lt;br /&gt;
&#039;&#039;&#039;Interactively&#039;&#039;&#039;, the  {{Odbedit cmd|cmd=msg}} works like the [[#Chat command]], sending a chat message which appears on the web server [[Chat Page]] and on any other  {{Utility|name=odbedit}} session for that experiment. The chat message does NOT appear in the MIDAS [[Message System#midas.log|message log]] or [[Message Page]]. In this case, the &amp;quot;facility&amp;quot; is hard-coded as &amp;quot;chat&amp;quot; and there are two parameters, &amp;quot;user&amp;quot; and &amp;quot;message&amp;quot;, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[local:js:S]/&amp;gt;msg fred &amp;quot;hi, are you there?&amp;quot;&lt;br /&gt;
[fred,USER] hi, are you there?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== To web server Message Page and message log ==&lt;br /&gt;
To send a message to the webserver [[Message Page]] and the  [[Message System#midas.log|message logfile]] ( {{File|name=midas.log}}) use the [[odbedit#Using an external command|command line]] with the  {{Odbedit cmd|cmd=msg}}. In this case, the &amp;quot;facility&amp;quot; is hard-coded as &amp;quot;midas&amp;quot;, and there are three parameters, two of which are optional:&lt;br /&gt;
; type  (optional)&lt;br /&gt;
: Default is 8 (MT_USER). If supplied, it must be set to one of the &#039;&#039;&#039;numerical&#039;&#039;&#039; values 1 (MT_ERROR), 2 (MT_INFO), 4 (MT_DEBUG) or 8 (MT_USER),  as defined in [http://ladd00.triumf.ca/~daqweb/doc/midas-devel/html/ midas.h].&lt;br /&gt;
; name  (optional)&lt;br /&gt;
: Ignored unless the type is MT_ERROR. Default is &amp;quot;script&amp;quot;.&lt;br /&gt;
; message&lt;br /&gt;
: the message to be sent, enclosed in quotes if it includes spaces&lt;br /&gt;
&lt;br /&gt;
See Table 1 below for examples.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 : examples of  {{Odbedit cmd|cmd=msg}}&lt;br /&gt;
|-&lt;br /&gt;
! odbedit -c &#039;msg  command&#039; !!colspan=&#039;2&#039;| Type !! Name !! Resulting Message !! Explanation&lt;br /&gt;
|-&lt;br /&gt;
| &#039;msg 2 &amp;quot;testing 123&amp;quot; &#039; &lt;br /&gt;
|  2&lt;br /&gt;
|  &#039;&#039;&#039;MT_INFO&#039;&#039;&#039; &lt;br /&gt;
| &lt;br /&gt;
|  [ODBEdit,&#039;&#039;&#039;INFO&#039;&#039;&#039;] testing 123&lt;br /&gt;
|  Message type supplied. Program name set to &amp;quot;ODBEdit&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;msg &amp;quot;testing 123&amp;quot; &#039;&lt;br /&gt;
| 8&lt;br /&gt;
|  &#039;&#039;&#039;MT_USER&#039;&#039;&#039;&lt;br /&gt;
| &lt;br /&gt;
|   [script,&#039;&#039;&#039;USER&#039;&#039;&#039;] testing 123&lt;br /&gt;
| Message type omitted, defaults to MT_USER &amp;lt;br&amp;gt;which sets program name to &amp;quot;script&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|  &#039;msg 1 my_name &amp;quot;error message&amp;quot; &#039;&lt;br /&gt;
| 1&lt;br /&gt;
| &#039;&#039;&#039;MT_ERROR&#039;&#039;&#039;&lt;br /&gt;
| my_name&lt;br /&gt;
|[ODBEdit,&#039;&#039;&#039;ERROR&#039;&#039;&#039;] [odbedit.cxx:2490:my_name,ERROR] error message&lt;br /&gt;
| Name parameter is supplied. Error message appears with a red background.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;msg 1 &amp;quot;error message&amp;quot; &#039;  &lt;br /&gt;
| 1&lt;br /&gt;
| &#039;&#039;&#039;MT_ERROR &#039;&#039;&#039;&lt;br /&gt;
| &lt;br /&gt;
| [ODBEdit,&#039;&#039;&#039;ERROR&#039;&#039;&#039;] [odbedit.cxx:2490:script,ERROR] error message&lt;br /&gt;
| Name parameter omitted,  default name is &amp;quot;script&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Troubleshooting ===&lt;br /&gt;
If the message does not appear on the [[Chat Page]] (interactive) or [[Message Page]] (command line),  check that the ODB key  [[Keys in the ODB /Logger tree#Data dir|/Logger/Data dir]] is set to a &#039;&#039;&#039;full directory path&#039;&#039;&#039;, such as &#039;&#039;/home/user/online/js&#039;&#039;, not a relative path such as the current directory &amp;quot;./&amp;quot;. If set to a full directory path, all clients will use the &#039;&#039;&#039;same&#039;&#039;&#039;  {{File|name=midas.log}} file, regardless of which directory they were started from. With a relative path,  {{Utility|name=mhttpd}} and  {{Utility|name=odbedit}} must be started in the same directory&lt;br /&gt;
for messages/chat to appear in the appropriate [[mhttpd]] page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:ODB]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Installation/Compilation_problems&amp;diff=2799</id>
		<title>Installation/Compilation problems</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Installation/Compilation_problems&amp;diff=2799"/>
		<updated>2018-11-21T00:14:34Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
== Installation/Compilation Problems ==&lt;br /&gt;
&lt;br /&gt;
=== SSL certificate errors ===&lt;br /&gt;
&lt;br /&gt;
At some sites you might get a SSL server certificate error during the git clone operation, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
error: SSL certificate problem, verify that the CA cert is OK. Details:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This indicates that you don&#039;t have the proper certificate authority (CA) files installed on your computer. Possible solutions:&lt;br /&gt;
&lt;br /&gt;
* The easiest way out is to tell git to ignore the SSL verification with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 git config --global http.sslVerify false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Set the environment variable GIT_SSL_NO_VERIFY=true.&lt;br /&gt;
* But the best solution is to just actually install the correct certificate authority files.&lt;br /&gt;
&lt;br /&gt;
=== CERNLIB Errors ===&lt;br /&gt;
&lt;br /&gt;
There are some older analyzer programs included in MIDAS that use PAW/HBOOK.  MIDAS will try to build these programs if you have the CERNLIB environment variable set.  This may cause errors trying to build mana.cxx, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gcc  -Dextname -DHAVE_HBOOK -c -g -O2 -Wall -Wno-strict-aliasing -Wuninitialized -Iinclude -Idrivers -I../mxml -I./mscb &lt;br /&gt;
-DHAVE_FTPLIB -D_LARGEFILE64_SOURCE -DHAVE_ROOT -pthread -m64 -I/usr/local/packages/root-5.32/include/root -DHAVE_ZLIB &lt;br /&gt;
-DHAVE_MSCB -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/hmana.o src/mana.cxx&lt;br /&gt;
src/mana.cxx: In function &#039;INT book_ntuples()&#039;:&lt;br /&gt;
src/mana.cxx:791: error: invalid conversion from &#039;const void*&#039; to &#039;void*&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unless you care about this functionality, the easiest solution is to unset the environment variable CERNLIB before compiling.&lt;br /&gt;
&lt;br /&gt;
=== MacOS 10.11 (El Capitan) openssl errors === &lt;br /&gt;
&lt;br /&gt;
Starting with version 10.11, MacOS has removed the openssl header files (they have been apparently deprecated for a while).    This causes a compiler error when trying to build the mongoose web server that MIDAS uses:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gcc  -c -g -O2 -Wall &amp;lt;snip&amp;gt; src/mongoose.c&lt;br /&gt;
src/mongoose.c:322:10: fatal error: &#039;openssl/ssl.h&#039; file not found&lt;br /&gt;
#include &amp;lt;openssl/ssl.h&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to fix this you need to install the openssl libraries using MacPorts.  If you haven&#039;t used MacPorts, the instructions would be &lt;br /&gt;
&lt;br /&gt;
# Install MacPorts using [https://www.macports.org/install.php MacPorts Installation Guide]&lt;br /&gt;
# Install the openssl library&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo port install openssl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Once you&#039;ve done that the installation will work correctly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]] [[Category:Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Category:Troubleshooting&amp;diff=2798</id>
		<title>Category:Troubleshooting</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Category:Troubleshooting&amp;diff=2798"/>
		<updated>2018-11-21T00:12:19Z</updated>

		<summary type="html">&lt;p&gt;Suz: Created page with &amp;quot;Category:Contents&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Contents]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=FAQ&amp;diff=2797</id>
		<title>FAQ</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=FAQ&amp;diff=2797"/>
		<updated>2018-11-21T00:10:49Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Frequently Asked Questions =&lt;br /&gt;
&lt;br /&gt;
There is a related page of [[Installation/Compilation problems|Common Installation Problems]].&lt;br /&gt;
__FORCETOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How to recover from a corrupted ODB ==&lt;br /&gt;
&lt;br /&gt;
* Stop your front-ends, [[mlogger]], [[mhttpd]], etc.&lt;br /&gt;
* Remove the shared memory associated to ODB buffer. Find the shared memory segment by doing &lt;br /&gt;
 ls -l /dev/shm&lt;br /&gt;
then remove the segment that will be something like /dev/shm/*_test_ODB_SHM&lt;br /&gt;
* Move the old ODB files. These will be in the location given by [[Exptab]], e.g. ~/online&lt;br /&gt;
 cd online&lt;br /&gt;
 mv .ODB.SHM .ODB.SHM.BAD&lt;br /&gt;
* Restart ODB with larger size using [[odbedit]] e.g.&lt;br /&gt;
 odbedit -s 100000000&lt;br /&gt;
* Reload the last saved ODB dump you have (see [[ODB#Save and reload the ODB|save and reload the ODB]]). These dumps are typically called something like &#039;online/history/*.xml&#039;.&lt;br /&gt;
So from  {{Utility|name=odbedit}} you do something like&lt;br /&gt;
 odbedit&amp;gt; load history/run00071.xml&lt;br /&gt;
* Your ODB should now be fixed.&lt;br /&gt;
&lt;br /&gt;
Note that sometimes it seems that you also need to remove the buffers associated with the system messages (called SYSMSG) as well as the buffers associated with the ODB.&lt;br /&gt;
&lt;br /&gt;
See also [[odbinit]].&lt;br /&gt;
&lt;br /&gt;
== How to get odbedit to show run state == &lt;br /&gt;
&lt;br /&gt;
Question: I&#039;ve seen the ODB prompt displaying the run state, how do you do that?&lt;br /&gt;
&lt;br /&gt;
Answer: Modify the /System/prompt field. The &amp;quot;S&amp;quot; is the trick.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 Fri&amp;gt; odb -e bnmr1 -h isdaq01&lt;br /&gt;
 [host:expt:Stopped]/cd /System/&lt;br /&gt;
 [host:expt:Stopped]/System&amp;gt;ls&lt;br /&gt;
 Clients&lt;br /&gt;
 Client Notify                   0&lt;br /&gt;
 Prompt                          [%h:%e:%S]%p&lt;br /&gt;
 Tmp&lt;br /&gt;
 [host:expt:Stopped]/System&lt;br /&gt;
 [host:expt:Stopped]/Systemset prompt [%h:%e:%S]%p&amp;gt;&lt;br /&gt;
 [host:expt:Stopped]/System&amp;gt;ls&lt;br /&gt;
 Clients&lt;br /&gt;
 Client Notify                   0&lt;br /&gt;
 Prompt                          [%h:%e:%S]%p&amp;gt;&lt;br /&gt;
 Tmp&lt;br /&gt;
 [host:expt:Stopped]/System&amp;gt;set Prompt [%h:%e:%s]%p&amp;gt;&lt;br /&gt;
 [host:expt:S]/System&amp;gt;set Prompt [%h:%e:%S]%p&amp;gt;&lt;br /&gt;
 [host:expt:Stopped]/System&amp;gt;     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[/System ODB tree#Prompt]].&lt;br /&gt;
&lt;br /&gt;
== Increasing Number of Hot-links ==&lt;br /&gt;
&lt;br /&gt;
MIDAS, by default, allows you to have a maximum of 256 individual [[Event Notification (Hot-Link)|hot-links]] to be registered.  If you find that you need more hot-links than that, follow the procedure below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Use odbedit to save current ODB&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
odbedit&lt;br /&gt;
save current_odb.odb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Stop all the running MIDAS processes, including mlogger and mserver using the web&lt;br /&gt;
interface. Then stop mhttpd as well.  To stop mhttpd just do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
killall mhttpd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Remove your old ODB (we will recreate it after modifying MIDAS, using the backup you just&lt;br /&gt;
made).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv .ODB.SHM .ODB.SHM.20161104&lt;br /&gt;
rm /dev/shm/&amp;lt;expname&amp;gt;_ODB_SHM&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;expname&amp;gt; is the name of your experiment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Make the following modifications to midas.  In this particular case I have increased the&lt;br /&gt;
max number of open records from 256 to 1024.  You would need to change the constants if you&lt;br /&gt;
want to change to other values&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff --git a/include/midas.h b/include/midas.h&lt;br /&gt;
index 02b30dd..33be7be 100644&lt;br /&gt;
--- a/include/midas.h&lt;br /&gt;
+++ b/include/midas.h&lt;br /&gt;
@@ -254,7 +254,7 @@ typedef std::vector&amp;lt;std::string&amp;gt; STRING_LIST;&lt;br /&gt;
-#define MAX_OPEN_RECORDS       256           /**&amp;lt; number of open DB records   */&lt;br /&gt;
+#define MAX_OPEN_RECORDS       1024           /**&amp;lt; number of open DB records   */&lt;br /&gt;
diff --git a/src/odb.c b/src/odb.c&lt;br /&gt;
index 47ace8f..ac1bef3 100755&lt;br /&gt;
--- a/src/odb.c&lt;br /&gt;
+++ b/src/odb.c&lt;br /&gt;
@@ -699,8 +699,8 @@ static void db_validate_sizes()&lt;br /&gt;
-   assert(sizeof(DATABASE_CLIENT) == 2112);&lt;br /&gt;
-   assert(sizeof(DATABASE_HEADER) == 135232);&lt;br /&gt;
+   assert(sizeof(DATABASE_CLIENT) == 8256);&lt;br /&gt;
+   assert(sizeof(DATABASE_HEADER) == 528448);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The calculation is as follows (in case you want a different number of open records): &lt;br /&gt;
DATABASE_CLIENT = 64 + 8*MAX_OPEN_ERCORDS = 64 + 8*1024 = 8256&lt;br /&gt;
DATABASE_HEADER = 64 + 64*DATABASE_CLIENT = 64 + 64*8256 = 528448&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Rebuild MIDAS&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd $MIDASSYS&lt;br /&gt;
make clean; make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Create new ODB&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
odbedit -s 1000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note, you should change the size of the ODB to whatever you need.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; reload your original ODB &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[local:exp:Stopped] load  current_odb.odb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt; Rebuild all your frontend programs (and other user-specific programs) against new MIDAS; they should then work and you should be able to produce more open records.&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Application_listing&amp;diff=2796</id>
		<title>Application listing</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Application_listing&amp;diff=2796"/>
		<updated>2018-11-20T23:35:56Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
The MIDAS package after [[Compilation &amp;amp; Build]] will contain a new directory &lt;br /&gt;
:    &amp;lt;span style=&amp;quot;color:#005c1F; font-style:italic &amp;quot;&amp;gt;$MIDASSYS/linux/&amp;lt;/span&amp;gt;  &amp;lt;span style=&amp;quot;color:white;&amp;quot;&amp;gt;space&amp;lt;/span&amp;gt; or &amp;lt;span style=&amp;quot;color:white;&amp;quot;&amp;gt;space&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#005c1F; font-style:italic &amp;quot;&amp;gt;$MIDASSYS/linux-m32/&amp;lt;/span&amp;gt;&lt;br /&gt;
under which the MIDAS library (in {{Filepath|path=../lib}}) and the images (in {{Filepath|path=../bin}}) will be placed. Most of the MIDAS applications are located here. There a few other applications that can be manually built under {{Filepath|path=/$MIDASSYS/utils}} as well. &lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[dio]]&#039;&#039;&#039;  &amp;amp;rarr; &#039;&#039;Direct I/O driver utility&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[Frontend Application]]&#039;&#039;&#039; &amp;amp;rarr; &#039;&#039;User-built - communicates with hardware &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[hvedit]]&#039;&#039;&#039; &amp;amp;rarr; &#039;&#039;High Voltage editor and GUI&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[lazylogger]]&#039;&#039;&#039; &amp;amp;rarr; &#039;&#039;Data archiver&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[mlogger]]&#039;&#039;&#039; &amp;amp;rarr; &#039;&#039;Event logger&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[mchart]]&#039;&#039;&#039; &amp;amp;rarr; &#039;&#039;Assembles data for stripchart&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[Mdump|mdump]]&#039;&#039;&#039; &amp;amp;rarr; &#039;&#039;Display contents of event banks&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[Melog|melog]]&#039;&#039;&#039;  &amp;amp;rarr; &#039;&#039;Send information to elog&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[mevb]]&#039;&#039;&#039; &amp;amp;rarr; &#039;&#039;Event builder application&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[mh2sql]]&#039;&#039;&#039; &amp;amp;rarr; &#039;&#039;Import history files into SQL database&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[Mhdump|mhdump]]&#039;&#039;&#039;  &amp;amp;rarr; &#039;&#039;Display history events&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039;   &amp;amp;rarr; &#039;&#039;Webserver for Run Control&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[mlxspeaker]]&#039;&#039;&#039;   &amp;amp;rarr; &#039;&#039;Audible messaging&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[mserver]]&#039;&#039;&#039;   &amp;amp;rarr; &#039;&#039;Remote server&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[mstat]]&#039;&#039;&#039;   &amp;amp;rarr; &#039;&#039;Monitor and display&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[mtape]]&#039;&#039;&#039;    &amp;amp;rarr; &#039;&#039;Tape manipulator&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[odbedit]]&#039;&#039;&#039;  &amp;amp;rarr; &#039;&#039;ODB Editor/Run control&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[odbhist]]&#039;&#039;&#039; &amp;amp;rarr; &#039;&#039; ODB parameter history display&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[odbinit]]&#039;&#039;&#039; &amp;amp;rarr; &#039;&#039; Initialize ODB &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[[stripchart]]&#039;&#039;&#039;   &amp;amp;rarr; &#039;&#039;Stripchart data display&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Utilities]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Old_and_Obsolete_versions&amp;diff=2761</id>
		<title>Old and Obsolete versions</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Old_and_Obsolete_versions&amp;diff=2761"/>
		<updated>2018-01-05T03:00:01Z</updated>

		<summary type="html">&lt;p&gt;Suz: Created page with &amp;quot;{{Pagelinks}}  = Purpose = For various reasons, not all experimenters are able or willing to update to the latest MIDAS version in a timely fashion.  Therefore, documentation...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Purpose =&lt;br /&gt;
For various reasons, not all experimenters are able or willing to update to the latest MIDAS version in a timely fashion. &lt;br /&gt;
Therefore, documentation for old and/or obsolete versions of the MIDAS code and utilities will be moved to this area.&lt;br /&gt;
&lt;br /&gt;
= web server mhttpd =&lt;br /&gt;
There was an important change to the web server [[mhttpd]] in MIDAS versions downloaded after &#039;&#039;&#039;May 2015&#039;&#039;&#039;. Prior to May 2015, mhttpd was insecure.  The only way to secure this version was to run behind a firewall.  As part of the May 2015 upgrade to MIDAS [[Security]], a secure alternative to running behind a firewall was developed.  The MIDAS Web Server {{Utility|name=mhttpd}} was explicitly linked with OpenSSL to provide secure HTTPS connections via the [https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose] web server.  To connect to an experiment using {{Utility|name=mhttpd}}, a username and password are now required.&lt;br /&gt;
&lt;br /&gt;
== mhttpd - pre May 2015 ==&lt;br /&gt;
;Note&lt;br /&gt;
* HTTP-only (pre-May2015) versions of mhttpd should only be used &#039;&#039;&#039;behind a firewall&#039;&#039;&#039;&lt;br /&gt;
* If Web [[Security]] is an issue, update to the latest version of mhttpd which uses HTTPS/OpenSSL.&lt;br /&gt;
&lt;br /&gt;
=== Arguments ===&lt;br /&gt;
&lt;br /&gt;
    -p port        : port number e.g. 8080 (no default). See [[#Usage|usage]].&lt;br /&gt;
   [-h hostname ]  : see [[Common Parameters to MIDAS Utilities]]&lt;br /&gt;
   [-e experiment] : see [[Common Parameters to MIDAS Utilities]]&lt;br /&gt;
   [-v]            : display verbose HTTP communication&lt;br /&gt;
   [-D]            : starts program as a daemon&lt;br /&gt;
   [-E]            : only display ELog system&lt;br /&gt;
   [-H]            : only display history plots&lt;br /&gt;
   [-a hostname]   : only allow access for specific host(s). Several [-a Hostname] statements might be given&lt;br /&gt;
   [-help]  &lt;br /&gt;
&lt;br /&gt;
=== Usage ===  &lt;br /&gt;
The command &#039;&#039;&#039;mhttpd -p port&#039;&#039;&#039; can be used to start the web server. In this case, the TCP/IP port number is &#039;&#039;&#039;required&#039;&#039;&#039; as an argument in order to listen to the web-based request.&lt;br /&gt;
&amp;lt;br&amp;gt;e.g. if mhttpd is started on IP host machine &amp;quot;myhost&amp;quot; on port 8081 as follows&lt;br /&gt;
: mhttpd -p 8081 -D&lt;br /&gt;
access to the [[#Features|&#039;&#039;Midas status page&#039;&#039;]] can be obtained by pointing a web browser to &lt;br /&gt;
 http://myhost.mydomain:8081&lt;br /&gt;
&lt;br /&gt;
;Note &lt;br /&gt;
If [[Exptab|multiple experiments]] run on the same host, a web server for each experiment must be started on a different port, e.g.&lt;br /&gt;
           mhttpd -e expt1 -p 8081 -D&lt;br /&gt;
           mhttpd -e expt2 -p 8082 -D&lt;br /&gt;
&lt;br /&gt;
=== Improve Security with SSL Proxy ===&lt;br /&gt;
Improved security for HTTP is gained by using an SSL (https) proxy. See [[Setup MIDAS experiment#mhttpd with HTTP|Setting up an SSL proxy]].&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Contents]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Mhttpd&amp;diff=2760</id>
		<title>Mhttpd</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Mhttpd&amp;diff=2760"/>
		<updated>2018-01-05T02:53:57Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
= Links =&lt;br /&gt;
{{mhttpdpages3|[[Mhttpd.js|MIDAS Javascript Library]]|[[odbedit]]|[[Security]]}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Purpose =&lt;br /&gt;
The {{Utility|name=mhttpd}} utility runs the &#039;&#039;&#039;MIDAS Web Server&#039;&#039;&#039; which allows the user to communicate with an experiment using any web browser. It is used primarily for run control. &lt;br /&gt;
&lt;br /&gt;
= Web security =&lt;br /&gt;
&lt;br /&gt;
For &#039;&#039;&#039;maximum web security&#039;&#039;&#039;, {{Utility|name=mhttpd}} should be run behind a password-protected &#039;&#039;&#039;Apache HTTPS proxy&#039;&#039;&#039; (see [[Security]] for details).  {{Utility|name=mhttpd}} should be built with HTTPS and built-in passwords disabled, http access restricted to localhost (or the host of the httpd, if they are not the same).&lt;br /&gt;
&lt;br /&gt;
Alternatively, mhttpd can be run with &#039;&#039;&#039;good web security&#039;&#039;&#039; using password-protected secure HTTPS connections. This is the default case, where mhttpd is explicitly linked with OpenSSL to provide secure HTTPS connections via the [https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose] web server.  To connect to an experiment using {{Utility|name=mhttpd}}, a username and password are required.&lt;br /&gt;
By default, users can connect from anywhere, providing they know the correct username and password. However, web access can be restricted by using the {{Utility|name=mhttpd}} access control list in the ODB at [[/Experiment ODB tree#mhttpd hosts subtree|Allowed hosts]], and/or by using the &amp;quot;-a&amp;quot; argument to  {{Utility|name=mhttpd}}.&lt;br /&gt;
&lt;br /&gt;
= Arguments =&lt;br /&gt;
       -h connect to midas server [[mserver]] on given host&lt;br /&gt;
       -e experiment to connect to&lt;br /&gt;
       -v display verbose HTTP communication&lt;br /&gt;
       -D become a daemon&lt;br /&gt;
       -E only display ELog system&lt;br /&gt;
       -H only display history plots&lt;br /&gt;
       -a only allow access for specific host(s), several [-a Hostname] statements might be given (default list&lt;br /&gt;
                   in ODB at [[/Experiment ODB tree#mhttpd hosts subtree|/Experiment/security/mhttpd hosts/allowed hosts]])&lt;br /&gt;
       --http port - bind to specified HTTP port (default is ODB [[/Experiment ODB tree#midas http port|/Experiment/midas http port]])&lt;br /&gt;
       --https port - bind to specified HTTPS port (default is ODB [[/Experiment ODB tree#midas https port|/Experiment/midas https port]])&lt;br /&gt;
       -help display usage information&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
== To start the webserver using HTTPS/SSL (Mongoose) ==&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd&amp;quot;&#039;&#039; or &lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd -v&amp;quot;&#039;&#039; to get debug information, or&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd -D&amp;quot;&#039;&#039; to run in the background&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd -a myHost1 -a myHost2&amp;quot;&#039;&#039; to restrict web access&lt;br /&gt;
All are equivalent to&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd --https 8443 --http 8080&amp;quot;&#039;&#039;&lt;br /&gt;
Starting {{Utility|name=mhttpd}} like this will redirect the default HTTP port of 8080 to the secure HTTPS port 8443. If the ports are not supplied, the default ports will be read from the ODB keys [[/Experiment ODB tree#midas http port|midas http port]] and [[/Experiment ODB tree#midas https port|midas https port]]. If ports are supplied, their values will overwrite the default values stored in the ODB. When {{Utility|name=mhttpd}} is started with a secure port for the first time, a password file (and optionally an SSL certificate)  need to be created. See [[#HTTPS/SSL server (Mongoose)|mhttpd HTTPS/SSL server]] for more information.&lt;br /&gt;
&lt;br /&gt;
If {{Utility|name=mhttpd}} is started on IP host machine &amp;quot;myhost&amp;quot; using the default ports, the [[#Features|&#039;&#039;Midas status page&#039;&#039;]] can be accessed by pointing a web browser to &lt;br /&gt;
* https://myhost.mydomain:8443&lt;br /&gt;
* or to http://myhost.mydomain:8080 which will be redirected automatically to https://myhost.mydomain:8443&lt;br /&gt;
&lt;br /&gt;
The automatic redirect may be convenient for users who are used to using the older HTTP-only version of {{Utility|name=mhttpd}} with a particular HTTP port (e.g. 8080) for their experiment. The redirect can be disabled by setting the ODB key [[/Experiment ODB tree#http redirect to https|http redirect to https]] to &amp;quot;n&amp;quot;. This also bypasses the user authentification.&lt;br /&gt;
&lt;br /&gt;
== To start the webserver when running behind a firewall ==&lt;br /&gt;
In this case, only the http port is in use.&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd&amp;quot;&#039;&#039; or &lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd -v&amp;quot;&#039;&#039; to get debug information, or&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd -D&amp;quot;&#039;&#039; to run in the background&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd --http 8080&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The [[#Features|&#039;&#039;Midas status page&#039;&#039;]] can be accessed by pointing a web browser to &lt;br /&gt;
* http://myhost.mydomain:8080&lt;br /&gt;
&lt;br /&gt;
=== Multiple experiments ===&lt;br /&gt;
If [[Exptab|multiple experiments]] run on the same host, a web server for each experiment must be started on a different port, e.g.&lt;br /&gt;
*           &#039;&#039;&amp;quot;mhttpd -e expt1 -D&amp;quot;&#039;&#039;                           use default ports&lt;br /&gt;
*           &#039;&#039;&amp;quot;mhttpd -e expt2 --http 8081 --https 8444 -D&amp;quot;&#039;&#039;  use supplied ports&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Features =&lt;br /&gt;
The Midas web server {{Utility|name=mhttpd}} provides a means for run control including monitoring of the run parameters.&lt;br /&gt;
Its main feature is a web page invoked through any web browser accessing the Midas experimental URL at a defined port (see [[#Usage|Usage]]).  &lt;br /&gt;
&lt;br /&gt;
The contents of this &#039;&#039;&#039;Midas status page&#039;&#039;&#039; is composed with minimal information relative to the experiment. It contains a collection of buttons and links to other pages to further describe and control the configuration of the experiment. &lt;br /&gt;
&lt;br /&gt;
* Minimal display on the main [[Status Page]]&lt;br /&gt;
** Experiment name, time &amp;amp; date, page refresh rate&lt;br /&gt;
** Standard Menu Buttons (see below)&lt;br /&gt;
** User defined buttons (e.g. alias links, run scripts, custom pages etc.)&lt;br /&gt;
** run comments and condition display section (if enabled)&lt;br /&gt;
** Equipment list with current running condition, number of event received, event rate, data rate for each equipment.&lt;br /&gt;
** Data logging statistics (number of event recorded, data size recorder, compression factor, usage storage level) if enabled. &lt;br /&gt;
** Secondary Data logging (data mover) with statistics if enabled.&lt;br /&gt;
** Single line of the most recent Midas message.&lt;br /&gt;
** Table of the current applications connected to this experiment.&lt;br /&gt;
&lt;br /&gt;
* Standard Menu Buttons&lt;br /&gt;
** Transition the state of the run (stopped/running/paused), allows user running condition parameters to be entered at the start state (see [[Edit-on-start Parameters]]).&lt;br /&gt;
** Access to the full [[Online Database]] for data display and/or data content modification. &lt;br /&gt;
** Display the [[Message Page]], which shows messages generated by the MIDAS [Message System]] as well as the user using cm_msg() functions.&lt;br /&gt;
** Access to [[ELOG Page]] switches to the predefined &amp;quot;electronic logbook&amp;quot;.&lt;br /&gt;
** Access to the [[Alarms Page]] for monitoring the different type of alarms (evaluated, programs, internals, periodic).&lt;br /&gt;
** Access to the [[Programs Page]]  for a status or interaction with the current running applications part of the Midas experiment.&lt;br /&gt;
** Access to the [[History Page]] for graphical data representation of any ODB variables and acquired data.&lt;br /&gt;
** Access to the Midas Slow Control Bus devices [[MSCB Page]] connected to this experiment.&lt;br /&gt;
** Access to the [[Sequencer Page]] control/monitoring page for [[Sequencer]] i.e. interactive loading/saving/running of a run sequence based on any ODB parameters.&lt;br /&gt;
** Access to the [[Chat Page]] for communication between users on the same experiment.&lt;br /&gt;
** Access to the [[Help Page]] with short-cut to the Midas Help documentation resource and other information.&lt;br /&gt;
* Links&lt;br /&gt;
** links to all the listed equipments invoking a dedicated page for the display and possible control of the equipment parameters.&lt;br /&gt;
** link to the logger configuration (if present) for the data recording.&lt;br /&gt;
** link to the possible secondary logging configuration parameters (if present).&lt;br /&gt;
&lt;br /&gt;
Other features include a JSON interface and Javascript library used for implementing interactive [[Custom Page|custom pages]] for MIDAS experiments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= HTTPS/SSL server (Mongoose) =&lt;br /&gt;
&lt;br /&gt;
The HTTPS/SSL  ([https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose]) server is activated by running {{Utility|name=mhttpd}}, and by default it listens on ports 8080 and 8443 (see [[#Usage]]).  &lt;br /&gt;
&lt;br /&gt;
{{Utility|name=mhttpd}} with Mongoose requires an &#039;&#039;&#039;SSL Certificate&#039;&#039;&#039; and a &#039;&#039;&#039;password file&#039;&#039;&#039;.  Ideally, an SSL Certificate issued by a well-known authority trusted by your browser should be used.&lt;br /&gt;
&lt;br /&gt;
The first time {{Utility|name=mhttpd}} is run, if it does not find an SSL Certificate, it will print instructions on how to [[#Create an SSL certificate|create a self-signed SSL Certificate]]. If it finds no existing password file, it will then print instructions on how to [[#Create a password file|create a password file]] (see below for examples).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Create an SSL certificate ==&lt;br /&gt;
If no [[#HTTPS/SSL server (Mongoose)|more secure]] SSL Certificate is available, then create a self-signed certificate by running {{Utility|name=mhttpd}},&lt;br /&gt;
and following the printed instructions :&lt;br /&gt;
 [user@dasdevpc2 test]$ mhttpd&lt;br /&gt;
 Web server will listen on ports &amp;quot;8080r,8443s&amp;quot;&lt;br /&gt;
 [mhttpd,ERROR] [mhttpd.cxx:17086:mongoose,ERROR] cannot find SSL certificate file &amp;quot;/home/user/online/test/ssl_cert.pem&amp;quot;&lt;br /&gt;
 [mhttpd,ERROR] [mhttpd.cxx:17087:mongoose,ERROR] please create SSL certificate file: openssl req -new -nodes -newkey rsa:2048&lt;br /&gt;
 -sha256 -out  ssl_cert.csr -keyout ssl_cert.key; openssl x509 -req -days 365 -sha256 -in ssl_cert.csr -signkey ssl_cert.key &lt;br /&gt;
 -out ssl_cert.pem; cat ssl_cert.key &amp;gt;&amp;gt; ssl_cert.pem&lt;br /&gt;
 could not start the mongoose web server, see messages and midas.log, bye!&lt;br /&gt;
&lt;br /&gt;
The certificate and key should be placed in one PEM file called ssl_cert.pem located in either MIDAS environment variables [[MIDAS environment variables#MIDAS_DIR|MIDAS_DIR]] or [[MIDAS environment variables#MIDASSYS|MIDASSYS]], and the permissions on the file should be 600  or only owner read/write.&lt;br /&gt;
 [user@dasdevpc2 test] chmod 600 ssl_cert.pem&lt;br /&gt;
&lt;br /&gt;
== Create a password file ==&lt;br /&gt;
Once a valid certificate is generated, when  {{Utility|name=mhttpd}} is restarted, you will need to create a password file. &lt;br /&gt;
   &lt;br /&gt;
 [user@dasdevpc2 test]$ mhttpd&lt;br /&gt;
 Web server will listen on ports &amp;quot;8080r,8443s&amp;quot;&lt;br /&gt;
 Web server will use SSL certificate file &amp;quot;/home/user/online/test/ssl_cert.pem&amp;quot;&lt;br /&gt;
 [mhttpd,ERROR] [mhttpd.cxx:17137:mongoose,ERROR] mongoose web server cannot find password file &amp;quot;/home/user/online/test/htpasswd.txt&amp;quot;&lt;br /&gt;
 [mhttpd,ERROR] [mhttpd.cxx:17138:mongoose,ERROR] please create password file: htdigest -c /home/user/online/test/htpasswd.txt test midas&lt;br /&gt;
 could not start the mongoose web server, see messages and midas.log, bye!&lt;br /&gt;
&lt;br /&gt;
Each person who is to have access to the experiment should create their own username and password. The first user (e.g. mary) creates the password file e.g. htpasswd.txt&lt;br /&gt;
 [user@dasdevpc2 test]$ htdigest -c /home/user/online/test/htpasswd.txt test mary&lt;br /&gt;
 Adding password for mary in realm test.&lt;br /&gt;
 New password:&lt;br /&gt;
 Re-type new password:&lt;br /&gt;
 [user@dasdevpc2 test]$ mhttpd&lt;br /&gt;
 Web server will listen on ports &amp;quot;8080r,8443s&amp;quot;&lt;br /&gt;
 Web server will use SSL certificate file &amp;quot;/home/user/online/test/ssl_cert.pem&amp;quot;&lt;br /&gt;
 Web server will use authentication realm &amp;quot;test&amp;quot;, password file &amp;quot;./htpasswd.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Access to the [[#Features|&#039;&#039;Midas status page&#039;&#039;]] can be obtained by pointing a web browser to &lt;br /&gt;
 https://myhost.mydomain:8443&lt;br /&gt;
The first time you connect you will be asked for a username and password. &lt;br /&gt;
Now that the password file has been created, subsequent users may create their own username and password in the same file by omitting &amp;quot;-c&amp;quot; argument in htdigest, e.g.&lt;br /&gt;
  htdigest  /home/user/online/test/htpasswd.txt test john&lt;br /&gt;
&lt;br /&gt;
Web access can be restricted to certain hosts if desired (see [[#Web security]]).&lt;br /&gt;
 &lt;br /&gt;
Documentation for the version of mongoose included with MIDAS can be found at [http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/mongoose/ Mongoose documentation]. &lt;br /&gt;
&lt;br /&gt;
For more information see [https://midas.triumf.ca/elog/Midas/1062 Elog note 1062]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Older versions ==&lt;br /&gt;
Documentation on older versions of mhttpd can be found at [[Old and Obsolete Versions]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Utilities]]&lt;br /&gt;
[[Category:Web server mhttpd]]&lt;br /&gt;
[[Category:Run control]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=New_Custom_Pages_(2017)&amp;diff=2659</id>
		<title>New Custom Pages (2017)</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=New_Custom_Pages_(2017)&amp;diff=2659"/>
		<updated>2017-11-15T21:09:55Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
{{mhttpdpages4|[[Custom Page Features]]|[[New Custom Pages (2017)]]|[[/Custom ODB tree]]|[[Mhttpd.js|MIDAS Javascript library]]}}&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
A new scheme of custom pages making use of modern HTML5 techniques has been introduced in 2017. This page describes all new elements and gives some example pages.&lt;br /&gt;
&lt;br /&gt;
= Required Elements =&lt;br /&gt;
&lt;br /&gt;
For the new custom pages to work, the following elements in a custom HTML page are required:&lt;br /&gt;
&lt;br /&gt;
* Including  &amp;lt;code&amp;gt;midas.js&amp;lt;/code&amp;gt;&lt;br /&gt;
* Including  &amp;lt;code&amp;gt;mhttpd.js&amp;lt;/code&amp;gt;&lt;br /&gt;
* Including style sheet &amp;lt;code&amp;gt;midas.css&amp;lt;/code&amp;gt;&lt;br /&gt;
* Setting the class of the HTML body to &amp;lt;code&amp;gt;mcss&amp;lt;/code&amp;gt;&lt;br /&gt;
* Calling &amp;lt;code&amp;gt;mhttpd_init(&#039;name&#039;)&amp;lt;/code&amp;gt; on page load where &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; is the name of the page shown on the left menu bar&lt;br /&gt;
* Using &amp;lt;code&amp;gt;div&amp;lt;/code&amp;gt; elements with various pre-defined id&#039;s and names&lt;br /&gt;
&lt;br /&gt;
= modbvalue =&lt;br /&gt;
&lt;br /&gt;
This special HTML div tag (abbreviation stands for Midas ODB VALUE) &amp;lt;code&amp;gt;&amp;amp;lt;div name=&amp;quot;modbvalue&amp;quot; data-odb-path=&amp;quot;/Some/Path&amp;quot;&amp;amp;gt;&amp;lt;/code&amp;gt; is now automatically replaced by the value in the ODB found at the given path. Updates are once per second by default. This can be changed by passing a second argument to &amp;lt;code&amp;gt;mhttpd_init(&#039;name&#039;, interval)&amp;lt;/code&amp;gt; where interval is in milliseconds. The following options are valid for this tag:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: List of valid options for modbvalue tag&lt;br /&gt;
|-&lt;br /&gt;
! Option !! Example !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| name || name=&amp;quot;modbvalue&amp;quot; || Tells the framework to replace this tag with an ODB value&lt;br /&gt;
|-&lt;br /&gt;
| data-odb-path || data-odb-path = &amp;quot;/Runinfo/Run number&amp;quot; || Path to the value in the ODB&lt;br /&gt;
|-&lt;br /&gt;
| data-odb-editable || data-odb-editable=&amp;quot;1&amp;quot; || If set, the value is not only shown, but is also clickable for in-line editing. Hitting return send the new value to the ODB.&lt;br /&gt;
|-&lt;br /&gt;
| data-format || data-format=&amp;quot;f3&amp;quot; || Specify format of data shown. See Table 2 below for options.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Table 2 below lists the format specifiers supported with a modbvalue tag &amp;lt;code&amp;gt;data-format=&amp;quot;...&amp;quot;&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 2: Format specifiers for modbvalue tag &amp;lt;code&amp;gt;data-format=&amp;quot;...&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! Option !! Example !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| d || 1234 || Shows a number in decimal encoding&lt;br /&gt;
|-&lt;br /&gt;
| x || 0x4D2 || Shows a number in hexadecimal encoding&lt;br /&gt;
|-&lt;br /&gt;
| b || 10011010010b|| Shows a number in binary encoding. Options d, x, b can be combined, like &amp;lt;code&amp;gt;data-format=&amp;quot;dxb&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| f&amp;amp;lt;x&amp;amp;gt; || 1.234 || Shows a floating point number with &amp;amp;lt;x&amp;amp;gt; digits after the decimal. A value of f0 shows only the integer part.&lt;br /&gt;
|-&lt;br /&gt;
| p&amp;amp;lt;x&amp;amp;gt; || 1.23 || Shows a floating point number with &amp;amp;lt;x&amp;amp;gt; significant digits of precision, independent of the decimal. For example a value of p2 can render a number to 12000 or to 0.00012&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= modbbutton =&lt;br /&gt;
&lt;br /&gt;
This tag generates a push-button which can set a certain ODB entry to a specific value. To set the {{Odbpath|path=Run number}} to 100, one can use the following tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;button name=&amp;quot;modbbutton&amp;quot; class=&amp;quot;mbutton&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-odb-value=&amp;quot;100&amp;quot;&amp;amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= modbhbar =&lt;br /&gt;
&lt;br /&gt;
The following tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;div name=&amp;quot;modbhbar&amp;quot; style=&amp;quot;width: 500px&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-max-value=&amp;quot;10&amp;quot; data-color=&amp;quot;lightgreen&amp;quot;&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
shows a horizontal bar with a total length of 500px. Depending on the ODB value {{Odbpath|path=Run number}}. If {{Odbpath|path=Run number}} is 10, then the bar is filled all the way to the right, if {{Odbpath|path=Run number}} is 5, the bar is only filled halfway.&lt;br /&gt;
&lt;br /&gt;
= modbvbar =&lt;br /&gt;
&lt;br /&gt;
Same as &amp;lt;code&amp;gt;modbhbar&amp;lt;/code&amp;gt;, except the bar grows vertically instead of horizontally.&lt;br /&gt;
&lt;br /&gt;
= Complete Example =&lt;br /&gt;
&lt;br /&gt;
The following code shows an example page (contained in {{Filepath|path=resources/a_example.html}} in the MIDAS distribution) of a custom page implementing most of the new features. You activate this page by putting in the ODB:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/Custom&lt;br /&gt;
  Path     /midas/resources&lt;br /&gt;
  Test     a_example.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
The file {{File|name=a_example.html}} contains the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html class=&amp;quot;mcss&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
   &amp;lt;meta charset=&amp;quot;UTF-8&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;midas.css&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;script src=&amp;quot;midas.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
   &amp;lt;script src=&amp;quot;mhttpd.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
   &amp;lt;title&amp;gt;Example&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body class=&amp;quot;mcss&amp;quot; onload=&amp;quot;mhttpd_init(&#039;Example&#039;)&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- header and side navigation will be filled in mhttpd_start --&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;mheader&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;msidenav&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;mmain&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;table class=&amp;quot;mtable&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;th colspan=&amp;quot;2&amp;quot; class=&amp;quot;mtableheader&amp;quot;&amp;gt;Status&amp;lt;/th&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td style=&amp;quot;width: 200px;&amp;quot;&amp;gt;&lt;br /&gt;
            Run number:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbvalue&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-odb-editable=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            Last run start:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbvalue&amp;quot; data-odb-path=&amp;quot;/Runinfo/Start time&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            Last run stop:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbvalue&amp;quot; data-odb-path=&amp;quot;/Runinfo/Stop time&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            Indicator:&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;div name=&amp;quot;modbbar&amp;quot; style=&amp;quot;width: 500px&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-max-value=&amp;quot;10&amp;quot;&lt;br /&gt;
                 data-color=&amp;quot;lightgreen&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
      &amp;lt;tr&amp;gt;&lt;br /&gt;
         &amp;lt;td colspan=&amp;quot;2&amp;quot; style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;button name=&amp;quot;modbbutton&amp;quot; class=&amp;quot;mbutton&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-odb-value=&amp;quot;1&amp;quot;&amp;gt;Set run&lt;br /&gt;
               number to 1&lt;br /&gt;
            &amp;lt;/button&amp;gt;&lt;br /&gt;
            &amp;lt;/button&amp;gt;&lt;br /&gt;
            &amp;lt;button name=&amp;quot;modbbutton&amp;quot; class=&amp;quot;mbutton&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-odb-value=&amp;quot;5&amp;quot;&amp;gt;Set run&lt;br /&gt;
               number to 5&lt;br /&gt;
            &amp;lt;/button&amp;gt;&lt;br /&gt;
            &amp;lt;/button&amp;gt;&lt;br /&gt;
            &amp;lt;button name=&amp;quot;modbbutton&amp;quot; class=&amp;quot;mbutton&amp;quot; data-odb-path=&amp;quot;/Runinfo/Run number&amp;quot; data-odb-value=&amp;quot;10&amp;quot;&amp;gt;Set run&lt;br /&gt;
               number to 10&lt;br /&gt;
            &amp;lt;/button&amp;gt;&lt;br /&gt;
            &amp;lt;/button&amp;gt;&lt;br /&gt;
         &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;/tr&amp;gt;&lt;br /&gt;
   &amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which results in the page shown in Figure 1 below.&lt;br /&gt;
&lt;br /&gt;
== Image ==&lt;br /&gt;
The example [[#Code]] results in the image shown below:&lt;br /&gt;
;&amp;lt;center&amp;gt;Figure 1  Example custom page using new (2017) features&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Custom17.png]]&lt;br /&gt;
&lt;br /&gt;
[[Category:mhttpd Pages]] [[Category:Custom]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Template:Mhttpdpages4&amp;diff=2658</id>
		<title>Template:Mhttpdpages4</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Template:Mhttpdpages4&amp;diff=2658"/>
		<updated>2017-11-15T20:13:14Z</updated>

		<summary type="html">&lt;p&gt;Suz: Created page with &amp;quot;  &amp;lt;noinclude&amp;gt; Usage: {{mhttpdpages5|link1|link2|link3|link4|link5}} Provide 4 extra links &amp;lt;/noinclude&amp;gt; &amp;lt;div style=&amp;quot;column-count:5;-moz-column-count:5;-webk...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
Usage: {{mhttpdpages5|[[link1]]|[[link2]]|[[link3]]|[[link4]]|[[link5]]}}&lt;br /&gt;
Provide 4 extra links&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:5;-moz-column-count:5;-webkit-column-count:5&amp;quot;&amp;gt;&lt;br /&gt;
* [[mhttpd|mhttpd web server]]&lt;br /&gt;
* [[Status Page]]&lt;br /&gt;
* [[Start Page]]&lt;br /&gt;
* [[ODB Page]]&lt;br /&gt;
* [[Message Page]]&lt;br /&gt;
* [[Programs Page]]&lt;br /&gt;
* [[Alarms Page]]&lt;br /&gt;
* [[History Page]]&lt;br /&gt;
* [[ELOG Page]]&lt;br /&gt;
* [[Chat Page]]&lt;br /&gt;
* [[Help Page]]&lt;br /&gt;
* [[Config Page]]&lt;br /&gt;
* [[Custom Page]]&lt;br /&gt;
* [[MSCB Page]]&lt;br /&gt;
* [[Sequencer Page]]&lt;br /&gt;
* [[odbedit]]&lt;br /&gt;
* {{{1|missing link1}}}&lt;br /&gt;
* {{{2|missing link2}}}&lt;br /&gt;
* {{{3|missing link3}}}&lt;br /&gt;
* {{{4|missing link4}}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Sequencer_Page&amp;diff=2644</id>
		<title>Sequencer Page</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Sequencer_Page&amp;diff=2644"/>
		<updated>2017-09-29T01:01:34Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
{{mhttpdpages3|[[Sequencer]]|[[/Sequencer ODB tree]]|[[Edit-on-Sequence Parameters]]}}&lt;br /&gt;
&lt;br /&gt;
= Purpose =&lt;br /&gt;
The purpose of the [[mhttpd]] Sequencer Web Page to provide a visual display for the [[Sequencer]]. Using the Sequencer Page, [[Sequencer|Sequencer scripts]] can be loaded, edited and run.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Access to the Sequencer Page =&lt;br /&gt;
The Sequencer Page is displayed by clicking on  {{Button|name=Sequencer}} button on the mhttpd [[Status Page]] or other [[mhttpd]] web page. &lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:If the Sequencer button is not present on the Status Page, it may have been [[Status Page#page-switch-buttons|suppressed]].&lt;br /&gt;
&lt;br /&gt;
= Features of the Sequencer Page =&lt;br /&gt;
* The Sequencer Page takes its parameters from the [[/Sequencer ODB tree]]. &lt;br /&gt;
* Sequencer scripts can be loaded and run from the Sequencer Page. &lt;br /&gt;
* A &#039;&#039;&#039;visual editor&#039;&#039;&#039; is provided to edit scripts. &lt;br /&gt;
* If [[Edit-on-Sequence Parameters]] are defined, these will be displayed when a sequence is started.  &lt;br /&gt;
* A &#039;&#039;&#039;progress display&#039;&#039;&#039; is provided showing the progress of a running script, and the last few Midas messages are also shown (Figure 5). &lt;br /&gt;
&lt;br /&gt;
= How to input and run a Sequencer Script =&lt;br /&gt;
; Note&lt;br /&gt;
: A Sequencer Script is written using commands recognized by the Sequencer.&#039;&#039;&#039; See [[Sequencer|Sequencer Commands]] for the list of sequencer commands. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Press the {{Button|name=Sequencer}} on the [[Status Page]] to display the Sequencer Page. &lt;br /&gt;
: The first time the button is pressed, the Sequencer Page will appear as in Figure 1, where no load file has been specified.&lt;br /&gt;
&amp;lt;li&amp;gt;Load or create a script file&lt;br /&gt;
:  A new script file can be created by entering sequencer commands using the [[#Edit or Create a Sequencer Script|visual editor]] on the Sequencer Page, or an existing sequencer script file can be [[#Load an existing Sequencer Script|loaded]]. &lt;br /&gt;
&amp;lt;li&amp;gt; [[#Start a Sequencer Script|Start]] the sequencer script&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Create a Sequencer Script ==&lt;br /&gt;
A new sequencer script can be created using the visual editor by typing in [[Sequencer|Sequencer Commands]], or by pasting in an example file (e.g. [[#Sequencer test file]] or one of [[Sequencer#MSL Example|MSL Example file]] or [[Sequencer#XML Example|MSL Example file]] ) as in Figure 2.&lt;br /&gt;
&lt;br /&gt;
The new script is then saved by pressing {{Button|name=Save}}. You will be asked for a file name. &lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The directory path where the sequencer files will be saved is set by the ODB parameter [[/Sequencer ODB tree#Path|/Sequencer/State/Path]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Load an existing Sequencer Script ==&lt;br /&gt;
An existing sequencer script file can be loaded using {{Button|name=Load Script}} as in Figure 3. If there is no existing file, use the  [[#Edit a Sequencer Script|visual editor]] to create one.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The directory path where the sequencer looks for saved files is set by the ODB parameter [[/Sequencer ODB tree#Path|/Sequencer/State/Path]].&lt;br /&gt;
&lt;br /&gt;
== Edit a Sequencer Script ==&lt;br /&gt;
A sequencer script can be edited on the Sequencer Page by pressing  {{Button|name=Edit Script}} (see Fugure 2). The &#039;&#039;&#039;visual editor&#039;&#039;&#039; allows changes to be made to the script.&lt;br /&gt;
The sequencer script must first be [[#Create a Sequencer Script|created]]  or [[#Load an existing Sequencer Script|loaded]] from a file. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|  style=&amp;quot;text-align: left; width: 100%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
|+ Table 1&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; | Figure 1:  Initial Sequencer page&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot;  | Figure 2: Display and/or Edit a Sequencer script&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; |Figure 3: Select a Sequencer file&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_noscript.png|Figure 1: Initial Sequencer page]]&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot;| [[File:sequencer_scripteditor.png|500px|Figure 2: Editing a Sequencer script]]&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot;| [[File:sequencer_filelist.png|Figure 3: Select a Sequencer file]]&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; | Figure 4: Start a Sequencer script&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_startscript.png|Figure 4: Start a Sequencer script]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Start a Sequencer Script ==&lt;br /&gt;
After a sequencer script has been [[#Load a Sequencer Script|loaded]], start the script by pressing &lt;br /&gt;
the {{Button|name=Start Script}} button.&lt;br /&gt;
&lt;br /&gt;
If there are errors in the script that prevents the script from running, the line(s) in error will be highlighted (Figure 5). &lt;br /&gt;
In this case, [[#Edit a Sequencer Script|edit the script]] and fix the errors.&lt;br /&gt;
&lt;br /&gt;
Once all errors are corrected and the script runs, the user will be asked to input any required parameters as in Figure 4 (in this case the number of runs, see [[#Sequencer test file|test_seq.msl]]). If [[Edit-on-Sequence Parameters]] are defined, these will be displayed in addition to any required parameters.  Note that [[Edit-on-start Parameters]] will not be displayed (parameters that change between runs should be set by the sequencer script).&lt;br /&gt;
&lt;br /&gt;
When the sequencer is running, a &#039;&#039;&#039;visual status&#039;&#039;&#039; is displayed in the Progress window, and the &#039;&#039;&#039;current position&#039;&#039;&#039; in the sequence file is also highlighted (Figure 6).&lt;br /&gt;
The sequencer can be paused by pressing  {{Button|name=Pause Script}}  (Figure 7).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The progress window will indicate when the sequencer is finished  (Figure 8).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|  style=&amp;quot;text-align: left; width: 100%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; | Figure 5: There is an error in the script&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot;  | Figure 6: Sequencer is running&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_error.png|500px|Figure 5: There is an error in the script]]&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_running.png|500px|Figure 6: Sequencer is running]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
{| style=&amp;quot;text-align: left; width: 100%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; |  Figure 7: Sequencer is paused&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; |Figure 8: Sequencer is finished&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_paused.png|500px|Figure 7: Sequencer is paused]]&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_finished.png|500px|thumb|Figure 8: Sequencer is finished]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Sequencer test file  =&lt;br /&gt;
The following is the contents of the sequence file used for testing &#039;&#039;test_seq.msl&#039;&#039; in the example [[#How to input and run a Sequencer Script|above]].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
COMMENT &amp;quot;This is a MSL test file&amp;quot;&lt;br /&gt;
RUNDESCRIPTION &amp;quot;Test run&amp;quot;&lt;br /&gt;
PARAM runs&lt;br /&gt;
&lt;br /&gt;
LOOP $runs&lt;br /&gt;
     TRANSITION START&lt;br /&gt;
     WAIT ODBvalue &amp;quot;/Equipment/FIFO_acq/Statistics/Events sent&amp;quot; &amp;gt;= 25&lt;br /&gt;
     TRANSITION STOP&lt;br /&gt;
     WAIT seconds 5&lt;br /&gt;
ENDLOOP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: mhttpd Pages]] [[Category: Sequencer]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Pagelinks}}&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Sequencer_Page&amp;diff=2643</id>
		<title>Sequencer Page</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Sequencer_Page&amp;diff=2643"/>
		<updated>2017-09-29T00:53:04Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
{{mhttpdpages3|[[Sequencer]]|[[/Sequencer ODB tree]]|[[Edit-on-Sequence Parameters]]}}&lt;br /&gt;
&lt;br /&gt;
= Purpose =&lt;br /&gt;
The purpose of the [[mhttpd]] Sequencer Web Page to provide a visual display for the [[Sequencer]]. Using the Sequencer Page, [[Sequencer|Sequencer scripts]] can be loaded, edited and run.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Access to the Sequencer Page =&lt;br /&gt;
The Sequencer Page is displayed by clicking on  {{Button|name=Sequencer}} button on the mhttpd [[Status Page]] or other [[mhttpd]] web page. &lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:If the Sequencer button is not present on the Status Page, it may have been [[Status Page#page-switch-buttons|suppressed]].&lt;br /&gt;
&lt;br /&gt;
= Features of the Sequencer Page =&lt;br /&gt;
* The Sequencer Page takes its parameters from the [[/Sequencer ODB tree]]. &lt;br /&gt;
* Sequencer scripts can be loaded and run from the Sequencer Page. &lt;br /&gt;
* A &#039;&#039;&#039;visual editor&#039;&#039;&#039; is provided to edit scripts. &lt;br /&gt;
* If [[Edit-on-Sequence Parameters]] are defined, these will be displayed when a sequence is started.  &lt;br /&gt;
* A &#039;&#039;&#039;progress display&#039;&#039;&#039; is provided showing the progress of a running script, and the last few Midas messages are also shown (Figure 5). &lt;br /&gt;
&lt;br /&gt;
= How to input and run a Sequencer Script =&lt;br /&gt;
; Note&lt;br /&gt;
: A Sequencer Script is written using commands recognized by the Sequencer.&#039;&#039;&#039; See [[Sequencer|Sequencer Commands]] for the list of sequencer commands. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Press the {{Button|name=Sequencer}} on the [[Status Page]] to display the Sequencer Page. &lt;br /&gt;
: The first time the button is pressed, the Sequencer Page will appear as in Figure 1, where no load file has been specified.&lt;br /&gt;
&amp;lt;li&amp;gt;Load or create a script file&lt;br /&gt;
:  A new script file can be created by entering sequencer commands using the [[#Edit or Create a Sequencer Script|visual editor]] on the Sequencer Page, or an existing sequencer script file can be [[#To load and existing Sequencer Script|loaded]]. &lt;br /&gt;
&amp;lt;li&amp;gt; [[#Start a Sequencer Script|Start]] the sequencer script&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  To Create a Sequencer Script ==&lt;br /&gt;
A new sequencer script can be created using the visual editor by typing in [[Sequencer|Sequencer Commands]], or by pasting in an example file (e.g. [[#Sequence test file]] or one of [[Sequencer#MSL Example|MSL Example file]] or [[Sequencer#XML Example|MSL Example file]] ) as in Figure 2.&lt;br /&gt;
&lt;br /&gt;
The new script is then saved by pressing {{Button|name=Save}}. You will be asked for a file name. &lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The directory path where the sequencer files will be saved is set by the ODB parameter [[/Sequencer ODB tree#Path|/Sequencer/State/Path]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== To Load an existing Sequencer Script ==&lt;br /&gt;
An existing sequencer script file can be loaded using {{Button|name=Load Script}} as in Figure 3. If there is no existing file, use the  [[#Edit a Sequencer Script|visual editor]] to create one.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The directory path where the sequencer looks for saved files is set by the ODB parameter [[/Sequencer ODB tree#Path|/Sequencer/State/Path]].&lt;br /&gt;
&lt;br /&gt;
== To Edit a Sequencer Script ==&lt;br /&gt;
A sequencer script can be edited on the Sequencer Page by pressing  {{Button|name=Edit Script}} (see Fugure 2). The &#039;&#039;&#039;visual editor&#039;&#039;&#039; allows changes to be made to the script.&lt;br /&gt;
The sequencer script must first be [[#To Create a Sequencer Script|created]]  or [[#Load an existing Sequencer Script|loaded]] from a file. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|  style=&amp;quot;text-align: left; width: 100%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
|+ Table 1&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; | Figure 1:  Initial Sequencer page&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot;  | Figure 2: Display and/or Edit a Sequencer script&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; |Figure 3: Select a Sequencer file&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_noscript.png|Figure 1: Initial Sequencer page]]&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot;| [[File:sequencer_scripteditor.png|500px|Figure 2: Editing a Sequencer script]]&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot;| [[File:sequencer_filelist.png|Figure 3: Select a Sequencer file]]&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; | Figure 4: Start a Sequencer script&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_startscript.png|Figure 4: Start a Sequencer script]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Start a Sequencer Script ==&lt;br /&gt;
After a sequencer script has been [[#Load a Sequencer Script|loaded]], start the script by pressing &lt;br /&gt;
the {{Button|name=Start Script}} button.&lt;br /&gt;
&lt;br /&gt;
If there are errors in the script that prevents the script from running, the line(s) in error will be highlighted (Figure 5). &lt;br /&gt;
In this case, [[#Edit a Sequencer Script|edit the script]] and fix the errors.&lt;br /&gt;
&lt;br /&gt;
Once all errors are corrected and the script runs, the user will be asked to input any required parameters as in Figure 4 (in this case the number of runs, see [[#Sequence test file|test_seq.msl]]). If [[Edit-on-Sequence Parameters]] are defined, these will be displayed in addition to any required parameters.  Note that [[Edit-on-start Parameters]] will not be displayed (parameters that change between runs should be set by the sequencer script).&lt;br /&gt;
&lt;br /&gt;
When the sequencer is running, a &#039;&#039;&#039;visual status&#039;&#039;&#039; is displayed in the Progress window, and the &#039;&#039;&#039;current position&#039;&#039;&#039; in the sequence file is also highlighted (Figure 6).&lt;br /&gt;
The sequencer can be paused by pressing  {{Button|name=Pause Script}}  (Figure 7).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The progress window will indicate when the sequencer is finished  (Figure 8).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|  style=&amp;quot;text-align: left; width: 100%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; | Figure 5: There is an error in the script&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot;  | Figure 6: Sequencer is running&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_error.png|500px|Figure 5: There is an error in the script]]&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_running.png|500px|Figure 6: Sequencer is running]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
{| style=&amp;quot;text-align: left; width: 100%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; |  Figure 7: Sequencer is paused&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; |Figure 8: Sequencer is finished&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_paused.png|500px|Figure 7: Sequencer is paused]]&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_finished.png|500px|thumb|Figure 8: Sequencer is finished]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Sequence test file  =&lt;br /&gt;
The following is the contents of the sequence file used for testing &#039;&#039;test_seq.msl&#039;&#039; in the example [[#How to input and run a Sequencer Script|above]].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
COMMENT &amp;quot;This is a MSL test file&amp;quot;&lt;br /&gt;
RUNDESCRIPTION &amp;quot;Test run&amp;quot;&lt;br /&gt;
PARAM runs&lt;br /&gt;
&lt;br /&gt;
LOOP $runs&lt;br /&gt;
     TRANSITION START&lt;br /&gt;
     WAIT ODBvalue &amp;quot;/Equipment/FIFO_acq/Statistics/Events sent&amp;quot; &amp;gt;= 25&lt;br /&gt;
     TRANSITION STOP&lt;br /&gt;
     WAIT seconds 5&lt;br /&gt;
ENDLOOP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: mhttpd Pages]] [[Category: Sequencer]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Pagelinks}}&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Sequencer_Page&amp;diff=2642</id>
		<title>Sequencer Page</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Sequencer_Page&amp;diff=2642"/>
		<updated>2017-09-28T22:55:50Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
{{mhttpdpages3|[[Sequencer]]|[[/Sequencer ODB tree]]|[[Edit-on-Sequence Parameters]]}}&lt;br /&gt;
&lt;br /&gt;
= Purpose =&lt;br /&gt;
The purpose of the [[mhttpd]] Sequencer Web Page to provide a visual display for the [[Sequencer]]. Using the Sequencer Page, [[Sequencer|Sequencer scripts]] can be loaded, edited and run.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Access to the Sequencer Page =&lt;br /&gt;
The Sequencer Page is displayed by clicking on  {{Button|name=Sequencer}} button on the mhttpd [[Status Page]] or other [[mhttpd]] web page. &lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:If the Sequencer button is not present on the Status Page, it may have been [[Status Page#page-switch-buttons|suppressed]].&lt;br /&gt;
&lt;br /&gt;
= Features of the Sequencer Page =&lt;br /&gt;
The Sequencer Page takes its parameters from the [[/Sequencer ODB tree]]. Sequencer scripts can be loaded and run from the Sequencer Page. A visual editor is provided to edit scripts. A display is provided showing the progress of a running script, and the last few Midas messages are also shown (Figure 5). If [[Edit-on-Sequence Parameters]] are defined, these will be displayed when a sequence is started.  &lt;br /&gt;
&lt;br /&gt;
== How to input and run a Sequencer Script ==&lt;br /&gt;
&#039;&#039;&#039;A Sequencer Script is written using commands recognized by the Sequencer.&#039;&#039;&#039; See [[Sequencer|Sequencer Commands]] for the list of sequencer commands. &lt;br /&gt;
&lt;br /&gt;
=== Load a Sequencer Script ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Press {{Button|name=Sequencer}} on [[Status Page]]. The first time the button is pressed, the Sequencer Page will appear as in Figure 1, where no load file has been specified.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Either&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Press {{Button|name=Edit Script}}  and input a new test sequence&lt;br /&gt;
:: i.e. type in [[Sequencer|Sequencer Commands]] or paste in an example file (e.g. [[#Sequence file]] or one of [[Sequencer#MSL Example|MSL Example file]] or [[Sequencer#XML Example|MSL Example file]] ) as in Figure 2.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; save the script by pressing {{Button|name=Save}}. You will be asked for a file name. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Or &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;load an existing sequencer scriptfile using {{Button|name=Load Script}} as in Figure 3.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The directory path where the sequencer files will be saved is set by the ODB parameter [[/Sequencer ODB tree#Path|/Sequencer/State/Path]].&lt;br /&gt;
&lt;br /&gt;
{|  style=&amp;quot;text-align: left; width: 100%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
|+ Table 1&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; | Figure 1:  Initial Sequencer page&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot;  | Figure 2: Display and/or Edit a Sequencer script&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; |Figure 3: Select a Sequencer file&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_noscript.png|Figure 1: Initial Sequencer page]]&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot;| [[File:sequencer_scripteditor.png|500px|Figure 2: Editing a Sequencer script]]&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot;| [[File:sequencer_filelist.png|Figure 3: Select a Sequencer file]]&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; | Figure 4: Select a Sequencer file&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_startscript.png|Figure 4: Select a Sequencer file]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Start a Sequencer Script ===&lt;br /&gt;
After a sequencer script has been [[#Load a Sequencer Script||loaded]], start the script:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Press {{Button|name=Start Script}} button to start the script. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;You will be asked to input any required parameters as in Figure 4 (in this case the number of runs, see [[#Sequence File|test_seq.msl]]).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If [[Edit-on-Sequence Parameters]] are defined, these will be displayed in addition to any required parameters&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In this example, the script contains an error that prevents the script from running (Figure 5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== C. Edit a Sequencer Script ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The script can be edited by pressing  {{Button|name=Edit Script}}, and any errors corrected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The script will run when  {{Button|name=Start Script}}  is pressed. A visual status is displayed in the Progress window, and the current position in the sequence file is also highlighted (Figure 6).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The sequencer can be paused by pressing the  {{Button|name=Pause Script}} button (Figure 7).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The progress window will indicated when the sequencer is finished  (Figure 8).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|  style=&amp;quot;text-align: left; width: 100%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; | Figure 5: There is an error in the script&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot;  | Figure 6: Sequencer is running&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_error.png|500px|Figure 5: There is an error in the script]]&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_running.png|500px|Figure 6: Sequencer is running]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
{| style=&amp;quot;text-align: left; width: 100%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; |  Figure 7: Sequencer is paused&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; style=&amp;quot;background-color:lemonchiffon; font-weight:bold&amp;quot; |Figure 8: Sequencer is finished&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_paused.png|500px|Figure 7: Sequencer is paused]]&lt;br /&gt;
| rowspan=&amp;quot;1&amp;quot; | [[File:sequencer_finished.png|500px|thumb|Figure 8: Sequencer is finished]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sequence file  ===&lt;br /&gt;
The following is the contents of the sequence file used for testing &#039;&#039;test_seq.msl&#039;&#039; in the example [[#How to input and run a Sequencer Script|above]].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
COMMENT &amp;quot;This is a MSL test file&amp;quot;&lt;br /&gt;
RUNDESCRIPTION &amp;quot;Test run&amp;quot;&lt;br /&gt;
PARAM runs&lt;br /&gt;
&lt;br /&gt;
LOOP $runs&lt;br /&gt;
     TRANSITION START&lt;br /&gt;
     WAIT ODBvalue &amp;quot;/Equipment/FIFO_acq/Statistics/Events sent&amp;quot; &amp;gt;= 25&lt;br /&gt;
     TRANSITION STOP&lt;br /&gt;
     WAIT seconds 5&lt;br /&gt;
ENDLOOP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: mhttpd Pages]] [[Category: Sequencer]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Pagelinks}}&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Sequencer_Page&amp;diff=2641</id>
		<title>Sequencer Page</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Sequencer_Page&amp;diff=2641"/>
		<updated>2017-09-28T19:38:40Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
{{mhttpdpages3|[[Sequencer]]|[[/Sequencer ODB tree]]|[[Edit-on-Sequence Parameters]]}}&lt;br /&gt;
&lt;br /&gt;
= Purpose =&lt;br /&gt;
The purpose of the [[mhttpd]] Sequencer Web Page to provide a visual display for the [[Sequencer]]. Using the Sequencer Page, [[Sequencer|Sequencer scripts]] can be loaded, edited and run.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Access to the Sequencer Page =&lt;br /&gt;
The Sequencer Page is displayed by clicking on  {{Button|name=Sequencer}} button on the mhttpd [[Status Page]] or other [[mhttpd]] web page. &lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:If the Sequencer button is not present on the Status Page, it may have been [[Status Page#page-switch-buttons|suppressed]].&lt;br /&gt;
&lt;br /&gt;
= Features of the Sequencer Page =&lt;br /&gt;
The Sequencer Page takes its parameters from the [[/Sequencer ODB tree]]. Sequencer scripts can be loaded and run from the Sequencer Page. A visual editor is provided to edit scripts. A display is provided showing the progress of a running script, and the last few Midas messages are also shown (Figure 5). If [[Edit-on-Sequence Parameters]] are defined, these will be displayed when a sequence is started.  &lt;br /&gt;
&lt;br /&gt;
== How to input and run a Sequencer Script ==&lt;br /&gt;
See [[Sequencer|Sequencer Commands]] for the list of commands recognized by the Sequencer. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Press {{Button|name=Sequencer}} on [[Status Page]]. The first time the button is pressed, the Sequencer Page will appear as in Figure 1, where no load file has been specified.&amp;lt;/li&amp;gt;&lt;br /&gt;
;Note&lt;br /&gt;
:The directory path where the sequencer files will be saved is set by the ODB parameter [[/Sequencer ODB tree#Path|/Sequencer/State/Path]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Either&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; press {{Button|name=Edit Script}}  and input a new test sequence (e.g. [[Sequencer#Sequence File|test_seq.msl]]) as in Figure 2.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; save the script by pressing {{Button|name=Save}}. You will be asked for a file name. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Or &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;load an existing script using {{Button|name=Load Script}} as in Figure 3.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Press {{Button|name=Start Script}} button to start the script. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;You will be asked to input any required parameters as in Figure 4 (in this case the number of runs, see [[#Sequence File|test_seq.msl]]).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If [[Edit-on-Sequence Parameters]] are defined, these will be displayed in addition to any required parameters&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;In this example, the script contains an error that prevents the script from running (Figure 5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The script is edited by pressing  {{Button|name=Edit Script}}, and the error corrected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Now the script will run when  {{Button|name=Start Script}}  is pressed. A visual status is displayed in the Progress window, and the current position in the sequence file is also highlighted (Figure 6).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; The sequencer can be paused by pressing the  {{Button|name=Pause Script}} button (Figure 7).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The progress window will indicated when the sequencer is finished  (Figure 8).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Click on a thumbnail to enlarge&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:sequencer_noscript.png|Figure 1: Initial Sequencer page&lt;br /&gt;
File:sequencer_scripteditor.png|Figure 2: Editing a Sequencer script&lt;br /&gt;
File:sequencer_filelist.png|Figure 3: Select a Sequencer file&lt;br /&gt;
File:sequencer_startscript.png|Figure 4: Select a Sequencer file&lt;br /&gt;
File:sequencer_error.png|Figure 5: There is an error in the script&lt;br /&gt;
File:sequencer_running.png|Figure 6: Sequencer is running&lt;br /&gt;
File:sequencer_paused.png|Figure 7: Sequencer is paused&lt;br /&gt;
File:sequencer_finished.png|Figure 8: Sequencer is finished&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sequence file  ===&lt;br /&gt;
The following is the contents of the sequence file used for testing &#039;&#039;test_seq.msl&#039;&#039; in the example [[#How to input and run a Sequencer Script|above]].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
COMMENT &amp;quot;This is a MSL test file&amp;quot;&lt;br /&gt;
RUNDESCRIPTION &amp;quot;Test run&amp;quot;&lt;br /&gt;
PARAM runs&lt;br /&gt;
&lt;br /&gt;
LOOP $runs&lt;br /&gt;
     TRANSITION START&lt;br /&gt;
     WAIT ODBvalue &amp;quot;/Equipment/FIFO_acq/Statistics/Events sent&amp;quot; &amp;gt;= 25&lt;br /&gt;
     TRANSITION STOP&lt;br /&gt;
     WAIT seconds 5&lt;br /&gt;
ENDLOOP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: mhttpd Pages]] [[Category: Sequencer]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Sequencer&amp;diff=2640</id>
		<title>Sequencer</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Sequencer&amp;diff=2640"/>
		<updated>2017-09-27T02:03:08Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[/Sequencer ODB tree]]&lt;br /&gt;
* [[Sequencer Page]]&lt;br /&gt;
* [[mhttpd]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
A Sequencer for starting and stopping runs was implemented in June 2011. Since then development has continued, with more commands being added, and the option of using a Midas Script Language (MSL) for commands, in addition to the XML language.&lt;br /&gt;
&lt;br /&gt;
The sequencer runs inside [[mhttpd]]. The first time  the  {{Button|name=Sequencer}} button on the [[Status Page]] is pressed, the ODB [[/Sequencer ODB tree|Sequencer Tree]] is created. If the Sequencer button is not present on the [[Status Page]], it may have been  [[Status Page#page-switch-buttons|suppressed]].&lt;br /&gt;
&lt;br /&gt;
The sequencer runs scripts in XML or MSL (Midas Script Language) format, which reside on the server (where {{Utility|name=mhttpd}} is running). The sequencer state is completely stored in the ODB, meaning that even if  {{Utility|name=mhttpd}} is stopped and restarted, the active sequence operation continues exactly where it has been stopped.&lt;br /&gt;
&lt;br /&gt;
Refer to the [[/Sequencer ODB tree]] for more details on its organization. &lt;br /&gt;
&lt;br /&gt;
For instructions on &#039;&#039;&#039;getting started with the sequencer&#039;&#039;&#039;, see [[Sequencer Page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Sequencer Commands =&lt;br /&gt;
The following commands are implemented in the MIDAS Sequencer. The left syntax is for the XML file, the right for the MSL (Midas Script Language).&lt;br /&gt;
&lt;br /&gt;
Variable names are indicated in italic, options are enclosed in [brackets].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: left; color: black; tr:nth-child(even) {background-color: #F0F0F0};&amp;quot; &lt;br /&gt;
!style=&amp;quot;width: 20%;background-color:#C0C0C0;&amp;quot;|XML format&lt;br /&gt;
!style=&amp;quot;width: 20%;background-color:#C0C0C0;&amp;quot;|MSL format&lt;br /&gt;
!style=&amp;quot;width: 60%;background-color:#C0C0C0;&amp;quot;|Description&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt; !DOCTYPE RunSequence[&amp;lt; !ENTITY &#039;&#039;name&#039;&#039; SYSTEM &amp;quot;&#039;&#039;name&#039;&#039;.xml&amp;quot; &amp;gt;]&amp;gt; &amp;amp;&#039;&#039;name&#039;&#039;; &lt;br /&gt;
||INCLUDE &#039;&#039;name&#039;&#039;&lt;br /&gt;
||Include another XML file &#039;&#039;name&#039;&#039;.xml&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Call name=&amp;quot;&#039;&#039;name&#039;&#039;&amp;quot;&amp;gt; a,b,c...&amp;lt;/Call&amp;gt;&lt;br /&gt;
||CALL &#039;&#039;name&#039;&#039;, &#039;&#039;a&#039;&#039;, &#039;&#039;b&#039;&#039;, &#039;&#039;c&#039;&#039;, ...&lt;br /&gt;
||Call a subroutine. Optional parameters &#039;&#039;a&#039;&#039;,&#039;&#039;b&#039;&#039;,&#039;&#039;c&#039;&#039;... are passed to the subroutine, where they can be referenced via $1, $2, $3, etc. The subroutine can either reside in the current file, or in a library file which is included.&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Cat name=&amp;quot;&#039;&#039;name&#039;&#039;&amp;quot;&amp;gt; &#039;&#039;a&#039;&#039;,&#039;&#039;b&#039;&#039;,&#039;&#039;c&#039;&#039;... &amp;lt;/Set&amp;gt;&lt;br /&gt;
||CAT &#039;&#039;name&#039;&#039;, &#039;&#039;a&#039;&#039;, &#039;&#039;b&#039;&#039;, &#039;&#039;c&#039;&#039;, ...&lt;br /&gt;
||Concatenates the strings &#039;&#039;a&#039;&#039;,&#039;&#039;b&#039;&#039;,&#039;&#039;c&#039;&#039;,... into a single variable name . Can be referenced with $&#039;&#039;name&#039;&#039;. If a string must contain a comma, it can be enclosed in quotes such as in &#039;&#039;&#039;CAT title $run, &amp;quot;,&amp;quot;, $n events&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Comment&amp;gt; &#039;&#039;comment&#039;&#039; &amp;lt;/Comment&amp;gt;&lt;br /&gt;
||COMMENT &#039;&#039;comment&#039;&#039;&lt;br /&gt;
||A comment for this XML file, for information only. This comment is shown when one clicks on the XML file in the browser inside the web page and can be used to show some information about an XML file. This can be helpful if one has many XML files and the file name only is not enough to supply enough information.&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Goto line=&amp;quot;&#039;&#039;n&#039;&#039;&amp;quot; / &amp;gt;&lt;br /&gt;
||GOTO &#039;&#039;n&#039;&#039;&lt;br /&gt;
||Jump to line &#039;&#039;n&#039;&#039; in script&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;If condition=&amp;quot;&#039;&#039;con&#039;&#039;&amp;quot; &amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
... &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;else /&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
... &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/if&amp;gt;&lt;br /&gt;
||IF &#039;&#039;con&#039;&#039;  &amp;lt;br&amp;gt;&lt;br /&gt;
... &amp;lt;br&amp;gt;&lt;br /&gt;
ELSE &amp;lt;br&amp;gt;&lt;br /&gt;
... &amp;lt;br&amp;gt;&lt;br /&gt;
ENDIF&lt;br /&gt;
||Statements between &amp;lt;if&amp;gt; and &amp;lt;/if&amp;gt; are only executed if condition con is true, otherwise the statements between the optional &amp;lt;else /&amp;gt; and &amp;lt;/if&amp;gt; are executed. The condition can use variables via $name and/or constants together with operators &amp;quot;&amp;lt;&amp;quot;, &amp;quot;&amp;lt;=&amp;quot;, &amp;quot;&amp;gt;&amp;quot;, &amp;quot;&amp;gt;=&amp;quot;, &amp;quot;==&amp;quot;, &amp;quot;!=&amp;quot;, &amp;quot;&amp;amp;&amp;quot; (bitwise AND). Up to four nested IF statements are possible.&lt;br /&gt;
|- &lt;br /&gt;
||&amp;lt;Library name=&amp;quot;&#039;&#039;name&#039;&#039;&amp;quot; &amp;gt;...&amp;lt;/Library&amp;gt;&lt;br /&gt;
||LIBRARY &#039;&#039;name&#039;&#039;&lt;br /&gt;
||Indicates that the current file is a library (which can be included by other files). A library usually consists of a set of subroutines.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Loop n=&amp;quot;&#039;&#039;n&#039;&#039;&amp;quot; [var=&amp;quot;&#039;&#039;name&#039;&#039;&amp;quot;]&amp;gt; ... &amp;lt;/Loop&amp;gt;&lt;br /&gt;
||LOOP [&#039;&#039;name&#039;&#039; ,] &#039;&#039;n&#039;&#039; ... ENDLOOP&lt;br /&gt;
||To execute a loop &#039;&#039;n&#039;&#039; times. For infinite loops, &amp;quot;infinite&amp;quot; can be specified as &#039;&#039;n&#039;&#039;. Optionally, the loop variable running from 1..&#039;&#039;n&#039;&#039; can be accessed inside the loop via $&#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Loop var=&amp;quot;&#039;&#039;name&#039;&#039;&amp;quot; values=&amp;quot;&#039;&#039;a&#039;&#039;,&#039;&#039;b&#039;&#039;,&#039;&#039;c&#039;&#039;,...&amp;quot;&amp;gt; ... &amp;lt;/Loop&amp;gt;&lt;br /&gt;
||LOOP &#039;&#039;name&#039;&#039;,  &#039;&#039;a&#039;&#039;, &#039;&#039;b&#039;&#039;, &#039;&#039;c&#039;&#039;, ... ... ENDLOOP&lt;br /&gt;
||Loop though a list of values. The loop is executed once for each value, which is stored into the variable &#039;&#039;name&#039;&#039; so it can be accessed inside the loop via $&#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Message [wait=&amp;quot;1&amp;quot;]&amp;gt; &#039;&#039;message&#039;&#039; &amp;lt;/Message&amp;gt;&lt;br /&gt;
||MESSAGE &#039;&#039;message&#039;&#039; [,1]&lt;br /&gt;
||Opens a message box in the browser containing the text message. If wait=&amp;quot;1&amp;quot;, then the sequencer waits until the box is closed by the user before continuing.&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;ODBGet path=&amp;quot;&#039;&#039;path&#039;&#039;&amp;quot; &amp;gt; &#039;&#039;name&#039;&#039; &amp;lt;/ODBGet&amp;gt;&lt;br /&gt;
||ODBGET &#039;&#039;path&#039;&#039;, &#039;&#039;name&#039;&#039;&lt;br /&gt;
||To get a value from a variable &#039;&#039;name&#039;&#039;. The variable can then be referenced with $&#039;&#039;name&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;ODBInc path=&amp;quot;&#039;&#039;path&#039;&#039;&amp;quot; &amp;gt; delta &amp;lt;/ODBInc&amp;gt;&lt;br /&gt;
||ODBINC &#039;&#039;path&#039;&#039; [, &#039;&#039;delta&#039;&#039;]&lt;br /&gt;
||To increment a value in the ODB. &#039;&#039;delta&#039;&#039; can be positive or negative. If no &amp;quot;delta&amp;quot; is given, 1 is used.&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;ODBSet [notify=&amp;quot;0|1&amp;quot;] path=&amp;quot;&#039;&#039;path&#039;&#039;&amp;quot; &amp;gt; &#039;&#039;value&#039;&#039; &amp;lt;/ODBSet&amp;gt;&lt;br /&gt;
||ODBSET &#039;&#039;path&#039;&#039;, &#039;&#039;value&#039;&#039; [, 0|1]&lt;br /&gt;
||To set a value in the ODB. The notify flag specifies if possible hot-links to this ODB value are notified. This can be useful if a front-end program has many parameters, which must be set for a specific run. The front-end usually has a hot-link to its parameters, so on each modification a callback function in the front-end is called which usually modifies some hardware. If there are many ODBSet statements for all parameters, the callback would be executed on each ODBSet, so the hardware would be reconfigured many times slowing down the startup of a run. In order to prevent this, notify=&amp;quot;0&amp;quot; can be specified for all ODBSet statements except the last one which contains notify=&amp;quot;1&amp;quot;, so the callback function is called only once at the end.&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;ODBSubdir path=&amp;quot;&#039;&#039;path&#039;&#039;&amp;quot; &amp;gt;...&amp;lt;/ODBSubdir&amp;gt;&lt;br /&gt;
||ODBSUBDIR &#039;&#039;path&#039;&#039; ...ENDODBSUBDIR&lt;br /&gt;
||If one wants to se several ODB values in the same directory, the ODBSet commands can be rather long if thepath is long. Using this command, the subdir can be specified for all commands between the opening and ending tags. So instead of writing &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;ODBSet path=&amp;quot;/Very/long/path/into/the/odb/value1&amp;quot;&amp;gt;1&amp;lt;/ODBSet&amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;ODBSet path=&amp;quot;/Very/long/path/into/the/odb/value2&amp;quot;&amp;gt;1&amp;lt;/ODBSet&amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;ODBSet path=&amp;quot;/Very/long/path/into/the/odb/value3&amp;quot;&amp;gt;1&amp;lt;/ODBSet&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;ODBSet path=&amp;quot;/Very/long/path/into/the/odb/value4&amp;quot;&amp;gt;1&amp;lt;/ODBSet&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
one can write &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;ODBSubdir path=&amp;quot;/Very/long/path/into/the/odb&amp;quot;&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;ODBSet path=&amp;quot;value1&amp;quot;&amp;gt;1&amp;lt;/ODBSet&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;ODBSet path=&amp;quot;value2&amp;quot;&amp;gt;1&amp;lt;/ODBSet&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;ODBSet path=&amp;quot;value3&amp;quot;&amp;gt;1&amp;lt;/ODBSet&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;ODBSet path=&amp;quot;value4&amp;quot;&amp;gt;1&amp;lt;/ODBSet&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;/ODBSubdir&amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Param name=&amp;quot;&#039;&#039;name&#039;&#039;&amp;quot; [comment=&amp;quot;&#039;&#039;comment&#039;&#039;&amp;quot;][options=&amp;quot;&#039;&#039;a&#039;&#039;,&#039;&#039;b&#039;&#039;,&#039;&#039;c&#039;&#039;,...&amp;quot;] [type=&amp;quot;bool&amp;quot;] /&amp;gt;&lt;br /&gt;
||PARAM &#039;&#039;name&#039;&#039;, &#039;&#039;comment&#039;&#039;, [&#039;&#039;a&#039;&#039;,&#039;&#039;b&#039;&#039;,&#039;&#039;c&#039;&#039; | bool]&lt;br /&gt;
||When starting a script, a start page is shown where one can enter additional parameters for the script. Parameters can be defined either centrally for all scripts in the ODB under /Experiment/Edit on sequence. This subdirectory in the ODB can contain links to ODB values, which are queried at the start page. In addition, each script can define additional parameters appended to this list. They will be stored under /Sequencer/Variables and can be referenced inside the script via $name, where name can be any variable name specified in the parameter statement. The optional &amp;quot;comment&amp;quot; is shown on the start page below the parameter name. If only certain options are possible for the parameter, they can be defined via the options list. The web page will then contain a drop-down list showing the options. In case of type=&amp;quot;bool&amp;quot;, a checkbox will be shown.&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;RunDescription&amp;gt; &#039;&#039;description&#039;&#039; &amp;lt;/RunDescription&amp;gt;&lt;br /&gt;
||RUNDESCRIPTION &#039;&#039;description&#039;&#039;&lt;br /&gt;
||a run description which is stored under /Experiment/Run Parameters/Run Description .&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Script [params=&amp;quot;&#039;&#039;a&#039;&#039;,&#039;&#039;b&#039;&#039;,&#039;&#039;c&#039;&#039;,...&amp;quot;]&amp;gt; &#039;&#039;script&#039;&#039; &amp;lt;/Script&amp;gt;&lt;br /&gt;
||SCRIPT &#039;&#039;script&#039;&#039; [, a, b, c, ...]&lt;br /&gt;
||To call a script on the server side. Optionally, pass parameters to the script.&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Set name=&amp;quot;&#039;&#039;name&#039;&#039;&amp;quot;&amp;gt; &#039;&#039;value&#039;&#039; &amp;lt;/Set&amp;gt;&lt;br /&gt;
||SET &#039;&#039;name&#039;&#039;, &#039;&#039;value&#039;&#039;&lt;br /&gt;
||Sets the variable &#039;&#039;name&#039;&#039; to &amp;quot;value&amp;quot;. The variable can then be referenced later in the script by putting a &amp;quot;$&amp;quot; in front of the name like $&amp;quot;name&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Subroutine name=&amp;quot;&#039;&#039;name&#039;&#039;&amp;quot;&amp;gt;...&amp;lt;/Subroutine&amp;gt;&lt;br /&gt;
||SUBROUTINE &#039;&#039;name&#039;&#039; ... ENDSUBROUTINE&lt;br /&gt;
||Declares a subroutine which can be called via CALL.&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Transition&amp;gt;Start | Stop&amp;lt;/Transition&amp;gt;&lt;br /&gt;
||TRANSITION start | stop | pause | resume&lt;br /&gt;
||To start, stop, pause or resume a run&lt;br /&gt;
|-&lt;br /&gt;
||&amp;lt;Wait for=&amp;quot;events | ODBvalue | seconds&amp;quot; [path=&amp;quot;&#039;&#039;ODB path&#039;&#039;&amp;quot;] [op=&amp;quot;&amp;gt;=/&amp;gt;/&amp;lt;=/&amp;lt;/==/!=&amp;quot;]&amp;gt; &#039;&#039;value&#039;&#039; &amp;lt;/Wait&amp;gt;&lt;br /&gt;
||WAIT events | ODBvalue | seconds, [&#039;&#039;ODB path&#039;&#039;], [&#039;&#039;op&#039;&#039;], [&#039;&#039;value&#039;&#039;]&lt;br /&gt;
||Wait until a number of events is acquired (testing /Equipment/Trigger/Statistics/Events sent), or until a value in the ODB exceeds value, or wait for &#039;&#039;value&#039;&#039; seconds. If the operand &#039;&#039;op&#039;&#039; is given, the ODB value is compared with value using this operand. So one could wait until an ODB value is equal to value or becomes smaller than value. Here is an example of such a statement which waits until some high voltage is below 100 V. &lt;br /&gt;
WAIT ODBvalue, /Equipment/HV/Variables/Measured[3], &amp;lt;, 100&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= MSL Example =&lt;br /&gt;
The following example is a simple script, which writes a run description to the ODB, asks for a number of runs, then executes the runs, each running for 60 seconds.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
COMMENT &amp;quot;This is a MSL test file&amp;quot;&lt;br /&gt;
RUNDESCRIPTION &amp;quot;Test run&amp;quot;&lt;br /&gt;
PARAM runs&lt;br /&gt;
&lt;br /&gt;
LOOP $runs&lt;br /&gt;
     TRANSITION START&lt;br /&gt;
     WAIT Seconds 60&lt;br /&gt;
     TRANSITION STOP&lt;br /&gt;
ENDLOOP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= XML Example =&lt;br /&gt;
The following XML script does exactly the same.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;RunSequence xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; xsi:noNamespaceSchemaLocation=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;Comment&amp;gt;This is a XML test file&amp;lt;/Comment&amp;gt;&lt;br /&gt;
  &amp;lt;RunDescription&amp;gt;Test run&amp;lt;/RunDescription&amp;gt;&lt;br /&gt;
  &amp;lt;Param name=&amp;quot;runs&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Loop n=&amp;quot;$runs&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Transition&amp;gt;START&amp;lt;/Transition&amp;gt;&lt;br /&gt;
    &amp;lt;Wait for=&amp;quot;events&amp;quot;&amp;gt;3000&amp;lt;/Wait&amp;gt;&lt;br /&gt;
    &amp;lt;Transition&amp;gt;STOP&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  &amp;lt;/Loop&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/RunSequence&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sequencer]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=File:Seq_newscript.png&amp;diff=2639</id>
		<title>File:Seq newscript.png</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=File:Seq_newscript.png&amp;diff=2639"/>
		<updated>2017-09-27T01:16:40Z</updated>

		<summary type="html">&lt;p&gt;Suz: Sequencer page where the example script has been loaded&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Sequencer page where the example script has been loaded&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=File:Seq_noscript.png&amp;diff=2638</id>
		<title>File:Seq noscript.png</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=File:Seq_noscript.png&amp;diff=2638"/>
		<updated>2017-09-27T01:15:35Z</updated>

		<summary type="html">&lt;p&gt;Suz: Sequencer page where no script has been loaded&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Sequencer page where no script has been loaded&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=MIDAS_environment_variables&amp;diff=2611</id>
		<title>MIDAS environment variables</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=MIDAS_environment_variables&amp;diff=2611"/>
		<updated>2017-01-23T23:27:55Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
MIDAS uses a several environment variables to facilitate the startup of the different applications. Only [[#MIDASSYS|MIDASSYS]] is required.  &lt;br /&gt;
&lt;br /&gt;
The MIDAS environment variables are also discussed in [[Compilation &amp;amp; Build]] and [[QuickStart]].&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
:Except where noted, the following environment variables are defined on the &#039;&#039;&#039;MIDAS experiment host&#039;&#039;&#039;, i.e. the host on which the MIDAS experiment shared memories are residing. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
= MIDASSYS =&lt;br /&gt;
This environmental variable is required. It should point to the main path of the installed MIDAS package on the experiment host e.g.&lt;br /&gt;
;csh :    setenv MIDASSYS $HOME/packages/midas  &lt;br /&gt;
;bash :   export MIDASSYS=$HOME/packages/midas  &lt;br /&gt;
The application [[odbedit]] will generate a warning message unless this variable is defined.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= MIDAS_EXPTAB =&lt;br /&gt;
This variable specifies the location of the optional [[exptab (Experiment Table)|exptab]] file containing the predefined MIDAS experiment(s), e.g. &lt;br /&gt;
&lt;br /&gt;
;csh :  setenv MIDAS_EXPTAB $HOME/online/exptab&lt;br /&gt;
;bash : export MIDAS_EXPTAB = $HOME/online/exptab&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;&#039;MIDAS_EXPTAB&#039;&#039;&#039; is not defined, the default location will be used (i.e. for OS_UNIX: &#039;&#039;/etc&#039;&#039;, / and for OS_WINNT: &#039;&#039;\system32, \system &#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= MIDAS_SERVER_HOST =&lt;br /&gt;
&lt;br /&gt;
If all the MIDAS clients run on the &#039;&#039;&#039;experiment host&#039;&#039;&#039;, this variable is NOT defined.&lt;br /&gt;
&lt;br /&gt;
It is needed when a connection to a remote experiment is requested. In that case, this variable is &#039;&#039;&#039;defined on the remote host(s)&#039;&#039;&#039;, and predefines the name of the [[#Introduction|experiment host]]. In this case, the [[mserver]] client must also be started on the experiment host. See [[Quickstart Linux|Quickstart]] for more information.&lt;br /&gt;
&lt;br /&gt;
Defining MIDAS_SERVER_HOST makes adding the &amp;quot;&#039;&#039;-h &amp;lt;hostname&amp;gt;&#039;&#039;&amp;quot; argument to the application command unnecessary (see [[Common Parameters to MIDAS Utilities]]). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MIDAS_SERVER_HOST&#039;&#039;&#039; will be superseded by [[#MIDAS_DIR |MIDAS_DIR]] if defined. This variable is valid for Unix as well as Windows OS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= MIDAS_EXPT_NAME =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Where there are multiple experiments available on the MIDAS experiment host, this variable predefines the name of the experiment to which the user wishes to connect. It prevents the requested application from asking for the experiment name. Defining MIDAS_EXPT_NAME makes adding the &#039;&#039;&amp;quot;-e &amp;lt;exptname&amp;gt;&amp;quot;&#039;&#039; argument to the application command unnecessary (see [[Common Parameters to MIDAS Utilities]]). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MIDAS_EXPT_NAME&#039;&#039;&#039; will be superseded by [[#MIDAS_DIR |MIDAS_DIR]] if defined. This variable is valid for Unix as well as Windows OS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= MIDAS_DIR =&lt;br /&gt;
This variable predefines the LOCAL directory path where the shared memories for the experiment are located. Defining this variable results in a single experiment called &amp;quot;Default&amp;quot;. Since a given directory path can only refer to a single experiment, &#039;&#039;&#039;MIDAS_DIR&#039;&#039;&#039; supersedes the &#039;&#039;&amp;quot;-e &amp;lt;exptname&amp;gt;&amp;quot;&#039;&#039; and &amp;quot;&#039;&#039;-h &amp;lt;hostname&amp;gt;&#039;&#039;&amp;quot; arguments as well as the [[#MIDAS_SERVER_HOST |MIDAS_SERVER_HOST]] and [[#MIDAS_EXPT_NAME|MIDAS_EXPT_NAME]] environment variables.&lt;br /&gt;
&lt;br /&gt;
;Note : If you wish to use the [[exptab]] file to define multiple experiments on a single host, do not define &#039;&#039;&#039;MIDAS_DIR&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= MIDAS_INVALID_STRING_IS_OK =&lt;br /&gt;
;Note&lt;br /&gt;
: Environment variable MIDAS_INVALID_STRING_IS_OK and UTF-8 key check added Jan 2017.&lt;br /&gt;
&lt;br /&gt;
By default, the ODB keys names are checked to ensure they are UTF-8 compliant (see [[ODB Access and Use#ODB Keys|ODB Keys]] for more information). &lt;br /&gt;
&lt;br /&gt;
Defining environment value  &#039;&#039;&#039;MIDAS_INVALID_STRING_IS_OK&#039;&#039;&#039;  (set to any value)  disables this key check.  The existence of this environment value is only checked for once, when a program starts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= ROOTSYS =&lt;br /&gt;
This variable must point to the ROOT package if generating a complete MIDAS/ROOT analyzer application. If not using ROOT, &#039;&#039;&#039;ROOTSYS&#039;&#039;&#039; should be undefined.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CERNLIB_PACK =&lt;br /&gt;
In case of HBOOK/PAW analyzer application, this variable should be pointing to a valid cernpacklib.a library. See [[#HAVE_HBOOK |HAVE_HBOOK]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
----------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= MIDAS_FRONTEND_INDEX =&lt;br /&gt;
This variable predefines the index assigned to the equipment using the event builder option. Useful if the [[Frontend Application|Frontend Applications]] are started from different hosts. Refer to [[Event Builder#Event Builder and related frontend fragment|Event Builder and related frontend fragment]] for more information.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
---------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= MCHART_DIR =&lt;br /&gt;
This variable is used for the old [[mchart]] utility.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Environment variable]] [[Category:Appendices]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=ReadOn_Flags&amp;diff=2606</id>
		<title>ReadOn Flags</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=ReadOn_Flags&amp;diff=2606"/>
		<updated>2016-12-12T23:39:58Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
Read-on flags RO_xxx are used in the [[Equipment List Parameters#ReadOn|Read On]]  field of the equipment declaration to specify when the read-out of an event occurs. These flags are defined in  [http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/html/midas_8h.html midas.h]. &lt;br /&gt;
* Multiple flags can be ORed together, e.g. RO_RUNNING|RO_ODB.  &lt;br /&gt;
* RO_TRANSITIONS is equivalent to  RO_BOR|RO_EOR|RO_PAUSE|RO_RESUME.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ READ_ON Flags&lt;br /&gt;
|-&lt;br /&gt;
! READ_ON Flag name !! Value !! Readout Occurs&lt;br /&gt;
|-&lt;br /&gt;
|RO_RUNNING     || 1 || While running&lt;br /&gt;
|-&lt;br /&gt;
|RO_STOPPED     || 2|| Before stopping run&lt;br /&gt;
|-&lt;br /&gt;
|RO_PAUSED     ||  4 || When run is paused&lt;br /&gt;
|-&lt;br /&gt;
|RO_BOR     ||     8|| At the beginning of run&lt;br /&gt;
|-&lt;br /&gt;
|RO_EOR     ||     16|| At the end of run&lt;br /&gt;
|-&lt;br /&gt;
|RO_PAUSE    ||    32|| Before pausing the run&lt;br /&gt;
|-&lt;br /&gt;
|RO_RESUME   ||    64|| Before resuming the run&lt;br /&gt;
|-&lt;br /&gt;
|RO_TRANSITIONS || 127 || At all transitions&lt;br /&gt;
|-&lt;br /&gt;
|RO_ALWAYS  || 255||Always (independent of the run status)&lt;br /&gt;
|-&lt;br /&gt;
|RO_ODB || 256 ||Copies the event to the &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;/Equipment/&amp;lt;equipment name&amp;gt;/Variables&amp;lt;/span&amp;gt; ODB tree. The ODB is updated with a new event approximately every second.&amp;lt;br&amp;gt;Note that this feature is generally used only for testing or monitoring, as writing large amounts of data to the ODB takes time.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Equipment]] [[Category:Frontend]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Edit-on-start_Parameters&amp;diff=2598</id>
		<title>Edit-on-start Parameters</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Edit-on-start_Parameters&amp;diff=2598"/>
		<updated>2016-11-26T00:18:00Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[Edit-on-Sequence Parameters]]&lt;br /&gt;
* [[/Experiment ODB tree]]&lt;br /&gt;
* mhttpd [[Start Page]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
== Introduction ==&lt;br /&gt;
When a run is started, by default only the &lt;br /&gt;
[[/Runinfo ODB tree #Run number|run number]] of the upcoming run will be displayed for editing (Figure 1).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;  &lt;br /&gt;
|+ Figure 1:  Run start with no edit-on-start parameters defined&lt;br /&gt;
|-&lt;br /&gt;
!  Using [[mhttpd]] !! Using [[odbedit]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Mhstart1.gif|left|border|300px]]&lt;br /&gt;
|  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 [local:bnmr:S]/Experiment&amp;gt;start&lt;br /&gt;
 Run number [30499]: &lt;br /&gt;
 Are the above parameters correct? ([y]/n/q):&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;edit-on-start&#039;&#039; parameters ==&lt;br /&gt;
It is often convenient to display and edit additional parameters prior to the run start. Not surprisingly, these parameters are known as &#039;&#039;&#039;&#039;&#039;edit-on-start&#039;&#039;&#039;&#039;&#039; parameters, since they automatically appear every time a run starts, and they are editable by the user. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Edit-on-start&#039;&#039; parameters are defined by creating ODB keys (or links to  existing ODB keys) in a special subtree named &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Edit on start&#039;&#039;&amp;lt;/span&amp;gt; that the user creates in the&lt;br /&gt;
[[/Experiment ODB tree]].&lt;br /&gt;
&lt;br /&gt;
Many users link to the  [[Keys in the ODB /Logger tree #/Logger/Write data |Write data key]] (see [[#Creating &#039;&#039;edit-on-start&#039;&#039; parameters|below]])  which enables/disables writing of data. A quick test run can then be made without data logging (see Figure 2).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|  class=&amp;quot;wikitable&amp;quot;  &lt;br /&gt;
|+ Figure 2: Run start with one edit-on-start parameter defined&lt;br /&gt;
|-&lt;br /&gt;
!  Using [[mhttpd]] !! Using [[odbedit]]&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Mhstart.gif|left|border|400px]]&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 [local:test:S]/Experiment&amp;gt;start&lt;br /&gt;
 Write data : n&lt;br /&gt;
 Run number [30499]:&lt;br /&gt;
 Are the above parameters correct? ([y]/n/q):  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
By using the  {{Odbedit cmd|cmd=start now}}, any edit-on-start parameters will &#039;&#039;not&#039;&#039; be displayed; the run will start immediately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Creating &#039;&#039;edit-on-start&#039;&#039; parameters ==&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: The examples shown here use &amp;lt;span style=&amp;quot;color:darkcyan;&amp;quot;&amp;gt;&#039;&#039;odbedit&#039;&#039;&amp;lt;/span&amp;gt; for ease of documentation; many users will prefer to   use the editing function of the &amp;lt;span style=&amp;quot;color:darkcyan;&amp;quot;&amp;gt;&#039;&#039;mhttpd&#039;&#039;&amp;lt;/span&amp;gt; [[ODB Page]] to create the ODB keys.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The first step to setting up the &#039;&#039;edit-on-start&#039;&#039; parameters is to create the subtree  &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Edit on start&#039;&#039;&amp;lt;/span&amp;gt; under &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; as follows:&lt;br /&gt;
&lt;br /&gt;
 $odbedit&lt;br /&gt;
 [local:Default:S]/&amp;gt;cd /experiment&lt;br /&gt;
 [local:Default:S]/Experiment&amp;gt;mkdir &amp;quot;Edit on start&amp;quot;&lt;br /&gt;
 [local:Default:S]/Experiment&amp;gt;cd &amp;quot;Edit on start&amp;quot;&lt;br /&gt;
 [local:Default:S]/Edit on start&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the user either creates the required parameters, or, if the parameters already exist elsewhere in the ODB, creates &#039;&#039;&#039;links&#039;&#039;&#039; to the parameters in the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Edit on start&#039;&#039;&amp;lt;/span&amp;gt; subtree. &lt;br /&gt;
&lt;br /&gt;
Some users find it convenient to create a subtree of &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; named &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Run Parameters&#039;&#039;&amp;lt;/span&amp;gt; to contain the run parameters. Links to these parameters in the subtree {{Odbpath|path=Run Parameters}} are then created in the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Edit on start&#039;&#039;&amp;lt;/span&amp;gt; subtree.&lt;br /&gt;
&lt;br /&gt;
The example below shows the creation of three parameters in the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Edit on start&#039;&#039;&amp;lt;/span&amp;gt; subtree.:&lt;br /&gt;
&lt;br /&gt;
*    a parameter to contain the title of the run (called &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;run_title&#039;&#039;&amp;lt;/span&amp;gt; )&lt;br /&gt;
*    a link to the ODB parameter &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Logger/Write data&#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
*    a link to the ODB parameter &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Equipment/FIFO_acq/frontend/hardware/num cycles&#039;&#039;&amp;lt;/span&amp;gt;(previously created by the user)&lt;br /&gt;
*   a link to the ODB parameter &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Equipment/Run Parameters/Run Description&#039;&#039;&amp;lt;/span&amp;gt;  (previously created by the user)&lt;br /&gt;
&lt;br /&gt;
 [local:Default:S]/Edit on start&amp;gt;&lt;br /&gt;
 [local:Default:S]/Edit on start&amp;gt;create string run_title&lt;br /&gt;
 String length [32]:128&lt;br /&gt;
 [local:Default:S]/Edit on start&amp;gt;ln &amp;quot;/Equipment/FIFO_acq/frontend/hardware/num cycles&amp;quot; &amp;quot;Number of cycles&amp;quot;&lt;br /&gt;
 [local:Default:S]/Edit on start&amp;gt;ln &amp;quot;/Experiment/Run Parameters/Run Description&amp;quot; &amp;quot;Description&amp;quot;&lt;br /&gt;
 [local:Default:S]/Edit on start&amp;gt;ln &amp;quot;/Logger/Write data&amp;quot; &amp;quot;write data&amp;quot;&lt;br /&gt;
 [local:Default:S]Edit on start&amp;gt;ls -lt&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
  run_title                      STRING  1     128   13m  0   RWD&lt;br /&gt;
  Number of cycles -&amp;gt; /equipment/fifo_acq/frontend/hardware/num cycles&lt;br /&gt;
                                DWORD   1     4     &amp;gt;99d 0   RWD  0&lt;br /&gt;
  write data -&amp;gt; /logger/Write data&lt;br /&gt;
                                BOOL    1     4     &amp;gt;99d 0   RWD  y&lt;br /&gt;
  Description -&amp;gt; /Experiment/Run Parameters/Run Description&lt;br /&gt;
          &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== &#039;&#039;edit-on-start&#039;&#039; parameter comments ==&lt;br /&gt;
&lt;br /&gt;
An optional subdirectory &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Parameter Comments&#039;&#039;&amp;lt;/span&amp;gt; can be created under the [[/Experiment ODB tree]] to display some extra text on the [[mhttpd]] Start page under an [[#edit-on-start parameters|edit-on-start parameter]] where the parameter name may not contain enough information. In this case, a parameter comment can be created by the user.&lt;br /&gt;
&lt;br /&gt;
This &amp;quot;parameter comment&amp;quot; option is visible ONLY when using the MIDAS web server [[mhttpd]]. The [[odbedit]] start command will not display this extra information.&lt;br /&gt;
&lt;br /&gt;
The name of the parameter in the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Parameter Comments&#039;&#039;&amp;lt;/span&amp;gt; subtree must match that of the corresponding edit-on-start parameter. &lt;br /&gt;
&lt;br /&gt;
=== Parameter comments when edit-on-start parameter is a link ===&lt;br /&gt;
If the edit-on-start parameter is a link &#039;&#039;which is named differently from the actual parameter&#039;&#039;, then the parameter name in the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Parameter Comments&#039;&#039;&amp;lt;/span&amp;gt; subtree must match the name of the actual parameter, rather than the link-name.&lt;br /&gt;
&lt;br /&gt;
This is illustrated in the below, where the Edit-on-start parameter is a link named &amp;quot;number of cycles&amp;quot;, which links to the actual parameter named &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/equipment/fifo_acq/frontend/hardware/num cycles&#039;&#039;&amp;lt;/span&amp;gt;.  The parameter name in the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Parameter Comments&#039;&#039;&amp;lt;/span&amp;gt; subtree for this parameter must be &#039;&#039;&#039;&amp;quot;num cycles&amp;quot;&#039;&#039;&#039; and &#039;&#039;&#039;NOT &amp;quot;number of cycles&amp;quot;&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[local:bnqr:Stopped]Parameter Comments&amp;gt;ls &amp;quot;Edit on start/Number of cycles&amp;quot; &lt;br /&gt;
Number of cycles -&amp;gt; /Equipment/FIFO_acq/frontend/hardware/num cycles&lt;br /&gt;
                              0&lt;br /&gt;
[local:bnqr:Stopped]/Experiment&amp;gt;ls &amp;quot;Parameter Comments/Num cycles&amp;quot; &lt;br /&gt;
Num cycles   Stop run after number of cycles is reached. Enter 0 to disable (free running)      &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Adding HTML styles to parameter comments ===&lt;br /&gt;
&lt;br /&gt;
HTML styling can be added to the parameter comments using the HTML span tag, as in Figures 3a and 3b.&lt;br /&gt;
;Figure 3a Adding HTML styling to the parameter comments Keys in ODB&lt;br /&gt;
[[File:Bnqr_parameter_comments.png|border|750px]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;Figure 3b Parameter comments shown with HTML styling&lt;br /&gt;
[[File:Bnqr_run_start.png|border]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Example of &#039;&#039;edit-on-start&#039;&#039; parameters ==&lt;br /&gt;
The relevant parts of the /Experiment tree are shown below&lt;br /&gt;
 [local:test:S]/Experiment&amp;gt;ls -lr&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
 Experiment                     DIR&lt;br /&gt;
    Name                        STRING  1     32    5s   0   RWD  test&lt;br /&gt;
    .........&lt;br /&gt;
    Run Parameters              DIR&lt;br /&gt;
        Run Description         STRING  1     256   2h   0   RWD  Test run&lt;br /&gt;
    edit on start               DIR&lt;br /&gt;
        run_title               STRING  1     128   1m   0   RWD  test without beam&lt;br /&gt;
        experiment number       STRING  1     32    1m   0   RWD  12345&lt;br /&gt;
        sample                  STRING  1     32    1m   0   RWD  NA&lt;br /&gt;
        field                   STRING  1     32    52s  0   RWD  2500&lt;br /&gt;
        Number of cycles -&amp;gt; /equipment/fifo_acq/frontend/hardware/num cycles&lt;br /&gt;
                                DWORD   1     4     &amp;gt;99d 0   RWD  0&lt;br /&gt;
        write data -&amp;gt; /logger/Write data&lt;br /&gt;
                                BOOL    1     4     &amp;gt;99d 0   RWD  y&lt;br /&gt;
        Description -&amp;gt; /Experiment/Run Parameters/Run Description&lt;br /&gt;
                                STRING  1     256   2h   0   RWD  Test run&lt;br /&gt;
    parameter comments          DIR&lt;br /&gt;
        field                   STRING  1     64    35m  0   RWD  &amp;lt;i&amp;gt;Entered in Tesla unit&amp;lt;/i&amp;gt;&lt;br /&gt;
        active                  STRING  1     64    35m  0   RWD  &amp;lt;i&amp;gt;Enter y to save data to disk&amp;lt;/i&amp;gt;&lt;br /&gt;
        Num cycles              STRING  1     80    34m  0   RWD  &amp;lt;i&amp;gt;Stop run after num cycles is reached. Enter 0 to disable (free running)&amp;lt;/i&amp;gt; &lt;br /&gt;
       .......&lt;br /&gt;
&lt;br /&gt;
Starting a run with edit-on-start parameters set up as above, results in a list of the edit-on-start parameters which the user can change (Figure 4).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|  class=&amp;quot;wikitable&amp;quot;  &lt;br /&gt;
|+ Figure 4: Run start with many edit-on-start parameters defined&lt;br /&gt;
|-&lt;br /&gt;
!  Using [[mhttpd]] !! Using [[odbedit]]&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Mhstart2.gif|left|border|700px]]&lt;br /&gt;
|  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 [local:test:S]/Experiment&amp;gt;start&lt;br /&gt;
 run_title : test without beam&lt;br /&gt;
 experiment number : 12345&lt;br /&gt;
 sample : NA&lt;br /&gt;
 field : 2500&lt;br /&gt;
 Number of cycles : 0&lt;br /&gt;
 write data : y&lt;br /&gt;
 Description : Test run&lt;br /&gt;
 Run number [30499]:&lt;br /&gt;
 Are the above parameters correct? ([y]/n/q):&lt;br /&gt;
 Starting run #30499&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prevent the run number being edited at Run Start ==&lt;br /&gt;
;NOTES&lt;br /&gt;
# Most experiments do not use this feature.  It was requested for experiments where the run number is strictly controlled, e.g. with a custom run number checking system that assigns the run number automatically based on the type of run.&lt;br /&gt;
#This feature is ignored by [[odbedit]]; regardless of whether the key &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;Edit run number&amp;lt;/span&amp;gt; is present, the run number may be edited when using &amp;lt;span style=&amp;quot;color:darkcyan;font-style:italic&amp;quot;&amp;gt;odbedit&amp;lt;/span&amp;gt; to start the run.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default, the user has the option to edit the run number at begin of run. To prevent this, the user may add an optional key {{Odbpath|path=Edit run number}} to the {{Odbpath|path=/Experiment/Edit on Start}} subdirectory. If this key is set to &amp;quot;n&amp;quot;, the user will not be able to edit the run number on the mhttpd [[Start Page]] at the begin of run.&lt;br /&gt;
&lt;br /&gt;
By creating the key {{Odbpath|path=/Experiment/Edit on Start/Edit run number}} as a Boolean variable, the ability of editing the run number in the  {{Utility|name=mhttpd}} [[Start Page]] is enabled or disabled, e.g.&lt;br /&gt;
&lt;br /&gt;
 [local:Default:S]Edit on start&amp;gt;create BOOL &amp;quot;Edit run number&amp;quot;&lt;br /&gt;
 [local:Default:S]Edit on start&amp;gt;set &amp;quot;Edit run number&amp;quot; n&lt;br /&gt;
&lt;br /&gt;
By default, if this key is NOT present, the run number IS editable.&lt;br /&gt;
&lt;br /&gt;
Figure 5 shows edit-on-start parameters with the key &amp;quot;Edit run number&amp;quot; present, using the mhttpd [[ODB Page]] (Figure 5a) or [[odbedit]] (Figure 5b).&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;  &lt;br /&gt;
|+ Figure 5: Displaying edit-on-start parameters&lt;br /&gt;
|-&lt;br /&gt;
!  Figure 5a: Using [[mhttpd]] [[ODB Page]]  !! Figure 5b: Using odbedit&lt;br /&gt;
|-&lt;br /&gt;
| [[File:odb_edit_on_start.png|left|border|700px]]&lt;br /&gt;
| &amp;lt;pre&amp;gt;&lt;br /&gt;
[local:bnqr:Stopped]/Experiment&amp;gt;ls &amp;quot;Edit on start/&lt;br /&gt;
run_title                       MgO, HH=22mT, 300 K, 28 keV 31Mg, SLR&lt;br /&gt;
experiment number               9998&lt;br /&gt;
experimenter                    ms cdpl wlk lp gdm&lt;br /&gt;
sample                          MgO&lt;br /&gt;
orientation                     100&lt;br /&gt;
temperature                     300 K&lt;br /&gt;
field                           220 G&lt;br /&gt;
run mode -&amp;gt; /Experiment/run parameters/run mode&lt;br /&gt;
                                1&lt;br /&gt;
Number of cycles -&amp;gt; /Equipment/FIFO_acq/frontend/hardware/num cycles&lt;br /&gt;
                                0&lt;br /&gt;
write data -&amp;gt; /Equipment/FIFO_acq/mdarc/enable mdarc logging&lt;br /&gt;
                                y&lt;br /&gt;
Edit run number                 n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting  {{Utility|name=mhttpd}} [[Start Page]] is shown below (Figure 6).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Figure 6: Start Page where run number cannot be edited&#039;&#039;&#039;&lt;br /&gt;
[[File:edit-on-start.png|left|border|1000px|Figure 6]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:Experiment]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=File:Bnqr_parameter_comments.png&amp;diff=2597</id>
		<title>File:Bnqr parameter comments.png</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=File:Bnqr_parameter_comments.png&amp;diff=2597"/>
		<updated>2016-11-25T23:52:33Z</updated>

		<summary type="html">&lt;p&gt;Suz: bnqr parameter comments odb keys showing HTML styling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;bnqr parameter comments odb keys showing HTML styling&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=File:Bnqr_run_start.png&amp;diff=2596</id>
		<title>File:Bnqr run start.png</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=File:Bnqr_run_start.png&amp;diff=2596"/>
		<updated>2016-11-25T23:51:36Z</updated>

		<summary type="html">&lt;p&gt;Suz: Suz uploaded a new version of File:Bnqr run start.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;run start parameters showing styling of parameter comments&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=File:Bnqr_run_start.png&amp;diff=2595</id>
		<title>File:Bnqr run start.png</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=File:Bnqr_run_start.png&amp;diff=2595"/>
		<updated>2016-11-25T23:44:56Z</updated>

		<summary type="html">&lt;p&gt;Suz: run start parameters showing styling of parameter comments&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;run start parameters showing styling of parameter comments&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=/Experiment_ODB_tree&amp;diff=2594</id>
		<title>/Experiment ODB tree</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=/Experiment_ODB_tree&amp;diff=2594"/>
		<updated>2016-11-25T22:59:51Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[odbedit]]&lt;br /&gt;
* &lt;br /&gt;
*&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Creating the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt;  tree ==&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; ODB tree is created automatically when the &#039;&#039;&#039;[[odbedit #Creating the ODB|ODB is first created]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; ODB tree contains information relevent to the experiment. Other optional keys are added by &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039; or by &lt;br /&gt;
the user to customize their experiment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
When initially created, the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; tree contains the following keys:&lt;br /&gt;
 [local:midas:S]/&amp;gt;ls -lrt /experiment&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
 Experiment                      DIR&lt;br /&gt;
    Name                         STRING  1     32    14s  0   RWD  midas&lt;br /&gt;
    Buffer sizes                 DIR&lt;br /&gt;
        SYSMSG                   DWORD   1     4     11h  0   RWD  100000&lt;br /&gt;
    Security                     DIR&lt;br /&gt;
        Enable non-localhost RPC BOOL    1     4     46s  0   RWD  n&lt;br /&gt;
        RPC ports                DIR&lt;br /&gt;
           ODBEdit               DWORD   1     4     38m  0   RWD  0&lt;br /&gt;
        RPC hosts                DIR&lt;br /&gt;
           Allowed hosts         STRING  10    256   38m  3   RWD&lt;br /&gt;
                                         [0]             localhost&lt;br /&gt;
                                         [1]&lt;br /&gt;
                                         [2]&lt;br /&gt;
                                         [3]&lt;br /&gt;
                                         [4]&lt;br /&gt;
                                         [5]&lt;br /&gt;
                                         [6]&lt;br /&gt;
                                         [7]&lt;br /&gt;
                                         [8]&lt;br /&gt;
                                         [9]&lt;br /&gt;
        Disable RPC hosts check  BOOL    1     4     46s  0   RWD  n&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following example shows the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; tree for a typical experiment: &lt;br /&gt;
&lt;br /&gt;
 [local:midas:R]/&amp;gt;ls -lrt /experiment&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
 Experiment                      DIR&lt;br /&gt;
    Name                         STRING  1     32    7s   0   RWD  midas&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Buffer sizes&amp;lt;/span&amp;gt;                 DIR&lt;br /&gt;
        SYSMSG                   DWORD   1     4     23h  0   RWD  100000&lt;br /&gt;
        SYSTEM                   DWORD   1     4     23h  0   RWD  640000000&lt;br /&gt;
        BUF0                     DWORD   1     4     23h  0   RWD  80000000&lt;br /&gt;
        BUF1                     DWORD   1     4     23h  0   RWD  80000000&lt;br /&gt;
        .......    &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;&#039;&#039;other user-defined buffers not shown &#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Security&amp;lt;/span&amp;gt;                     DIR&lt;br /&gt;
        Enable non-localhost RPC BOOL    1     4     38m  0   RWD  n&lt;br /&gt;
        &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;RPC ports&amp;lt;/span&amp;gt;                DIR&lt;br /&gt;
            ODBEdit              DWORD   1     4     38m  0   RWD  0&lt;br /&gt;
            Logger               DWORD   1     4     35m  0   RWD  0&lt;br /&gt;
            mhttpd               DWORD   1     4     23m  0   RWD  0&lt;br /&gt;
        &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;RPC hosts&amp;lt;/span&amp;gt;                DIR&lt;br /&gt;
            Allowed hosts        STRING  10    256   38m  3   RWD&lt;br /&gt;
                                         [0]             localhost&lt;br /&gt;
                                         [1]&lt;br /&gt;
                                         [2]&lt;br /&gt;
                                         [3]&lt;br /&gt;
                                         [4]&lt;br /&gt;
                                         [5]&lt;br /&gt;
                                         [6]&lt;br /&gt;
                                         [7]&lt;br /&gt;
                                         [8]&lt;br /&gt;
                                         [9]&lt;br /&gt;
        Disable RPC hosts check  BOOL    1     4     38m  0   RWD  n&lt;br /&gt;
        &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;mhttpd hosts&amp;lt;/span&amp;gt;             DIR&lt;br /&gt;
            Allowed hosts        STRING  10    256   5h   0   RWD&lt;br /&gt;
                                         [0]&lt;br /&gt;
                                         [1]&lt;br /&gt;
                                         [2]&lt;br /&gt;
                                         [3]&lt;br /&gt;
                                         [4]&lt;br /&gt;
                                         [5]&lt;br /&gt;
                                         [6]&lt;br /&gt;
                                         [7]&lt;br /&gt;
                                         [8]&lt;br /&gt;
                                         [9]&lt;br /&gt;
    midas http port              INT     1     4     5h   0   RWD  8080&lt;br /&gt;
    midas https port             INT     1     4     5h   0   RWD  8443&lt;br /&gt;
    http redirect to https       BOOL    1     4     5h   0   RWD  y&lt;br /&gt;
    CSS File                     STRING  1     1024  9h   0   RWD  mhttpd.css&lt;br /&gt;
    JS File                      STRING  1     1024  9h   0   RWD  mhttpd.js&lt;br /&gt;
    Menu Buttons                 STRING  1     1000  9h   0   RWD  Status, ODB, Messages, ELog, Alarms, Programs, History, Sequencer, Config, Help&lt;br /&gt;
    Start-Stop Buttons           BOOL    1     4     8h   0   RWD  y&lt;br /&gt;
    Pause-Resume Buttons         BOOL    1     4     8h   0   RWD  n&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Status items&amp;lt;/span&amp;gt;                DIR&lt;br /&gt;
        Experiment Name -&amp;gt; /Experiment/Name&lt;br /&gt;
    MAX_EVENT_SIZE               DWORD   1     4     23h  0   RWD  4194304&lt;br /&gt;
    Midas server port            DWORD   1     4     3m   0   RWD  1175&lt;br /&gt;
    Transition debug flag        INT     1     4     23h  0   RWD  0&lt;br /&gt;
    Transition connect timeout   INT     1     4     23h  0   RWD  10000&lt;br /&gt;
    Transition timeout           INT     1     4     23h  0   RWD  120000&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;edit on start&amp;lt;/span&amp;gt;                DIR&lt;br /&gt;
        experiment number        DWORD   1     4     2h   0   RWD  9499&lt;br /&gt;
        field                    STRING  1     32    2h   0   RWD  19000.2(0.0)G&lt;br /&gt;
        comment-&amp;gt; /Experiment/run parameters/comment&lt;br /&gt;
                                 STRING  1     80    2h   0   RWD  Testing with low beam&lt;br /&gt;
        Number of channels -&amp;gt; /Run Parameters/number of channels&lt;br /&gt;
                                 DWORD   1     4     2h   0   RWD  20&lt;br /&gt;
        Write Data -&amp;gt; /Logger/Write data&lt;br /&gt;
                                 BOOL    1     4     2h   0   RWD  n&lt;br /&gt;
        Number of cycles -&amp;gt; /Equipment/FIFO_acq/frontend/hardware/num cycles&lt;br /&gt;
                                 DWORD   1     4     2h   0   RWD  0&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Parameter Comments&amp;lt;/span&amp;gt;           DIR                   &lt;br /&gt;
        field                    STRING  1     32    &amp;gt;99d 0   RWD  &amp;lt;i&amp;gt;Entered in Tesla unit&amp;lt;/i&amp;gt;&lt;br /&gt;
        Num cycles               STRING  1     80    &amp;gt;99d 0   RWD  &amp;lt;i&amp;gt;Stop run after num cycles is reached. Enter 0 to disable (free running)&amp;lt;/i&amp;gt;&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Run Parameters&amp;lt;/span&amp;gt;               DIR&lt;br /&gt;
        Comment                  STRING  1     80    2h   0   RWD  Testing with low beam&lt;br /&gt;
        Run Description          STRING  1     256   7h   0   RWD  Sequencer Tests&lt;br /&gt;
        Number of channels       DWORD   1     4     2h   0   RWD  20&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Lock when running&amp;lt;/span&amp;gt;            DIR&lt;br /&gt;
        Num channels -&amp;gt; /Run Parameters/number of channels&lt;br /&gt;
                                 DWORD   1     4     2h   0   RWD  20&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;edit on sequence&amp;lt;/span&amp;gt;             DIR&lt;br /&gt;
        title                    STRING  1     128   2h   0   RWD  none&lt;br /&gt;
        experiment number        DWORD   1     4     2h   0   RWD  9438&lt;br /&gt;
        experimenter             STRING  1     32    2h   0   RWD  gls&lt;br /&gt;
        sample                   STRING  1     36    2h   0   RWD  NA&lt;br /&gt;
        run description -&amp;gt; /Experiment/run parameters/run description&lt;br /&gt;
                                 STRING  1     256   7h   0   RWD  Sequencer Tests&lt;br /&gt;
        Write Data -&amp;gt; /Logger/Write data&lt;br /&gt;
                                 BOOL    1     4     2h   0   RWD  n&lt;br /&gt;
        Number of cycles -&amp;gt; /Equipment/FIFO_acq/frontend/hardware/num cycles&lt;br /&gt;
                                 DWORD   1     4     2h   0   RWD  0&lt;br /&gt;
    Prevent start on alarms      BOOL    1     4     22h  0   RWD  n&lt;br /&gt;
    Prevent start on required    BOOL    1     4     22h  0   RWD  n&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Status items&amp;lt;/span&amp;gt;                 DIR&lt;br /&gt;
        Experiment Name -&amp;gt; /Experiment/Name&lt;br /&gt;
                                 STRING  1     32    7s   0   RWD  midas&lt;br /&gt;
    Start-Stop Buttons           BOOL    1     4     5h   0   RWD  y&lt;br /&gt;
    Pause-Resume Buttons         BOOL    1     4     5h   0   RWD  n&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Keys in &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; tree==&lt;br /&gt;
&lt;br /&gt;
The keys in the ODB &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment tree&#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
are described in the following sections.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Name &#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]]&lt;br /&gt;
contains the name of the experiment. It is created by the MIDAS system when the ODB is created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Buffer Sizes &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&lt;br /&gt;
This key in the [[#top|/Experiment tree]] is a subtree to contain the sizes of the &lt;br /&gt;
Midas Buffers for the experiment. Created by the MIDAS system with default values. The sizes can be changed to optimize the memory usage. See &#039;&#039;&#039;[[Event Buffer]]&#039;&#039;&#039; Size(s) for details.  Other user-defined&lt;br /&gt;
buffers may be present (e.g. for &#039;&#039;&#039;[[event filtering]]&#039;&#039;&#039;).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;SYSMSG &#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  100000 Bytes&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#Buffer Sizes|/Experiment/Buffer Sizes subtree]]&lt;br /&gt;
contains the size of SYSMSG buffer. This buffer is used for MIDAS messages.&lt;br /&gt;
The default value of this key is defined by MESSAGE_BUFFER_SIZE in $MIDASSYS/include/msystem.h .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;SYSTEM &#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  32MiBytes&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#Buffer Sizes|/Experiment/Buffer Sizes subtree]]&lt;br /&gt;
contains the size of SYSTEM buffer.  The default value of this key is&lt;br /&gt;
DEFAULT_BUFFER_SIZE = 32 MiB (defined in [http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/html/midas_8h_source.html midas.h]). &lt;br /&gt;
The actual SYSTEM buffer size is set by this key. To increase the SYSTEM buffer size (e.g. for very large events), see [[Event Buffer]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;MAX_EVENT_SIZE &#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  4MiBytes&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]]&lt;br /&gt;
specifies the maximum event size that can be acquired. The default value of this key is&lt;br /&gt;
DEFAULT_MAX_EVENT_SIZE =  4 MiB  (defined in [http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/html/midas_8h_source.html midas.h]). &lt;br /&gt;
The actual maximum event size is set by this key, and can be increased for larger events if needed (see  [[Event Buffer]] for more information).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;midas http port&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  8080&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is created when [[mhttpd]] is run for the first time. It contains the listening port for the HTTP server (default 8080). This will be redirected to the secure HTTPS port given by [[#midas https port|midas https port]] if the key [[#http redirect to https|http redirect to https]] is set to &amp;quot;y&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If the http port are supplied with the &amp;quot;--http&amp;quot; option when starting  {{Utility|name=mhttpd}}, the port supplied will overwrite the default value stored in this key. See [[mhttpd]] for details. &lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This [[Security]] feature was added to  [[mhttpd]] in August 2015&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;midas https port&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  8443&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is created when [[mhttpd]] is run for the first time. It contains the listening port (default 8443) for the secure &lt;br /&gt;
HTTPS/SSL server ([https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose]). &lt;br /&gt;
&lt;br /&gt;
If the https port is supplied with the &amp;quot;--https&amp;quot; option when starting  {{Utility|name=mhttpd}}, the port supplied will overwrite the default value stored in this key. See [[mhttpd]] for details.&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This [[Security]] feature was added to [[mhttpd]] in August 2015&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;http redirect to https&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  y&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is created when [[mhttpd]] is run for the first time.  If set to &amp;quot;y&amp;quot;, connections to the http port (specified by the key [[#midas http port|midas http port]] will be redirected to hte https port (specified by the key [[#midas https port|midas https port]], i.e. the listening port for the secure &lt;br /&gt;
HTTPS/SSL server ([https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose]). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This [[Security]] feature was added to [[mhttpd]] in August 2015&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;midas server port&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  1175&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key is created when [[mserver]] is started for the first time. It contains the default value of the port used by [[mserver]]. This is set to MIDAS_TCP_PORT = 1175 ( midas.h).  A different port can be used by starting [[mserver]] with the -p argument.&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This key was added in May 2015 (see [[Security]]). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;CSS File&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;mhttpd.css&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains the name of the [[Custom Page Features#MIDAS stylesheet|MIDAS stylesheet]] file for the use of those writing [[Custom Page|Custom Web Pages]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;JS File&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;mhttpd.js&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains the name of the [[mhttpd.js|Javascript library]] file for the use of those writing [[Custom Page|Custom Web Pages]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Menu Buttons&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:2;-moz-column-count:2;-webkit-column-count:2&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;Status, ODB, Messages, ELog, Alarms, Programs, History, Sequencer, Chat, Config, Help&amp;quot;&lt;br /&gt;
 &amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]]&lt;br /&gt;
is added automatically by &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039; to allow the Menu buttons that appear on the &#039;&#039;&#039;[[mhttpd|Main Status Page]]&#039;&#039;&#039; to be customized by &lt;br /&gt;
removing unnecessary buttons or by changing their order. &lt;br /&gt;
&lt;br /&gt;
The Start/Stop/Pause/Resume buttons are not now included in  &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Menu Buttons&#039;&#039;&amp;lt;/span&amp;gt;. &lt;br /&gt;
* To suppress/display the Start/Stop buttons use key [[#Start-Stop Buttons|Start-Stop Buttons]].&lt;br /&gt;
* To display/suppress the Pause/Resume buttons, use key [[#Pause-Resume Buttons|Pause-Resume Buttons]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Note&lt;br /&gt;
:If [[MSCB Page#MIDAS with MSCB support|MSCB support]] is built into MIDAS, the default will also include the MSCB Menu button (see [[MSCB Page]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Start-Stop Buttons&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; y&lt;br /&gt;
 &amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is added automatically by &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039; to allow the user to suppress the Start or Stop buttons from appearing on the [[Status Page]]. By default, Start/Stop buttons are shown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Pause-Resume Buttons&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; n&lt;br /&gt;
 &amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is added automatically by &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039;.&lt;br /&gt;
By default the Pause/Resume menu buttons do not appear on the [[Status Page]]. The user can allow these buttons&lt;br /&gt;
to appear during the run by setting this key to &amp;quot;y&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition debug flag &#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains a flag that, if set to 1, causes messages reporting transition progress to be output.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition connect timeout&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  10000&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains the&lt;br /&gt;
value of timeout for remote rpc connect&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition timeout&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  120000&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains the&lt;br /&gt;
value of timeout for transition &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Prevent start on alarms&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;  &lt;br /&gt;
This key in the [[#top|/Experiment tree]] if set true &lt;br /&gt;
will prevent the run from starting if an [[Alarm System|alarm]] is true, i.e.&lt;br /&gt;
the run start procedure will fail if an alarm has been [[/Alarms ODB tree#Triggered|Triggered]] for a client, provided a valid [[/Alarms ODB tree#alarms class|alarms class]] has&lt;br /&gt;
been entered in the client&#039;s [[/Programs ODB tree#Alarm class|Alarm class]] key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Prevent start on required program&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] if set true (&amp;quot;y&amp;quot;)&lt;br /&gt;
will prevent the run from starting if one of the &#039;&#039;&#039;required&#039;&#039;&#039; clients is not running. A client is flagged as &amp;quot;required&amp;quot; by setting the ODB key &lt;br /&gt;
[[/Programs ODB tree#Required|Required]] to &amp;quot;y&amp;quot;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Edit on Sequence &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This  optional subdirectory  in the [[#top|/Experiment tree]] may&lt;br /&gt;
contain user-defined parameters which will be displayed for editing at the start of each [[Sequencer|Sequence]]. See [[Edit-on-Sequence Parameters]] for details. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Edit on Start &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This  optional subdirectory  in the [[#top|/Experiment tree]] may&lt;br /&gt;
contain user-defined parameters which will be displayed for editing at the beginning of each run. See &#039;&#039;&#039;[[Edit-on-start Parameters]]&#039;&#039;&#039; for details. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Lock when running &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This  optional subdirectory  in the [[#top|/Experiment tree]] contains user-defined links to ODB parameters to prevent them being changed when the run is in progress. See &#039;&#039;&#039;[[Lock when running]]&#039;&#039;&#039; for details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Parameter Comments &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This  optional subdirectory   in the [[#top|/Experiment tree]] may contain user-defined parameter comments that give more information about&lt;br /&gt;
the &#039;&#039;&#039;[[Edit-on-start Parameters]]&#039;&#039;&#039;.  See [[Edit-on-start Parameters#edit-on-start parameter comments|creating parameter comments]] for details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Run Parameters &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This  optional subdirectory   in the [[#top|/Experiment tree]] may contain user-defined parameters or parameter(s)&lt;br /&gt;
with reserved names (i.e. [[#Run Description|Run Description]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Run Description&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This ODB key is used by the [[Sequencer]] [[Sequencer#RUNDESCRIPTION|RUNDESCRIPTION]] command to store the&lt;br /&gt;
run description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;&amp;lt;parameter name&amp;gt;&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
The user may define parameters here e.g. for linking as  &#039;&#039;&#039;[[Edit-on-start Parameters|Edit-on-start]]&#039;&#039;&#039; or &#039;&#039;&#039;[[Edit-on-Sequence Parameters|Edit-on-Sequence]]&#039;&#039;&#039; parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Status items&#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This key in the [[#top|/Experiment tree]] is a subtree  which by default contains a link to the [[#Name|experiment name]]. Any links or keys&lt;br /&gt;
created by the user in this optional subdirectory will be displayed on the [[mhttpd]] main status page. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Security&#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This optional subtree   in the [[#top|/Experiment tree]] is created when the &#039;&#039;&#039;[[odbedit]]&#039;&#039;&#039; commands  &amp;lt;span style=&amp;quot;color:saddlebrown; font-style:bold; &amp;quot;&amp;gt;passwd&amp;lt;/span&amp;gt; or  &amp;lt;span style=&amp;quot;color:saddlebrown; font-style:bold; &amp;quot;&amp;gt;webpasswd&amp;lt;/span&amp;gt; are issued. It enables a user to set up security features. See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Disable RPC hosts check&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting the key to &amp;quot;n&amp;quot; (the default) causes access by unauthorized hosts to be prevented by the system checking the RPC access control list (see [[#RPC hosts subtree|RPC hosts/Allowed hosts]]).&lt;br /&gt;
&lt;br /&gt;
If MIDAS clients have to connect from random hosts (i.e. dynamically assigned random DHCP addresses), one can disable the host name checks by &lt;br /&gt;
setting this key to &amp;quot;y&amp;quot;. This configuration is insecure and should only be done on a private network behind a firewall. See [https://midas.triumf.ca/elog/Midas/1080 Note 1080].&lt;br /&gt;
&lt;br /&gt;
; NOTE&lt;br /&gt;
: This key was added August 2015. Used by [[mserver]] to improve network [[Security]] for the MIDAS experiment. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Enable non-localhost RPC&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The default value of this key is &amp;quot;n&amp;quot;, denying access by external network connections.  If running an experiment that requires external network connections, this key must be set to &amp;quot;y&amp;quot; and the key [[#RPC hosts|RPC hosts]] must be filled. See [https://midas.triumf.ca/elog/Midas/1080 Note 1080].&lt;br /&gt;
&lt;br /&gt;
; NOTE&lt;br /&gt;
: This key was added August 2015. Used by [[mserver]] to improve network [[Security]] for the MIDAS experiment. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;RPC ports&#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This subtree in the [[#Security subtree|/Experiment/Security subtree]] is new as of August 2015. It is created by the MIDAS system. &lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;). This subdirectory contains the names of MIDAS clients and their fixed TCP port numbers. When a client is started for the first time, an entry named for the client will be created in this subtree.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;&amp;lt;client-name&amp;gt;&#039;&#039;&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When a MIDAS client is started, a key will be created named for that client. It will contain the fixed TCP port number that the MIDAS client is using.&lt;br /&gt;
Clients started on the local host will have TCP port numbers of 0 (default).&lt;br /&gt;
&lt;br /&gt;
Once a remote [[Frontend Operation|frontend]] is bound to a fixed port, appropriate openings can be made in the firewall, etc. Default port number value &lt;br /&gt;
will be 0 meaning &amp;quot;use random port&amp;quot;, same as now. See [https://midas.triumf.ca/elog/Midas/1079].&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This feature was added  August 2015. It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;RPC hosts&#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This subtree in the [[#Security subtree|/Experiment/Security subtree]] is new as of August 2015. It is created by the MIDAS system. &lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Allowed hosts (rpc hosts)&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- need this because of duplicate &amp;quot;Allowed hosts&amp;quot; in &amp;quot;mhttpd hosts/&amp;quot; subtree --&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Allowed hosts&#039;&#039;&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING array&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;localhost&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This key in the [[#RPC hosts subtree|/Experiment/Security/RPC hosts subtree]] is new as of August 2015 and is created by the system (i.e. midas.c).&lt;br /&gt;
&lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;) and is used to maintain a Network Access Control list. &lt;br /&gt;
The access control list array is self-growing - it will have at least 10 empty entries at the end at all times.&lt;br /&gt;
&lt;br /&gt;
The default value for {{Odbpath|path=Allowed hosts[0]}} is &amp;quot;localhost&amp;quot;, which will reject all external connections, even when permitted by [[#Enable external RPC connections|Enable external RPC connections]].  The user will be required to enter the names of all machines that will run midas clients in this array. See [https://midas.triumf.ca/elog/Midas/1090].&lt;br /&gt;
&lt;br /&gt;
All clients&#039; db_watch() routines watch the access control list and automatically reload it when it is changed, so there is no need to restart clients.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;mhttpd hosts&#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This subtree in the [[#Security subtree|/Experiment/Security subtree]] is new as of August 2015. It is created by the MIDAS system. &lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Allowed hosts (mhttpd hosts)&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- need this because of duplicate &amp;quot;Allowed hosts&amp;quot; in &amp;quot;rpc hosts/&amp;quot; subtree --&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Allowed hosts&#039;&#039;&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING array&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;localhost&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This key in the [[#RPC hosts subtree|/Experiment/Security/mhttpd hosts subtree]] is new as of August 2015 and is created by the system (i.e. midas.c).&lt;br /&gt;
&lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;) and is used to maintain an access control list for [[mhttpd]].  An empty list means free access from everywhere. Access control is also controlled by the [[mhttpd]] &amp;quot;-a&amp;quot; command line arguments. Hosts supplied by the &amp;quot;-a&amp;quot; command line arguments are not added to the access control list by the system.&lt;br /&gt;
&lt;br /&gt;
The access control list is watched by  {{Utility|name=mhttpd}}, therefore there is no need to restart it after updating the list.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:whitesmoke&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;font-size:120%; font-style:bold&amp;quot;&amp;gt;The following keys are OBSOLESCENT - replaced by the [[Security|security features]] added Aug 2015&amp;lt;/span&amp;gt; ===&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Password &#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;This feature pre-dates the improved [[Security]] features (August 2015)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Do not set this key except through the {{Odbedit cmd|cmd=passwd}}. Setting an unencrypted password will lock you out of the ODB unless {{Utility|name=odbedit}} is listed in the [[#Allowed programs subtree|allowed programs subtree]].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;This security feature is not proof against malicious access. See [[Security]] for details.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This optional key in the [[#Security|/Experiment/Security subtree]]&lt;br /&gt;
contains the encrypted password. This Key is created when the {{Odbedit cmd|cmd=passwd}} is issued. See [[Security#Restrict user access|Restrict user access]] for details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Allowed Hosts&#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
* This subtree pre-dates the improved [[Security]] features (August 2015) and is not to be confused with  [[#RPC hosts subtree|RPC hosts/Allowed hosts]] array.&lt;br /&gt;
* This security feature is not proof against malicious access. See [[Security]] for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This subtree in the  [[#Security|/Experiment/Security subtree]] is created when the {{Odbedit cmd|cmd=passwd}} is issued. When created, this subtree is empty.&lt;br /&gt;
Optionally, it may contain  user-defined names of remote hosts allowed to have free access (i.e. without password) to the current experiment. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Allowed programs &#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
* This subtree pre-dates the improved [[Security]] features (August 2015)&lt;br /&gt;
* This feature is not proof against malicious access. See [[Security]] for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This optional subtree  in the  [[#Security|/Experiment/Security subtree]] is created when the {{Odbedit cmd|cmd=passwd}} is issued. When created, this subtree is empty.&lt;br /&gt;
Optionally, it may  contain user-defined names of clients allowed to have free access (i.e. without password) to the current experiment. See [[Security #Allowed programs]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Web Password&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
* This key pre-dates (and has been superceded by)  the improved [[Security]] features (August 2015)&lt;br /&gt;
* This feature is not proof against malicious access. See [[Security]] for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If [[Security#Restrict user access|restriction on user web access]] has been set up, this key in the  [[#Security|/Experiment/Security subtree]]&lt;br /&gt;
will contain an encrypted password for Web server access. This key is created by using the {{Odbedit cmd|cmd=webpasswd}}. &lt;br /&gt;
&lt;br /&gt;
If this key is present, the user will be requested to provide the &amp;quot;Web Password&amp;quot; when accessing the requested experiment in &amp;quot;Write Access&amp;quot; mode. The &amp;quot;Read Only Access&amp;quot; mode is still available (without a password) to all users.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- obsolescent --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:silver&amp;quot;&amp;gt;&lt;br /&gt;
== &amp;lt;span style=&amp;quot;font-size:120%;&amp;quot;&amp;gt;The following keys are OBSOLETE:&amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Mongoose listening_port&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;8080r,8443s&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:This key in the [[#top|/Experiment tree]] existed for a short time in midas versions May-August 2015. &lt;br /&gt;
: It has been &#039;&#039;&#039;replaced by the ODB keys [[#midas http port|midas http port]] and [[#midas https port|midas https port]].&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:80%&amp;quot;&amp;gt;&lt;br /&gt;
This key in the [[#top|/Experiment tree]] was created when [[mhttpd]] was run for the first time. It contained the listening ports for the secure &lt;br /&gt;
HTTPS/SSL server ([https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose]). The ports are the HTTP port (default 8080) which is to be redirected to the secure HTTPS port (default 8443). &lt;br /&gt;
If ports were supplied with the &amp;quot;--mg&amp;quot; option when starting  {{Utility|name=mhttpd}}, their values will overwrite the default values stored in this key. See [[mhttpd]] for details. &lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Mongoose access_control_list&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:This key in the [[#top|/Experiment tree]] existed for a short time in midas versions May-August 2015. &lt;br /&gt;
:&#039;&#039;&#039;Use the [[#mhttpd hosts subtree|mhttpd hosts/Allowed hosts]] access control list or the [[mhttpd]] &amp;quot;-a hostname&amp;quot; parameter to restrict access.&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:80%&amp;quot;&amp;gt;&lt;br /&gt;
This key in the [[#top|/Experiment tree]] is created when [[mhttpd]] is run for the first time. It contains the access control list (ACL) for the [https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose] web server.  By default, this key is empty and there is no access control.  The format of the ACL is described under access_control_list at [https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/Options.md?at=develop Mongoose Configuration Options].&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- obsolete ..  silver --&amp;gt;&lt;br /&gt;
[[Category:ODB Tree]] [[Category:Experiment]] [[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=/Lazy_ODB_tree&amp;diff=2593</id>
		<title>/Lazy ODB tree</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=/Lazy_ODB_tree&amp;diff=2593"/>
		<updated>2016-11-25T20:18:29Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:4;-moz-column-count:4;-webkit-column-count:4&amp;quot;&amp;gt;&lt;br /&gt;
* [[Data Logger]]&lt;br /&gt;
* [[Lazylogger]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating the /Lazy tree ==&lt;br /&gt;
This tree is created with default parameters on the first activation of the &amp;lt;span style=&amp;quot;color:darkcyan;&amp;quot;&amp;gt;&#039;&#039;lazylogger&#039;&#039;&amp;lt;/span&amp;gt;  utility . This task connects to a defined channel (e.g. Tape, Disk) when started. Multiple instances of the program can run concurrently, connecting to a different channel (see [[lazylogger]]).&lt;br /&gt;
&lt;br /&gt;
The following example shows a  &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy&amp;lt;/span&amp;gt; tree with a &amp;lt;channel-name&amp;gt; of &amp;quot;Disk&amp;quot;. A sub-tree &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/Disk&amp;lt;/span&amp;gt; has been created, containing sub-trees &amp;quot;Settings&amp;quot; and &amp;quot;Statistics&amp;quot;. A third sub-tree &amp;quot;List&amp;quot; will be created after the first successful operation of the channel. The contents of these sub-trees is discussed below (see &lt;br /&gt;
[[#Explanation of the Keys in the ODB /Lazy/&amp;lt;channel_name&amp;gt;/Settings subtree|Settings]]&lt;br /&gt;
[[#The ODB /Lazy/&amp;lt;channel_name&amp;gt;/Statistics subtree|Statistics]] and&lt;br /&gt;
[[#The ODB /Lazy/&amp;lt;channel_name&amp;gt;/List subtree|List]] subtrees.)&lt;br /&gt;
&lt;br /&gt;
 [local:pol:S]/&amp;gt;ls /lazy/disk&lt;br /&gt;
 Settings&lt;br /&gt;
 Statistics&lt;br /&gt;
 List&lt;br /&gt;
&lt;br /&gt;
== The ODB /Lazy/&amp;lt;channel_name&amp;gt;/Settings subtree ==&lt;br /&gt;
=== Example ===&lt;br /&gt;
The following example shows a typical &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy&amp;lt;/span&amp;gt;  ODB tree obtained using the [[odbedit]] &amp;quot;ls&amp;quot; command. See keys in the ODB /Lazy tree for more information on each key. &lt;br /&gt;
&lt;br /&gt;
   Settings                             DIR&lt;br /&gt;
        Maintain free space(%)          INT     1     4     3m   0   RWD  0&lt;br /&gt;
        Stay behind                     INT     1     4     3m   0   RWD  -3&lt;br /&gt;
        Alarm Class                     STRING  1     32    3m   0   RWD  &lt;br /&gt;
        Running condition               STRING  1     128   3m   0   RWD  ALWAYS&lt;br /&gt;
        Data dir                        STRING  1     256   3m   0   RWD  /home/midas/online&lt;br /&gt;
        Data format                     STRING  1     8     3m   0   RWD  MIDAS&lt;br /&gt;
        Filename format                 STRING  1     128   3m   0   RWD  run%05d.mid&lt;br /&gt;
        Backup type                     STRING  1     8     3m   0   RWD  Tape&lt;br /&gt;
        Execute after rewind            STRING  1     64    3m   0   RWD  &lt;br /&gt;
        Path                            STRING  1     128   3m   0   RWD  &lt;br /&gt;
        Capacity (Bytes)                FLOAT   1     4     3m   0   RWD  5e+09&lt;br /&gt;
        List label                      STRING  1     128   3m   0   RWD  &lt;br /&gt;
        Execute before writing file     STRING  1     64    11h  0   RWD  lazy_prewrite.csh&lt;br /&gt;
        Execute after writing file      STRING  1     64    11h  0   RWD  rundb_addrun.pl&lt;br /&gt;
        Modulo.Position                 STRING  1     8     11h  0   RWD  2.1&lt;br /&gt;
        Tape Data Append                BOOL    1     4     11h  0   RWD  y&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Explanation of the Keys in the ODB /Lazy/&amp;lt;channel_name&amp;gt;/Settings subtree  ===&lt;br /&gt;
&lt;br /&gt;
An example of the subtree is shown above.&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Maintain free space(%)&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0 &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As the data Logger (&amp;lt;span style=&amp;quot;color:darkcyan;&amp;quot;&amp;gt;&#039;&#039;mlogger&#039;&#039;&amp;lt;/span&amp;gt;) runs independently from the &amp;lt;span style=&amp;quot;color:darkcyan;&amp;quot;&amp;gt;&#039;&#039;Lazylogger&#039;&#039;&amp;lt;/span&amp;gt;, the data logging device (e.g. disk) contains all the recorded data files. Under this condition, Lazylogger can be instructed to &amp;quot;purge&amp;quot; the disk after successful backup of the data onto a &amp;quot;slow device&amp;quot; (e.g. tape). &lt;br /&gt;
&lt;br /&gt;
This parameter &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;Maintain free space(%)&amp;lt;/span&amp;gt; in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree controls the percentage of disk space required to be maintained as free (for &amp;quot;none&amp;quot; set to 0).&lt;br /&gt;
&lt;br /&gt;
* The conditions that must ALL be satisfied before removing a data file are defined as:&lt;br /&gt;
#The data file corresponding to the given run number following the format declared under [[#Filename format#Filename format]] IS PRESENT on the Settings/Data Dir path.&lt;br /&gt;
#The given run number MUST appear anywhere under the [[#The ODB /Lazy/&amp;lt;channel_name&amp;gt;/List subtree|List]] directory of ALL the Lazy channels having the same &lt;br /&gt;
[[#Filename format#Filename format]] as this channel.&lt;br /&gt;
#The given run number MUST appear anywhere under the [[#The ODB /Lazy/&amp;lt;channel_name&amp;gt;/List subtree|List]] directory of that channel&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Stay behind&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0 &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree defines how many consecutive data files should be kept between the current run and the last lazylogger run.&lt;br /&gt;
&lt;br /&gt;
; Example with &amp;quot;Stay behind = -3&amp;quot; &lt;br /&gt;
: Current acquisition run number 253 -&amp;gt; run00253.mid is being logged by mlogger.&lt;br /&gt;
: Files available on the disk corresponding to runs #248, #249, #250, #251, #252.&lt;br /&gt;
: Lazylogger will start backing up run #250 as soon as the new run 254 starts.&lt;br /&gt;
: &amp;quot;Stay behind = -3&amp;quot; corresponds to 3 files untouched on the disk (#251, #252, #253).&lt;br /&gt;
&lt;br /&gt;
; If the &#039;&#039;&#039;sign&#039;&#039;&#039; (+/-) of the &amp;quot;Stay behind&amp;quot; parameter is&lt;br /&gt;
: negative: the lazylogger will always scan the entire disk at the &amp;quot;Data Dir&amp;quot; path, from the oldest to the most recent file present for backup.&lt;br /&gt;
: positive: lazylogger will backup starting from -x behind the current acquisition run number. Run order will be ignored.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Alarm Class&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree defines &lt;br /&gt;
specify the [[Alarm class]] to be used in case of an alarm being triggered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Running Condition&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;ALWAYS&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree &lt;br /&gt;
specifies the type of condition for which the lazylogger should be actived. By default the lazylogger is ALWAYS running. &lt;br /&gt;
&lt;br /&gt;
;The choices are&lt;br /&gt;
: ALWAYS, NEVER, WHILE_NO_ACQ_RUNNING,&lt;br /&gt;
: or a condition based on a single field of the ODB key&amp;lt;=&amp;gt;value&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039; : In the case of high data rate acquisition it could be necessary to activate the lazylogger only&lt;br /&gt;
&lt;br /&gt;
* when the run is either paused or stopped (i.e. WHILE_NO_ACQ_RUNNING)&lt;br /&gt;
      [[odbedit]] &amp;gt; set &amp;quot;Running condition&amp;quot; WHILE_ACQ_NOT_RUNNING&lt;br /&gt;
* or when some external condition is satisfied such as &amp;quot;low beam intensity&amp;quot;.&lt;br /&gt;
      odbedit&amp;gt; set &amp;quot;Running condition&amp;quot; &amp;quot;/alias/max_rate &amp;lt; 200&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Data Dir&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree &lt;br /&gt;
specifies the data directory path of the data logging device (e.g. disk). If this key is present, the contents is taken as the path, otherwise the current directory is used (i.e. the path where the lazylogger client was started).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Data format&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;MIDAS&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree &lt;br /&gt;
specifies the data format of the data files. See [[Keys in the ODB /Logger/Channels subtree#/Logger/Channels/0/Settings/Format|Format]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Filename format&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;run%05d.mid&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree &lt;br /&gt;
specifies the filename format of the data files on the data logging device (i.e. disk). This should be the same  filename format as used by the data logger to save the files &lt;br /&gt;
(see [[Keys in the ODB /Logger/Channels subtree#/Logger/Channels/0/Settings/Filename | Filename]]).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Backup type&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;Tape&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree  specifies the type of the &amp;quot;backup device&amp;quot; to be used for the lazylog backup.&lt;br /&gt;
It can be &amp;quot;Disk&amp;quot;,&amp;quot;Tape&amp;quot;, &amp;quot;Script&amp;quot; or &amp;quot;Ftp&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Execute after rewind&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree  specifies&lt;br /&gt;
an optional script to run after completion of a lazylogger backup set (see below [[#Capacity (Bytes)|Capacity]]).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Path&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree  specifies&lt;br /&gt;
the [[#Backup type|backup device]] path. &lt;br /&gt;
&lt;br /&gt;
There are three possible types of Path:&lt;br /&gt;
&lt;br /&gt;
* For Tape : e.g. /dev/nst0- (UNIX like).&lt;br /&gt;
* For Disk : e.g. /data1/myexpt&lt;br /&gt;
* For Script: the path to the script file to run.  An example file for copying to dcache is here [[lazy_dcache.perl]].&lt;br /&gt;
* For Ftp :  host,port,user,password,directory&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Capacity (Bytes)&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; FLOAT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  5e9 &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter only matters for TAPE backup type.  This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree  specifies&lt;br /&gt;
the maximum [[#Backup type|backup device]]  capacity in bytes. When this capacity is reached,the lazylogger will close the backup device and clear the [[#List label|List label]] field to prevent further backup. It will also rewind the stream device if possible.&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;List label&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree  specifies&lt;br /&gt;
a label for a set of backed up files to the [[#Backup type|backup device]]. This label is used internally by the lazylogger for creating a new array composed of the backed up runs under the [[#The ODB /Lazy/&amp;lt;channel_name&amp;gt;/List subtree|List]] subdirectory, until the [[#Capacity (Bytes)|Capacity]] value has been reached. Once the backup set is complete, lazylogger will clear the &amp;quot;List label&amp;quot; field and therefore prevent any further backup until a non-empty &amp;quot;List label&amp;quot; is re-entered. However, the list label will remain under the &lt;br /&gt;
[[#The ODB /Lazy/&amp;lt;channel_name&amp;gt;/List subtree|List]]key to display all run being backed up until the corresponding files have been removed from the disk.&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Execute before writing file&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree  permits a script to be run before the beginning of &lt;br /&gt;
the lazy job. The arguments passed to the script are: input file name , output file name, current block number.&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Execute after writing file&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This parameter  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree  permits&lt;br /&gt;
a script to be run after the completion of the lazy job. The arguments passed to the scripts are: list label, current job number, source path, file name, file size in MB, current block number.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Modulo.Position&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This field  in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree &lt;br /&gt;
is for multiple instances of the lazylogger where each instance works on a sub-set of run number. By specifying the Modulo.Position you&#039;re telling the current lazy instance how many instances are simultaneously running (3.) and the position of which this instance is assigned to (.1) As an example for 3 lazyloggers running simultaneously the field assignment should be :&lt;br /&gt;
&lt;br /&gt;
  Channel    Field    Run#&lt;br /&gt;
  Lazy_1     3.0      21, 24, 27, ...&lt;br /&gt;
  Lazy_2     3.1      22, 25, 28, ...&lt;br /&gt;
  Lazy_3     3.2      23, 26, 29, ...&lt;br /&gt;
&lt;br /&gt;
In the [[#Example of the ODB /Lazy/&amp;lt;channel_name&amp;gt;/Settings subtree|example above]], the Modulo.Position is set to 2.1 , indicating this is instance 1, and two lazyloggers are running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====  &amp;lt;span  style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Tape Data Append&#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;y&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If this key in the ODB &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Lazy/&amp;lt;channel_name&amp;gt;/Settings&amp;lt;/span&amp;gt; subtree &lt;br /&gt;
is set to &amp;quot;y&amp;quot;, the spooling of the Tape device to the End_of_Device (EOD) before starting the lazy job is enabled. This command is valid only for [[#Backup type|Backup type]] Tape. If this flag is not enabled the lazy job starts at the current tape position.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The ODB /Lazy/&amp;lt;channel_name&amp;gt;/Statistics subtree ==&lt;br /&gt;
&lt;br /&gt;
The  Statistics subtree contains general information about the status of the current lazylogger channel.&lt;br /&gt;
&lt;br /&gt;
An example of the Statistics subtree for a lazylogger channel is shown below:&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
 [local:pol:S]/&amp;gt;ls /lazy/disk/Statistics/&lt;br /&gt;
 Backup file                     000321.mid&lt;br /&gt;
 File size (Bytes)               0&lt;br /&gt;
 KBytes copied                   0&lt;br /&gt;
 Total Bytes copied              0&lt;br /&gt;
 Copy progress (%)               0&lt;br /&gt;
 Copy Rate (Bytes per s)         0&lt;br /&gt;
 Backup status (%)               0&lt;br /&gt;
 Number of Files                 173&lt;br /&gt;
 Current Lazy run                321&lt;br /&gt;
&lt;br /&gt;
== The ODB /Lazy/&amp;lt;channel_name&amp;gt;/List subtree ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The List subtree will contain arrays of run number associated with the array name backup-set label (see [[#List label|List label]]) . Any run number appearing in any of the arrays is considered to have been backed up.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
An example of the List subtree for a lazylogger channel is shown below. In this case, the list label was set to &amp;quot;archive&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 [local:pol:S]/&amp;gt;ls /lazy/disk/List&lt;br /&gt;
 archive&lt;br /&gt;
                                230&lt;br /&gt;
                                231&lt;br /&gt;
                                232&lt;br /&gt;
                                233&lt;br /&gt;
                                234&lt;br /&gt;
                                235&lt;br /&gt;
                                236&lt;br /&gt;
                                237&lt;br /&gt;
&lt;br /&gt;
[[Category:ODB Tree]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=/Runinfo_ODB_tree&amp;diff=2592</id>
		<title>/Runinfo ODB tree</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=/Runinfo_ODB_tree&amp;diff=2592"/>
		<updated>2016-11-25T20:17:09Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
== Creating the /Runinfo tree ==&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Runinfo&#039;&#039;&amp;lt;/span&amp;gt; tree is created automatically when the [[odbedit #Creating the ODB|ODB is first created]].&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Runinfo&#039;&#039;&amp;lt;/span&amp;gt; ODB tree contains system information &lt;br /&gt;
about the state of the current run. Several time fields are available for run time statistics. &lt;br /&gt;
This information is displayed on the {{Utility|name=mhttpd}} [[Status Page|Status page]] or can be&lt;br /&gt;
viewed with [[odbedit]] as shown [[#Example |below]].&lt;br /&gt;
&lt;br /&gt;
== Example == &lt;br /&gt;
 &amp;gt; odb -e expt -h host&lt;br /&gt;
 [host:expt:Running]/&amp;gt;ls -r -l /runinfo&lt;br /&gt;
 Key name                      Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ------------------------------------------------------------------------&lt;br /&gt;
 Runinfo                        DIR&lt;br /&gt;
    State                      INT     1     4     2h   0   RWD  3&lt;br /&gt;
    Online Mode                INT     1     4     2h   0   RWD  1&lt;br /&gt;
    Run number                 INT     1     4     2h   0   RWD  8521&lt;br /&gt;
    Transition in progress     INT     1     4     2h   0   RWD  0&lt;br /&gt;
    Requested transition       INT     1     4     2h   0   RWD  0&lt;br /&gt;
    Start time                 STRING  1     32    2h   0   RWD  Thu Mar 23 10:03:44 2000&lt;br /&gt;
    Start time binary          DWORD   1     4     2h   0   RWD  953834624&lt;br /&gt;
    Stop time                  STRING  1     32    2h   0   RWD  Thu Mar 23 10:03:33 2000&lt;br /&gt;
    Stop time binary           DWORD   1     4     2h   0   RWD  0&lt;br /&gt;
&lt;br /&gt;
== Keys in the /Runinfo tree ==&lt;br /&gt;
The keys in the ODB  &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Runinfo&#039;&#039;&amp;lt;/span&amp;gt; tree are described in the following sections. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;State&#039;&#039;&amp;lt;/span&amp;gt;  === &lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  1&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Runinfo tree]]&lt;br /&gt;
specifies the state of the current run (see [[Run States and Transitions #MIDAS State and Transition Codes|MIDAS run states]]) . The possible states are&lt;br /&gt;
*    1: STOPPED ( STATE_STOPPED )&lt;br /&gt;
*    2: PAUSED ( STATE_PAUSED )&lt;br /&gt;
*    3: RUNNING ( STATE_RUNNING )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Online Mode&#039;&#039;&amp;lt;/span&amp;gt;  === &lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  1&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Runinfo tree]]&lt;br /&gt;
specifies the expected acquisition mode. This parameter allows the user to detect if the data are coming from a &amp;quot;real-time&amp;quot; hardware source (the default) or from a data save-set. Note that for analysis replay using &amp;quot;analyzer&amp;quot;, this flag will be switched off. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Run number&#039;&#039;&amp;lt;/span&amp;gt;  === &lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Runinfo tree]]&lt;br /&gt;
specifies the current run number. This number is automatically incremented by a successful run start procedure. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition in progress&#039;&#039;&amp;lt;/span&amp;gt;  === &lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Runinfo tree]]&lt;br /&gt;
specifies the current internal state of the system. This parameter is used for multiple source of &amp;quot;run start&amp;quot; synchronization. Sometimes when run start or stop fails, &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition in progress&#039;&#039;&amp;lt;/span&amp;gt;  is left set to 1, and must be manually set to 0 by the user (e.g. with [[odbedit]]) before the run start/stop command can be retried.&lt;br /&gt;
  &amp;gt; odb set &amp;quot;/runinfo/transition in progress&amp;quot; 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Start abort&#039;&#039;&amp;lt;/span&amp;gt;  === &lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key in the [[#top|/Runinfo tree]] will be set if run start is aborted. The run start may be aborted if&lt;br /&gt;
the saved data file already exists, or on alarm (see [[/Experiment ODB tree#Prevent start on alarms|prevent start on alarm]]) , or if a &lt;br /&gt;
[[/Experiment ODB tree#Prevent start on required progs| required program]] is not running.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Requested transition&#039;&#039;&amp;lt;/span&amp;gt;  === &lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key in the [[#top|/Runinfo tree]]&lt;br /&gt;
specifies whether a transition has been requested. It will be set if a [[Run States and Transitions #Deferred Transitions|deferred transition]] is in progress. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Start time&#039;&#039;&amp;lt;/span&amp;gt;  === &lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;Tue Sep 09 15:04:42 1997&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Runinfo tree]] &lt;br /&gt;
specifies in an ASCII format the time at which the last run has been started. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Start time binary&#039;&#039;&amp;lt;/span&amp;gt;  === &lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Runinfo tree]] &lt;br /&gt;
specifies in a binary format the time at which the last run has been started. This field is useful for time interval computation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Stop time&#039;&#039;&amp;lt;/span&amp;gt;  === &lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;Tue Sep 09 15:04:42 1997&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Runinfo tree]] &lt;br /&gt;
specifies in an ASCII format the time at which the last run was stopped. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Stop time binary&#039;&#039;&amp;lt;/span&amp;gt;  === &lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Runinfo tree]] &lt;br /&gt;
specifies in a binary format the time at which the last run has been stopped. This field is useful for time interval computation. &lt;br /&gt;
&lt;br /&gt;
[[Category:ODB Tree]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=/System_ODB_tree&amp;diff=2591</id>
		<title>/System ODB tree</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=/System_ODB_tree&amp;diff=2591"/>
		<updated>2016-11-25T20:13:54Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
== Creating the /System tree ==&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/System&#039;&#039;&amp;lt;/span&amp;gt; ODB tree is created automatically when the [[odbedit #Creating the ODB|ODB is first created]].&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/System&#039;&#039;&amp;lt;/span&amp;gt; ODB tree contains information &lt;br /&gt;
specific to each &amp;quot;MIDAS client&amp;quot; currently connected to the experiment. The sequence number appears in the ODB under the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/System/Clients&#039;&#039;&amp;lt;/span&amp;gt; subtrees. &lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
The following example shows a typical &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/System&#039;&#039;&amp;lt;/span&amp;gt; ODB tree obtained using the&lt;br /&gt;
[[odbedit]] ls command.&lt;br /&gt;
&lt;br /&gt;
[local:midas:S]/System&amp;gt;ls -lr&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
 System                          DIR&lt;br /&gt;
     Clients                     DIR&lt;br /&gt;
        11781                   DIR&lt;br /&gt;
            Name                STRING  1     32    1h   0   R    ODBEdit&lt;br /&gt;
            Host                STRING  1     256   1h   0   R    dasdevpc2.triumf.ca&lt;br /&gt;
            Hardware type       INT     1     4     1h   0   R    44&lt;br /&gt;
            Server Port         INT     1     4     1h   0   R    55904&lt;br /&gt;
    Tmp                         DIR&lt;br /&gt;
    Client Notify               INT     1     4     1h   0   RWD  0&lt;br /&gt;
    Prompt                      STRING  1     256   10h  0   RWD  [%h:%e:%s]%p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Keys in &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/System&#039;&#039;&amp;lt;/span&amp;gt; tree==&lt;br /&gt;
&lt;br /&gt;
The keys in the ODB &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/System tree&#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
are described in the following sections.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Tmp&#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&lt;br /&gt;
This subtree in the [[#top|/System ODB tree]] is created and used by the system.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Client Notify&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/System ODB tree]] is used by the system to inform other clients after deleting a client from the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Prompt&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;[%h:%e:%s]%p&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key in the [[#top|/System ODB tree]] controls the format of the prompt of the [[odbedit]] utility. The default prompt is&lt;br /&gt;
shown below&lt;br /&gt;
&lt;br /&gt;
 odbedit&lt;br /&gt;
 [local:midas:S]/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The meanings of the prompt symbols are&lt;br /&gt;
 %h Host name&lt;br /&gt;
 %e Experiment name&lt;br /&gt;
 %s Run state symbol (U,S,P,R i.e. unknown, stopped, paused, running)&lt;br /&gt;
 %p Current ODB path&lt;br /&gt;
 %t Current time&lt;br /&gt;
&lt;br /&gt;
==== Changing the odbedit prompt ====&lt;br /&gt;
&lt;br /&gt;
To set the [[odbedit]] prompt to show the long-form of the run state :&lt;br /&gt;
&lt;br /&gt;
  [local:midas:S]/System&amp;gt;set Prompt &amp;quot;[%h:%e:%S]%p&amp;gt;&amp;quot;&lt;br /&gt;
  [local:midas:Stopped]/System&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To set the prompt to the word &amp;quot;yes&amp;quot; :&lt;br /&gt;
&lt;br /&gt;
    [local:midas:Stopped]/System&amp;gt;set Prompt yes&amp;gt;&lt;br /&gt;
    yes&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To set the prompt to name the fields (i.e. Host, Expt, State, Path):&lt;br /&gt;
&lt;br /&gt;
    yes&amp;gt;set Prompt [Host:%h-Expt:%e:State:%s]Path:%p&amp;gt;&lt;br /&gt;
    [Host:local-Expt:midas-State:S]Path:/System&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To set the prompt to the current time:&lt;br /&gt;
&lt;br /&gt;
    [Host:local-Expt:midas-State:S]Path:/System&amp;gt;set Prompt &amp;quot;%t&amp;gt;&amp;quot;&lt;br /&gt;
    13:29:08&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Clients&#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&lt;br /&gt;
This subtree is in the [[#top|/System ODB tree]].&lt;br /&gt;
Each client is listed in this subtree under a &amp;lt;client-number&amp;gt; subtree.&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/System/Clients&#039;&#039;&amp;lt;/span&amp;gt; subtree reflects the system at a given time. &lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
The following example is of the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/System/Clients&#039;&#039;&amp;lt;/span&amp;gt; subtree.&lt;br /&gt;
More information has been added in  &amp;lt;span style=&amp;quot;color:green;&amp;quot;&amp;gt; green&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 [local:midas:S]Clients&amp;gt;ls -lr&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
 Clients                         DIR&lt;br /&gt;
    1832                        DIR  &amp;lt;span style=&amp;quot;color:green;&amp;quot;&amp;gt;  &amp;lt;------------ Frontend 1&amp;lt;/span&amp;gt;&lt;br /&gt;
        Name                    STRING  1     32    21h  0   R    ebfe01&lt;br /&gt;
        Host                    STRING  1     256   21h  0   R    pierre2&lt;br /&gt;
        Hardware type           INT     1     4     21h  0   R    42&lt;br /&gt;
        Server Port             INT     1     4     21h  0   R    2582&lt;br /&gt;
        Transition START        INT     1     4     21h  0   R    500&lt;br /&gt;
        Transition STOP         INT     1     4     21h  0   R    500&lt;br /&gt;
        Transition PAUSE        INT     1     4     21h  0   R    500&lt;br /&gt;
        Transition RESUME       INT     1     4     21h  0   R    500&lt;br /&gt;
        RPC                     DIR&lt;br /&gt;
            17000               BOOL    1     4     21h  0   R    y&lt;br /&gt;
    3872                        DIR   &amp;lt;span style=&amp;quot;color:green;&amp;quot;&amp;gt;  &amp;lt;------------ Frontend 2 &amp;lt;/span&amp;gt;&lt;br /&gt;
        Name                    STRING  1     32    21h  0   R    ebfe02&lt;br /&gt;
        Host                    STRING  1     256   21h  0   R    pierre2&lt;br /&gt;
        Hardware type           INT     1     4     21h  0   R    42&lt;br /&gt;
        Server Port             INT     1     4     21h  0   R    2585&lt;br /&gt;
        Transition START        INT     1     4     21h  0   R    500&lt;br /&gt;
        Transition STOP         INT     1     4     21h  0   R    500&lt;br /&gt;
        Transition PAUSE        INT     1     4     21h  0   R    500&lt;br /&gt;
        Transition RESUME       INT     1     4     21h  0   R    500&lt;br /&gt;
        RPC                     DIR&lt;br /&gt;
            17000               BOOL    1     4     21h  0   R    y&lt;br /&gt;
    2220                        DIR   &amp;lt;span style=&amp;quot;color:green;&amp;quot;&amp;gt;  &amp;lt;------------ ODBedit doesn&#039;t need transition&amp;lt;/span&amp;gt;&lt;br /&gt;
        Name                    STRING  1     32    42s  0   R    ODBEdit&lt;br /&gt;
        Host                    STRING  1     256   42s  0   R    pierre2&lt;br /&gt;
        Hardware type           INT     1     4     42s  0   R    42&lt;br /&gt;
        Server Port             INT     1     4     42s  0   R    3429&lt;br /&gt;
    568                         DIR   &amp;lt;span style=&amp;quot;color:green;&amp;quot;&amp;gt;  &amp;lt;------------ Event Builder&amp;lt;/span&amp;gt;&lt;br /&gt;
        Name                    STRING  1     32    26s  0   R    Ebuilder&lt;br /&gt;
        Host                    STRING  1     256   26s  0   R    pierre2&lt;br /&gt;
        Hardware type           INT     1     4     26s  0   R    42&lt;br /&gt;
        Server Port             INT     1     4     26s  0   R    3432&lt;br /&gt;
        Transition START        INT     1     4     26s  0   R    300&lt;br /&gt;
        Transition STOP         INT     1     4     26s  0   R    700&lt;br /&gt;
    2848                        DIR   &amp;lt;span style=&amp;quot;color:green;&amp;quot;&amp;gt;  &amp;lt;------------ Logger&amp;lt;/span&amp;gt;&lt;br /&gt;
        Name                    STRING  1     32    5s   0   R    Logger&lt;br /&gt;
        Host                    STRING  1     256   5s   0   R    pierre2&lt;br /&gt;
        Hardware type           INT     1     4     5s   0   R    42&lt;br /&gt;
        Server Port             INT     1     4     5s   0   R    3436&lt;br /&gt;
        Transition START        INT     1     4     5s   0   R    200&lt;br /&gt;
        Transition STOP         INT     1     4     5s   0   R    800&lt;br /&gt;
        Transition PAUSE        INT     1     4     5s   0   R    500&lt;br /&gt;
        Transition RESUME       INT     1     4     5s   0   R    500&lt;br /&gt;
        RPC                     DIR&lt;br /&gt;
            14000               BOOL    1     4     5s   0   R    y&lt;br /&gt;
&lt;br /&gt;
=== Keys in the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;&amp;lt;client-number&amp;gt; subtree&#039;&#039;&amp;lt;/span&amp;gt; ===&lt;br /&gt;
This subtree is found in the [[#Clients subtree|Clients subtree]]. Each client that has run on the experiment is &lt;br /&gt;
listed in a &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&amp;lt;client-number&amp;gt;&amp;lt;/span&amp;gt; subtree.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Name&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;client-number&amp;gt; subtree|&amp;lt;client-number&amp;gt; subtree]] contains the client name. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Host&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key  in the [[#&amp;lt;client-number&amp;gt; subtree|&amp;lt;client-number&amp;gt; subtree]]  contains the &lt;br /&gt;
[[Common Parameters to MIDAS Utilities #Midas host |Midas host name]] on which this client is running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Hardware type&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key in the [[#&amp;lt;client-number&amp;gt; subtree|&amp;lt;client-number&amp;gt; subtree]] is used by the system to contain a code that describes the  hardware architecture of the host.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Server Port&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key in the [[#&amp;lt;client-number&amp;gt; subtree|&amp;lt;client-number&amp;gt; subtree]] is used by the system to contain the client&#039;s server port.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition START&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; 500   (depends on client)&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;client-number&amp;gt; subtree|&amp;lt;client-number&amp;gt; subtree]] is used to contain the&lt;br /&gt;
[[Run States and Transitions#Default Transition Sequence Numbers |Client sequence number]] for  [[Run States and Transitions |Start Transition]].&lt;br /&gt;
&lt;br /&gt;
If a permanent change of a client sequence number is required, the MIDAS system call &lt;br /&gt;
&#039;&#039;cm_set_transition_sequence()&#039;&#039; can be used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition STOP&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  500   (depends on client)&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;client-number&amp;gt; subtree|&amp;lt;client-number&amp;gt; subtree]] is used to contain the&lt;br /&gt;
[[Run States and Transitions#Default Transition Sequence Numbers |Client sequence number]] for  [[Run States and Transitions |Stop Transition]].&lt;br /&gt;
&lt;br /&gt;
If a permanent change of a client sequence number is required, the MIDAS system call &lt;br /&gt;
&#039;&#039;cm_set_transition_sequence()&#039;&#039; can be used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition PAUSE&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  500   (depends on client)&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;client-number&amp;gt; subtree|&amp;lt;client-number&amp;gt; subtree]] is used to contain the&lt;br /&gt;
[[Run States and Transitions#Default Transition Sequence Numbers |Client sequence number]] for  [[Run States and Transitions |Pause Transition]].&lt;br /&gt;
&lt;br /&gt;
If a permanent change of a client sequence number is required, the MIDAS system call &lt;br /&gt;
&#039;&#039;cm_set_transition_sequence()&#039;&#039; can be used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition RESUME&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  500   (depends on client)&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#&amp;lt;client-number&amp;gt; subtree|&amp;lt;client-number&amp;gt; subtree]] is used to contain the&lt;br /&gt;
[[Run States and Transitions#Default Transition Sequence Numbers |Client sequence number]] for  [[Run States and Transitions |Resume Transition]].&lt;br /&gt;
&lt;br /&gt;
If a permanent change of a client sequence number is required, the MIDAS system call &lt;br /&gt;
&#039;&#039;cm_set_transition_sequence()&#039;&#039; can be used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:ODB Tree]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=/Customscript_ODB_tree&amp;diff=2590</id>
		<title>/Customscript ODB tree</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=/Customscript_ODB_tree&amp;diff=2590"/>
		<updated>2016-11-25T20:05:53Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[Online Database]]&lt;br /&gt;
* [[mhttpd]]&lt;br /&gt;
* [[Custom Page]]&lt;br /&gt;
* [[/Script ODB tree]]&lt;br /&gt;
* [[ODB]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Purpose  =&lt;br /&gt;
The optional  &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Customscript&amp;lt;/span&amp;gt; ODB tree provides the user with a way to execute a script when a button on a [[mhttpd]] [[Custom Page]] is clicked, including the capability of passing parameters from the ODB to the user-written script. This tree is similar to the [[/Script ODB tree]], except instead of producing [[/Script ODB tree#Script-button|script-buttons]] on the [[Status Page]], it produces  [[#Customscript-button|customscript-buttons]] on a user-written [[Custom Page]], provided an HTML &amp;lt;input&amp;gt; tag is provided in the Custom Page code for each custom-script button (see [[Custom Page Features#CustomScript Buttons]]).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating the /Customscript tree =&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Customscript&amp;lt;/span&amp;gt;  ODB tree is [[ODB#Creating ODB keys|created]] by the user. This tree is optional, and the names of any keys in this tree are chosen by the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=  &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;&amp;lt;customscript-name&amp;gt;&amp;lt;/span&amp;gt; key or subtree =&lt;br /&gt;
&amp;lt;div id=&amp;quot;Customscript-button&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Any key created in the &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Customscript&amp;lt;/span&amp;gt; tree will appear as a &#039;&#039;&#039;&#039;&#039;customscript-button&#039;&#039;&#039;&#039;&#039;  &amp;lt;span style=&amp;quot;color: #444444; background-color: #CCCCCC; font-style:italic; font-size: 90; padding:0.25em;padding-left: 0.5em;padding-right: 0.5em;border:1px solid #808080;border-radius: 5px;margin-bottom:1px;&amp;quot;&amp;gt;&amp;lt;customscript-name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
(see [[#Purpose|above]]).&lt;br /&gt;
&lt;br /&gt;
Otherwise, the syntax of the &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Customscript&amp;lt;/span&amp;gt; tree is exactly the same as that of the &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Script&amp;lt;/span&amp;gt; tree. See [[/Script ODB tree#&amp;lt;script-name&amp;gt; key or subtree|Script tree]] for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:ODB Tree]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=/Script_ODB_tree&amp;diff=2589</id>
		<title>/Script ODB tree</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=/Script_ODB_tree&amp;diff=2589"/>
		<updated>2016-11-25T20:05:16Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
==== Links ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[Online Database]]&lt;br /&gt;
* [[mhttpd]] status page&lt;br /&gt;
* [[#Script-button|script-button]]&lt;br /&gt;
* [[ODB]]&lt;br /&gt;
* [[/Customscript ODB tree]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Purpose  =&lt;br /&gt;
The optional  &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Script&amp;lt;/span&amp;gt; ODB tree provides the user with a way to execute a script when a button on the [[mhttpd]] [[Status Page]] is clicked, including the capability of passing parameters from the ODB to the user-written script.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Creating the  &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Script&amp;lt;/span&amp;gt; tree =&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Script&amp;lt;/span&amp;gt;  ODB tree is [[ODB#Creating ODB keys|created]] by the user. This tree is optional, and the names of any keys in this tree are chosen by the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=  &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;&amp;lt;script-name&amp;gt;&amp;lt;/span&amp;gt; key or subtree =&lt;br /&gt;
&amp;lt;div id=&amp;quot;Script-button&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Any key created in the &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/Script&amp;lt;/span&amp;gt; tree will appear as a &#039;&#039;&#039;&#039;&#039;script-button&#039;&#039;&#039;&#039;&#039;  &amp;lt;span style=&amp;quot;color: #444444; background-color: #CCCCCC; font-style:italic; font-size: 90; padding:0.25em;padding-left: 0.5em;padding-right: 0.5em;border:1px solid #808080;border-radius: 5px;margin-bottom:1px;&amp;quot;&amp;gt;&amp;lt;script-name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
on the default [[mhttpd]] [[Status Page]]. &lt;br /&gt;
&lt;br /&gt;
;Either&lt;br /&gt;
: The key can contain the name and path of the script to be executed when the script-button is pressed, e.g.&lt;br /&gt;
      [local:midas:S]&amp;gt;ls /script&lt;br /&gt;
      Stop Now       odbedit -c &#039;stop now&#039;&lt;br /&gt;
      Tune X40       /home/midas/perl/tunes.sh tune X40&lt;br /&gt;
: In this case, two script-buttons would appear on the [[Status Page]], i.e. &amp;lt;span style=&amp;quot;color: #444444; background-color: #CCCCCC;  font-style:italic; font-size: 90; padding:0.25em;padding-left: 0.5em;padding-right: 0.5em;border:1px solid #808080;border-radius: 5px;margin-bottom:1px;&amp;quot;&amp;gt;Stop Now&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color: #444444; background-color: #CCCCCC; font-style:italic; font-size: 90; padding:0.25em;padding-left: 0.5em;padding-right: 0.5em;border:1px solid #808080;border-radius: 5px;margin-bottom:1px;&amp;quot;&amp;gt;Tune X40&amp;lt;/span&amp;gt;,&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
; or&lt;br /&gt;
: the key may be a &#039;&#039;&#039;subtree&#039;&#039;&#039;, in which case the first key in the subtree must contain the name and path of the script to be &lt;br /&gt;
: executed. Any further keys in the subtree contain parameters (which may include links) to be passed as arguments to the script, e.g.&lt;br /&gt;
      [local:midas:S]&amp;gt;ls &amp;quot;/script/change mode&amp;quot;&lt;br /&gt;
      cmd                             /home/midas/online/perl/change_mode.pl&lt;br /&gt;
      include path                    /home/midas/online/perl&lt;br /&gt;
      experiment name -&amp;gt; /experiment/name&lt;br /&gt;
                                      test_exp&lt;br /&gt;
      select mode -&amp;gt; /experiment/edit on start/select mode                     &lt;br /&gt;
                                      1h&lt;br /&gt;
      mode file tag                   none&lt;br /&gt;
:In this case, one script-button would be created, i.e.  &amp;lt;span style=&amp;quot;color: #444444; background-color: #CCCCCC; font-style:italic; :font-size: 90; padding:0.25em;padding-left: 0.5em;padding-right: 0.5em;border:1px solid #808080;border-radius: 5px;margin-bottom:1px;&amp;quot;&amp;gt;change mode&amp;lt;/span&amp;gt;. Pressing this button would result in the script &amp;quot;change_mode.pl&amp;quot; executed with the following key contents as parameters, equivalent to the command:&lt;br /&gt;
      /home/pol/online/perl/change_mode.pl  /home/pol/online/perl pol 1h mode&lt;br /&gt;
&lt;br /&gt;
[[Category:ODB Tree]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Mhttpd&amp;diff=2549</id>
		<title>Mhttpd</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Mhttpd&amp;diff=2549"/>
		<updated>2016-09-14T00:41:47Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
= Links =&lt;br /&gt;
{{mhttpdpages3|[[Mhttpd.js|MIDAS Javascript Library]]|[[odbedit]]|[[Security]]}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Purpose =&lt;br /&gt;
The {{Utility|name=mhttpd}} utility runs the &#039;&#039;&#039;MIDAS Web Server&#039;&#039;&#039; which allows the user to communicate with an experiment using any web browser. It is used primarily for run control. &lt;br /&gt;
&lt;br /&gt;
= Web security =&lt;br /&gt;
As part of the recent upgrade to MIDAS [[Security]], the MIDAS Web Server {{Utility|name=mhttpd}} is now (May 2015) explicitly linked with OpenSSL to provide secure HTTPS connections via the [https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose] web server.  To connect to an experiment using {{Utility|name=mhttpd}}, a username and password are required.&lt;br /&gt;
By default, users can connect from anywhere, providing they know the correct username and password. However, web access can be restricted by using the {{Utility|name=mhttpd}} access control list in the ODB at [[/Experiment ODB tree#mhttpd hosts subtree|Allowed hosts]], and/or by using the &amp;quot;-a&amp;quot; argument to  {{Utility|name=mhttpd}}.&lt;br /&gt;
&lt;br /&gt;
For &#039;&#039;&#039;maximum security&#039;&#039;&#039;, it is recommended that {{Utility|name=mhttpd}} be run behind an &#039;&#039;&#039;Apache HTTPS proxy&#039;&#039;&#039; (see [[Security]] for details). In this case, {{Utility|name=mhttpd}} should be built  without OpenSSL (see [https://midas.triumf.ca/elog/Midas/1069]), or the Mongoose/OpenSSL web server should be disabled using the arguments supplied to  {{Utility|name=mhttpd}} (see [[#To start the webserver using the oldserver|starting the web server using the oldserver]]).&lt;br /&gt;
&lt;br /&gt;
= Arguments =&lt;br /&gt;
       -h connect to midas server [[mserver]] on given host&lt;br /&gt;
       -e experiment to connect to&lt;br /&gt;
       -v display verbose HTTP communication&lt;br /&gt;
       -D become a daemon&lt;br /&gt;
       -E only display ELog system&lt;br /&gt;
       -H only display history plots&lt;br /&gt;
       -a only allow access for specific host(s), several [-a Hostname] statements might be given (default list&lt;br /&gt;
                   in ODB at [[/Experiment ODB tree#mhttpd hosts subtree|/Experiment/security/mhttpd hosts/allowed hosts]])&lt;br /&gt;
       --http port - bind to specified HTTP port (default is ODB [[/Experiment ODB tree#midas http port|/Experiment/midas http port]])&lt;br /&gt;
       --https port - bind to specified HTTPS port (default is ODB [[/Experiment ODB tree#midas https port|/Experiment/midas https port]])&lt;br /&gt;
       --nomg use the old mhttpd web server&lt;br /&gt;
       --oldserver [port] - use the old web server on given port&lt;br /&gt;
       --nooldserver - do not use the old mhttpd web server&lt;br /&gt;
       -help display usage information&lt;br /&gt;
 &lt;br /&gt;
 If using an old version (before May 2015), see [[#Insecure (pre-May 2015) versions|old server]] argument list.      &lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
== To start the webserver using HTTPS/SSL (Mongoose) ==&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd&amp;quot;&#039;&#039; or &lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd -v&amp;quot;&#039;&#039; to get debug information, or&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd -D&amp;quot;&#039;&#039; to run in the background&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd -a myHost1 -a myHost2&amp;quot;&#039;&#039; to restrict web access&lt;br /&gt;
All are equivalent to&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd --https 8443 --http 8080&amp;quot;&#039;&#039;&lt;br /&gt;
Starting {{Utility|name=mhttpd}} like this will redirect the default HTTP port of 8080 to the secure HTTPS port 8443. If the ports are not supplied, the default ports will be read from the ODB keys [[/Experiment ODB tree#midas http port|midas http port]] and [[/Experiment ODB tree#midas https port|midas https port]]. If ports are supplied, their values will overwrite the default values stored in the ODB. When {{Utility|name=mhttpd}} is started with a secure port for the first time, a password file (and optionally an SSL certificate)  need to be created. See [[#HTTPS/SSL server (Mongoose)|mhttpd HTTPS/SSL server]] for more information.&lt;br /&gt;
&lt;br /&gt;
If {{Utility|name=mhttpd}} is started on IP host machine &amp;quot;myhost&amp;quot; using the default ports, the [[#Features|&#039;&#039;Midas status page&#039;&#039;]] can be accessed by pointing a web browser to &lt;br /&gt;
* https://myhost.mydomain:8443&lt;br /&gt;
* or to http://myhost.mydomain:8080 which will be redirected automatically to https://myhost.mydomain:8443&lt;br /&gt;
&lt;br /&gt;
The automatic redirect may be convenient for users who are used to using {{Utility|name=mhttpd}} with a particular HTTP port (e.g. 8080) for their experiment. The redirect can be disabled by setting the ODB key [[/Experiment ODB tree#http redirect to https|http redirect to https]] to &amp;quot;n&amp;quot;. This also bypasses the user authentification.&lt;br /&gt;
&lt;br /&gt;
=== Multiple experiments ===&lt;br /&gt;
If [[Exptab|multiple experiments]] run on the same host, a web server for each experiment must be started on a different port, e.g.&lt;br /&gt;
*           &#039;&#039;&amp;quot;mhttpd -e expt1 -D&amp;quot;&#039;&#039;                           use default ports&lt;br /&gt;
*           &#039;&#039;&amp;quot;mhttpd -e expt2 --http 8081 --https 8444 -D&amp;quot;&#039;&#039;  use supplied ports&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  To start the webserver using the oldserver  ==&lt;br /&gt;
To run a new version of {{Utility|name=mhttpd}} using the old server (i.e. NOT the Mongoose/HTTPS server)&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd --oldserver 8087&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This command is useful for running new versions of {{Utility|name=mhttpd}} using an Apache HTTPS proxy (see [[Security]]) - except that it does not support [[Mjsonrpc]], so on recent versions (Sept 2016) the Programs page does not work when run like this. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Features =&lt;br /&gt;
The Midas web server {{Utility|name=mhttpd}} provides a means for run control including monitoring of the run parameters.&lt;br /&gt;
Its main feature is a web page invoked through any web browser accessing the Midas experimental URL at a defined port (see [[#Usage|Usage]]).  &lt;br /&gt;
&lt;br /&gt;
The contents of this &#039;&#039;&#039;Midas status page&#039;&#039;&#039; is composed with minimal information relative to the experiment. It contains a collection of buttons and links to other pages to further describe and control the configuration of the experiment. &lt;br /&gt;
&lt;br /&gt;
* Minimal display on the main [[Status Page]]&lt;br /&gt;
** Experiment name, time &amp;amp; date, page refresh rate&lt;br /&gt;
** Standard Menu Buttons (see below)&lt;br /&gt;
** User defined buttons (e.g. alias links, run scripts, custom pages etc.)&lt;br /&gt;
** run comments and condition display section (if enabled)&lt;br /&gt;
** Equipment list with current running condition, number of event received, event rate, data rate for each equipment.&lt;br /&gt;
** Data logging statistics (number of event recorded, data size recorder, compression factor, usage storage level) if enabled. &lt;br /&gt;
** Secondary Data logging (data mover) with statistics if enabled.&lt;br /&gt;
** Single line of the most recent Midas message.&lt;br /&gt;
** Table of the current applications connected to this experiment.&lt;br /&gt;
&lt;br /&gt;
* Standard Menu Buttons&lt;br /&gt;
** Transition the state of the run (stopped/running/paused), allows user running condition parameters to be entered at the start state (see [[Edit-on-start Parameters]]).&lt;br /&gt;
** Access to the full [[Online Database]] for data display and/or data content modification. &lt;br /&gt;
** Display the [[Message Page]], which shows messages generated by the MIDAS [Message System]] as well as the user using cm_msg() functions.&lt;br /&gt;
** Access to [[ELOG Page]] switches to the predefined &amp;quot;electronic logbook&amp;quot;.&lt;br /&gt;
** Access to the [[Alarms Page]] for monitoring the different type of alarms (evaluated, programs, internals, periodic).&lt;br /&gt;
** Access to the [[Programs Page]]  for a status or interaction with the current running applications part of the Midas experiment.&lt;br /&gt;
** Access to the [[History Page]] for graphical data representation of any ODB variables and acquired data.&lt;br /&gt;
** Access to the Midas Slow Control Bus devices [[MSCB Page]] connected to this experiment.&lt;br /&gt;
** Access to the [[Sequencer Page]] control/monitoring page for [[Sequencer]] i.e. interactive loading/saving/running of a run sequence based on any ODB parameters.&lt;br /&gt;
** Access to the [[Chat Page]] for communication between users on the same experiment.&lt;br /&gt;
** Access to the [[Help Page]] with short-cut to the Midas Help documentation resource and other information.&lt;br /&gt;
* Links&lt;br /&gt;
** links to all the listed equipments invoking a dedicated page for the display and possible control of the equipment parameters.&lt;br /&gt;
** link to the logger configuration (if present) for the data recording.&lt;br /&gt;
** link to the possible secondary logging configuration parameters (if present).&lt;br /&gt;
&lt;br /&gt;
Other features include a JSON interface and Javascript library used for implementing interactive [[Custom Page|custom pages]] for MIDAS experiments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= HTTPS/SSL server (Mongoose) =&lt;br /&gt;
&lt;br /&gt;
The HTTPS/SSL  ([https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose]) server is activated by running {{Utility|name=mhttpd}}, and by default it listens on ports 8080 and 8443 (see [[#Usage]]).  &lt;br /&gt;
&lt;br /&gt;
{{Utility|name=mhttpd}} with Mongoose requires an &#039;&#039;&#039;SSL Certificate&#039;&#039;&#039; and a &#039;&#039;&#039;password file&#039;&#039;&#039;.  Ideally, an SSL Certificate issued by a well-known authority trusted by your browser should be used.&lt;br /&gt;
&lt;br /&gt;
The first time {{Utility|name=mhttpd}} is run, if it does not find an SSL Certificate, it will print instructions on how to [[#Create an SSL certificate|create a self-signed SSL Certificate]]. If it finds no existing password file, it will then print instructions on how to [[#Create a password file|create a password file]] (see below for examples).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Create an SSL certificate ==&lt;br /&gt;
If no [[#HTTPS/SSL server (Mongoose)|more secure]] SSL Certificate is available, then create a self-signed certificate by running {{Utility|name=mhttpd}},&lt;br /&gt;
and following the printed instructions :&lt;br /&gt;
 [user@dasdevpc2 test]$ mhttpd&lt;br /&gt;
 Web server will listen on ports &amp;quot;8080r,8443s&amp;quot;&lt;br /&gt;
 [mhttpd,ERROR] [mhttpd.cxx:17086:mongoose,ERROR] cannot find SSL certificate file &amp;quot;/home/user/online/test/ssl_cert.pem&amp;quot;&lt;br /&gt;
 [mhttpd,ERROR] [mhttpd.cxx:17087:mongoose,ERROR] please create SSL certificate file: openssl req -new -nodes -newkey rsa:2048&lt;br /&gt;
 -sha256 -out  ssl_cert.csr -keyout ssl_cert.key; openssl x509 -req -days 365 -sha256 -in ssl_cert.csr -signkey ssl_cert.key &lt;br /&gt;
 -out ssl_cert.pem; cat ssl_cert.key &amp;gt;&amp;gt; ssl_cert.pem&lt;br /&gt;
 could not start the mongoose web server, see messages and midas.log, bye!&lt;br /&gt;
&lt;br /&gt;
The certificate and key should be placed in one PEM file called ssl_cert.pem located in either MIDAS environment variables [[MIDAS environment variables#MIDAS_DIR|MIDAS_DIR]] or [[MIDAS environment variables#MIDASSYS|MIDASSYS]], and the permissions on the file should be 600  or only owner read/write.&lt;br /&gt;
 [user@dasdevpc2 test] chmod 600 ssl_cert.pem&lt;br /&gt;
&lt;br /&gt;
== Create a password file ==&lt;br /&gt;
Once a valid certificate is generated, when  {{Utility|name=mhttpd}} is restarted, you will need to create a password file. &lt;br /&gt;
   &lt;br /&gt;
 [user@dasdevpc2 test]$ mhttpd&lt;br /&gt;
 Web server will listen on ports &amp;quot;8080r,8443s&amp;quot;&lt;br /&gt;
 Web server will use SSL certificate file &amp;quot;/home/user/online/test/ssl_cert.pem&amp;quot;&lt;br /&gt;
 [mhttpd,ERROR] [mhttpd.cxx:17137:mongoose,ERROR] mongoose web server cannot find password file &amp;quot;/home/user/online/test/htpasswd.txt&amp;quot;&lt;br /&gt;
 [mhttpd,ERROR] [mhttpd.cxx:17138:mongoose,ERROR] please create password file: htdigest -c /home/user/online/test/htpasswd.txt test midas&lt;br /&gt;
 could not start the mongoose web server, see messages and midas.log, bye!&lt;br /&gt;
&lt;br /&gt;
Each person who is to have access to the experiment should create their own username and password. The first user (e.g. mary) creates the password file e.g. htpasswd.txt&lt;br /&gt;
 [user@dasdevpc2 test]$ htdigest -c /home/user/online/test/htpasswd.txt test mary&lt;br /&gt;
 Adding password for mary in realm test.&lt;br /&gt;
 New password:&lt;br /&gt;
 Re-type new password:&lt;br /&gt;
 [user@dasdevpc2 test]$ mhttpd&lt;br /&gt;
 Web server will listen on ports &amp;quot;8080r,8443s&amp;quot;&lt;br /&gt;
 Web server will use SSL certificate file &amp;quot;/home/user/online/test/ssl_cert.pem&amp;quot;&lt;br /&gt;
 Web server will use authentication realm &amp;quot;test&amp;quot;, password file &amp;quot;./htpasswd.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Access to the [[#Features|&#039;&#039;Midas status page&#039;&#039;]] can be obtained by pointing a web browser to &lt;br /&gt;
 https://myhost.mydomain:8443&lt;br /&gt;
The first time you connect you will be asked for a username and password. &lt;br /&gt;
Now that the password file has been created, subsequent users may create their own username and password in the same file by omitting &amp;quot;-c&amp;quot; argument in htdigest, e.g.&lt;br /&gt;
  htdigest  /home/user/online/test/htpasswd.txt test john&lt;br /&gt;
&lt;br /&gt;
Web access can be restricted to certain hosts if desired (see [[#Web security]]).&lt;br /&gt;
 &lt;br /&gt;
Documentation for the version of mongoose included with MIDAS can be found at [http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/mongoose/ Mongoose documentation]. &lt;br /&gt;
&lt;br /&gt;
For more information see [https://midas.triumf.ca/elog/Midas/1062 Elog note 1062]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:whitesmoke; font-size:90%&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= HTTP only (pre-May 2015) versions =&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
* HTTP-only (pre-May2015) versions of mhttpd should only be used &#039;&#039;&#039;behind a firewall&#039;&#039;&#039;&lt;br /&gt;
* If Web [[Security]] is an issue, update to the latest version of mhttpd which uses HTTPS/OpenSSL.&lt;br /&gt;
&lt;br /&gt;
== Arguments (old version) ==&lt;br /&gt;
&lt;br /&gt;
    -p port        : port number e.g. 8080 (no default). See [[#Usage|usage]].&lt;br /&gt;
   [-h hostname ]  : see [[Common Parameters to MIDAS Utilities]]&lt;br /&gt;
   [-e experiment] : see [[Common Parameters to MIDAS Utilities]]&lt;br /&gt;
   [-v]            : display verbose HTTP communication&lt;br /&gt;
   [-D]            : starts program as a daemon&lt;br /&gt;
   [-E]            : only display ELog system&lt;br /&gt;
   [-H]            : only display history plots&lt;br /&gt;
   [-a hostname]   : only allow access for specific host(s). Several [-a Hostname] statements might be given&lt;br /&gt;
   [-help]  &lt;br /&gt;
&lt;br /&gt;
== Usage (old version) ==  &lt;br /&gt;
The command &#039;&#039;&#039;mhttpd -p port&#039;&#039;&#039; can be used to start the web server (http version). In this case, the TCP/IP port number is &#039;&#039;&#039;required&#039;&#039;&#039; as an argument in order to listen to the web-based request.&lt;br /&gt;
&amp;lt;br&amp;gt;e.g. if mhttpd is started on IP host machine &amp;quot;myhost&amp;quot; on port 8081 as follows&lt;br /&gt;
: mhttpd -p 8081 -D&lt;br /&gt;
access to the [[#Features|&#039;&#039;Midas status page&#039;&#039;]] can be obtained by pointing a web browser to &lt;br /&gt;
 http://myhost.mydomain:8081&lt;br /&gt;
&lt;br /&gt;
;Note &lt;br /&gt;
If [[Exptab|multiple experiments]] run on the same host, a web server for each experiment must be started on a different port, e.g.&lt;br /&gt;
           mhttpd -e expt1 -p 8081 -D&lt;br /&gt;
           mhttpd -e expt2 -p 8082 -D&lt;br /&gt;
&lt;br /&gt;
== Improve Security with SSL Proxy ==&lt;br /&gt;
Improved security for HTTP is gained by using an SSL (https) proxy. See [[Setup MIDAS experiment#mhttpd with HTTP|Setting up an SSL proxy]].&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Utilities]]&lt;br /&gt;
[[Category:Web server mhttpd]]&lt;br /&gt;
[[Category:Run control]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=AJAX&amp;diff=2548</id>
		<title>AJAX</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=AJAX&amp;diff=2548"/>
		<updated>2016-09-09T23:48:00Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[mhttpd]]&lt;br /&gt;
* [[mhttpd.js]] Javascript Library&lt;br /&gt;
* [[Custom Page]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= About =&lt;br /&gt;
&lt;br /&gt;
This page will document the MIDAS AJAX functions accessible through special mhttpd URLs.&lt;br /&gt;
&lt;br /&gt;
These AJAX functions are typically accessed from browser javascript using the MIDAS [[mhttpd.js]] library.&lt;br /&gt;
&lt;br /&gt;
As originally written, code snippets are taken from mhttpd.cxx git commit db4602dc2ed63674413f92cc92f49f183bd14225, 21 Aug 2013.&lt;br /&gt;
&lt;br /&gt;
mhttpd AJAX functions are invoked using the &amp;quot;cmd&amp;quot; parameter with value equal to the name of the AJAX request, for example, to call &amp;quot;jmsg&amp;quot;, do:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
curl &amp;quot;http://localhost:8080?cmd=jmsg&amp;amp;n=5&amp;quot; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or where the webserver is using [[mhttpd#HTTPS/SSL server (Mongoose)|HTTPS/SSL (Mongoose)]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;https://localhost:8443?cmd=jmsg&amp;amp;n=5&amp;quot; -k -u username:passwd --digest&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= URL percent-encoding =&lt;br /&gt;
&lt;br /&gt;
All parameter names and parameter values (?name=value) are passed through urlDecode.&lt;br /&gt;
&lt;br /&gt;
Encoding used by urlDecode:&lt;br /&gt;
&lt;br /&gt;
* %HH - decoded as char value 0xHH (hex encoding)&lt;br /&gt;
* &amp;quot;+&amp;quot; - decoded as &amp;quot; &amp;quot; (&amp;quot;plus&amp;quot; decoded as &amp;quot;space&amp;quot;)&lt;br /&gt;
* other chars decoded as themselves&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- [[AJAX]] [[mhttpd.js|Javascript library]]  --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is consistent with URL encoding rules specified by  http://tools.ietf.org/html/rfc3986&lt;br /&gt;
&lt;br /&gt;
On the client side ([[mhttpd.js]]), parameter values should be encoded using the JavaScript encodeURIComponent() function.&lt;br /&gt;
&lt;br /&gt;
* BUG: value of parameter &amp;quot;format&amp;quot; is not passed through urlDecode (git commit db4602dc2ed63674413f92cc92f49f183bd14225, 21 Aug 2013), this is consistent with mhttpd.js which does not urlEncode the values. Values of &amp;quot;format0&amp;quot;, etc used by ODBMGet() are decoded as expected.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            urlDecode(pitem);&lt;br /&gt;
            if (!equal_ustring(pitem, &amp;quot;format&amp;quot;))&lt;br /&gt;
               urlDecode(p);&lt;br /&gt;
            setparam(pitem, p);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* BUG: confirm that values of &amp;quot;format0&amp;quot;, etc are decoded correctly.&lt;br /&gt;
&lt;br /&gt;
= jset =&lt;br /&gt;
&lt;br /&gt;
* JSONP: no&lt;br /&gt;
* parameters:&lt;br /&gt;
** ?pnam=&amp;lt;code&amp;gt;xxx&amp;lt;/code&amp;gt; - cookie_cpwd to match value of ODB /Custon/Pwd/xxx. How is this supposed to work??? How to use it???&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      if (*getparam(&amp;quot;pnam&amp;quot;)) {&lt;br /&gt;
         sprintf(ppath, &amp;quot;/Custom/Pwd/%s&amp;quot;, getparam(&amp;quot;pnam&amp;quot;));&lt;br /&gt;
         str[0] = 0;&lt;br /&gt;
         db_get_value(hDB, 0, ppath, str, &amp;amp;size, TID_STRING, TRUE);&lt;br /&gt;
         if (!equal_ustring(cookie_cpwd, str)) {&lt;br /&gt;
            show_text_header();&lt;br /&gt;
            rsprintf(&amp;quot;Invalid password!&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
** ?odb=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt;&lt;br /&gt;
** ?value=&amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;&lt;br /&gt;
** ?type=&amp;lt;code&amp;gt;integer&amp;lt;/code&amp;gt; - if ODB path does not exist, it is created, using &amp;quot;type&amp;quot; as the MIDAS TID_xxx data type&lt;br /&gt;
** ?len=&amp;lt;code&amp;gt;integer&amp;lt;/code&amp;gt; - when ODB path is created, if &amp;quot;len&amp;quot; is not zero, it is made an array of &amp;quot;len&amp;quot; size, with all values set to &amp;quot;value&amp;quot;. Except if &amp;quot;type&amp;quot; is TID_STRING, there is no array created, but &amp;quot;len&amp;quot; is used as the ODB string length.&lt;br /&gt;
&lt;br /&gt;
* ODB path encoding for arrays:&lt;br /&gt;
** /path/array[i] - write array element [i]&lt;br /&gt;
** /path/array - write array element [0]&lt;br /&gt;
** /path/array[*] - write as many array elements as there are comma-separated entries in &amp;quot;value&amp;quot;. There is no check against existing array length - db_set_data_index() will grow the array as neeed.&lt;br /&gt;
&lt;br /&gt;
* example: TBW&lt;br /&gt;
&lt;br /&gt;
= jget =&lt;br /&gt;
&lt;br /&gt;
* JSONP: no&lt;br /&gt;
* parameters:&lt;br /&gt;
** ?odb=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt;&lt;br /&gt;
** ?format=&amp;lt;code&amp;gt;sprintf format&amp;lt;/code&amp;gt;&lt;br /&gt;
** ?odb0=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; - activates the multiple jget function&lt;br /&gt;
** ?odb&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt;&lt;br /&gt;
** ?format&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;sprintf format&amp;lt;/code&amp;gt;&lt;br /&gt;
** ?name=&amp;lt;code&amp;gt;integer&amp;lt;/code&amp;gt; - non-zero value enables output of key names&lt;br /&gt;
* returns:&lt;br /&gt;
** single jget returns the text from output_key()&lt;br /&gt;
** multiple jget returns the values of all given ODB paths (?odb0=path?format0=format?odb1=path?format1=format?...) separated by the string &amp;quot;$#----#$\n&amp;quot;.&lt;br /&gt;
** &amp;lt;DB_NO_KEY&amp;gt; for non-existant ODB paths (db_find_key() != DB_SUCCESS)&lt;br /&gt;
** &amp;lt;DB_OUT_OF_RANGE&amp;gt; for out of bounds array elements&lt;br /&gt;
&lt;br /&gt;
* ODB array path encoding:&lt;br /&gt;
** /path/array[i] -&amp;gt; index=i&lt;br /&gt;
** /path/array[*] -&amp;gt; index=-1&lt;br /&gt;
** /path/array -&amp;gt; index=0&lt;br /&gt;
** then it is passed to output_key()&lt;br /&gt;
&lt;br /&gt;
* encoding by mhttpd.cxx output_key():&lt;br /&gt;
** TID_KEY: all subkeys are enumerated and passed to output_key() with &amp;quot;index&amp;quot; set to &amp;quot;-1&amp;quot;. Output for all subkeys is concatenated without any separators.&lt;br /&gt;
** arrays or simple variables (index=-1): &amp;quot;v0\nv1\n...&amp;quot;, if &amp;quot;name&amp;quot; is &amp;quot;1&amp;quot;, then: &amp;quot;key[0]: v0\nkey[1]: v1\n...&amp;quot;&lt;br /&gt;
** array elements or simple variables (index!=-1): &amp;quot;value\n&amp;quot;, if &amp;quot;name&amp;quot; is &amp;quot;1&amp;quot;, then: &amp;quot;key[i]: valuei\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* BUG: output_key() has no check against negative array indices - passed directly to db_sprintf()/db_sprintff() which also has no array bounds check&lt;br /&gt;
* BUG: output_key() has no check for db_get_data() success or failure, no handling of DB_TRUNCATED.&lt;br /&gt;
* BUG: some versions of mhttpd do not percent-encode the value of the &amp;quot;format&amp;quot; parameter (see section about URL encoding). Values of &amp;quot;format0&amp;quot;, etc are decoded as expected.&lt;br /&gt;
* BUG: output_key() ignores it&#039;s &amp;quot;format&amp;quot; argument except when encoding arrays. Instead, for encoding of simple variables the value of URL &amp;quot;format&amp;quot; parameter is used unconditionally. This means that the ODBMGet() format[] arguments are only applied to arrays, simple variables use the default format.&lt;br /&gt;
&lt;br /&gt;
* example: TBW&lt;br /&gt;
&lt;br /&gt;
= jcopy =&lt;br /&gt;
&lt;br /&gt;
* JSONP: yes&lt;br /&gt;
* parameters:&lt;br /&gt;
** &amp;amp;format=&amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt; same as &amp;quot;encoding&amp;quot; but subject to an mhttpd URI percent-encoding bug (it is not URI-decoded)&lt;br /&gt;
** &amp;amp;encoding=&amp;lt;code&amp;gt;encoding&amp;lt;/code&amp;gt; see below&lt;br /&gt;
** &amp;amp;callback=&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; name of the JSONP callback function&lt;br /&gt;
** &amp;amp;odb=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; single jcopy function&lt;br /&gt;
** &amp;amp;odb0=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; multiple jcopy function&lt;br /&gt;
** &amp;amp;odb&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; ODB paths for multiple copy&lt;br /&gt;
&lt;br /&gt;
* single jcopy returns:&lt;br /&gt;
** data encoded according to &amp;quot;encoding&amp;quot; (see below)&lt;br /&gt;
** &amp;lt;DB_NO_KEY&amp;gt; is ODB path does not exist (db_find_key() != DB_SUCCESS)&lt;br /&gt;
&lt;br /&gt;
* multiple jcopy returns:&lt;br /&gt;
** each ODB path is encoded same for single jcopy, with following separators:&lt;br /&gt;
** encoding=&amp;quot;odb&amp;quot;, separator is string &amp;quot;$#----#$\n&amp;quot;, non existant keys return &amp;lt;DB_NO_KEY&amp;gt;&amp;quot;&lt;br /&gt;
** encoding=&amp;quot;xml&amp;quot;, outer XML element is &amp;lt;jcopy&amp;gt;, each ODB path is wrapped in a &amp;lt;data&amp;gt; element, non existant keys are encoded as &amp;lt;DB_NO_KEY/&amp;gt;&lt;br /&gt;
** encoding=&amp;quot;json&amp;quot;, data is encoded as a JSON array - &amp;quot;[ path0, path1, ... ]&amp;quot;, non existant keys are encoded as &amp;quot;{ &amp;quot;/error&amp;quot; : %d }&amp;quot; with the error return value of db_find_key().&lt;br /&gt;
&lt;br /&gt;
* jcopy &amp;quot;encoding&amp;quot; (and &amp;quot;format&amp;quot;) parameter:&lt;br /&gt;
** encoding=&amp;quot;odb&amp;quot; - returns data encoded by db_copy()&lt;br /&gt;
** encoding=&amp;quot;xml&amp;quot; - returns data encoded by db_copy_xml()&lt;br /&gt;
** encoding=&amp;quot;json&amp;quot; - returns data encoded by db_copy_json(), with these options:&lt;br /&gt;
*** &amp;quot;json-p&amp;quot; - data is wrapped by &amp;quot;callback(data);\n&amp;quot;&lt;br /&gt;
*** &amp;quot;json-nofollowlinks&amp;quot; - ODB links are encoded as links not as values pointed to by links&lt;br /&gt;
*** &amp;quot;json-nokeys&amp;quot; - only values are encoded, ODB keys are omitted, except for &amp;quot;last_written&amp;quot;&lt;br /&gt;
*** &amp;quot;json-nolastwritten&amp;quot; - value of ODB key &amp;quot;last_written&amp;quot; is omitted, too.&lt;br /&gt;
*** &amp;quot;json-norecurse&amp;quot; - do not recurse into subdirectories (to implement odb edit &amp;quot;ls -l&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
* examples:&lt;br /&gt;
** single jcopy in ODB format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jcopy&amp;amp;odb=/runinfo&amp;amp;encoding=odb&amp;quot;&lt;br /&gt;
[.]&lt;br /&gt;
State = INT : 1&lt;br /&gt;
Online Mode = INT : 1&lt;br /&gt;
Run number = INT : 0&lt;br /&gt;
Transition in progress = INT : 0&lt;br /&gt;
Start abort = INT : 0&lt;br /&gt;
Requested transition = INT : 0&lt;br /&gt;
Start time = STRING : [32] Tue Sep 09 15:04:42 1997&lt;br /&gt;
Start time binary = DWORD : 0&lt;br /&gt;
Stop time = STRING : [32] Tue Sep 09 15:04:42 1997&lt;br /&gt;
Stop time binary = DWORD : 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* single jcopy in XML format:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jcopy&amp;amp;odb=/runinfo&amp;amp;encoding=xml&amp;quot;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;!-- created by MXML on Thu Aug 22 09:53:02 2013 --&amp;gt;&lt;br /&gt;
&amp;lt;odb root=&amp;quot;/Runinfo&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; xsi:noNamespaceSchemaLocation=&amp;quot;http://midas.psi.ch/odb.xsd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;key name=&amp;quot;State&amp;quot; type=&amp;quot;INT&amp;quot;&amp;gt;1&amp;lt;/key&amp;gt;&lt;br /&gt;
  &amp;lt;key name=&amp;quot;Online Mode&amp;quot; type=&amp;quot;INT&amp;quot;&amp;gt;1&amp;lt;/key&amp;gt;&lt;br /&gt;
  &amp;lt;key name=&amp;quot;Run number&amp;quot; type=&amp;quot;INT&amp;quot;&amp;gt;0&amp;lt;/key&amp;gt;&lt;br /&gt;
  &amp;lt;key name=&amp;quot;Transition in progress&amp;quot; type=&amp;quot;INT&amp;quot;&amp;gt;0&amp;lt;/key&amp;gt;&lt;br /&gt;
  &amp;lt;key name=&amp;quot;Start abort&amp;quot; type=&amp;quot;INT&amp;quot;&amp;gt;0&amp;lt;/key&amp;gt;&lt;br /&gt;
  &amp;lt;key name=&amp;quot;Requested transition&amp;quot; type=&amp;quot;INT&amp;quot;&amp;gt;0&amp;lt;/key&amp;gt;&lt;br /&gt;
  &amp;lt;key name=&amp;quot;Start time&amp;quot; type=&amp;quot;STRING&amp;quot; size=&amp;quot;32&amp;quot;&amp;gt;Tue Sep 09 15:04:42 1997&amp;lt;/key&amp;gt;&lt;br /&gt;
  &amp;lt;key name=&amp;quot;Start time binary&amp;quot; type=&amp;quot;DWORD&amp;quot;&amp;gt;0&amp;lt;/key&amp;gt;&lt;br /&gt;
  &amp;lt;key name=&amp;quot;Stop time&amp;quot; type=&amp;quot;STRING&amp;quot; size=&amp;quot;32&amp;quot;&amp;gt;Tue Sep 09 15:04:42 1997&amp;lt;/key&amp;gt;&lt;br /&gt;
  &amp;lt;key name=&amp;quot;Stop time binary&amp;quot; type=&amp;quot;DWORD&amp;quot;&amp;gt;0&amp;lt;/key&amp;gt;&lt;br /&gt;
&amp;lt;/odb&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* single jcopy on JSON format:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jcopy&amp;amp;odb=/runinfo&amp;amp;encoding=json&amp;quot;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;State/key&amp;quot; : { &amp;quot;type&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;State&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;Online Mode/key&amp;quot; : { &amp;quot;type&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Online Mode&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;Run number/key&amp;quot; : { &amp;quot;type&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Run number&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;Transition in progress/key&amp;quot; : { &amp;quot;type&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Transition in progress&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;Start abort/key&amp;quot; : { &amp;quot;type&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Start abort&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;Requested transition/key&amp;quot; : { &amp;quot;type&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Requested transition&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;Start time/key&amp;quot; : { &amp;quot;type&amp;quot; : 12, &amp;quot;item_size&amp;quot; : 32, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Start time&amp;quot; : &amp;quot;Tue Sep 09 15:04:42 1997&amp;quot;,&lt;br /&gt;
  &amp;quot;Start time binary/key&amp;quot; : { &amp;quot;type&amp;quot; : 6, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Start time binary&amp;quot; : &amp;quot;0x00000000&amp;quot;,&lt;br /&gt;
  &amp;quot;Stop time/key&amp;quot; : { &amp;quot;type&amp;quot; : 12, &amp;quot;item_size&amp;quot; : 32, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Stop time&amp;quot; : &amp;quot;Tue Sep 09 15:04:42 1997&amp;quot;,&lt;br /&gt;
  &amp;quot;Stop time binary/key&amp;quot; : { &amp;quot;type&amp;quot; : 6, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Stop time binary&amp;quot; : &amp;quot;0x00000000&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* multiple jcopy in JSON format:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jcopy&amp;amp;odb0=/experiment/name&amp;amp;odb1=/runinfo&amp;amp;encoding=json&amp;quot;&lt;br /&gt;
[&lt;br /&gt;
{&lt;br /&gt;
&amp;quot;Name/key&amp;quot; : { &amp;quot;type&amp;quot; : 12, &amp;quot;item_size&amp;quot; : 32, &amp;quot;last_written&amp;quot; : 1377190203 },&lt;br /&gt;
&amp;quot;Name&amp;quot; : &amp;quot;javascript1&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
,&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;State/key&amp;quot; : { &amp;quot;type&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;State&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;Online Mode/key&amp;quot; : { &amp;quot;type&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Online Mode&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;Run number/key&amp;quot; : { &amp;quot;type&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Run number&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;Transition in progress/key&amp;quot; : { &amp;quot;type&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Transition in progress&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;Start abort/key&amp;quot; : { &amp;quot;type&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Start abort&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;Requested transition/key&amp;quot; : { &amp;quot;type&amp;quot; : 7, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Requested transition&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;Start time/key&amp;quot; : { &amp;quot;type&amp;quot; : 12, &amp;quot;item_size&amp;quot; : 32, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Start time&amp;quot; : &amp;quot;Tue Sep 09 15:04:42 1997&amp;quot;,&lt;br /&gt;
  &amp;quot;Start time binary/key&amp;quot; : { &amp;quot;type&amp;quot; : 6, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Start time binary&amp;quot; : &amp;quot;0x00000000&amp;quot;,&lt;br /&gt;
  &amp;quot;Stop time/key&amp;quot; : { &amp;quot;type&amp;quot; : 12, &amp;quot;item_size&amp;quot; : 32, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Stop time&amp;quot; : &amp;quot;Tue Sep 09 15:04:42 1997&amp;quot;,&lt;br /&gt;
  &amp;quot;Stop time binary/key&amp;quot; : { &amp;quot;type&amp;quot; : 6, &amp;quot;last_written&amp;quot; : 1377182821 },&lt;br /&gt;
  &amp;quot;Stop time binary&amp;quot; : &amp;quot;0x00000000&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* multiple jcopy in condensed JSON encoding with JSONP wrapper:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jcopy&amp;amp;odb0=/experiment/name&amp;amp;odb1=/runinfo&amp;amp;encoding=json-p-nokeys&amp;amp;callback=mycallback&amp;quot;&lt;br /&gt;
mycallback([&lt;br /&gt;
{&lt;br /&gt;
&amp;quot;Name/last_written&amp;quot; : 1377190203,&lt;br /&gt;
&amp;quot;Name&amp;quot; : &amp;quot;javascript1&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
,&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;State/last_written&amp;quot; : 1377182821,&lt;br /&gt;
  &amp;quot;State&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;Online Mode/last_written&amp;quot; : 1377182821,&lt;br /&gt;
  &amp;quot;Online Mode&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;Run number/last_written&amp;quot; : 1377182821,&lt;br /&gt;
  &amp;quot;Run number&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;Transition in progress/last_written&amp;quot; : 1377182821,&lt;br /&gt;
  &amp;quot;Transition in progress&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;Start abort/last_written&amp;quot; : 1377182821,&lt;br /&gt;
  &amp;quot;Start abort&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;Requested transition/last_written&amp;quot; : 1377182821,&lt;br /&gt;
  &amp;quot;Requested transition&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;Start time/last_written&amp;quot; : 1377182821,&lt;br /&gt;
  &amp;quot;Start time&amp;quot; : &amp;quot;Tue Sep 09 15:04:42 1997&amp;quot;,&lt;br /&gt;
  &amp;quot;Start time binary/last_written&amp;quot; : 1377182821,&lt;br /&gt;
  &amp;quot;Start time binary&amp;quot; : &amp;quot;0x00000000&amp;quot;,&lt;br /&gt;
  &amp;quot;Stop time/last_written&amp;quot; : 1377182821,&lt;br /&gt;
  &amp;quot;Stop time&amp;quot; : &amp;quot;Tue Sep 09 15:04:42 1997&amp;quot;,&lt;br /&gt;
  &amp;quot;Stop time binary/last_written&amp;quot; : 1377182821,&lt;br /&gt;
  &amp;quot;Stop time binary&amp;quot; : &amp;quot;0x00000000&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
]&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
** multiple jcopy in values-only JSON encoding with JSONP wrapper:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jcopy&amp;amp;odb0=/experiment/name&amp;amp;odb1=/runinfo&amp;amp;encoding=json-p-nokeys-nolastwritten&amp;amp;callback=mycallback&amp;quot;&lt;br /&gt;
mycallback([&lt;br /&gt;
&amp;quot;javascript1&amp;quot;&lt;br /&gt;
,&lt;br /&gt;
{&lt;br /&gt;
1,&lt;br /&gt;
1,&lt;br /&gt;
186,&lt;br /&gt;
0,&lt;br /&gt;
0,&lt;br /&gt;
0,&lt;br /&gt;
&amp;quot;Thu Jan 16 11:56:53 2014&amp;quot;,&lt;br /&gt;
&amp;quot;0x52d83985&amp;quot;,&lt;br /&gt;
&amp;quot;Thu Jan 16 11:56:58 2014&amp;quot;,&lt;br /&gt;
&amp;quot;0x52d8398a&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
]&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= jkey =&lt;br /&gt;
&lt;br /&gt;
* JSONP: no&lt;br /&gt;
* parameters:&lt;br /&gt;
** &amp;amp;odb=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt;&lt;br /&gt;
* returns:&lt;br /&gt;
** &amp;quot;&amp;lt;DB_NO_KEY&amp;gt;&amp;quot; if key does not exist&lt;br /&gt;
** MIDAS &amp;quot;KEY&amp;quot; structure (see midas.h)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
         db_get_key(hDB, hkey, &amp;amp;key);&lt;br /&gt;
         rsprintf(&amp;quot;%s\n&amp;quot;, key.name);&lt;br /&gt;
         rsprintf(&amp;quot;TID_%s\n&amp;quot;, rpc_tid_name(key.type));&lt;br /&gt;
         rsprintf(&amp;quot;%d\n&amp;quot;, key.num_values);&lt;br /&gt;
         rsprintf(&amp;quot;%d\n&amp;quot;, key.item_size);&lt;br /&gt;
         rsprintf(&amp;quot;%d&amp;quot;, key.last_written);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jkey&amp;amp;odb=/runinfo/run+number&amp;quot;&lt;br /&gt;
Run number&lt;br /&gt;
TID_INT&lt;br /&gt;
1&lt;br /&gt;
4&lt;br /&gt;
1377182821&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* BUG: last entry is not &amp;quot;\n&amp;quot; terminated&lt;br /&gt;
* BUG: there is no check for db_get_key() error return&lt;br /&gt;
&lt;br /&gt;
= jcreate =&lt;br /&gt;
&lt;br /&gt;
* git branch: feature/ajax&lt;br /&gt;
* JSONP: yes&lt;br /&gt;
* parameters:&lt;br /&gt;
** &amp;amp;encoding=&amp;lt;code&amp;gt;encoding&amp;lt;/code&amp;gt; only JSON is implemented&lt;br /&gt;
** &amp;amp;callback=&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; name of the JSONP callback function&lt;br /&gt;
** &amp;amp;odb=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; single jcreate function&lt;br /&gt;
** &amp;amp;odb0=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; multiple jcreate function&lt;br /&gt;
** &amp;amp;odb&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; ODB paths for multiple copy&lt;br /&gt;
** &amp;amp;type=&amp;lt;code&amp;gt;TID_type&amp;lt;/code&amp;gt; single jcreate: integer &amp;quot;type&amp;quot; argument to db_create_key()&lt;br /&gt;
** &amp;amp;type&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;TID_type&amp;lt;/code&amp;gt; same for multiple jcreate&lt;br /&gt;
** &amp;amp;strlen=&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; if &amp;quot;type&amp;quot; is TID_STRING, create string of given length. If absent, zero-length string is created&lt;br /&gt;
** &amp;amp;strlen&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; same for multiple jcreate&lt;br /&gt;
** &amp;amp;arraylen=&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; is present, use db_set_num_values() to create an array of specified length&lt;br /&gt;
** &amp;amp;arraylen&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; same for multiple jcreate&lt;br /&gt;
&lt;br /&gt;
* single jcreate returns:&lt;br /&gt;
** integer status value from db_create_key()&lt;br /&gt;
&lt;br /&gt;
* multiple jcreate returns:&lt;br /&gt;
** data encoded as JSON, i.e.: [ 1, 312, 1 ]&lt;br /&gt;
&lt;br /&gt;
* examples:&lt;br /&gt;
&lt;br /&gt;
** single jcreate:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jcreate&amp;amp;odb=/test/foo&amp;amp;type=7&amp;quot;&lt;br /&gt;
1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
** multiple jcreate with JSON-P encoding:&lt;br /&gt;
(note how /nonexistant is created with an invalid &amp;quot;type&amp;quot;)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jcreate&amp;amp;odb0=/test/foo&amp;amp;type0=7&amp;amp;odb1=/nonexistant&amp;amp;type1=100&amp;amp;odb2=/test/bar&amp;amp;type2=12&amp;amp;encoding=json&amp;amp;callback=aaa&amp;quot;&lt;br /&gt;
aaa([ 1, 309, 1 ]);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
** create an array of integers:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
curl &amp;quot;http://localhost:8080?cmd=jcreate&amp;amp;odb=/test/foo70&amp;amp;type=7&amp;amp;arraylen=10&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
** create an array of strings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
curl &amp;quot;http://localhost:8080?cmd=jcreate&amp;amp;odb=/test/foo12s5&amp;amp;type=12&amp;amp;strlen=32&amp;amp;arraylen=5&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= jresize =&lt;br /&gt;
&lt;br /&gt;
* git branch: feature/ajax&lt;br /&gt;
* JSONP: yes&lt;br /&gt;
* parameters:&lt;br /&gt;
** &amp;amp;encoding=&amp;lt;code&amp;gt;encoding&amp;lt;/code&amp;gt; only JSON is implemented&lt;br /&gt;
** &amp;amp;callback=&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; name of the JSONP callback function&lt;br /&gt;
** &amp;amp;odb=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; single jresize function&lt;br /&gt;
** &amp;amp;odb0=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; multiple jresize function&lt;br /&gt;
** &amp;amp;odb&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; ODB paths for multiple resize&lt;br /&gt;
** &amp;amp;strlen=&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; change string length, including element length of string arrays&lt;br /&gt;
** &amp;amp;strlen&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; same for multiple jcreate&lt;br /&gt;
** &amp;amp;arraylen=&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; change array length, including string arrays&lt;br /&gt;
** &amp;amp;arraylen&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; same for multiple jcreate&lt;br /&gt;
&lt;br /&gt;
* single jresize returns:&lt;br /&gt;
** integer status value from db_find_key(), db_get_key(), db_get_data(), db_set_data(), db_set_num_values()&lt;br /&gt;
&lt;br /&gt;
* multiple jresize returns:&lt;br /&gt;
** data encoded as JSON, i.e.: [ 1, 312, 1 ]&lt;br /&gt;
&lt;br /&gt;
* examples: similar to jcreate:&lt;br /&gt;
&lt;br /&gt;
** resize integer array: curl &amp;quot;http://localhost:8080?cmd=jresize&amp;amp;odb=/test/foo70&amp;amp;arraylen=5&amp;quot;&lt;br /&gt;
** resize string array: curl &amp;quot;http://localhost:8080?cmd=jresize&amp;amp;odb=/test/foo12s5&amp;amp;arraylen=5&amp;quot;&lt;br /&gt;
** resize element size of string array: curl &amp;quot;http://localhost:8080?cmd=jresize&amp;amp;odb=/test/foo12s5&amp;amp;strlen=16&amp;quot;&lt;br /&gt;
** and change array size at the same time: curl &amp;quot;http://localhost:8080?cmd=jresize&amp;amp;odb=/test/foo12s5&amp;amp;strlen=30&amp;amp;arraylen=10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= jrename =&lt;br /&gt;
&lt;br /&gt;
* git branch: feature/ajax&lt;br /&gt;
* JSONP: yes&lt;br /&gt;
* parameters:&lt;br /&gt;
** &amp;amp;encoding=&amp;lt;code&amp;gt;encoding&amp;lt;/code&amp;gt; only JSON is implemented&lt;br /&gt;
** &amp;amp;callback=&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; name of the JSONP callback function&lt;br /&gt;
** &amp;amp;odb=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; single jrename function&lt;br /&gt;
** &amp;amp;odb0=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; multiple jrename function&lt;br /&gt;
** &amp;amp;odb&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; ODB paths for multiple rename&lt;br /&gt;
** &amp;amp;name=&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; single rename: new key &amp;quot;name&amp;quot; argument to db_rename_key()&lt;br /&gt;
** &amp;amp;name&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; same for multiple rename&lt;br /&gt;
&lt;br /&gt;
* single jrename returns:&lt;br /&gt;
** integer status value from db_rename_key()&lt;br /&gt;
&lt;br /&gt;
* multiple jrename returns:&lt;br /&gt;
** data encoded as JSON, i.e.: [ 1, 312, 1 ]&lt;br /&gt;
&lt;br /&gt;
* examples:&lt;br /&gt;
&lt;br /&gt;
** single jrename:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jrename&amp;amp;odb=/test/foo&amp;amp;name=foofoo&amp;quot;&lt;br /&gt;
1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
** multiple jrename:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jrename&amp;amp;odb0=/test/foo&amp;amp;name0=foofoo&amp;amp;odb1=/test/bar&amp;amp;name1=barbar&amp;quot;&lt;br /&gt;
[ 1, 1 ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= jlink =&lt;br /&gt;
&lt;br /&gt;
* git branch: feature/ajax&lt;br /&gt;
* JSONP: yes&lt;br /&gt;
* parameters:&lt;br /&gt;
** &amp;amp;encoding=&amp;lt;code&amp;gt;encoding&amp;lt;/code&amp;gt; only JSON is implemented&lt;br /&gt;
** &amp;amp;callback=&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; name of the JSONP callback function&lt;br /&gt;
** &amp;amp;odb=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; single jlink function&lt;br /&gt;
** &amp;amp;odb0=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; multiple jlink function&lt;br /&gt;
** &amp;amp;odb&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; ODB paths for multiple link&lt;br /&gt;
** &amp;amp;dest=&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; single link: destination argument to db_create_link()&lt;br /&gt;
** &amp;amp;dest&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; same for multiple rename&lt;br /&gt;
&lt;br /&gt;
* single jlink returns:&lt;br /&gt;
** integer status value from db_create_link()&lt;br /&gt;
&lt;br /&gt;
* multiple jlink returns:&lt;br /&gt;
** data encoded as JSON, i.e.: [ 1, 312, 1 ]&lt;br /&gt;
&lt;br /&gt;
* examples:&lt;br /&gt;
&lt;br /&gt;
** single jlink:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jlink&amp;amp;odb=/test/link&amp;amp;dest=/test/foo&amp;quot;&lt;br /&gt;
1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
** multiple jlink:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jlink&amp;amp;odb0=/test/link0&amp;amp;dest0=/test/foo&amp;amp;odb1=/test/link1&amp;amp;dest1=/test/foo&amp;quot;&lt;br /&gt;
[ 1, 1 ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= jreorder =&lt;br /&gt;
&lt;br /&gt;
* git branch: feature/ajax&lt;br /&gt;
* JSONP: yes&lt;br /&gt;
* parameters:&lt;br /&gt;
** &amp;amp;encoding=&amp;lt;code&amp;gt;encoding&amp;lt;/code&amp;gt; only JSON is implemented&lt;br /&gt;
** &amp;amp;callback=&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; name of the JSONP callback function&lt;br /&gt;
** &amp;amp;odb=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; single jreorder function&lt;br /&gt;
** &amp;amp;odb0=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; multiple jreorder function&lt;br /&gt;
** &amp;amp;odb&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; ODB paths for multiple reorder&lt;br /&gt;
** &amp;amp;index=&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; single link: &amp;quot;index&amp;quot; argument to db_reorder_key(). Special index values are: &amp;quot;0&amp;quot; is top, &amp;quot;-1&amp;quot; is bottom.&lt;br /&gt;
** &amp;amp;index&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; same for multiple reorder&lt;br /&gt;
&lt;br /&gt;
* single jreorder returns:&lt;br /&gt;
** integer status value from db_reorder_key()&lt;br /&gt;
&lt;br /&gt;
* multiple jreorder returns:&lt;br /&gt;
** data encoded as JSON, i.e.: [ 1, 312, 1 ]&lt;br /&gt;
&lt;br /&gt;
* examples:&lt;br /&gt;
&lt;br /&gt;
** single jreorder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jreorder&amp;amp;odb=/test/bar&amp;amp;index=0&amp;quot;&lt;br /&gt;
1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
** multiple jreorder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jreorder&amp;amp;odb0=/test/foo&amp;amp;index0=0&amp;amp;odb1=/test/bar&amp;amp;index1=1&amp;quot;&lt;br /&gt;
[ 1, 1 ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= jdelete =&lt;br /&gt;
&lt;br /&gt;
* git branch: feature/ajax&lt;br /&gt;
* JSONP: yes&lt;br /&gt;
* parameters:&lt;br /&gt;
** &amp;amp;encoding=&amp;lt;code&amp;gt;encoding&amp;lt;/code&amp;gt; only JSON is implemented&lt;br /&gt;
** &amp;amp;callback=&amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; name of the JSONP callback function&lt;br /&gt;
** &amp;amp;odb=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; single jdelete function&lt;br /&gt;
** &amp;amp;odb0=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; multiple jdelete function&lt;br /&gt;
** &amp;amp;odb&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;=&amp;lt;code&amp;gt;ODB path&amp;lt;/code&amp;gt; ODB paths for multiple jdelete&lt;br /&gt;
&lt;br /&gt;
* single jdelete returns:&lt;br /&gt;
** integer status value from db_delete_key()&lt;br /&gt;
&lt;br /&gt;
* multiple jdelete returns:&lt;br /&gt;
** data encoded as JSON, i.e.: [ 1, 312, 1 ]&lt;br /&gt;
&lt;br /&gt;
* examples:&lt;br /&gt;
&lt;br /&gt;
** single jdelete:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jdelete&amp;amp;odb=/test/foo&amp;quot;&lt;br /&gt;
1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
** multiple jdelete with JSON-P encoding:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jdelete&amp;amp;odb0=/test/foo&amp;amp;odb1=/nonexistant&amp;amp;odb2=/test/bar&amp;amp;encoding=json&amp;amp;callback=aaa&amp;quot;&lt;br /&gt;
aaa([ 1, 312, 1 ]);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= jmsg =&lt;br /&gt;
&lt;br /&gt;
* JSONP: no&lt;br /&gt;
* parameters:&lt;br /&gt;
** &amp;amp;n=&amp;lt;code&amp;gt;number of messages to return&amp;lt;/code&amp;gt;  return last n messages&lt;br /&gt;
** &amp;amp;t=&amp;lt;code&amp;gt;unix timestamp&amp;lt;/code&amp;gt; return all messages since time t&lt;br /&gt;
::: Note that parameter &#039;&#039;&#039;&amp;amp;n=0 must be specified with parameter &amp;amp;t&#039;&#039;&#039; (see example 2 below)&lt;br /&gt;
* returns: output of midas.c::cm_msg_retrieve()&lt;br /&gt;
* example 1: get last 5 messages&lt;br /&gt;
:: in this example the webserver is using http &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jmsg&amp;amp;n=5&amp;quot;&lt;br /&gt;
Thu Aug 22 08:05:10 2013 [Logger,TALK] Warning: This is an example alarm&lt;br /&gt;
Thu Aug 22 08:06:13 2013 [mhttpd,TALK] Alarm: Run number became too large&lt;br /&gt;
Thu Aug 22 08:06:13 2013 [mhttpd,TALK] Warning: This is an example alarm&lt;br /&gt;
Thu Aug 22 08:07:15 2013 [fejrpc,TALK] Alarm: Run number became too large&lt;br /&gt;
Thu Aug 22 08:07:15 2013 [fejrpc,TALK] Warning: This is an example alarm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* example 2: get all messages since a certain date &lt;br /&gt;
:: in this example the webserver is using [[mhttpd#HTTPS/SSL server (Mongoose)|HTTPS/SSL (Mongoose)]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ date -d &amp;quot;Fri Sep 9 16:10:00 PDT 2016&amp;quot; +%s&lt;br /&gt;
1473462600&lt;br /&gt;
$ curl &amp;quot;https://localhost:8443?cmd=jmsg&amp;amp;n=0&amp;amp;t=1473462600&amp;quot; -k -u username:passwd --digest&lt;br /&gt;
1473462926 16:15:26.119 2016/09/09 [ODBEdit,TALK] Alarm: RF has tripped&lt;br /&gt;
1473462863 16:14:23.740 2016/09/09 [autorun,TALK] Alarm: RF has tripped&lt;br /&gt;
1473462799 16:13:19.109 2016/09/09 [mheader,TALK] Alarm: RF has tripped&lt;br /&gt;
1473462739 16:12:19.078 2016/09/09 [feEpics,TALK] Alarm: RF has tripped&lt;br /&gt;
1473462673 16:11:13.003 2016/09/09 [feEpics,TALK] Alarm: RF has tripped&lt;br /&gt;
1473462607 16:10:07.101 2016/09/09 [ODBEdit,TALK] Alarm: RF has tripped&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* BUG: last message is not &amp;quot;\n&amp;quot; terminated (violation of the HTTP protocol?)&lt;br /&gt;
&lt;br /&gt;
= jgenmsg =&lt;br /&gt;
&lt;br /&gt;
* JSONP: no&lt;br /&gt;
* parameters:&lt;br /&gt;
** &amp;amp;msg=&amp;lt;code&amp;gt;message text&amp;lt;/code&amp;gt;&lt;br /&gt;
* returns: string &amp;quot;Message successfully created\n&amp;quot;&lt;br /&gt;
* example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl &amp;quot;http://localhost:8080?cmd=jgenmsg&amp;amp;msg=test+message&amp;quot;&lt;br /&gt;
Message successfully created&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* BUG: &amp;quot;Message successfully created\n&amp;quot; is returned even if the &amp;quot;msg&amp;quot; parameter is missing and regardless of cm_msg() error return code.&lt;br /&gt;
&lt;br /&gt;
= jalm =&lt;br /&gt;
&lt;br /&gt;
* JSONP: no&lt;br /&gt;
* parameters: no&lt;br /&gt;
* returns:&lt;br /&gt;
** text from alarm.c::al_get_alarms()&lt;br /&gt;
** is &amp;quot;\n&amp;quot; separated list of alarms&lt;br /&gt;
** alarm format is &amp;quot;class: text&amp;quot;, where &amp;quot;class&amp;quot; is the alarm class, &amp;quot;text&amp;quot; is the alarm message from ODB /Alarms/alarms/xxx/&lt;br /&gt;
* example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ curl http://localhost:8080?cmd=jalm&lt;br /&gt;
Alarm: Run number became too large&lt;br /&gt;
Warning: This is an example alarm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* BUG: return text is &amp;quot;\n&amp;quot; terminated, array created by javascript request.responseText.split(&#039;\n&#039;) will have an extra empty element at the end.&lt;br /&gt;
&lt;br /&gt;
[[Category:Ajax]] [[Category:Javascript library]] [[Category:Custom]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Custom_Page_Features&amp;diff=2547</id>
		<title>Custom Page Features</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Custom_Page_Features&amp;diff=2547"/>
		<updated>2016-09-01T20:38:31Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[Mhttpd|mhttpd MIDAS web server]]&lt;br /&gt;
* [[ODB Page]]&lt;br /&gt;
* [[Custom Page]]&lt;br /&gt;
* [[/Custom ODB tree]]&lt;br /&gt;
* [[Mhttpd.js|MIDAS Javascript library (mhttpd.js)]]&lt;br /&gt;
* [[mjsonrpc|MIDAS JSON RPC library functions (mjsonrpc)]]&lt;br /&gt;
* [[odbedit]] &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
This page describes some of the special features provided for use on a user-created [[Custom Page|Custom Web Page]] running under [[mhttpd]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= The MIDAS Javascript Library =&lt;br /&gt;
The MIDAS Javascript Library [[mhttpd.js]] includes routines written in Javascript and AJAX to provide features useful for writers of [[Custom Page]]s, such as access to the ODB. Recently asynchronous [[mjsonrpc|JSON-RPC functions]] using [[mjsonrpc#Javascript client library|Promises]]  has been added (January 2016).&lt;br /&gt;
;NOTE&lt;br /&gt;
:To use functions in this library, it &#039;&#039;&#039;must be [[mhttpd.js#include js lib|included in the HTML code]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Many of the older routines (ODBGet, ODBSet) use &#039;&#039;&#039;synchronous&#039;&#039;&#039; RPC requests. With synchronous request, a second RPC request must wait until the first request is complete. This can significantly slow down web pages where many calls to ODBGet are made. For this reason, functions were developed that can be synchronous or &#039;&#039;&#039;asynchronous&#039;&#039;&#039; (e.g. ODBMCopy) that include a callback mechanism. The data from ODBMCopy can be formatted in [[mjsonrpc#JSON general information|JSON]]. &lt;br /&gt;
&lt;br /&gt;
Web developers are moving away from synchronous RPC requests, which are now deprecated [https://midas.triumf.ca/elog/Midas/1128]. Some modern browsers return a warning on a synchronous RPC request. &lt;br /&gt;
&lt;br /&gt;
A new group of JSON-RPC functions using  [[mjsonrpc#Javascript client library|Promises]] has been added to the MIDAS Javascript Library (January 2016). These are asynchronous only, and they also provide more functionality and have better error handling than the older AJAX calls, which are also inconsistent in how they handle Booleans. They also have much improved handling of reading/writing arrays to the ODB. It is {{Important|text=recommended that all new Custom Pages are written using these JSON-RPC functions}}. They do require an up-to-date browser that supports Promises (see [https://midas.triumf.ca/elog/Midas/1145]). If using an older browser version, the asynchronous AJAX calls (e.g. ODBMCopy) should be used in order to avoid having to rewrite the web page at a later date to remove all synchronous calls.  &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Access the ODB using mjson-rpc asynchronous functions ==&lt;br /&gt;
&lt;br /&gt;
Access to the ODB is provided by the  [[Mhttpd.js|MIDAS Javascript Library]], which (since January 2016) includes the [[mjsonrpc]] functions.  It is [[#The MIDAS Javascript Library|recommended]] that these functions are used for &#039;&#039;&#039;new&#039;&#039;&#039; pages rather than the older AJAX calls (see below). &lt;br /&gt;
&lt;br /&gt;
To run these functions you need&lt;br /&gt;
# to  [[mhttpd.js#include js lib|include the Javascript library in the HTML code]]&#039;&#039;&#039;&lt;br /&gt;
# to use an up-to-date browser that supports Promises (see [https://midas.triumf.ca/elog/Midas/1145]). &lt;br /&gt;
&lt;br /&gt;
Examples showing how to read and write to the ODB can be found at [[mjsonrpc#examples]]. Also included are examples using arrays. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Access the ODB using asynchronous AJAX calls ==&lt;br /&gt;
;NOTE&lt;br /&gt;
: It is recommended that  asynchronous MIDAS JSON-RPC functions are used for new pages rather than the older AJAX calls (see [[#Access the ODB using mjson-rpc asynchronous functions|above]]).&lt;br /&gt;
&lt;br /&gt;
[[#Example 2 : Asynchronous calls using Javascript and AJAX|Example 2]] uses the asynchronous call ODBMCopy() with callback to read the data. The data are converted into JSON format. In this case, when accessing the JSON data, &#039;&#039;the ODB Keynames must be in the same case as they are in the ODB&#039;&#039;, even though the case is ignored by the ODB. If you find this feature annoying, use [[#Access the ODB using mjson-rpc asynchronous functions|mjson-rpc function db_get_values()]] as all keynames are converted to lower case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Access the ODB using synchronous AJAX requests ==&lt;br /&gt;
;NOTE&lt;br /&gt;
: Synchronous requests are now deprecated (see [[#The MIDAS Javascript Library|above]]). New pages should be written [[#Using mjson-rpc asynchronous functions]].&lt;br /&gt;
&lt;br /&gt;
See [[#Example 3 : Synchronous Calls using Javascript and AJAX]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Access the ODB with HTML-style &amp;lt;span style=&amp;quot;color:seagreen font-style:italic&amp;quot;&amp;gt;&amp;lt;odb&amp;gt;&amp;lt;/span&amp;gt; tags =&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This method pre-dates the [[Mhttpd.js|MIDAS Javascript Library]]. It is recommended that the [[Mhttpd.js|MIDAS Javascript Library]] be used for ODB access.&lt;br /&gt;
&lt;br /&gt;
If Javascript (JS) is not available, the older HTML-style  {{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tags are still available and provide limited functionality.&lt;br /&gt;
&lt;br /&gt;
The  HTML-style {{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tag has been defined for read/write access to the ODB under HTML. The {{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tags are declared within enclosing HTML {{HtmlTag|tag=&amp;lt;form...&amp;gt;....&amp;lt;/form&amp;gt;}} tags.&lt;br /&gt;
&lt;br /&gt;
{|  style=&amp;quot;text-align: left; width: 100%; background-color: rgb(255, 255, 255);&amp;quot; border=&amp;quot;3&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;2&amp;quot;&lt;br /&gt;
|+ Access to ODB from HTML&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;text-align: center; vertical-align: top; background-color: rgb(204, 204, 255); font-weight: bold;&amp;quot; | HTML ODB tag&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot; style=&amp;quot;text-align: center; vertical-align: top; background-color: rgb(204, 204, 255); font-weight: bold;&amp;quot; | Meaning&lt;br /&gt;
&lt;br /&gt;
|-   &lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;text-align: left; vertical-align: top; background-color: rgb(255, 255, 255); color: seagreen; font-style:italic&amp;quot;  |&amp;lt;odb src=&amp;quot;odb path&amp;quot;&amp;gt;&lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;text-align: left; vertical-align: top; background-color: rgb(255, 255, 255); color: black&amp;quot;  |Display ODB field (read only)&lt;br /&gt;
	&lt;br /&gt;
|-   &lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;text-align: left; vertical-align: top; background-color: rgb(255, 255, 255); color: seagreen; font-style:italic&amp;quot;  |&amp;lt;odb src=&amp;quot;odb path&amp;quot; edit=1 pwd=&amp;quot;CustomPwd&amp;quot;&amp;gt;&lt;br /&gt;
| Display an Editable ODB field (inline style). Optional password protection with &#039;&#039;&#039;pwd&#039;&#039;&#039; .&lt;br /&gt;
&lt;br /&gt;
|-   &lt;br /&gt;
| colspan=&amp;quot;1&amp;quot; rowspan=&amp;quot;1&amp;quot;  style=&amp;quot;text-align: left; vertical-align: top; background-color: rgb(255, 255, 255); color: seagreen; font-style:italic&amp;quot;  |&amp;lt;odb src=&amp;quot;odb path&amp;quot; edit=2 pwd=&amp;quot;CustomPwd&amp;quot;&amp;gt;&lt;br /&gt;
| Display an Editable ODB field (popup style). Optional password protection with &#039;&#039;&#039;pwd&#039;&#039;&#039; .&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: The Optional password protection with &#039;&#039;&#039;pwd&#039;&#039;&#039; (documented in the [http://ladd00.triumf.ca/~daqweb/doc/midas-old/html/RC_customize_ODB.html#RC_Access_Control| OldMidas Document]) may not be working.&lt;br /&gt;
: Use the  [[/Experiment ODB tree#Security subtree|Web Password security]] instead. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tags are included in the HTML code e.g.&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
 Experiment Name: &amp;lt;odb src=&amp;quot;/Experiment/Name&amp;quot;&amp;gt;&lt;br /&gt;
 Run Number: &amp;lt;odb src=&amp;quot;/runinfo/run number&amp;quot; edit=1&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
{{Html|text= Experiment Name: &amp;lt;odb src=&amp;quot;/Experiment/Name&amp;quot;&amp;gt; &amp;lt;br&amp;gt;  Run Number: &amp;lt;odb src=&amp;quot;/runinfo/run number&amp;quot; edit=1&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
See also [[Custom Page#How to write a Custom Page|HTML Custom Page example]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= ODB RPC access =&lt;br /&gt;
The [[Mhttpd.js|MIDAS Javascript Library]] function ODBRpc() defined for RPC access.&lt;br /&gt;
&lt;br /&gt;
This permits buttons on MIDAS &amp;quot;custom&amp;quot; web pages to invoke RPC calls directly into user frontend programs, for example to turn hardware modules on or off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= JSON support =&lt;br /&gt;
[[mjsonrpc#JSON general information|JSON]] support is provided with the [[Mhttpd.js|MIDAS Javascript Library]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=   Access to the MIDAS Menu buttons =&lt;br /&gt;
Access to the standard MIDAS Menu buttons can be provided with HTML {{HtmlTag|tag=&amp;lt;input...&amp;gt;}} tags of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&#039;&#039;&amp;lt;button-name&amp;gt;&#039;&#039; type=&amp;quot;submit&amp;quot; &amp;gt; --&amp;gt;&lt;br /&gt;
{{Html|text=&amp;lt;input name=&amp;quot;cmd&amp;quot; value=&#039;&#039;&amp;lt;button-name&amp;gt;&#039;&#039; type=&amp;quot;submit&amp;quot; &amp;gt;}}&lt;br /&gt;
Valid values are the standard MIDAS Menu buttons, i.e. (Start, Pause, Resume, Stop, ODB, Elog, Alarms, History, Programs etc). The {{HtmlTag|tag=&amp;lt;input...&amp;gt;}} tags must be declared within enclosing HTML {{HtmlTag|tag=&amp;lt;form...&amp;gt;....&amp;lt;/form&amp;gt;}} tags (see above).&lt;br /&gt;
&lt;br /&gt;
The following HTML fragment shows the inclusion of three of the standard buttons, giving access to the Main Status, ODB and Messages pages :&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 &amp;lt;form name=&amp;quot;form1&amp;quot; method=&amp;quot;Get&amp;quot; action=&amp;quot;/CS/MyExpt&amp;amp;&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;Status&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;ODB&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;Messages&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;/form&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
{{Html|text= &amp;lt;form name=&amp;quot;form1&amp;quot; method=&amp;quot;Get&amp;quot; action=&amp;quot;/CS/MyExpt&amp;amp;&amp;quot;&amp;gt; &amp;lt;br&amp;gt; &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;Status&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt; &amp;lt;br&amp;gt; &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;ODB&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt; &amp;lt;br&amp;gt; &amp;lt;input name=&amp;quot;cmd&amp;quot; value=&amp;quot;Messages&amp;quot; type=&amp;quot;submit&amp;quot;&amp;gt; &amp;lt;br&amp;gt; ...  &amp;lt;br&amp;gt; &amp;lt;/form&amp;gt; }}&lt;br /&gt;
&lt;br /&gt;
See also [[#Redirect]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Redirect =&lt;br /&gt;
&lt;br /&gt;
When buttons are included on a Custom Page, after pressing a button (e.g. the Start or Stop button) it may be desirable to return to the same custom page, rather than returning to the [[Status Page]].&lt;br /&gt;
&lt;br /&gt;
This can be done by including an HTML {{HtmlTag|tag=&amp;lt;input...&amp;gt;}} tag with the attributes &#039;&#039;type&#039;&#039; set to &amp;quot;hidden&amp;quot; and &#039;&#039;name&#039;&#039; set to &amp;quot;redir&amp;quot;. This name (&amp;quot;redir&amp;quot;) is detected by [[Mhttpd]], causing a redirect to the specified custom link in the &#039;&#039;value&#039;&#039; attribute.&lt;br /&gt;
&lt;br /&gt;
For example, the following redirects the screen back to the custom page link   {{Odbpath|path=/Custom/my_custom_page&amp;amp;}} when buttons are pressed:&lt;br /&gt;
{{Html|text=&amp;lt;input type=hidden name=&amp;quot;redir&amp;quot; value=&amp;quot;my_custom_page&amp;amp;&amp;quot;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
See also [[#Replace Status Page by a Custom page|Redirect when a Custom Page replaces the Status Page]].&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CustomScript Buttons =&lt;br /&gt;
&lt;br /&gt;
[[/Customscript ODB tree#Customscript-button|CustomScript buttons]] can be provided on [[Custom Page|Custom Pages]]. These buttons are equivalent to optional &#039;&#039;&#039;script buttons&#039;&#039;&#039; on the [[Status Page]], which call a script to perform a particular action when the button is pressed. See [[/Script ODB tree#Script-button|script buttons]] for details. Customscript buttons can be set up through the [[/Customscript ODB tree]].&lt;br /&gt;
&lt;br /&gt;
Any key &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/CustomScript/test&amp;lt;/span&amp;gt; will appear as a customscript-button &lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #444444; background-color: #CCCCCC; font-style:italic; font-size: 90; padding:0.25em;padding-left: 0.5em;padding-right: 0.5em;border:1px solid #808080;border-radius: 5px;margin-bottom:1px;&amp;quot;&amp;gt;test&amp;lt;/span&amp;gt; on a custom page whose code includes an HTML {{HtmlTag|tag=&amp;lt;input...&amp;gt;}} tag of the form:&lt;br /&gt;
{{Html|text=&amp;lt;input type=submit name=customscript value=&amp;quot;test&amp;quot;&amp;gt;}}&lt;br /&gt;
where the action of the button &amp;lt;span style=&amp;quot;color: #444444; background-color: #CCCCCC; font-style:italic; font-size: 90; padding:0.25em;padding-left: 0.5em;padding-right: 0.5em;border:1px solid #808080;border-radius: 5px;margin-bottom:1px;&amp;quot;&amp;gt;test&amp;lt;/span&amp;gt; will be found in the &amp;lt;span style=&amp;quot;color:purple; font-style:italic&amp;quot;&amp;gt;/customscript/test&amp;lt;/span&amp;gt; subdirectory.&lt;br /&gt;
&lt;br /&gt;
After pressing a customscript-button, the &#039;&#039;type=submit&#039;&#039; in the HTML {{HtmlTag|tag=&amp;lt;input&amp;gt;}} will cause a page reload. This will result in a switch to the [[Status Page]], unless a [[#redirect]] input tag is included to redirect back to the original custom page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Customscript button without a page reload ==&lt;br /&gt;
To define a customscript button that does &#039;&#039;&#039;not&#039;&#039;&#039; cause a page reload, set the &#039;&#039;type&#039;&#039; in the HTML {{HtmlTag|tag=&amp;lt;input&amp;gt;}} to &amp;quot;button&amp;quot;, i.e. &lt;br /&gt;
{{Html|text=&amp;lt;input name=&amp;quot;customscript&amp;quot; value=&amp;quot;test&amp;quot; type=&amp;quot;button&amp;quot; onClick=cs_button(this.value)&amp;gt;  &amp;lt;!-- Customscript button does not reload page; no callback --&amp;gt;}}&lt;br /&gt;
and use &#039;&#039;&amp;quot;onClick&amp;quot;&#039;&#039; to call a function to [[#Send an Ajax Request]] instead. The following function sends an asynchronous request, with an optional callback.&lt;br /&gt;
{{HtmlTag|tag=&amp;lt;script&amp;gt;}}&lt;br /&gt;
 &amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
function cs_button(cmd, callback)&amp;lt;br&amp;gt;&lt;br /&gt;
{  // send a request to execute a custom script&lt;br /&gt;
:   var url;&lt;br /&gt;
:   var request = XMLHttpRequestGeneric();&lt;br /&gt;
:&lt;br /&gt;
:   url = ODBUrlBase&lt;br /&gt;
:   if(document.getElementById(&amp;quot;redir&amp;quot;) != null)&lt;br /&gt;
::     url +=  &#039;?redir=&#039;+document.getElementById(&#039;redir&#039;).value&lt;br /&gt;
:   url+=&#039;&amp;amp;customscript=&#039;+ encodeURIComponent(cmd);&lt;br /&gt;
:   request.open(&#039;GET&#039;, url, true); // asynchronous request&lt;br /&gt;
:   request.send(null);&lt;br /&gt;
:  if(callback!=undefined) {&lt;br /&gt;
::      request.onreadystatechange = function() {&lt;br /&gt;
:::         if (request.readyState == 4) { &lt;br /&gt;
::::            if (request.status == 200)&lt;br /&gt;
:::::                callback();&lt;br /&gt;
::::            else&lt;br /&gt;
:::::                alert(&#039;cs_button: Error after sending request to Custom Script &amp;quot;&#039;+cmd+&#039;&amp;quot; :\nHTTP Status: &#039;+request.status)&lt;br /&gt;
:::            }&lt;br /&gt;
::         }&lt;br /&gt;
:  }&lt;br /&gt;
:  else { &lt;br /&gt;
::   if (request.status != 200)&lt;br /&gt;
:::       alert(&#039;cs_button: Error after sending request to Custom Script &amp;quot;&#039;+cmd+&#039;&amp;quot; :\nHTTP Status: &#039;+request.status)&lt;br /&gt;
:	   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{HtmlTag|tag=&amp;lt;/script&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Resource files =&lt;br /&gt;
It is often desirable to serve resource files (i.e. &#039;&#039;&#039;local files&#039;&#039;&#039; such as an external stylesheet, javascript files or images&#039;&#039;&#039;&amp;lt;sup&amp;gt;***&amp;lt;/sup&amp;gt;&#039;&#039;&#039;) to a custom page. The following sections describe two alternative ways of serving resource files to a custom page:&lt;br /&gt;
* [[#Resource files served WITH /custom/path key defined|with  /custom/path key defined]]&lt;br /&gt;
* [[#Resource files served WITHOUT /custom/path key defined|without  /custom/path key defined]]&lt;br /&gt;
See also serving resources to a [[#Replace Status Page by a Custom Status page|Custom Status page]].&lt;br /&gt;
;NOTE&lt;br /&gt;
:  &#039;&#039;&#039;&amp;lt;sup&amp;gt;***&amp;lt;/sup&amp;gt;&#039;&#039;&#039; To superimpose labels, bars or fills onto an image, the image cannot be served as a resource file. See [[#Image insertion]].&lt;br /&gt;
&lt;br /&gt;
== Resource files served WITH &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;/custom/path&amp;lt;/span&amp;gt; key defined ==&lt;br /&gt;
When a number of resource files are required, it is convenient to place them in the same directory on the disk, and create a key  {{Odbpath|path=/Custom/Path}} to contain this directory. &lt;br /&gt;
&lt;br /&gt;
 $ ls  /home/midas/online/custom/&lt;br /&gt;
   custom_functions.js       custom_globals.js     custom_page.html    custom_stylesheet.css      test_image.png&lt;br /&gt;
With the  {{Odbpath|path=/Custom/Path}} key defined, [[/Custom ODB tree#Custom-Link|custom-links]] for individual resource files need not be created in the  {{Odbpath|path=/Custom/Path}} tree. The custom-link  {{Odbpath|path=custom_page&amp;amp;}} &#039;&#039;&#039;is&#039;&#039;&#039; required so that the custom page can be accessed from the [[/Custom ODB tree#Custom-Button|custom-button]]  {{Button|name=custom_page}} on the Status Page. The key name ends in the special character &amp;quot;&amp;amp;&amp;quot; so that it will open in the same window as the Status page (see [[/Custom ODB tree#Key names|key names]]).&lt;br /&gt;
 $ odbedit&lt;br /&gt;
   [local:exp:S] ls /custom&lt;br /&gt;
   path                           /home/midas/online/custom/&lt;br /&gt;
   custom_page&amp;amp;                   custom_page.html&lt;br /&gt;
 &lt;br /&gt;
A {{HtmlTag|tag=&amp;lt;script&amp;gt;}} tag for each resource file to be served (specifying the file name) is then placed in the header of  {{File|name=custom_page.html}} &lt;br /&gt;
i.e.&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;custom_functions.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;}}&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;custom_globals.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;}}&lt;br /&gt;
&amp;lt;br&amp;gt; and a {{HtmlTag|tag=&amp;lt;link&amp;gt;}} tag for an external stylesheet&lt;br /&gt;
{{Html|text=&amp;lt;link type=&amp;quot;text/css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;custom_stylesheet.css&amp;quot; title=&amp;quot;Stylesheet&amp;quot;&amp;gt;}}&lt;br /&gt;
An image tag is placed in the body of  {{File|name=custom_page.html}} &lt;br /&gt;
{{Html|text=&amp;lt;img src=&amp;quot;test_image.png&amp;quot;&amp;gt; }}&lt;br /&gt;
[[mhttpd]] then loads the resource file from the directory indicated by the Path key with the correct MIME type (see  [[/Custom ODB tree#Keys in the /Custom tree|Custom tree keys]] for supported MIME types). &lt;br /&gt;
&lt;br /&gt;
== Resource files served WITHOUT &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;/custom/path&amp;lt;/span&amp;gt; key defined ==&lt;br /&gt;
Alternatively, resource files can be served to a [[Custom Page]] by creating a key for every resource file in the [[/Custom ODB tree]]. These keys must contain the full path of the file on the disk, and the key {{Odbpath|path=/Custom/Path}} must NOT be defined. The resource files can be in different directories on the disk. By defining the key names with an appropriate file extension, the resource files are served with the appropriate MIME types. The key names end in the special character &amp;quot;!&amp;quot; so that they will not appear on the Status page as custom-links (see [[/Custom ODB tree#Key names|key names]].&lt;br /&gt;
&lt;br /&gt;
Without the {{Odbpath|path=/Custom/Path}} key,  the links for the above example in the {{Odbpath|path=/Custom}} tree might look like&lt;br /&gt;
 $ odbedit&lt;br /&gt;
   [local:exp:S] ls /custom&lt;br /&gt;
   custom_page&amp;amp;                   /home/midas/online/custom/custom_page.html&lt;br /&gt;
   custom_functions.js!           /home/midas/online/resources/custom_functions.js&lt;br /&gt;
   globals.js!                    /home/midas/online/resources/custom_functions.js&lt;br /&gt;
   stylesheet.css!                /home/midas/online/stylesheets/custom_stylesheet.css&lt;br /&gt;
   image.png!                     /home/midas/images/test_image.png  &lt;br /&gt;
&lt;br /&gt;
assuming the resource files are now in the subdirectories indicated.&lt;br /&gt;
The {{HtmlTag|tag=&amp;lt;script&amp;gt;}} tag for each resource file to be served (specifying the custom-link) is then placed in the header of  {{File|name=custom_page.html}} &lt;br /&gt;
i.e.&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;custom_functions.js!&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;}}&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;globals.js!&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;}}&lt;br /&gt;
&amp;lt;br&amp;gt; and a {{HtmlTag|tag=&amp;lt;link&amp;gt;}} tag for an external stylesheet&lt;br /&gt;
{{Html|text=&amp;lt;link type=&amp;quot;text/css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;stylesheet.css!&amp;quot; title=&amp;quot;Stylesheet&amp;quot;&amp;gt;}}&lt;br /&gt;
An image tag is placed in the body of  {{File|name=custom_page.html}} &lt;br /&gt;
{{Html|text=&amp;lt;img src=&amp;quot;image.png!&amp;quot;&amp;gt; }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= MIDAS stylesheet =&lt;br /&gt;
&lt;br /&gt;
The MIDAS package provides a condensed stylesheet &lt;br /&gt;
: {{Filepath|path=/home/midas/packages/midas/resources/}}{{File|name=mhttpd.css}} &lt;br /&gt;
for users who would like their custom pages to have a similar &amp;quot;look and feel&amp;quot; to that of the standard pages.&lt;br /&gt;
&lt;br /&gt;
To include the MIDAS stylesheet, in the HTML header, add &lt;br /&gt;
{{HtmlTag|tag=&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;mhttpd.css&amp;quot;&amp;gt;}}&lt;br /&gt;
No &#039;&#039;custom link&#039;&#039; needs to be defined.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting Demo custom page is shown in Figure 1, which can be compared with Figure 2 (no stylesheet). &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Figure 1  !! Figure 2&lt;br /&gt;
|-&lt;br /&gt;
| Demo Custom Page using MIDAS stylesheet || Demo Custom Page&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| [[File:Mhxcustom03.jpg|thumb|300px]] || [[File:Mhxcustom02.jpg|thumb|200px]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=  Alias-Buttons and Hyperlinks =&lt;br /&gt;
Any hyperlink can easily be included on a [[Custom Page]] by using the standard HTML anchor {{HtmlTag|tag=&amp;lt;a...&amp;gt;}} tag, e.g.&lt;br /&gt;
{{Html|text=&amp;lt;a href=&amp;quot;http://ladd00.triumf.ca/~daqweb/doc/midas/html/&amp;quot;&amp;gt;Midas Help&amp;lt;/a&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Links on a custom page equivalent to [[/Alias ODB tree#Alias-Buttons|alias-buttons]] can also be made e.g.&lt;br /&gt;
{{Html|text=&amp;lt;button type=&amp;quot;button&amp;quot; onclick=&amp;quot;document.location.href=&#039;/Alias/alias&amp;amp;&#039;;&amp;quot;&amp;gt;alias&amp;lt;/button&amp;gt;}}&lt;br /&gt;
See the [[/Alias ODB tree]] for details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=    Page refresh =&lt;br /&gt;
The following {{HtmlTag|tag=&amp;lt;meta...&amp;gt;}} tag included in the HTML header code will cause the whole custom page to refresh in 60 seconds :&lt;br /&gt;
{{Html|text=&amp;lt;meta http-equiv=&amp;quot;Refresh&amp;quot; content=&amp;quot;60&amp;quot;&amp;gt;}}&lt;br /&gt;
It is also possible to [[#Periodic update of parts of a custom page|periodically update parts]] of a custom page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Periodic update of parts of a custom page =&lt;br /&gt;
&lt;br /&gt;
The functionality of [[Mhttpd.js|ODBGet]] together with the window.setInterval() function&lt;br /&gt;
can be used to update parts of the web page periodically.&lt;br /&gt;
For example the Javascript fragment below contains a function which updates the current run number every 10 seconds in the background:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt; &amp;lt;!-- JS --&amp;gt;&lt;br /&gt;
window.setInterval(&amp;quot;Refresh()&amp;quot;, 10000);&amp;lt;br&amp;gt;&lt;br /&gt;
function Refresh() {&amp;lt;br&amp;gt;&lt;br /&gt;
:document.getElementById(&amp;quot;run_number&amp;quot;).innerHTML = ODBGet(&#039;/Runinfo/Run number&#039;);&amp;lt;br&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The custom page has to &lt;br /&gt;
* [[Mhttpd.js#include js lib|include the MIDAS JS library]] to access ODBGet&lt;br /&gt;
* contain an element with id=&amp;quot;run_number&amp;quot;, such as&lt;br /&gt;
{{Html|text=&amp;lt;td id=&amp;quot;run_number&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Display last MIDAS message(s) =&lt;br /&gt;
&lt;br /&gt;
The message log (see [[Message System]]) can be accessed from a custom page using a call to the JavaScript library function [[Mhttpd.js|ODBGetMsg]] (provided the [[Mhttpd.js#include js lib|JS library is included]]).&lt;br /&gt;
&lt;br /&gt;
This allows the inclusion of the &amp;quot;Last Midas message&amp;quot; on a custom page, e.g.&lt;br /&gt;
{{JS|text=document.write(&#039;Last message:&#039;+ODBGetMsg(&amp;quot;midas&amp;quot;,0,1))}}&lt;br /&gt;
More messages may be displayed by increasing the third parameter to ODBGetMsg.&lt;br /&gt;
;Note&lt;br /&gt;
: Parameters were changed August 2015. See [[Mhttpd.js|ODBGetMsg]] for older versions.&lt;br /&gt;
: Coming soon - a [[mjsonrpc]] function&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Generate a message log entry =&lt;br /&gt;
&lt;br /&gt;
A custom page can generate a message to be sent to the MIDAS message log (see [[Message System]]).  A call to mjsonrpc_cm_msg() will generate a message if using the [[mjsonrpc]] functions. Otherwise, use the AJAX function [[Mhttpd.js|ODBGenerateMsg]]. To use these functions, the  [[Mhttpd.js#include js lib|JS library must be included]] in the html code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=   Checkboxes =&lt;br /&gt;
The function [[Mhttpd.js|ODBSet]] (provided the [[Mhttpd.js#include js lib|JS library is included]]) can be used when one clicks on a checkbox for example:&lt;br /&gt;
{{Html|text=&amp;lt;input  name=&amp;quot;box0&amp;quot;  type=&amp;quot;checkbox&amp;quot;  onClick=&amp;quot;ODBSet(my_path, this.checked?&#039;1&#039;:&#039;0&#039;)&amp;quot;&amp;gt;}}&lt;br /&gt;
If used as above, the state of the checkbox must be initialized when the page is loaded. This can be done with some JavaScript code called on initialization, e.g.&lt;br /&gt;
{{JS|text=document.form1.box0.checked= ODBGet(my_path));  // initialize to the correct value}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Replace Status Page by a Custom page =&lt;br /&gt;
&lt;br /&gt;
Click to enlarge thumbnail&lt;br /&gt;
[[File:Mhcustom_status.jpg|thumbnail|left|Figure 3: ODB /Custom/Status custom-link to a custom status page]]&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a custom-link with the [[/Custom ODB tree#Key names|reserved key name]] &#039;&#039;&#039;Status&#039;&#039;&#039;  (not &amp;quot;Status&amp;amp;&amp;quot; or &amp;quot;Status!&amp;quot;) is created in the [[/Custom ODB tree]] (as shown in  Figure 3), then that custom page will &#039;&#039;&#039;replace the default Status Page&#039;&#039;&#039;. &lt;br /&gt;
  &lt;br /&gt;
Clicking on the {{Button|name=Status}} button on any of the sub-pages (e.g. [[ODB Page]], [[Programs Page]] etc.) will now return to the Custom Status Page. If there are buttons on the Custom Status page, you &#039;&#039;&#039;must&#039;&#039;&#039; include a  [[#Redirect]] statement of the form&lt;br /&gt;
{{Html|text=&amp;lt;input type=hidden name=&amp;quot;redir&amp;quot; value=&amp;quot;../&amp;quot;&amp;gt;}}&lt;br /&gt;
or you will see the message &lt;br /&gt;
 Invalid custom page:NULL path&lt;br /&gt;
&lt;br /&gt;
If the Custom Status page includes [[#Resource files]] served on a regular custom page with a statement such as&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;cs_functions!&amp;quot;&amp;gt;}}&lt;br /&gt;
to serve them in a Custom Status page, the statement would be&lt;br /&gt;
{{Html|text=&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;&amp;lt;span style=&amp;quot;font-weight:bold&amp;quot;&amp;gt;/CS/&amp;lt;/span&amp;gt;cs_functions!&amp;quot;&amp;gt;}}&lt;br /&gt;
In fact, this statement can be used in a regular custom page, as the &amp;quot;/CS/&amp;quot; is ignored in that case.&lt;br /&gt;
&lt;br /&gt;
To return to the default Status Page, delete the &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;/Custom/Status&amp;lt;/span&amp;gt; key. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Start, Stop and Check if a program is running =&lt;br /&gt;
There are [[mjsonrpc]] functions that implemented all three program management functions - start program, &lt;br /&gt;
stop program and &amp;quot;is running?&amp;quot; as JSON-RPC methods.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Send an Ajax request =&lt;br /&gt;
By sending an Ajax request from a custom page, you can make a button perform a specific function. &lt;br /&gt;
  &lt;br /&gt;
All functions in midas are controlled through special URLs. So the URL&lt;br /&gt;
 http://&amp;lt;host:port&amp;gt;/?cmd=Start&amp;amp;value=10&lt;br /&gt;
will start run #10.&lt;br /&gt;
&lt;br /&gt;
Although it is easier to use an HTML input statement to [[#Access to the MIDAS Menu buttons]], &lt;br /&gt;
to send an Ajax request, you can use the function &#039;&#039;XMLHttpRequestGeneric&#039;&#039; which is in the MIDAS Javascript library [[mhttpd.js]].&lt;br /&gt;
Then the HTML code would be&lt;br /&gt;
&lt;br /&gt;
{{Html|text=&amp;lt;input type=&amp;quot;button&amp;quot; onclick=&amp;quot;start()&amp;quot;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
and in your JavaScript code add a function &#039;&#039;start()&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
function start()&lt;br /&gt;
{&lt;br /&gt;
:   var request = XMLHttpRequestGeneric();&lt;br /&gt;
&lt;br /&gt;
:   url = &#039;?cmd=Start&amp;amp;value=10&#039;;&lt;br /&gt;
:   request.open(&#039;GET&#039;, url, true);  // asynchronous request&lt;br /&gt;
:   request.send(null);&lt;br /&gt;
} &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
See also [[#Access to the MIDAS Menu buttons]]. Another example with optional callback can be found in [[#Customscript button without a page reload]].&lt;br /&gt;
&lt;br /&gt;
This mechanism can be used for starting a particular program, see for example (see [https://midas.triumf.ca/elog/Midas/1046]). However, this functionality is now provided by [[mjsonrpc]] functions - see [[#Start, Stop and Check if a program is running]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=    Image insertion  =&lt;br /&gt;
An image can be loaded from the web using an HTML {{HtmlTag|tag=&amp;lt;img...&amp;gt;}}, e.g.  &lt;br /&gt;
   {{Html|text=&amp;quot;TRIUMF logo&amp;quot; &amp;lt;img src=&amp;quot;https://lixenon.triumf.ca/InternalDocuments/Alice/figures/TRIUMF-logo.jpg/image_preview&amp;quot;&amp;gt;}}&lt;br /&gt;
or a MIDAS History image can be inserted into a custom page using an HTML {{HtmlTag|tag=&amp;lt;img...&amp;gt;}} tag of the following form:&lt;br /&gt;
 {{Html|text=blah&amp;lt;img src=&amp;quot;http://hostname.domain:port/HS/Meterdis.gif&amp;amp;scale=12h&amp;amp;width=300&amp;quot;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
If the image file is on the local disk, it can be loaded as a &#039;&#039;&#039;resource file&#039;&#039;&#039;. The image can be of format .pdf, .jpg, .gif, .png. See loading [[#Resource files]].&lt;br /&gt;
&lt;br /&gt;
If you wish to superimpose features such as &#039;&#039;&#039;labels and fills&#039;&#039;&#039;, the image file cannot be served as a [[#Resource files|resource file]]. Instead, the image file must be in &#039;&#039;&#039;gif&#039;&#039;&#039; format, and must be included in the {{Odbpath|path=/Custom/images}} subtree (Figure 4). Image insertion into a Custom page will be illustrated using the Demo custom page shown in [[#MIDAS stylesheet|Figure 2]]. All the files required for this demo can be found in the MIDAS package at $MIDASSYS/examples/custom. If you do not wish to create&lt;br /&gt;
the keys yourself, proceed to [[#Superimposing Labels, Bars and Fills onto a gif image]]. &lt;br /&gt;
&lt;br /&gt;
Make a [[/Custom ODB tree#Custom-Link|custom-link]] to the Demo custom page file &#039;&#039;myexpt.html&#039;&#039; , i.e.&lt;br /&gt;
 [local:js:S]/&amp;gt;ls /custom&lt;br /&gt;
    myexpt&amp;amp;                  /home/test/packages/midas/examples/custom/myexpt.html&lt;br /&gt;
 &lt;br /&gt;
To make the image &#039;&#039;myexpt.gif&#039;&#039; visible on the custom page, the path and filename of the image file must be defined in the   {{Odbpath|path=/Custom/images}} subtree. To do this, &lt;br /&gt;
create the  subtrees {{Odbpath|path=/Custom/images/myexpt.gif}} where the subtree name &amp;quot;myexpt.gif&amp;quot; is named for the image file you are going to use. Multiple images can be used, by creating multiple imagefile subtrees.&lt;br /&gt;
&lt;br /&gt;
In the imagefile subtree {{Odbpath|path=myexpt.gif}}, create the STRING key  {{Odbpath|path=Background}}, and set it to contain the path and name of the image file.  The tree structure should then look similar to Figure 4, minus the labels/bars/fill subtrees which will be added to the ODB later.&lt;br /&gt;
&lt;br /&gt;
The image must also be referenced in the custom HTML file &#039;&#039;myexpt.html&#039;&#039; in the &amp;quot;src&amp;quot; field of an HTML {{HtmlTag|tag=&amp;lt;img...&amp;gt;}} tag, e.g. &lt;br /&gt;
{{Html|text=&amp;lt;img &#039;&#039;&#039;src=&amp;quot;myexpt.gif&amp;quot;&#039;&#039;&#039;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Click to enlarge thumbnail&lt;br /&gt;
[[File:Mhcustom_images.jpg|thumbnail|left|Figure 4: /Custom/Images ODB Tree]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
Once the image is visible, enable [[#HTML mapping]], optionally [[#Display mouse position]] and proceed to  [[#Superimposing Labels, Bars and Fills onto a gif image]]. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== HTML mapping ==&lt;br /&gt;
Note that if additional features such as active clickable areas and labels, bars and fills superimposed on the image are also required, HTML mapping must also be activated with the HTML {{HtmlTag|tag=&amp;lt;map...&amp;gt;}} tag and the &amp;quot;usemap&amp;quot; attribute of the HTML {{HtmlTag|tag=&amp;lt;img&amp;gt;}} tag&lt;br /&gt;
{{Html|text=   &amp;lt;map &#039;&#039;&#039;name=&amp;quot;myexpt.map&amp;quot;&#039;&#039;&#039;&amp;gt; &amp;lt;br&amp;gt; &amp;lt;img src=&amp;quot;myexpt.gif&amp;quot; &#039;&#039;&#039;usemap=&amp;quot;#myexpt.map&amp;quot;&#039;&#039;&#039;&amp;gt; &amp;lt;br&amp;gt;...&amp;lt;br&amp;gt; &amp;lt;/map&amp;gt;&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Display mouse position ==&lt;br /&gt;
[[File:Cursor.png|thumbnail|left|Figure 5: MEG Gas System Custom Page showing cursor position]]&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When writing custom pages with large background images and labels and fills placed on that image, it is hard to figure out X and Y coordinates of the labels. This can now be simplified by using the function &#039;&#039;getMouseXY()&#039;&#039; in the development JavaScript built-in library [[develop.js]]. This function supplies the X,Y position of the cursor if an element of ID &amp;quot;&#039;&#039;&#039;refimg&#039;&#039;&#039;&amp;quot; is present. This JS library &#039;&#039;&#039;must be [[develop.js|included in the custom page]]&#039;&#039;&#039; in order to use it:&lt;br /&gt;
&lt;br /&gt;
Then, set the &amp;quot;id&amp;quot; attribute of the background HTML {{HtmlTag|tag=&amp;lt;img...&amp;gt;}} tag to &amp;quot;refimg&amp;quot;, e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
: &amp;lt;img  &#039;&#039;&#039;id=&amp;quot;refimg&amp;quot;&#039;&#039;&#039; src=&amp;quot;ebit_pc.gif&amp;quot; usemap=&amp;quot;#Custom1&amp;quot;&amp;gt;   &amp;lt;!-- name=&amp;quot;refimg&amp;quot; makes crosshairs appear --&amp;gt;&lt;br /&gt;
: &amp;lt;map name=&amp;quot;Custom1&amp;quot;&amp;gt;&lt;br /&gt;
: .....&lt;br /&gt;
: &amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;&#039;&#039;&#039;refimg&#039;&#039;&#039;&amp;quot; tag is present, the cursor changes into a crosshair, and its absolute and relative locations in respect to the reference image are shown in the status bar (Figure 5).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
==  Superimposing Labels, Bars and Fills onto a gif image ==&lt;br /&gt;
You can enhance your custom page by superimposing multiple features based on ODB variables onto an image (e.g. [[#Display mouse position|Figure 5]]), such as&lt;br /&gt;
&lt;br /&gt;
*    labels: &amp;quot;live&amp;quot; ODB values positioned in a particular location of the page&lt;br /&gt;
*    bars : &amp;quot;bar level&amp;quot; showing graphically ODB values such as levels or rate etc.&lt;br /&gt;
*    fills : &amp;quot;color level&amp;quot; where colour is used as the level indicator.&lt;br /&gt;
&lt;br /&gt;
Each entry (label/bar/fill) will have an ODB tree associated to it defining the ODB variable path, X/Y position, colour, etc. Each time the page is updated, the latest ODB value/level/rate will be shown based on the ODB parameter to which the label, bar or fill is linked - hence the term &amp;quot;live&amp;quot;. The overlay of the requested features is done onto the selected image file.&lt;br /&gt;
&lt;br /&gt;
This powerful new extension brings the [[mhttpd]] capability closer to other experimental web controllers similar to EPICS.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:    Be sure to enable the feature to [[#Display mouse position]] in order to facilitate finding the X,Y positions of the various features.&lt;br /&gt;
: [[#HTML mapping]] must be activated for labels/bars/fills to work&lt;br /&gt;
&lt;br /&gt;
A Demo custom page showing labels, bars and fills superimposed on an image is shown in [[#MIDAS stylesheet|Figure 2]]. &lt;br /&gt;
All the files for this demo can be found in $MIDASSYS/examples/custom/. The file xcustom.odb contains the ODB keys required, including those to insert the image and superimpose the various labels, fills etc. This file can be loaded into the ODB with the  {{Odbedit cmd|cmd=load}}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=== Adding Labels ===&lt;br /&gt;
&lt;br /&gt;
 [[File:Mhcustom_label.jpg|thumbnail|left|Figure 6: /Custom/Images/Labels ODB subtree]]&lt;br /&gt;
&lt;br /&gt;
In order to include a readout of ODB values (i.e. labels), on the image, a further ODB subdirectory  {{Odbpath|path=/Custom/images/&amp;lt;imagefile.gif/Labels}} must be created. Creating a subdirectory for a particular label i.e. {{Odbpath|path=&amp;lt;label name&amp;gt;}} in the   {{Odbpath|path=Labels}} subtree will, at the next custom web page refresh, cause the complete structure for that label to be created and filled with default values. Once the {{Odbpath|path=&amp;lt;label name&amp;gt;}} subtree is created, the user fills the various keys as desired. See [[/Custom ODB tree#Labels subtree]] for details of the various fields. This procedure is repeated for all the labels required, using a unique {{Odbpath|path=&amp;lt;label name&amp;gt;}} subdirectory for each label. An example of a {{Odbpath|path=&amp;lt;label name&amp;gt;}} subtree is shown in Figure 6. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=== Adding Bars ===&lt;br /&gt;
 &lt;br /&gt;
[[File:Mhcustom_fill.jpg|thumbnail|left|Figure 7: /Custom/Images/Fills ODB subtree]]&lt;br /&gt;
&lt;br /&gt;
In a similar way, Bars can be superimposed on the image. Create  a new ODB subdirectory  {{Odbpath|path=/Custom/images/&amp;lt;imagefile.gif/Bars}}. Create a subdirectory for a particular Bar ({{Odbpath|path=&amp;lt;bar name&amp;gt;}}) in the {{Odbpath|path=Bars}}  subdirectory. Refresh the web page and fill the various keys as desired.  See [[/Custom ODB tree#Bars subtree]] for details of the various fields.  Examples of a &amp;lt;bar-name&amp;gt; subtree is shown in Figure 7.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
=== Adding Fills ===&lt;br /&gt;
[[File:Mhcustom_bar.jpg|thumbnail|left|Figure 8: /Custom/Images/Bars ODB subtree]]&lt;br /&gt;
&lt;br /&gt;
In a similar way, Fills can be superimposed on the image. Create new ODB subdirectory   {{Odbpath|path=/Custom/images/&amp;lt;imagefile.gif/Fills}}. Create a subdirectory for a particular  Fill ({{Odbpath|path=&amp;lt;fill name&amp;gt;}}) in the {{Odbpath|path=Fills}} subdirectory. Refresh the web page and fill the various keys as desired.  See  [[/Custom ODB tree#Fills subtree]] for details of the various fields.  Examples of a ({{Odbpath|path=&amp;lt;fill name&amp;gt;}}  subtree is shown in Figure 8. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- clear wraparound after thumbnail --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Mapping active areas onto the image ==&lt;br /&gt;
Provided [[#HTML mapping]] is activated, &amp;quot;clickable&amp;quot; areas can be created on the image.&lt;br /&gt;
&lt;br /&gt;
This can be done now with a new function like this:&lt;br /&gt;
{{Html|text= &amp;lt;area shape=&amp;quot;rect&amp;quot; coords=&amp;quot;40,200,100,300&amp;quot; alt=&amp;quot;Main Valve&amp;quot; href=&amp;quot;Custom1?cmd=Toggle&amp;amp;odb=/Equipment/Environment/Variables/Output[2]&amp;quot;&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
This defines a clickable map on top of the custom image. The area(s) should match with some area(s) on the image, e.g. the box of a valve. Determining the co-ordinates of this area is simplified by using the Display mouse position feature.&lt;br /&gt;
&lt;br /&gt;
By clicking on this area, the supplied path to the ODB is used (in this case  {{Odbpath|path=/Equipment/Environment/Variables/Output[2]}}) and its value is toggled. If the valve value is then used in the image via a [[#Adding Fills|Fill]] statement to change the color of the valve, it can turn green or red depending on its state. This is illustrated in [[#Display mouse position|Figure 5]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking an active area can also be made to open a new custom page, for example:&lt;br /&gt;
{{Html|text=&amp;lt;area shape=rect coords=&amp;quot;687,530, 890,648&amp;quot; alt=&amp;quot;Pump detail&amp;quot; href = &amp;quot;Pump!&amp;quot; title=&amp;quot;Click for Details&amp;quot;&amp;gt;}}&lt;br /&gt;
{{Html|text=&amp;lt;area shape=rect coords=&amp;quot;560,574,775,662&amp;quot; alt=&amp;quot;Buffer Tank detail&amp;quot; href = &amp;quot;BufferTank!&amp;quot; title=&amp;quot;Click for Details&amp;quot;&amp;gt;}}&lt;br /&gt;
where &#039;&#039;Pump!&#039;&#039; and &#039;&#039;BufferTank!&#039;&#039; are defined as links to custom pages in the [[/Custom ODB tree]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Edit boxes floating on top of a graphic ==&lt;br /&gt;
&lt;br /&gt;
An edit box can be placed on top of a graphic in a particular position by means of an HTML  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&amp;amp;lt;div&amp;amp;gt;&amp;lt;/span&amp;gt; tag. Using the ODBEdit function from the Midas JS library [[Mhttpd.js]], the custom page code would look like this:&lt;br /&gt;
&amp;lt;!-- Complicated... have to use &amp;lt;pre&amp;gt; because of &amp;lt;div&amp;gt;, then a table to keep the background colour between &amp;lt;pre&amp;gt;s --&amp;gt;&lt;br /&gt;
{|  style=&amp;quot;text-align: left; width: 100%; background-color: floralwhite;&amp;quot; border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;pre style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;position:absolute; top:100px; left:50px;&amp;quot;&amp;gt;    &lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic;&amp;quot;&amp;gt;&lt;br /&gt;
document.write(&#039;Run number: &#039;)&lt;br /&gt;
path=&#039;/runinfo/run number&#039;&lt;br /&gt;
rn = ODBGet(path)&lt;br /&gt;
document.write(&#039;&amp;lt;a href=&amp;quot;#&amp;quot; onclick=&amp;quot;ODBEdit(path)&amp;quot; &amp;gt;&#039;)  &lt;br /&gt;
document.write(rn)&lt;br /&gt;
document.write(&#039;&amp;lt;/a&amp;gt;&#039;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;custom.gif&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The same thing could be done with the HTML-style {{HtmlTag|tag=&amp;lt;odb&amp;gt;}} tag :&lt;br /&gt;
&amp;lt;pre style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;position:absolute; top:100px; left:50px;&amp;quot;&amp;gt;&lt;br /&gt;
Run number:  &amp;lt;odb src=&amp;quot;/Runinfo/run number&amp;quot; edit=1&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;custom.gif&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
= Examples =&lt;br /&gt;
For more examples of accessing the ODB with the Javascript library [[mhttpd.js]] look at the example experiment in the MIDAS package $MIDASSYS/examples/javascript1/example.html.&lt;br /&gt;
&lt;br /&gt;
== Example 1 : Asynchronous calls using mjsonrpc functions ==&lt;br /&gt;
See [[mjsonrpc#examples]]&lt;br /&gt;
&lt;br /&gt;
== Example 2 : Asynchronous calls using Javascript and AJAX ==&lt;br /&gt;
&lt;br /&gt;
Example 2 shows html code illustrating the use of ODBMCopy(), where innerHTML is used to display the data. On a page with images or a lot of data, innerHTML allows you to update variables without having to reload the whole page. In the example, a timer causes the page to update every 10s (reread the data). Often the ODB data for the whole page can be read by one asynchronous ODBMCopy() call, rather than scattering synchronous ODBGet() calls throughout the page.  &lt;br /&gt;
&lt;br /&gt;
Access to the ODB is provided by the  [[Mhttpd.js|MIDAS Javascript Library]], included with the line &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&amp;amp;lt;script src=&#039;mhttpd.js&#039;&amp;amp;gt;&amp;amp;lt;/script&amp;amp;gt;&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;MyTitle&amp;lt;/title&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;script src=&#039;mhttpd.js&#039;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
var updatePeriod = 10000; // in msec &amp;lt;br&amp;gt;&lt;br /&gt;
var updateTimerId = 0; &amp;lt;br&amp;gt;&lt;br /&gt;
var counter=0; &amp;lt;br&amp;gt;&lt;br /&gt;
function update()  {  &amp;lt;br&amp;gt;&lt;br /&gt;
:clearTimeout(updateTimerId); &amp;lt;br&amp;gt;&lt;br /&gt;
:      load(); &lt;br /&gt;
:      if (updatePeriod &amp;gt; 0) &lt;br /&gt;
:      updateTimerId = setTimeout(&#039;update()&#039;, updatePeriod); &lt;br /&gt;
} &amp;lt;br&amp;gt;&lt;br /&gt;
function load()  { &amp;lt;br&amp;gt;&lt;br /&gt;
: document.getElementById(&#039;LastUpdated&#039;).innerHTML = &amp;quot;Updating...&amp;quot; + new Date; &lt;br /&gt;
: var paths = [ &amp;quot;/Runinfo&amp;quot;, &amp;quot;/Experiment&amp;quot;]; &lt;br /&gt;
: var data_odb=ODBMCopy(paths, mcopy_callback, &amp;quot;json&amp;quot;) &lt;br /&gt;
: counter++; &lt;br /&gt;
: document.getElementById(&#039;counter&#039;).innerHTML = &#039;Counter: &#039;+ counter &lt;br /&gt;
} &amp;lt;br&amp;gt;&lt;br /&gt;
function mcopy_callback(data)  {  &amp;lt;br&amp;gt;&lt;br /&gt;
:    var obj= JSON.parse(data);&lt;br /&gt;
: var runinfo=obj[0];&lt;br /&gt;
: document.getElementById(&#039;rn&#039;).innerHTML = &#039;Run Number =&#039;+ parseInt(runinfo[&amp;quot;Run number&amp;quot;]);&lt;br /&gt;
: document.getElementById(&#039;state&#039;).innerHTML  =&#039;Run State= &#039;+ runinfo.State;&lt;br /&gt;
: var experiment=obj[1];&lt;br /&gt;
: document.getElementById(&#039;name&#039;).innerHTML=&#039;Experiment name = &#039;+ experiment.Name &amp;lt;br&amp;gt; &lt;br /&gt;
}&amp;lt;br&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/script&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;/head&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;body&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;b&amp;amp;gt;Javascript code using ODBMCopy with callback&amp;amp;lt;/b&amp;amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
The data on the page is updated every 10 sec using a timer&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;LastUpdated&amp;quot; &amp;amp;gt; Last updated: never&amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;rn&amp;quot;&amp;amp;gt; Run Number : unknown  &amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;state&amp;quot;&amp;amp;gt; State : unknown&amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;name&amp;quot;&amp;amp;gt; Experiment name : unknown  &amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;amp;lt;p id=&amp;quot;counter&amp;quot;&amp;amp;gt;Counter: zero  &amp;amp;lt;/p&amp;amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt; &amp;lt;/div&amp;gt;  &lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:steelblue; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
: if (updatePeriod &amp;gt; 0)&lt;br /&gt;
:  update(); &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:floralwhite; color:seagreen; font-style:italic&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/script&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;/body&amp;gt; &amp;lt;/html&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Example 3 : Synchronous Calls using Javascript and AJAX ==&lt;br /&gt;
In the following example, JS functions ODBGet and  ODBEdit from the [[Mhttpd.js|MIDAS Javascript Library]] are used to access the ODB.  &lt;br /&gt;
;NOTE&lt;br /&gt;
# Synchronous calls are now deprecated (see [[#The MIDAS Javascript Library|above]]).&lt;br /&gt;
# The Javascript library &#039;&#039;&#039;must be [[mhttpd.js#include js lib|included in the HTML code]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
{{Html|text=&amp;lt;script&amp;gt;}}&lt;br /&gt;
{{JS|text=document.write (&#039;Experiment Name: &#039;+ ODBGet(&amp;quot;/Experiment/Name&amp;quot;)) &amp;lt;br&amp;gt; var alarm_path=&amp;quot;/alarms/Alarm system active&amp;quot;; &amp;lt;br&amp;gt; var alarm_active=ODBGet(alarm_path); &amp;lt;br&amp;gt; document.write(&#039;&amp;lt;a href=&amp;quot;#&amp;quot; onclick=&amp;quot;ODBEdit(alarm_path)&amp;quot; &amp;gt;&#039;+alarm_active+&#039;&amp;lt;/a&amp;gt;&#039;)}}&lt;br /&gt;
{{Html|text=&amp;lt;/script&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Custom]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=/Experiment_ODB_tree&amp;diff=2546</id>
		<title>/Experiment ODB tree</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=/Experiment_ODB_tree&amp;diff=2546"/>
		<updated>2016-08-26T01:33:27Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[odbedit]]&lt;br /&gt;
* &lt;br /&gt;
*&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Creating the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt;  tree ==&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; ODB tree is created automatically when the &#039;&#039;&#039;[[odbedit #Creating the ODB|ODB is first created]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
The &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; ODB tree contains information relevent to the experiment. Other optional keys are added by &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039; or by &lt;br /&gt;
the user to customize their experiment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
When initially created, the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; tree contains the following keys:&lt;br /&gt;
 [local:midas:S]/&amp;gt;ls -lrt /experiment&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
 Experiment                      DIR&lt;br /&gt;
    Name                         STRING  1     32    14s  0   RWD  midas&lt;br /&gt;
    Buffer sizes                 DIR&lt;br /&gt;
        SYSMSG                   DWORD   1     4     11h  0   RWD  100000&lt;br /&gt;
    Security                     DIR&lt;br /&gt;
        Enable non-localhost RPC BOOL    1     4     46s  0   RWD  n&lt;br /&gt;
        RPC ports                DIR&lt;br /&gt;
           ODBEdit               DWORD   1     4     38m  0   RWD  0&lt;br /&gt;
        RPC hosts                DIR&lt;br /&gt;
           Allowed hosts         STRING  10    256   38m  3   RWD&lt;br /&gt;
                                         [0]             localhost&lt;br /&gt;
                                         [1]&lt;br /&gt;
                                         [2]&lt;br /&gt;
                                         [3]&lt;br /&gt;
                                         [4]&lt;br /&gt;
                                         [5]&lt;br /&gt;
                                         [6]&lt;br /&gt;
                                         [7]&lt;br /&gt;
                                         [8]&lt;br /&gt;
                                         [9]&lt;br /&gt;
        Disable RPC hosts check  BOOL    1     4     46s  0   RWD  n&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following example shows the &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; tree for a typical experiment: &lt;br /&gt;
&lt;br /&gt;
 [local:midas:R]/&amp;gt;ls -lrt /experiment&lt;br /&gt;
 Key name                        Type    #Val  Size  Last Opn Mode Value&lt;br /&gt;
 ---------------------------------------------------------------------------&lt;br /&gt;
 Experiment                      DIR&lt;br /&gt;
    Name                         STRING  1     32    7s   0   RWD  midas&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Buffer sizes&amp;lt;/span&amp;gt;                 DIR&lt;br /&gt;
        SYSMSG                   DWORD   1     4     23h  0   RWD  100000&lt;br /&gt;
        SYSTEM                   DWORD   1     4     23h  0   RWD  640000000&lt;br /&gt;
        BUF0                     DWORD   1     4     23h  0   RWD  80000000&lt;br /&gt;
        BUF1                     DWORD   1     4     23h  0   RWD  80000000&lt;br /&gt;
        .......    &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;&#039;&#039;other user-defined buffers not shown &#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Security&amp;lt;/span&amp;gt;                     DIR&lt;br /&gt;
        Enable non-localhost RPC BOOL    1     4     38m  0   RWD  n&lt;br /&gt;
        &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;RPC ports&amp;lt;/span&amp;gt;                DIR&lt;br /&gt;
            ODBEdit              DWORD   1     4     38m  0   RWD  0&lt;br /&gt;
            Logger               DWORD   1     4     35m  0   RWD  0&lt;br /&gt;
            mhttpd               DWORD   1     4     23m  0   RWD  0&lt;br /&gt;
        &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;RPC hosts&amp;lt;/span&amp;gt;                DIR&lt;br /&gt;
            Allowed hosts        STRING  10    256   38m  3   RWD&lt;br /&gt;
                                         [0]             localhost&lt;br /&gt;
                                         [1]&lt;br /&gt;
                                         [2]&lt;br /&gt;
                                         [3]&lt;br /&gt;
                                         [4]&lt;br /&gt;
                                         [5]&lt;br /&gt;
                                         [6]&lt;br /&gt;
                                         [7]&lt;br /&gt;
                                         [8]&lt;br /&gt;
                                         [9]&lt;br /&gt;
        Disable RPC hosts check  BOOL    1     4     38m  0   RWD  n&lt;br /&gt;
        &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;mhttpd hosts&amp;lt;/span&amp;gt;             DIR&lt;br /&gt;
            Allowed hosts        STRING  10    256   5h   0   RWD&lt;br /&gt;
                                         [0]&lt;br /&gt;
                                         [1]&lt;br /&gt;
                                         [2]&lt;br /&gt;
                                         [3]&lt;br /&gt;
                                         [4]&lt;br /&gt;
                                         [5]&lt;br /&gt;
                                         [6]&lt;br /&gt;
                                         [7]&lt;br /&gt;
                                         [8]&lt;br /&gt;
                                         [9]&lt;br /&gt;
    midas http port              INT     1     4     5h   0   RWD  8080&lt;br /&gt;
    midas https port             INT     1     4     5h   0   RWD  8443&lt;br /&gt;
    http redirect to https       BOOL    1     4     5h   0   RWD  y&lt;br /&gt;
    CSS File                     STRING  1     1024  9h   0   RWD  mhttpd.css&lt;br /&gt;
    JS File                      STRING  1     1024  9h   0   RWD  mhttpd.js&lt;br /&gt;
    Menu Buttons                 STRING  1     1000  9h   0   RWD  Status, ODB, Messages, ELog, Alarms, Programs, History, Sequencer, Config, Help&lt;br /&gt;
    Start-Stop Buttons           BOOL    1     4     8h   0   RWD  y&lt;br /&gt;
    Pause-Resume Buttons         BOOL    1     4     8h   0   RWD  n&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Status items&amp;lt;/span&amp;gt;                DIR&lt;br /&gt;
        Experiment Name -&amp;gt; /Experiment/Name&lt;br /&gt;
    MAX_EVENT_SIZE               DWORD   1     4     23h  0   RWD  4194304&lt;br /&gt;
    Midas server port            DWORD   1     4     3m   0   RWD  1175&lt;br /&gt;
    Transition debug flag        INT     1     4     23h  0   RWD  0&lt;br /&gt;
    Transition connect timeout   INT     1     4     23h  0   RWD  10000&lt;br /&gt;
    Transition timeout           INT     1     4     23h  0   RWD  120000&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;edit on start&amp;lt;/span&amp;gt;                DIR&lt;br /&gt;
        experiment number        DWORD   1     4     2h   0   RWD  9499&lt;br /&gt;
        field                    STRING  1     32    2h   0   RWD  19000.2(0.0)G&lt;br /&gt;
        comment-&amp;gt; /Experiment/run parameters/comment&lt;br /&gt;
                                 STRING  1     80    2h   0   RWD  Testing with low beam&lt;br /&gt;
        Number of channels -&amp;gt; /Run Parameters/number of channels&lt;br /&gt;
                                 DWORD   1     4     2h   0   RWD  20&lt;br /&gt;
        Write Data -&amp;gt; /Logger/Write data&lt;br /&gt;
                                 BOOL    1     4     2h   0   RWD  n&lt;br /&gt;
        Number of cycles -&amp;gt; /Equipment/FIFO_acq/frontend/hardware/num cycles&lt;br /&gt;
                                 DWORD   1     4     2h   0   RWD  0&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Parameter Comments&amp;lt;/span&amp;gt;           DIR                   &lt;br /&gt;
        field                    STRING  1     32    &amp;gt;99d 0   RWD  &amp;lt;i&amp;gt;Entered in Tesla unit&amp;lt;/i&amp;gt;&lt;br /&gt;
        Num cycles               STRING  1     80    &amp;gt;99d 0   RWD  &amp;lt;i&amp;gt;Stop run after num cycles is reached. Enter 0 to disable (free running)&amp;lt;/i&amp;gt;&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Run Parameters&amp;lt;/span&amp;gt;               DIR&lt;br /&gt;
        Comment                  STRING  1     80    2h   0   RWD  Testing with low beam&lt;br /&gt;
        Run Description          STRING  1     256   7h   0   RWD  Sequencer Tests&lt;br /&gt;
        Number of channels       DWORD   1     4     2h   0   RWD  20&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Lock when running&amp;lt;/span&amp;gt;            DIR&lt;br /&gt;
        Num channels -&amp;gt; /Run Parameters/number of channels&lt;br /&gt;
                                 DWORD   1     4     2h   0   RWD  20&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;edit on sequence&amp;lt;/span&amp;gt;             DIR&lt;br /&gt;
        title                    STRING  1     128   2h   0   RWD  none&lt;br /&gt;
        experiment number        DWORD   1     4     2h   0   RWD  9438&lt;br /&gt;
        experimenter             STRING  1     32    2h   0   RWD  gls&lt;br /&gt;
        sample                   STRING  1     36    2h   0   RWD  NA&lt;br /&gt;
        run description -&amp;gt; /Experiment/run parameters/run description&lt;br /&gt;
                                 STRING  1     256   7h   0   RWD  Sequencer Tests&lt;br /&gt;
        Write Data -&amp;gt; /Logger/Write data&lt;br /&gt;
                                 BOOL    1     4     2h   0   RWD  n&lt;br /&gt;
        Number of cycles -&amp;gt; /Equipment/FIFO_acq/frontend/hardware/num cycles&lt;br /&gt;
                                 DWORD   1     4     2h   0   RWD  0&lt;br /&gt;
    Prevent start on alarms      BOOL    1     4     22h  0   RWD  n&lt;br /&gt;
    Prevent start on required    BOOL    1     4     22h  0   RWD  n&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;Status items&amp;lt;/span&amp;gt;                 DIR&lt;br /&gt;
        Experiment Name -&amp;gt; /Experiment/Name&lt;br /&gt;
                                 STRING  1     32    7s   0   RWD  midas&lt;br /&gt;
    Start-Stop Buttons           BOOL    1     4     5h   0   RWD  y&lt;br /&gt;
    Pause-Resume Buttons         BOOL    1     4     5h   0   RWD  n&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Keys in &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment&#039;&#039;&amp;lt;/span&amp;gt; tree==&lt;br /&gt;
&lt;br /&gt;
The keys in the ODB &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;/Experiment tree&#039;&#039;&amp;lt;/span&amp;gt; &lt;br /&gt;
are described in the following sections.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Name &#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]]&lt;br /&gt;
contains the name of the experiment. It is created by the MIDAS system when the ODB is created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Buffer Sizes &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&lt;br /&gt;
This key in the [[#top|/Experiment tree]] is a subtree to contain the sizes of the &lt;br /&gt;
Midas Buffers for the experiment. Created by the MIDAS system with default values. The sizes can be changed to optimize the memory usage. See &#039;&#039;&#039;[[Event Buffer]]&#039;&#039;&#039; Size(s) for details.  Other user-defined&lt;br /&gt;
buffers may be present (e.g. for &#039;&#039;&#039;[[event filtering]]&#039;&#039;&#039;).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;SYSMSG &#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  100000 Bytes&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#Buffer Sizes|/Experiment/Buffer Sizes subtree]]&lt;br /&gt;
contains the size of SYSMSG buffer. This buffer is used for MIDAS messages.&lt;br /&gt;
The default value of this key is defined by MESSAGE_BUFFER_SIZE in $MIDASSYS/include/msystem.h .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;SYSTEM &#039;&#039;&amp;lt;/span&amp;gt;  ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  32MiBytes&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#Buffer Sizes|/Experiment/Buffer Sizes subtree]]&lt;br /&gt;
contains the size of SYSTEM buffer.  The default value of this key is&lt;br /&gt;
DEFAULT_BUFFER_SIZE = 32 MiB (defined in [http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/html/midas_8h_source.html midas.h]). &lt;br /&gt;
The actual SYSTEM buffer size is set by this key. To increase the SYSTEM buffer size (e.g. for very large events), see [[Event Buffer]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;MAX_EVENT_SIZE &#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  4MiBytes&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]]&lt;br /&gt;
specifies the maximum event size that can be acquired. The default value of this key is&lt;br /&gt;
DEFAULT_MAX_EVENT_SIZE =  4 MiB  (defined in [http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/html/midas_8h_source.html midas.h]). &lt;br /&gt;
The actual maximum event size is set by this key, and can be increased for larger events if needed (see  [[Event Buffer]] for more information).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;midas http port&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  8080&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is created when [[mhttpd]] is run for the first time. It contains the listening port for the HTTP server (default 8080). This will be redirected to the secure HTTPS port given by [[#midas https port|midas https port]] if the key [[#http redirect to https|http redirect to https]] is set to &amp;quot;y&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If the http port are supplied with the &amp;quot;--http&amp;quot; option when starting  {{Utility|name=mhttpd}}, the port supplied will overwrite the default value stored in this key. See [[mhttpd]] for details. &lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This [[Security]] feature was added to  [[mhttpd]] in August 2015&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;midas https port&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  8443&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is created when [[mhttpd]] is run for the first time. It contains the listening port (default 8443) for the secure &lt;br /&gt;
HTTPS/SSL server ([https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose]). &lt;br /&gt;
&lt;br /&gt;
If the https port is supplied with the &amp;quot;--https&amp;quot; option when starting  {{Utility|name=mhttpd}}, the port supplied will overwrite the default value stored in this key. See [[mhttpd]] for details.&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This [[Security]] feature was added to [[mhttpd]] in August 2015&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;http redirect to https&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  y&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is created when [[mhttpd]] is run for the first time.  If set to &amp;quot;y&amp;quot;, connections to the http port (specified by the key [[#midas http port|midas http port]] will be redirected to hte https port (specified by the key [[#midas https port|midas https port]], i.e. the listening port for the secure &lt;br /&gt;
HTTPS/SSL server ([https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose]). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This [[Security]] feature was added to [[mhttpd]] in August 2015&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;midas server port&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DWORD&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  1175&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This key is created when [[mserver]] is started for the first time. It contains the default value of the port used by [[mserver]]. This is set to MIDAS_TCP_PORT = 1175 ( midas.h).  A different port can be used by starting [[mserver]] with the -p argument.&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This key was added in May 2015 (see [[Security]]). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;CSS File&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;mhttpd.css&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains the name of the [[Custom Page Features#MIDAS stylesheet|MIDAS stylesheet]] file for the use of those writing [[Custom Page|Custom Web Pages]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;JS File&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;mhttpd.js&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains the name of the [[mhttpd.js|Javascript library]] file for the use of those writing [[Custom Page|Custom Web Pages]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Menu Buttons&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:2;-moz-column-count:2;-webkit-column-count:2&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;Status, ODB, Messages, ELog, Alarms, Programs, History, Sequencer, Chat, Config, Help&amp;quot;&lt;br /&gt;
 &amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]]&lt;br /&gt;
is added automatically by &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039; to allow the Menu buttons that appear on the &#039;&#039;&#039;[[mhttpd|Main Status Page]]&#039;&#039;&#039; to be customized by &lt;br /&gt;
removing unnecessary buttons or by changing their order. &lt;br /&gt;
&lt;br /&gt;
The Start/Stop/Pause/Resume buttons are not now included in  &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Menu Buttons&#039;&#039;&amp;lt;/span&amp;gt;. &lt;br /&gt;
* To suppress/display the Start/Stop buttons use key [[#Start-Stop Buttons|Start-Stop Buttons]].&lt;br /&gt;
* To display/suppress the Pause/Resume buttons, use key [[#Pause-Resume Buttons|Pause-Resume Buttons]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Note&lt;br /&gt;
:If [[MSCB Page#MIDAS with MSCB support|MSCB support]] is built into MIDAS, the default will also include the MSCB Menu button (see [[MSCB Page]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Start-Stop Buttons&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; y&lt;br /&gt;
 &amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is added automatically by &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039; to allow the user to suppress the Start or Stop buttons from appearing on the [[Status Page]]. By default, Start/Stop buttons are shown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Pause-Resume Buttons&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039; n&lt;br /&gt;
 &amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] is added automatically by &#039;&#039;&#039;[[mhttpd]]&#039;&#039;&#039;.&lt;br /&gt;
By default the Pause/Resume menu buttons do not appear on the [[Status Page]]. The user can allow these buttons&lt;br /&gt;
to appear during the run by setting this key to &amp;quot;y&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition debug flag &#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains a flag that, if set to 1, causes messages reporting transition progress to be output.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition connect timeout&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  10000&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains the&lt;br /&gt;
value of timeout for remote rpc connect&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Transition timeout&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; INT&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  120000&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] contains the&lt;br /&gt;
value of timeout for transition &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Prevent start on alarms&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;  &lt;br /&gt;
This key in the [[#top|/Experiment tree]] if set true &lt;br /&gt;
will prevent the run from starting if an [[Alarm System|alarm]] is true, i.e.&lt;br /&gt;
the run start procedure will fail if an alarm has been [[/Alarms ODB tree#Triggered|Triggered]] for a client, provided a valid [[/Alarms ODB tree#alarms class|alarms class]] has&lt;br /&gt;
been entered in the client&#039;s [[/Programs ODB tree#Alarm class|Alarm class]] key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Prevent start on required program&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
This key in the [[#top|/Experiment tree]] if set true (&amp;quot;y&amp;quot;)&lt;br /&gt;
will prevent the run from starting if one of the &#039;&#039;&#039;required&#039;&#039;&#039; clients is not running. A client is flagged as &amp;quot;required&amp;quot; by setting the ODB key &lt;br /&gt;
[[/Programs ODB tree#Required|Required]] to &amp;quot;y&amp;quot;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Edit on Sequence &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This  optional subdirectory  in the [[#top|/Experiment tree]] may&lt;br /&gt;
contain user-defined parameters which will be displayed for editing at the start of each [[Sequencer|Sequence]]. See [[Edit-on-Sequence Parameters]] for details. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Edit on Start &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This  optional subdirectory  in the [[#top|/Experiment tree]] may&lt;br /&gt;
contain user-defined parameters which will be displayed for editing at the beginning of each run. See &#039;&#039;&#039;[[Edit-on-start Parameters]]&#039;&#039;&#039; for details. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Lock when running &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This  optional subdirectory  in the [[#top|/Experiment tree]] contains user-defined links to ODB parameters to prevent them being changed when the run is in progress. See &#039;&#039;&#039;[[Lock when running]]&#039;&#039;&#039; for details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Parameter Comments &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This  optional subdirectory   in the [[#top|/Experiment tree]] may contain user-defined parameter comments that give more information about&lt;br /&gt;
the &#039;&#039;&#039;[[Edit-on-start Parameters]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Run Parameters &#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This  optional subdirectory   in the [[#top|/Experiment tree]] may contain user-defined parameters or parameter(s)&lt;br /&gt;
with reserved names (i.e. [[#Run Description|Run Description]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Run Description&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This ODB key is used by the [[Sequencer]] [[Sequencer#RUNDESCRIPTION|RUNDESCRIPTION]] command to store the&lt;br /&gt;
run description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;&amp;lt;parameter name&amp;gt;&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
The user may define parameters here e.g. for linking as  &#039;&#039;&#039;[[Edit-on-start Parameters|Edit-on-start]]&#039;&#039;&#039; or &#039;&#039;&#039;[[Edit-on-Sequence Parameters|Edit-on-Sequence]]&#039;&#039;&#039; parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Status items&#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This key in the [[#top|/Experiment tree]] is a subtree  which by default contains a link to the [[#Name|experiment name]]. Any links or keys&lt;br /&gt;
created by the user in this optional subdirectory will be displayed on the [[mhttpd]] main status page. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Security&#039;&#039;&amp;lt;/span&amp;gt; subtree ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This optional subtree   in the [[#top|/Experiment tree]] is created when the &#039;&#039;&#039;[[odbedit]]&#039;&#039;&#039; commands  &amp;lt;span style=&amp;quot;color:saddlebrown; font-style:bold; &amp;quot;&amp;gt;passwd&amp;lt;/span&amp;gt; or  &amp;lt;span style=&amp;quot;color:saddlebrown; font-style:bold; &amp;quot;&amp;gt;webpasswd&amp;lt;/span&amp;gt; are issued. It enables a user to set up security features. See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Disable RPC hosts check&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting the key to &amp;quot;n&amp;quot; (the default) causes access by unauthorized hosts to be prevented by the system checking the RPC access control list (see [[#RPC hosts subtree|RPC hosts/Allowed hosts]]).&lt;br /&gt;
&lt;br /&gt;
If MIDAS clients have to connect from random hosts (i.e. dynamically assigned random DHCP addresses), one can disable the host name checks by &lt;br /&gt;
setting this key to &amp;quot;y&amp;quot;. This configuration is insecure and should only be done on a private network behind a firewall. See [https://midas.triumf.ca/elog/Midas/1080 Note 1080].&lt;br /&gt;
&lt;br /&gt;
; NOTE&lt;br /&gt;
: This key was added August 2015. Used by [[mserver]] to improve network [[Security]] for the MIDAS experiment. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Enable non-localhost RPC&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; BOOL&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;n&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The default value of this key is &amp;quot;n&amp;quot;, denying access by external network connections.  If running an experiment that requires external network connections, this key must be set to &amp;quot;y&amp;quot; and the key [[#RPC hosts|RPC hosts]] must be filled. See [https://midas.triumf.ca/elog/Midas/1080 Note 1080].&lt;br /&gt;
&lt;br /&gt;
; NOTE&lt;br /&gt;
: This key was added August 2015. Used by [[mserver]] to improve network [[Security]] for the MIDAS experiment. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;RPC ports&#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This subtree in the [[#Security subtree|/Experiment/Security subtree]] is new as of August 2015. It is created by the MIDAS system. &lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;). This subdirectory contains the names of MIDAS clients and their fixed TCP port numbers. When a client is started for the first time, an entry named for the client will be created in this subtree.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;&amp;lt;client-name&amp;gt;&#039;&#039;&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  0&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When a MIDAS client is started, a key will be created named for that client. It will contain the fixed TCP port number that the MIDAS client is using.&lt;br /&gt;
Clients started on the local host will have TCP port numbers of 0 (default).&lt;br /&gt;
&lt;br /&gt;
Once a remote [[Frontend Operation|frontend]] is bound to a fixed port, appropriate openings can be made in the firewall, etc. Default port number value &lt;br /&gt;
will be 0 meaning &amp;quot;use random port&amp;quot;, same as now. See [https://midas.triumf.ca/elog/Midas/1079].&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: This feature was added  August 2015. It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;RPC hosts&#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This subtree in the [[#Security subtree|/Experiment/Security subtree]] is new as of August 2015. It is created by the MIDAS system. &lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Allowed hosts (rpc hosts)&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- need this because of duplicate &amp;quot;Allowed hosts&amp;quot; in &amp;quot;mhttpd hosts/&amp;quot; subtree --&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Allowed hosts&#039;&#039;&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING array&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;localhost&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This key in the [[#RPC hosts subtree|/Experiment/Security/RPC hosts subtree]] is new as of August 2015 and is created by the system (i.e. midas.c).&lt;br /&gt;
&lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;) and is used to maintain a Network Access Control list. &lt;br /&gt;
The access control list array is self-growing - it will have at least 10 empty entries at the end at all times.&lt;br /&gt;
&lt;br /&gt;
The default value for {{Odbpath|path=Allowed hosts[0]}} is &amp;quot;localhost&amp;quot;, which will reject all external connections, even when permitted by [[#Enable external RPC connections|Enable external RPC connections]].  The user will be required to enter the names of all machines that will run midas clients in this array. See [https://midas.triumf.ca/elog/Midas/1090].&lt;br /&gt;
&lt;br /&gt;
All clients&#039; db_watch() routines watch the access control list and automatically reload it when it is changed, so there is no need to restart clients.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;mhttpd hosts&#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This subtree in the [[#Security subtree|/Experiment/Security subtree]] is new as of August 2015. It is created by the MIDAS system. &lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;Allowed hosts (mhttpd hosts)&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;  &amp;lt;!-- need this because of duplicate &amp;quot;Allowed hosts&amp;quot; in &amp;quot;rpc hosts/&amp;quot; subtree --&amp;gt;&lt;br /&gt;
===== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Allowed hosts&#039;&#039;&amp;lt;/span&amp;gt; =====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING array&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;localhost&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This key in the [[#RPC hosts subtree|/Experiment/Security/mhttpd hosts subtree]] is new as of August 2015 and is created by the system (i.e. midas.c).&lt;br /&gt;
&lt;br /&gt;
It is part of the improved security features of MIDAS (See &#039;&#039;&#039;[[Security]]&#039;&#039;&#039;) and is used to maintain an access control list for [[mhttpd]].  An empty list means free access from everywhere. Access control is also controlled by the [[mhttpd]] &amp;quot;-a&amp;quot; command line arguments. Hosts supplied by the &amp;quot;-a&amp;quot; command line arguments are not added to the access control list by the system.&lt;br /&gt;
&lt;br /&gt;
The access control list is watched by  {{Utility|name=mhttpd}}, therefore there is no need to restart it after updating the list.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:whitesmoke&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;font-size:120%; font-style:bold&amp;quot;&amp;gt;The following keys are OBSOLESCENT - replaced by the [[Security|security features]] added Aug 2015&amp;lt;/span&amp;gt; ===&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Password &#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;This feature pre-dates the improved [[Security]] features (August 2015)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Do not set this key except through the {{Odbedit cmd|cmd=passwd}}. Setting an unencrypted password will lock you out of the ODB unless {{Utility|name=odbedit}} is listed in the [[#Allowed programs subtree|allowed programs subtree]].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;This security feature is not proof against malicious access. See [[Security]] for details.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This optional key in the [[#Security|/Experiment/Security subtree]]&lt;br /&gt;
contains the encrypted password. This Key is created when the {{Odbedit cmd|cmd=passwd}} is issued. See [[Security#Restrict user access|Restrict user access]] for details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Allowed Hosts&#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
* This subtree pre-dates the improved [[Security]] features (August 2015) and is not to be confused with  [[#RPC hosts subtree|RPC hosts/Allowed hosts]] array.&lt;br /&gt;
* This security feature is not proof against malicious access. See [[Security]] for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This subtree in the  [[#Security|/Experiment/Security subtree]] is created when the {{Odbedit cmd|cmd=passwd}} is issued. When created, this subtree is empty.&lt;br /&gt;
Optionally, it may contain  user-defined names of remote hosts allowed to have free access (i.e. without password) to the current experiment. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Allowed programs &#039;&#039;&amp;lt;/span&amp;gt; subtree ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; DIR&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
* This subtree pre-dates the improved [[Security]] features (August 2015)&lt;br /&gt;
* This feature is not proof against malicious access. See [[Security]] for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This optional subtree  in the  [[#Security|/Experiment/Security subtree]] is created when the {{Odbedit cmd|cmd=passwd}} is issued. When created, this subtree is empty.&lt;br /&gt;
Optionally, it may  contain user-defined names of clients allowed to have free access (i.e. without password) to the current experiment. See [[Security #Allowed programs]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Web Password&#039;&#039;&amp;lt;/span&amp;gt; ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
* This key pre-dates (and has been superceded by)  the improved [[Security]] features (August 2015)&lt;br /&gt;
* This feature is not proof against malicious access. See [[Security]] for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If [[Security#Restrict user access|restriction on user web access]] has been set up, this key in the  [[#Security|/Experiment/Security subtree]]&lt;br /&gt;
will contain an encrypted password for Web server access. This key is created by using the {{Odbedit cmd|cmd=webpasswd}}. &lt;br /&gt;
&lt;br /&gt;
If this key is present, the user will be requested to provide the &amp;quot;Web Password&amp;quot; when accessing the requested experiment in &amp;quot;Write Access&amp;quot; mode. The &amp;quot;Read Only Access&amp;quot; mode is still available (without a password) to all users.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- obsolescent --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:silver&amp;quot;&amp;gt;&lt;br /&gt;
== &amp;lt;span style=&amp;quot;font-size:120%;&amp;quot;&amp;gt;The following keys are OBSOLETE:&amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Mongoose listening_port&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;8080r,8443s&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:This key in the [[#top|/Experiment tree]] existed for a short time in midas versions May-August 2015. &lt;br /&gt;
: It has been &#039;&#039;&#039;replaced by the ODB keys [[#midas http port|midas http port]] and [[#midas https port|midas https port]].&#039;&#039;&#039; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:80%&amp;quot;&amp;gt;&lt;br /&gt;
This key in the [[#top|/Experiment tree]] was created when [[mhttpd]] was run for the first time. It contained the listening ports for the secure &lt;br /&gt;
HTTPS/SSL server ([https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose]). The ports are the HTTP port (default 8080) which is to be redirected to the secure HTTPS port (default 8443). &lt;br /&gt;
If ports were supplied with the &amp;quot;--mg&amp;quot; option when starting  {{Utility|name=mhttpd}}, their values will overwrite the default values stored in this key. See [[mhttpd]] for details. &lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color: purple;&amp;quot;&amp;gt;&#039;&#039;Mongoose access_control_list&#039;&#039;&amp;lt;/span&amp;gt;  ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Type:&#039;&#039;&#039; STRING&lt;br /&gt;
* &#039;&#039;&#039;Default:&#039;&#039;&#039;  &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:This key in the [[#top|/Experiment tree]] existed for a short time in midas versions May-August 2015. &lt;br /&gt;
:&#039;&#039;&#039;Use the [[#mhttpd hosts subtree|mhttpd hosts/Allowed hosts]] access control list or the [[mhttpd]] &amp;quot;-a hostname&amp;quot; parameter to restrict access.&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:80%&amp;quot;&amp;gt;&lt;br /&gt;
This key in the [[#top|/Experiment tree]] is created when [[mhttpd]] is run for the first time. It contains the access control list (ACL) for the [https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose] web server.  By default, this key is empty and there is no access control.  The format of the ACL is described under access_control_list at [https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/Options.md?at=develop Mongoose Configuration Options].&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- obsolete ..  silver --&amp;gt;&lt;br /&gt;
[[Category:ODB Tree]] [[Category:Experiment]] [[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Event_Buffer&amp;diff=2545</id>
		<title>Event Buffer</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Event_Buffer&amp;diff=2545"/>
		<updated>2016-08-26T01:25:32Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
== Increase size of events  ==&lt;br /&gt;
In some experiments, the default event size (currently 4MiB) may not be large enough.  &lt;br /&gt;
&lt;br /&gt;
To increase the size of events, one must increase:&lt;br /&gt;
* the value of ODB [[/Experiment ODB tree #/Experiment/MAX_EVENT_SIZE |/Experiment/MAX_EVENT_SIZE]]&lt;br /&gt;
* max_event_size in the  [[Frontend Operation#Frontend|Frontend]] and recompile&lt;br /&gt;
Actual limits on the bank size and event size are [[#Limits on the bank and event sizes|described below]].&lt;br /&gt;
&lt;br /&gt;
By default the shared memory event buffer (used to contain the data from the event) is named SYSTEM. Its default size is 8MB. &lt;br /&gt;
&lt;br /&gt;
For very large events, it will also be necessary to [[#Increase size of SYSTEM buffer|increase the size]] of the SYSTEM buffer (and any buffers used by the event builder etc).&lt;br /&gt;
Ultimately, the maximum event size is limited by the size of the SYSTEM buffer which is limited by the physical memory of your computer. No recompilation of MIDAS necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Limits on the bank and event sizes ==&lt;br /&gt;
&lt;br /&gt;
;Limitations in order: &lt;br /&gt;
&lt;br /&gt;
# bank32 size is limited to a 32 bit integer size (about 4000 Gbytes)&lt;br /&gt;
# bank size is limited by event size&lt;br /&gt;
# event size in a  [[Frontend Operation#Frontend|Frontend]] based on MIDAS &#039;&#039;mfe.c&#039;&#039; is limited to the value of max_event_size set by the user&lt;br /&gt;
# maximum event size that can go through the MIDAS event buffer system is limited to ODB value [[/Experiment ODB tree #/Experiment/MAX_EVENT_SIZE |/Experiment/MAX_EVENT_SIZE]] (Note that MAX_EVENT_SIZE in midas.h is no longer used).&lt;br /&gt;
# maximum event size is limited to &#039;&#039;&#039;half&#039;&#039;&#039; the size of the SYSTEM shared memory event buffer (or any other buffers that the event has to go through)&lt;br /&gt;
# default size of the SYSTEM buffer is 8 Mbytes set by ODB /Experiment/Buffer sizes/SYSTEM. This limits maximum event size to about 4 Mbytes.&lt;br /&gt;
# size of SYSTEM buffer can be [[#Increase size of SYSTEM buffer|increased]] to arbitrary size, but in practice no bigger than the amount of computer physical memory minus space needed for running the  [[Frontend Operation#Frontend|Frontend]] program and [[mlogger]], which also allocate buffer space to hold 1 event of maximum size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So for a computer with 8 Gbytes of RAM, you can make the SYSTEM buffer size 4&lt;br /&gt;
GBytes, set ODB MAX_EVENT_SIZE to 1 Gbyte, and in theory, you should be able to&lt;br /&gt;
write 1 Gbyte events from your frontend to disk.&lt;br /&gt;
&lt;br /&gt;
In practice, some of the biggest events to go through a MIDAS system are&lt;br /&gt;
non-compressed waveforms in the T2K/ND280 FGD and TPC detectors, about 4 Mbytes of&lt;br /&gt;
data per event.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;other considerations&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
; Other considerations (rules of thumb): &lt;br /&gt;
&lt;br /&gt;
# the SYSTEM event buffer should be big enough to hold 10-100 events.&lt;br /&gt;
# the SYSTEM event buffer should be big enough to hold about 5-10 seconds of data&lt;br /&gt;
:: i.e. if the event size is 1 Mbyte and data rate is 1 Hz, 10 seconds of data will be 1Mbyte*1Hz*10sec = 10 Mbytes.&lt;br /&gt;
&lt;br /&gt;
This is because the SYSTEM buffer decouples the real-time activity of the  [[Frontend Operation#Frontend|Frontend]]&lt;br /&gt;
program from non-real-time activity of writing data to storage devices.&lt;br /&gt;
&lt;br /&gt;
== Increase size of SYSTEM buffer ==&lt;br /&gt;
For large events it may be necessary to increase the size of the SYSTEM buffer. See [[#other considerations|note above]].&lt;br /&gt;
* shutdown all clients&lt;br /&gt;
* set ODB key [[/Experiment ODB tree#SYSTEM|/Experiment/Buffer Sizes/SYSTEM]] to the larger value (a power of 2)&lt;br /&gt;
* remove  SYSTEM shared memory file .SYSTEM.SHM (located in directory given by [[#Exptab]])&lt;br /&gt;
* restart clients&lt;br /&gt;
&lt;br /&gt;
[[Category:Event]] [[Category:Frontend]] [[Category:Buffer]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Odbedit_examples&amp;diff=2531</id>
		<title>Odbedit examples</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Odbedit_examples&amp;diff=2531"/>
		<updated>2016-06-20T21:01:14Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[Mhttpd|mhttpd MIDAS web server]]&lt;br /&gt;
* [[ODB Page]]&lt;br /&gt;
* [[odbedit]] &lt;br /&gt;
* [[ODB|Using the ODB]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Examples of odbedit commands =&lt;br /&gt;
&lt;br /&gt;
* [[ODB#Example|cd]]&lt;br /&gt;
* [[ODB#Example|create]], [[ODB#Creating arrays|create arrays]]&lt;br /&gt;
* [[Creating Internal Custom Page#odbedit import export|export]]&lt;br /&gt;
* [[Creating Internal Custom Page#odbedit import export|import]]&lt;br /&gt;
* [[Edit-on-start Parameters#Creating edit-on-start parameters|ln]]&lt;br /&gt;
* [[ODB#Example|ls, ls -r]]&lt;br /&gt;
* [[ODB#experim.h include file|make]]&lt;br /&gt;
* [[ODB#Example|mkdir]]&lt;br /&gt;
* [[ODB#Reorder ODB keys|move]]&lt;br /&gt;
* [[ODB#Example|set]], [[ODB#Creating arrays|set arrays]]&lt;br /&gt;
&lt;br /&gt;
; For more examples, see [[ODB|Using the ODB]]&lt;br /&gt;
&lt;br /&gt;
[[Category:ODB]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Setup_MIDAS_experiment_at_TRIUMF&amp;diff=2530</id>
		<title>Setup MIDAS experiment at TRIUMF</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Setup_MIDAS_experiment_at_TRIUMF&amp;diff=2530"/>
		<updated>2016-06-13T23:07:18Z</updated>

		<summary type="html">&lt;p&gt;Suz: /* Secure MIDAS and ELOG Web access */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page describes setting up a MIDAS experiment at TRIUMF. This information can be adapted for other sites.&lt;br /&gt;
&lt;br /&gt;
== Environment variables ==&lt;br /&gt;
* &#039;&#039;&#039;MIDASSYS&#039;&#039;&#039; Base directory of the MIDAS package, midas and mxml should be at the same level.&lt;br /&gt;
* &#039;&#039;&#039;MIDAS_EXPTAB&#039;&#039;&#039; Experiment definition file&lt;br /&gt;
* &#039;&#039;&#039;MIDAS_SERVER_HOST&#039;&#039;&#039; MIDAS host server name for remote midas connections.&lt;br /&gt;
* &#039;&#039;&#039;MIDAS_EXPT_NAME&#039;&#039;&#039; Experiment name&lt;br /&gt;
&lt;br /&gt;
== Standard layout of MIDAS experiment ==&lt;br /&gt;
The following shows the directory layout of a standard MIDAS experiment: &lt;br /&gt;
&lt;br /&gt;
 /home/exptuser/&lt;br /&gt;
                packages/&lt;br /&gt;
                        root                   &amp;lt;---- ROOT&lt;br /&gt;
                        mxml&lt;br /&gt;
                        mscb&lt;br /&gt;
                        midas/                 &amp;lt;---- MIDAS&lt;br /&gt;
                              linux/{lib,bin}       &amp;lt;---- binaries matching the selected 64-bit/32-bit flavour of ROOT&lt;br /&gt;
                              linux-m32/{lib,bin}   &amp;lt;---- limited function 32-bit binaries for 32-bit frontend machines, build by &amp;quot;make linux32&amp;quot;&lt;br /&gt;
                              linux-m64/{lib,bin}   &amp;lt;---- limited function 64-bit binaries (only needed if ROOT and linux/bin are 32-bit)&lt;br /&gt;
                              linux-arm/{lib,bin}   &amp;lt;---- full function ARM cross-compiled using &amp;quot;make linuxarm&amp;quot;&lt;br /&gt;
                              linux-crosscompile/{lib,bin}  &amp;lt;---- cross-compiled limited function binaries for PPC and ARM frontends (see Makefile)&lt;br /&gt;
                        rootana                &amp;lt;---- ROOT analyzer&lt;br /&gt;
                        roody                  &amp;lt;---- graphical online histogram viewer for MIDAS and ROOTANA&lt;br /&gt;
                 online/&lt;br /&gt;
                        exptab                         &amp;lt;---- experiment definition&lt;br /&gt;
                        {.ODB,.SYSTEM,.SYSMSG,etc}.SHM &amp;lt;---- MIDAS shared memory save files&lt;br /&gt;
                        src                            &amp;lt;---- experiment frontend sources&lt;br /&gt;
                        bin,scripts&lt;br /&gt;
                        elog                           &amp;lt;---- MIDAS elog&lt;br /&gt;
                        history                        &amp;lt;---- MIDAS history&lt;br /&gt;
                        data -&amp;gt; /data/exptname/current &amp;lt;---- symlink to the data directory&lt;br /&gt;
 /data/exptname/current                                &amp;lt;---- experiment data directory with ODB save files and MIDAS .mid/.mid.gz data files&lt;br /&gt;
&lt;br /&gt;
== Prepare computers ==&lt;br /&gt;
&lt;br /&gt;
On some operating systems, several MIDAS functions require administrator access:&lt;br /&gt;
&lt;br /&gt;
* on el7 linux (SL7/CC7/CentOS7/RHEL7) - access to mhttpd port 8443 requires special firewall rules, see here: https://www.triumf.info/wiki/DAQwiki/index.php/SLinstall#Enable_firewall_for_MIDAS_.28CentOS7.29&lt;br /&gt;
* on el7 linux - access to mserver to run frontends and other programs on some other computer requires special firewall rules, see here: https://www.triumf.info/wiki/DAQwiki/index.php/SLinstall#Enable_firewall_for_MIDAS_.28CentOS7.29&lt;br /&gt;
* on el7 linux - on the frontend machines (and other machines that will connect to the mserver, the same firewall rule needs to be created (use the IP address of the machine running the mserver)&lt;br /&gt;
&lt;br /&gt;
== Prepare the user account ==&lt;br /&gt;
&amp;lt;div id=&amp;quot;NOTES&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
;NOTES&lt;br /&gt;
* Instructions are given for recent MIDAS versions (August 2015 and later) which have enhanced [[Security]]. Instructions for older versions differ slightly.&lt;br /&gt;
** follow the  &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt; instructions for older versions&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;Default Ports&#039;&#039;&#039; are different between the two versions:&lt;br /&gt;
** default ports are mserver (1175), mhttpd (8080 and 8443)&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;default ports (older versions) are mserver (7071), mhttpd (8081) &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The default port for ROODY is 9091.&lt;br /&gt;
&lt;br /&gt;
* Setup the user account for running this instance of midas. For machines part of the LADD cluster, follow these  [http://daq-plone.triumf.ca/SM/docs/local/NewLaddUser] instructions.&lt;br /&gt;
* check that the account is using the /bin/bash shell&lt;br /&gt;
* make $HOME/.profile look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/echo You must source&lt;br /&gt;
&lt;br /&gt;
export SVN_EDITOR=&amp;quot;emacs -nw&amp;quot;&lt;br /&gt;
export GIT_EDITOR=&amp;quot;emacs -nw&amp;quot;&lt;br /&gt;
export MIDASSYS=$HOME/packages/midas&lt;br /&gt;
export ROOTANASYS=$HOME/packages/rootana&lt;br /&gt;
export MIDAS_EXPTAB=$HOME/online/exptab&lt;br /&gt;
#&lt;br /&gt;
# setup the MIDAS mserver&lt;br /&gt;
#&lt;br /&gt;
case `hostname` in&lt;br /&gt;
daq07*)&lt;br /&gt;
   unset MIDAS_SERVER_HOST&lt;br /&gt;
   ;;&lt;br /&gt;
*)&lt;br /&gt;
   export MIDAS_SERVER_HOST=daq07.triumf.ca:7070&lt;br /&gt;
   ;;&lt;br /&gt;
esac&lt;br /&gt;
#&lt;br /&gt;
# select 64-bit or 32-bit MIDAS and ROOT&lt;br /&gt;
#&lt;br /&gt;
case `uname -i` in&lt;br /&gt;
i386)&lt;br /&gt;
   source /daq/daqshare/olchansk/root/root_v5.34.01_SL62_32/bin/thisroot.sh&lt;br /&gt;
   export PATH=.:$MIDASSYS/linux-m32/bin:$PATH&lt;br /&gt;
   ;;&lt;br /&gt;
*)&lt;br /&gt;
   #source /daq/daqshare/olchansk/root/root_v5.34.34_SL67_64/bin/thisroot.sh&lt;br /&gt;
   source $HOME/packages/root/bin/thisroot.sh&lt;br /&gt;
   export PATH=.:$MIDASSYS/linux/bin:$PATH&lt;br /&gt;
   ;;&lt;br /&gt;
esac&lt;br /&gt;
#&lt;br /&gt;
export PATH=.:$HOME/online/bin:$HOME/packages/roody/bin:$PATH&lt;br /&gt;
#&lt;br /&gt;
#end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* mkdir $HOME/packages&lt;br /&gt;
* Logout and login again, for .cshrc changes to take effect&lt;br /&gt;
&lt;br /&gt;
== Install ROOT ==&lt;br /&gt;
&lt;br /&gt;
* Identify the Linux version: RH9 (Red Hat Linux 9), FC3 (Fedora Core 3), RHEL4/SL4 (Red Hat Enterprise LInux 4/Scientific Linux 4), SL5x, SL6x, (CentOS/CC/SL) el7x: more /etc/redhat-release&lt;br /&gt;
* Decide to use 32-bit or 64-bit ROOT (&#039;uname -a&#039;)&lt;br /&gt;
* cd $HOME/packages&lt;br /&gt;
* ls -l /daq/daqshare/olchansk/root/ ### to see all available ROOT packages&lt;br /&gt;
* ln -s /daq/daqshare/olchansk/root/root_vNNN_VVV_BB root, where NNN is the latest available version of ROOT (&amp;quot;ls -l /daq/daqshare/olchansk/root&amp;quot;), VVV is the Linux version code (RH9, FC3, SL4, etc) and BB is &amp;quot;_32&amp;quot; or &amp;quot;_64&amp;quot; for 32-bit or 64-bit ROOT. For example: /daq/daqshare/olchansk/root/root_v5.10.00_SL40&lt;br /&gt;
* for example: ln -s /daq/daqshare/olchansk/root/root_v5.34.34_el72_64 $HOME/packages/root&lt;br /&gt;
* Check that ROOT works: &amp;quot;source $HOME/packages/root/bin/thisroot.sh; root&amp;quot;. Type &amp;quot;.q&amp;quot; to exit root.&lt;br /&gt;
&lt;br /&gt;
== Install MIDAS ==&lt;br /&gt;
&lt;br /&gt;
* cd $HOME/packages&lt;br /&gt;
* (OBSOLETE) svn co svn+ssh://svn@savannah.psi.ch/repos/meg/midas/trunk midas, password &amp;quot;svn&amp;quot;. (password has to be entered twice)&lt;br /&gt;
* (OBSOLETE) svn co svn+ssh://svn@savannah.psi.ch/repos/meg/mxml/trunk mxml&lt;br /&gt;
* git clone https://bitbucket.org/tmidas/midas&lt;br /&gt;
* git clone https://bitbucket.org/tmidas/mxml&lt;br /&gt;
* git clone https://bitbucket.org/tmidas/mscb&lt;br /&gt;
* (IF BITBUCKET IS DOWN) git clone -v --progress https://daq.triumf.ca/~daqweb/git/mxml.git&lt;br /&gt;
* (IF BITBUCKET IS DOWN) git clone -v --progress https://daq.triumf.ca/~daqweb/git/mscb.git&lt;br /&gt;
* (IF BITBUCKET IS DOWN) git clone -v --progress https://daq.triumf.ca/~daqweb/git/midas.git&lt;br /&gt;
* cd midas&lt;br /&gt;
* make&lt;br /&gt;
* (only if needed) make linux32 ### build the 32-bit MIDAS libraries&lt;br /&gt;
* ls -l linux/bin/odbedit ### check that odbedit has been created (do not run it yet)&lt;br /&gt;
&lt;br /&gt;
You can see a list of other installation problems at [[Common problems &amp;amp; Debugging recipes]].&lt;br /&gt;
&lt;br /&gt;
;NOTE&lt;br /&gt;
: Optional features in MIDAS can be explicitly disabled if desired when making MIDAS using the NO_xxx feature (NO_ROOT,NO_MYSQL,NO_ODBC,NO_SQLITE,NO_MSCB), e.g. &amp;quot;make NO_ROOT=1&amp;quot; to disable ROOT. These NO_xxx Makefile variables are only used to control autodetection.&lt;br /&gt;
&lt;br /&gt;
== Install ROOTANA ==&lt;br /&gt;
&lt;br /&gt;
* cd $HOME/packages&lt;br /&gt;
* git clone https://bitbucket.org/tmidas/rootana&lt;br /&gt;
* cd rootana&lt;br /&gt;
* make&lt;br /&gt;
&lt;br /&gt;
== Install ROODY ==&lt;br /&gt;
&lt;br /&gt;
* cd $HOME/packages&lt;br /&gt;
* git clone https://bitbucket.org/tmidas/roody&lt;br /&gt;
* cd roody&lt;br /&gt;
* make&lt;br /&gt;
* $HOME/packages/roody/bin/roody, run the program&lt;br /&gt;
&lt;br /&gt;
== Build special versions of MIDAS ==&lt;br /&gt;
&lt;br /&gt;
Build special versions of MIDAS for the case when some MIDAS programs, such as VME frontends, will run on a different computer that may have a different flavour of operating system, i.e. 32-bit linux or an older version of Scientific Linux.&lt;br /&gt;
&lt;br /&gt;
* login to the computer where the frontends will run and:&lt;br /&gt;
* if it is a 32-bit linux: cd $HOME/packages/midas; make linux32&lt;br /&gt;
* if it is a 64-bit linux: cd $HOME/packages/midas; make linux64&lt;br /&gt;
&lt;br /&gt;
* login to the host computer to cross-compile ARM code:&lt;br /&gt;
* if it is an ARM linux: cd $HOME/packages/midas; make linuxarm # may need to install ARM cross compilers&lt;br /&gt;
&lt;br /&gt;
== Prepare VME hardware ==&lt;br /&gt;
&lt;br /&gt;
Hardware check list:&lt;br /&gt;
* VME crate&lt;br /&gt;
* VME processor (supported are V77xx, V7805, V7865)&lt;br /&gt;
* On all VME modules, set the VME address jumpers as described here: http://daq-plone.triumf.ca/SM/docs/local/vme_jumpers&lt;br /&gt;
* run vmescan to confirm correct VME addresses&lt;br /&gt;
** cd $HOME/packages&lt;br /&gt;
** svn checkout https://ladd00.triumf.ca/svn/daqsvn/trunk/vme&lt;br /&gt;
** cd vme&lt;br /&gt;
** make&lt;br /&gt;
** ./vmescan.exe (or _gef.exe, depending on the VME driver in use)&lt;br /&gt;
&lt;br /&gt;
== Install Universe-II VME driver (V7648, V7750, V7805, V7851) ==&lt;br /&gt;
&lt;br /&gt;
* login as root (ssh root@localhost)&lt;br /&gt;
* follow instructions: https://www.triumf.info/wiki/DAQwiki/index.php/VME-CPU#V7648.2C_V7750.2C_V7805.2C_V7851_:_Setup_vme_universe_VME_drivers&lt;br /&gt;
* cd ~/packages/vme; vmescan.exe&lt;br /&gt;
&lt;br /&gt;
== Install Tsi-148 VME driver (V7865) ==&lt;br /&gt;
&lt;br /&gt;
* login as root (ssh root@localhost)&lt;br /&gt;
* follow instructions: https://www.triumf.info/wiki/DAQwiki/index.php/VME-CPU#V7865_and_XVB-602_:_Setup_gefvme.2Ftsi148_VME_drivers&lt;br /&gt;
* cd ~/packages/vme; vmescan_gef.exe&lt;br /&gt;
&lt;br /&gt;
== Setup the experiment environment ==&lt;br /&gt;
&lt;br /&gt;
* Decide which computer will host MIDAS (where MIDAS shared memory buffers will reside). &lt;br /&gt;
: This computer will run the [[mserver]], [[mlogger]] and [[mhttpd]] applications. (It is usually the machine where the MIDAS,ROOT etc. packages have been downloaded). It will be referred to as the host machine (localhost).&lt;br /&gt;
&lt;br /&gt;
The environment is slightly different depending on whether all programs run on the host machine, or whether some programs run on remote host(s) : &lt;br /&gt;
=== ALL programs run on localhost ===&lt;br /&gt;
:If all programs run on the host machine (localhost), it is not necessary to run [[mserver]]. [[Environment Variables#MIDAS_SERVER_HOST|MIDAS_SERVER_HOST]] will not be assigned (see example .cshrc [[#Prepare the user account|above]]).&lt;br /&gt;
&lt;br /&gt;
=== Some programs run on REMOTE host(s) ===&lt;br /&gt;
: &#039;&#039;&#039;IMPORTANT:&#039;&#039;&#039; &lt;br /&gt;
# Since August 2015 &#039;&#039;&#039;you must explicitly allow access for clients running on remote machines&#039;&#039;&#039;. To do this, follow the &#039;&#039;&#039;[[Security#MIDAS programs on remote machines|instructions here]]&#039;&#039;&#039;.&lt;br /&gt;
# The example code .cshrc ([[#Prepare the user account|see above]]) should be present on both host and remote machine(s). This will ensure that [[Environment Variables#MIDAS_SERVER_HOST|MIDAS_SERVER_HOST]] will NOT be set for the host machine (localhost), but on a remote machine, MIDAS_SERVER_HOST will be set to the MIDAS host machine. &lt;br /&gt;
# The client [[mserver]] must be started on the MIDAS host machine. Note that multiple experiments can run on the same host machine by starting several instances of [[mserver]] (one for each experiment) running with different ports (and .cshrc would be edited so that MIDAS_SERVER_HOST is set to the appropriate port for the experiment).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
On the host machine:&lt;br /&gt;
* mkdir $HOME/online&lt;br /&gt;
* cd $HOME/online&lt;br /&gt;
* create directories for local programs, sources, elog and history: mkdir bin src elog history&lt;br /&gt;
* create data directory: mkdir -p /ladd/data1/t2kvme5/data; ln -s /ladd/data1/t2kvme5/data $HOME/online&lt;br /&gt;
* create the exptab file &amp;quot;$HOME/online/exptab&amp;quot; following the example below. The first entry (exptname) is the name if the DAQ system (MIDAS experiment name), the second entry (/home/USER/online) is the location of MIDAS shared memory buffers (by convention, $HOME/online), the third entry (kopio03) is your username.&lt;br /&gt;
&amp;lt;pre&amp;gt;exptname /home/kopio03/online kopio03&amp;lt;/pre&amp;gt;&lt;br /&gt;
* logout and login again for all changes to take effect&lt;br /&gt;
&lt;br /&gt;
== Setup experiment startup scripts ==&lt;br /&gt;
* login to the experiment host computer&lt;br /&gt;
* echo $MIDAS_SERVER_HOST ### to check correct value - should be blank&lt;br /&gt;
* create $HOME/online/bin/start_daq.sh, replacing XXX with the hostname of the machine running the experiment (and changing the mserver and mhttpd ports, as needed).&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 # start_daq.sh&lt;br /&gt;
 cd $HOME/online&lt;br /&gt;
 #&lt;br /&gt;
 case `hostname` in XXX*)&lt;br /&gt;
    echo &amp;quot;Good, we are on XXX!&amp;quot;&lt;br /&gt;
    ;;&lt;br /&gt;
 *)&lt;br /&gt;
    echo &amp;quot;The start_daq script should be executed on XXX&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
    ;;&lt;br /&gt;
 esac&lt;br /&gt;
 #&lt;br /&gt;
 odbedit -c clean&lt;br /&gt;
 #   start [[mhttpd]] on default port. (Mongoose https version - see [[mhttpd]] for other options)&lt;br /&gt;
 mhttpd  -D  -a localhost -a XXX.triumf.ca # optionally restrict access to specified hosts&lt;br /&gt;
 #&lt;br /&gt;
 #   start [[mserver]] on default port (use argument -p to use a different port) &lt;br /&gt;
 mserver -D   # access must now be specifically allowed - see [[#Setup the experiment environment|above]]&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:orange;&amp;quot;&amp;gt;&lt;br /&gt;
 # OR ([[#NOTES|older MIDAS versions]])&lt;br /&gt;
 # mhttpd  -p 8081 -D -a localhost -a XXX.triumf.ca      # optionally restrict access to specified hosts&lt;br /&gt;
 # mserver -p 7071 -D -a localhost -a lxdragon01.triumf.ca -a lxdragon02.triumf.ca -a XXX.triumf.ca # optionally restrict access to specified hosts&lt;br /&gt;
 &amp;lt;/span&amp;gt;&lt;br /&gt;
 #&lt;br /&gt;
 mlogger -D&lt;br /&gt;
 #end file&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Setup experiment database (ODB) ==&lt;br /&gt;
&lt;br /&gt;
* run $HOME/online/bin/start_daq.sh&lt;br /&gt;
&lt;br /&gt;
* odbedit, run these commands: (replace user names and directory names)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set &amp;quot;/Logger/Message file&amp;quot; &amp;quot;/home/kopio03/online/midas.log&amp;quot;&lt;br /&gt;
set &amp;quot;/Logger/Data Dir&amp;quot;     &amp;quot;/home/kopio03/online/data&amp;quot;&lt;br /&gt;
create STRING &amp;quot;/Logger/History dir&amp;quot;&lt;br /&gt;
set &amp;quot;/Logger/History dir&amp;quot;  &amp;quot;/home/kopio03/online/history&amp;quot;&lt;br /&gt;
create STRING &amp;quot;/Logger/Elog dir&amp;quot;&lt;br /&gt;
set &amp;quot;/Logger/Elog dir&amp;quot;     &amp;quot;/home/kopio03/online/elog&amp;quot;&lt;br /&gt;
set &amp;quot;/Logger/ODB dump file&amp;quot; &amp;quot;/home/kopio03/online/history/run%05d.xml&amp;quot;&lt;br /&gt;
set &amp;quot;/Logger/ODB dump&amp;quot; &amp;quot;y&amp;quot;&lt;br /&gt;
set &amp;quot;/Logger/Channels/0/Settings/Filename&amp;quot; &amp;quot;run%05dsub%03d.mid.gz&amp;quot;&lt;br /&gt;
set &amp;quot;/Logger/Channels/0/Settings/Subrun byte limit&amp;quot; &amp;quot;1000000000&amp;quot;&lt;br /&gt;
set &amp;quot;/Logger/Channels/0/Settings/Compression&amp;quot;   1&lt;br /&gt;
set &amp;quot;/Logger/Channels/0/Settings/ODB Dump&amp;quot; &amp;quot;y&amp;quot;&lt;br /&gt;
set &amp;quot;/Programs/Logger/Required&amp;quot; y&lt;br /&gt;
set &amp;quot;/Programs/Logger/Start command&amp;quot; &amp;quot;mlogger -D&amp;quot;&lt;br /&gt;
set &amp;quot;/Programs/fevme/Required&amp;quot; &amp;quot;y&amp;quot;&lt;br /&gt;
set &amp;quot;/Programs/fevme/Start command&amp;quot; &amp;quot;ssh -n lxdaq09 $HOME/online/src/fevme_gef.exe -O&amp;quot;&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* open web browser e.g. firefox.&lt;br /&gt;
* go to the midas status page at https://localhost:8443  (default port). &lt;br /&gt;
** if running [[mhttpd]] with Mongoose HTTPS/OpenSSL (the default) for the first time, you will need to create a password file. Follow the instructions (see [[mhttpd#HTTPS/SSL server (Mongoose)]] for details).&lt;br /&gt;
** For other options (i.e. HTTPS/SSL proxy) see [[#Secure MIDAS and ELOG Web access]] &lt;br /&gt;
*&amp;lt;span style=&amp;quot;color:orange;&amp;quot;&amp;gt;OR open the midas status page at http://localhost:8081 ([[#NOTES|older MIDAS versions]])&lt;br /&gt;
* midas status page will show most stuff &amp;quot;red&amp;quot; as nothing is running yet&lt;br /&gt;
* DON&#039;T DO THIS YET run ./fevme.exe (on the computer with the VME interface, could be different from computer hosting the experiment), observe that corresponding equipments have been created&lt;br /&gt;
* save the url bookmark to the &amp;quot;personal toolbar&amp;quot;&lt;br /&gt;
* go to the Programs page, stop mlogger, stop fevme, start mlogger, start fevme&lt;br /&gt;
* go to the Status page, start run, stop run&lt;br /&gt;
* go back to the Status page, everything should be green&lt;br /&gt;
* start a run&lt;br /&gt;
* send signals to the ADC gate&lt;br /&gt;
* you should be getting events&lt;br /&gt;
* to look at data, proceed with setting up the [[ROOTANA|ROOT Analyzer]].&lt;br /&gt;
&lt;br /&gt;
== Start DAQ programs at boot time ==&lt;br /&gt;
&lt;br /&gt;
* add this to /etc/rc.local (replace username and location of the start_daq script)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su - alpha -c /home/alpha/online/bin/start_daq.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup local software version control ==&lt;br /&gt;
&lt;br /&gt;
Version control for experiment source code is setup using &amp;quot;git&amp;quot; (http://git-scm.com/)&lt;br /&gt;
&lt;br /&gt;
* cd $HOME/online&lt;br /&gt;
* git init&lt;br /&gt;
* git add exptab&lt;br /&gt;
* git add bin/start_daq.sh&lt;br /&gt;
* git add .gitignore ### contents can be&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*~&lt;br /&gt;
*.o&lt;br /&gt;
*.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* git add src/Makefile src/*.cxx ...&lt;br /&gt;
* git commit -a&lt;br /&gt;
&lt;br /&gt;
== Adjust MIDAS buffer sizes ==&lt;br /&gt;
&lt;br /&gt;
Default MIDAS SYSTEM buffer size is 8 Mbytes, fairly small for high-data-rate experiments. The rule of thumb is to have at least a few seconds worth of buffer space available. For example, if event size is 10 Kbytes and the event rate is 1 kHz, data rate is 10*10^3*1*10^3 = 10 Mbytes/sec. To buffer 10 seconds of data we need 100 Mbytes of buffer space.&lt;br /&gt;
&lt;br /&gt;
To resize the MIDAS event buffers (SYSTEM, etc) do this:&lt;br /&gt;
* stop all frontends, stop mlogger&lt;br /&gt;
* start odbedit:&lt;br /&gt;
** cd &amp;quot;/Experiment/Buffer sizes&amp;quot;&lt;br /&gt;
** set SYSTEM 100000000&lt;br /&gt;
* run &amp;quot;mdump -z SYSTEM&amp;quot;&lt;br /&gt;
* if mdump complains about the size of .SYSTEM.SHM, remove it, try again.&lt;br /&gt;
* ls -l /dev/shm ### to observe that the size of shared memory is correct&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Secure MIDAS and ELOG Web access  ==&lt;br /&gt;
In versions prior to May 2015, the default web access to MIDAS and ELOG uses the &amp;quot;http:&amp;quot; protocol which is insecure. In this case, all information is transmitted as clear text meaning that secret, confidential and sensitive information (such as the MIDAS and ELOG passwords and usernames) can be stolen &amp;quot;easily&amp;quot;. This means that even &amp;quot;password protected&amp;quot; MIDAS and ELOG pages are not really protected if accessed using the &amp;quot;http&amp;quot; method. &lt;br /&gt;
 &lt;br /&gt;
Better security for HTTP is gained by using a password protected &#039;&#039;&#039;SSL (https) proxy&#039;&#039;&#039;. (It does not provide absolute security because of remaining problems with the security of SSL certificates, security of passwords, etc). Setting up an SSL (https) proxy is described [[#Setting up an HTTP proxy|below]].&lt;br /&gt;
&lt;br /&gt;
Since May 2015, an &#039;&#039;alternative secure option&#039;&#039; to setting up an HTTP proxy is available to users of MIDAS. Recent versions of elogd (ELOG) do support SSL https:// connections, and [[#mhttpd with HTTPS/SSL server (Mongoose)]] is now available.  This option is the default, and provides a similar level of security to an HTTP proxy. &lt;br /&gt;
&lt;br /&gt;
See [[Security#Web Access]] for a comparison of these two secure options.&lt;br /&gt;
  &lt;br /&gt;
=== mhttpd with HTTPS/SSL server (Mongoose) ===&lt;br /&gt;
&lt;br /&gt;
Since May 2015 the MIDAS web server [[mhttpd]] is explicitly linked with OpenSSL to provide secure HTTPS connections via the [https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose] web server (see [[mhttpd]]). With this version, default web access to MIDAS uses the &amp;quot;https&amp;quot; protocol. Web access to {{Utility|name=mhttpd}} can be restricted by using the  &amp;quot;-a hostname&amp;quot; switch of [[mhttpd]]. The first time {{Utility|name=mhttpd}} is run, a password file must be created. An SSL certificate is also required. See [[mhttpd#HTTPS/SSL server (Mongoose)|HTTPS/SSL server (Mongoose)]] for instructions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== mhttpd using an HTTPS/SSL proxy ===&lt;br /&gt;
An [[#Setting up an HTTP proxy|HTTP proxy]] must be set up. This is the only way of securing older version of [[mhttpd]] (pre August 2015). Older versions of mhttpd are started using the -p port option  e.g.&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt; mhttpd  -D -p 8080  &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run a new version of mhttpd using an HTTP proxy, use the options provided to run the old (non-Mongoose) webserver on a given port, i.e.&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;  mhttpd --oldserver 8080 --nomg   -D  &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When using an SSL proxy, only access from the SSL proxy (and maybe some special trusted machines) should be permitted. &lt;br /&gt;
This is done using the &amp;quot;-a hostname&amp;quot; switch of [[mhttpd]]. Normally there will be only &amp;quot;-a localhost&amp;quot; switch, enabling access only for the local machine (where the SSL proxy is running). Additional &amp;quot;-a hostname&amp;quot; switches enable access from listed local machines. No &amp;quot;-a xxx&amp;quot; enables access from everywhere (defeating the purpose of the SSL proxy, unless access controls are enforced elsewhere, i.e. by a site firewall or by local firewall rules).&lt;br /&gt;
&lt;br /&gt;
== Setting up an HTTP proxy ==&lt;br /&gt;
In this example, we use APACHE HTTPD to password-protect a typical midas/mhttpd and elog installation.&lt;br /&gt;
&lt;br /&gt;
In this configuration, one uses the Linux stock httpd that accepts encrypted https:// connections and forwards them to mhttpd and elogd. Instead of (or in addition to) using mhttpd and elogd passwords, one configures password protection in httpd via the regular apache httpd password mechanisms (htpasswd, etc).&lt;br /&gt;
&lt;br /&gt;
Recent versions of elogd do support SSL https:// connections, but if one is running an SSL proxy for anyway, it is simpler to run both through the same SSL proxy using the same SSL host certificate and the same httpd password file.&lt;br /&gt;
&lt;br /&gt;
=== Restricting http: access to elogd ===&lt;br /&gt;
;Note&lt;br /&gt;
:Recent versions of elogd do support SSL https:// connections. The following information is for those using an HTTP proxy (see above).&lt;br /&gt;
&lt;br /&gt;
For elogd, this is done using the &amp;quot;-n localhost&amp;quot; switch with enables only access from the same machine if present, or access from anywhere is absent (defeating the purpose of the SSL proxy, unless access controls are enforced elsewhere).&lt;br /&gt;
&lt;br /&gt;
(It is recommended to run elogd from the same user as the main daq user and to keep elogd.cfg and all logbooks in the home directory of this user, where they are captured by the normal site backup system)&lt;br /&gt;
&lt;br /&gt;
== Install standalone elog ==&lt;br /&gt;
&lt;br /&gt;
* login into the user account that will run the elog&lt;br /&gt;
* cd $HOME/packages&lt;br /&gt;
* git clone https://bitbucket.org/ritt/elog&lt;br /&gt;
* cd elog&lt;br /&gt;
* make&lt;br /&gt;
* create new file start_elogd with this contents:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
killall elogd&lt;br /&gt;
sleep 1&lt;br /&gt;
killall -KILL elogd&lt;br /&gt;
sleep 1&lt;br /&gt;
$HOME/packages/elog/elogd -n localhost -x -c $HOME/packages/elog/elogd.cfg -p 8082 -D&lt;br /&gt;
&lt;br /&gt;
#end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* chmod a+x start_elogd&lt;br /&gt;
* edit elogd.cfg to read:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[global]&lt;br /&gt;
port = 8082&lt;br /&gt;
SMTP host = smtp.triumf.ca&lt;br /&gt;
URL = https://titan00.triumf.ca/elog/&lt;br /&gt;
&lt;br /&gt;
Reverse sort = 1&lt;br /&gt;
Display Mode = full&lt;br /&gt;
&lt;br /&gt;
#List Menu commands = New, Find, Admin, Help&lt;br /&gt;
#Menu commands = New, Edit, Reply, Find, Duplicate, Help&lt;br /&gt;
&lt;br /&gt;
Entries Per Page = 30&lt;br /&gt;
Supress Email on edit = 1&lt;br /&gt;
Default encoding = 1&lt;br /&gt;
Page title = TITAN ELOG&lt;br /&gt;
Resolve host names = 1&lt;br /&gt;
&lt;br /&gt;
Logfile = /home/titan/packages/elog/elogd.log&lt;br /&gt;
#Logging level = 3&lt;br /&gt;
&lt;br /&gt;
[midas]&lt;br /&gt;
&lt;br /&gt;
List page Title = T2K M11 MIDAS ELOG&lt;br /&gt;
Comment = T2K M11 MIDAS ELOG&lt;br /&gt;
Page Title = T2K M11 MIDAS ELOG&lt;br /&gt;
RSS Title = [$logbook - $type - $system] $subject, posted by $author&lt;br /&gt;
&lt;br /&gt;
Attributes = Author, Subject, Run, Type, System&lt;br /&gt;
Show Attributes Edit = Run, Author, Subject, Type, System&lt;br /&gt;
Required Attributes = Author, Type, System, Subject&lt;br /&gt;
&lt;br /&gt;
Options Type = Routine, Reply, Shift Summary, Modification, Question, Info, Problem&lt;br /&gt;
Options System = General, DAQ, Beamline&lt;br /&gt;
&lt;br /&gt;
Preset Run = $shell(MIDASSYS=. /home/t2km11/packages/midas/linux/bin/odbedit -d Runinfo -c &#039;ls -v \&amp;quot;run number\&amp;quot;&#039;)&lt;br /&gt;
&lt;br /&gt;
Preset On Reply Type = Reply&lt;br /&gt;
Preset On Reply Run = $shell(MIDASSYS=. /home/t2km11/packages/midas/linux/bin/odbedit -d Runinfo -c &#039;ls -v \&amp;quot;run number\&amp;quot;&#039;)&lt;br /&gt;
&lt;br /&gt;
List Display = Date, Subject, Type, System, Author, ID&lt;br /&gt;
Quick Filter = Date, Type, ID&lt;br /&gt;
&lt;br /&gt;
Remove on reply = Author&lt;br /&gt;
Quote on reply = 1&lt;br /&gt;
&lt;br /&gt;
Use lock = 1&lt;br /&gt;
&lt;br /&gt;
************* Email Functionality ****************&lt;br /&gt;
&lt;br /&gt;
Use Email Subject = [T2KM11 - $System] $Subject&lt;br /&gt;
Omit Email To = 1&lt;br /&gt;
&lt;br /&gt;
Email System General = xxx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* ./start_elogd &amp;amp;&lt;br /&gt;
* firefox http://localhost:8082 # hould show the elog message index&lt;br /&gt;
&lt;br /&gt;
To start elogd automatically when the machine is rebooted, login as root and&lt;br /&gt;
* add this text to /etc/rc.local:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
su - titan -c &amp;quot;/home/titan/packages/elog/start_elogd&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* chmod a+x /etc/rc.local&lt;br /&gt;
* systemctl start rc-local&lt;br /&gt;
&lt;br /&gt;
To import elog entries from the mhttpd elog, do this:&lt;br /&gt;
&lt;br /&gt;
* cd ~/packages/elog/logbooks&lt;br /&gt;
* ln -s /home/t2km11/online/elog midas&lt;br /&gt;
* cd midas&lt;br /&gt;
* ~/packages/elog/elconv)&lt;br /&gt;
&lt;br /&gt;
== Install https proxy ==&lt;br /&gt;
&lt;br /&gt;
* login as root to the https proxy machine&lt;br /&gt;
* cd ~root&lt;br /&gt;
* yum install mod_ssl&lt;br /&gt;
* yum install crypto-utils # see http://www.triumf.info/wiki/DAQwiki/index.php/SLinstall#Enable_monitoring_of_HTTPS_certificates&lt;br /&gt;
* create a certificate request (replace ladd09 with your hostname): openssl req -new -nodes -newkey rsa:2048 -sha256 -out ladd09.csr -keyout ladd09.key (answer: CA, BC, Vancouver, TRIUMF, DAQ, ladd09.triumf.ca, email@email.com&lt;br /&gt;
* sign it by TRIUMF:&lt;br /&gt;
** mail -s &amp;quot;Certificate request&amp;quot; yourself@email.com &amp;amp;lt; ladd09.csr&lt;br /&gt;
** forward this request to Andrew Daviel&lt;br /&gt;
** he will email the signed crt file, copy it to this system as ladd09.crt&lt;br /&gt;
* sign it yourself: openssl x509 -req -days 365 -sha256 -in ladd09.csr -signkey ladd09.key -out ladd09.crt&lt;br /&gt;
* (if the certificate expires, renew it by signing it again)&lt;br /&gt;
* Additional commands for working with certificates:&lt;br /&gt;
** explore the private key: openssl pkey -in ladd09.key -text -noout&lt;br /&gt;
** explore the certificate request: openssl req -in ladd00.csr -text -noout&lt;br /&gt;
** explore the certificate: openssl x509 -in ladd09.crt -noout -text&lt;br /&gt;
* move certificate files to proper system locations:&lt;br /&gt;
* mv ladd09.key  /etc/pki/tls/private/&lt;br /&gt;
* mv ladd09.crt /etc/pki/tls/certs/&lt;br /&gt;
* if selinux is enabled, do this:&lt;br /&gt;
** restorecon -Rv /etc/pki/tls/certs/&lt;br /&gt;
** restorecon -Rv /etc/pki/tls/private/&lt;br /&gt;
** /usr/sbin/setsebool -P httpd_can_network_connect 1&lt;br /&gt;
* open /etc/httpd/conf.d/ssl.conf in a text editor, go to the very bottom and right before the &amp;quot;&amp;lt;/VirtualHost&amp;gt;&amp;quot; entry, add following text:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
SSLCertificateFile /etc/pki/tls/certs/ladd09.crt &lt;br /&gt;
SSLCertificateKeyFile /etc/pki/tls/private/ladd09.key &lt;br /&gt;
&lt;br /&gt;
ProxyPass /elog/ http://localhost:8082/ retry=1&lt;br /&gt;
ProxyPass /      http://localhost:8080/ retry=1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Location /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SSLRequireSSL&lt;br /&gt;
AuthType Basic&lt;br /&gt;
AuthName &amp;quot;password protected site&amp;quot;&lt;br /&gt;
Require valid-user&lt;br /&gt;
&lt;br /&gt;
# create password file: touch /etc/httpd/htpasswd&lt;br /&gt;
# to add new user or change password: htpasswd /etc/httpd/htpasswd username&lt;br /&gt;
AuthUserFile /etc/httpd/htpasswd&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/Location&amp;gt;&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* comment out duplicate &amp;quot;SSLCertificateFile&amp;quot; and &amp;quot;SSLCertificateKeyFile&amp;quot; elsewhere in the file&lt;br /&gt;
* (optionally) If you got a certificate that is signed by DigiCert or RapidSSL then you&#039;ll need to add a line specifying the certificate chain file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
SSLCertificateChainFile /etc/pki/tls/certs/DigiCertCA.crt&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* touch /etc/httpd/htpasswd&lt;br /&gt;
* htpasswd /etc/httpd/htpasswd midas # enter password midas&lt;br /&gt;
* chkconfig httpd on&lt;br /&gt;
* service httpd restart&lt;br /&gt;
* firewall-cmd --add-port=443/tcp --permanent&lt;br /&gt;
* firewall-cmd --reload&lt;br /&gt;
* firewall-cmd --list-all&lt;br /&gt;
* test it&lt;br /&gt;
** test the SSL proxy: https://host/ should yield the midas status page, https://host/elog/ should yield the elog message index&lt;br /&gt;
* in ODB, set &amp;quot;/Elog/URL&amp;quot; to &amp;quot;https://host/elog/&amp;quot;&lt;br /&gt;
* now from the midas status page, the &amp;quot;Elog&amp;quot; button should take us to the https Elog URL&lt;br /&gt;
&lt;br /&gt;
In needed, enable user directories: https://blah/~user in ~user/public_html&lt;br /&gt;
&lt;br /&gt;
* edit /etc/httpd/conf.d/userdir.conf, replace &amp;quot;UserDir disabled&amp;quot; with &amp;quot;UserDir enabled&amp;quot;&lt;br /&gt;
* setsebool -P httpd_enable_homedirs true&lt;br /&gt;
* systemctl restart httpd&lt;br /&gt;
&lt;br /&gt;
== Setup the history mhttpd for faster access to history plots ==&lt;br /&gt;
When running an SSL proxy,&lt;br /&gt;
* start the main mhttpd (&amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;orange&amp;lt;/span&amp;gt; command for old mhttpd, &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;green&amp;lt;/span&amp;gt; for new mhttpd with Mongoose(post August2015):&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&amp;quot;mhttpd -p 8071 -D&amp;quot; &amp;lt;/span&amp;gt;  or  &lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt; &amp;quot;mhttpd  -D --oldserver 8071 --nomg&amp;quot; &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* start the history mhttpd&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt; &amp;quot;mhttpd -p 8072 -D -H&amp;quot;&amp;lt;/span&amp;gt; or&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt; &amp;quot;mhttpd  -D -H --oldserver 8072 --nomg&amp;quot; &amp;lt;/span&amp;gt;&lt;br /&gt;
* set ODB /History/URL to &amp;quot;http://alphacpc09.cern.ch:8072/HS/&amp;quot;&lt;br /&gt;
* open the MIDAS status page&lt;br /&gt;
* go to the history section, try to open any history plot, observe that the history plot gif image loads correctly, inspect it&#039;s URL (use &amp;quot;copy image URL&amp;quot; or &amp;quot;view source&amp;quot;, etc), it should point to port 8072 causing connection to the history mhttpd.&lt;br /&gt;
* continue with these instructions to setup history mhttpd access through an SSL proxy:&lt;br /&gt;
* setup SSL proxy access (required mod_proxy_html)&lt;br /&gt;
** login as root to the SSL proxy machine&lt;br /&gt;
** on SL5, install the missing mod_proxy_html httpd module:&lt;br /&gt;
** yum install httpd-devel libxml2-devel&lt;br /&gt;
** wget http://apache.webthing.com/mod_proxy_html/mod_proxy_html.tar.bz2&lt;br /&gt;
** tar xjvf mod_proxy_html.tar.bz2 &lt;br /&gt;
** cd mod_proxy_html&lt;br /&gt;
** apxs -c -I. -I/usr/include/libxml2 -i mod_proxy_html.c &lt;br /&gt;
** apxs -c -I. -I/usr/include/libxml2 -i mod_xml2enc.c&lt;br /&gt;
** cd /etc/httpd/conf.d, add this to ssl.conf:&lt;br /&gt;
&lt;br /&gt;
;before the ProxyPass statements:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# proxy the MIDAS web servers  &lt;br /&gt;
LoadModule  xml2enc_module       modules/mod_xml2enc.so  &lt;br /&gt;
LoadModule  proxy_html_module    modules/mod_proxy_html.so  &lt;br /&gt;
ProxyHTMLLinks  a               href  &lt;br /&gt;
ProxyHTMLLinks  link            href  &lt;br /&gt;
ProxyHTMLLinks  img             src  &lt;br /&gt;
#ProxyHTMLEnable On  &lt;br /&gt;
ProxyRequests off  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
;after the ProxyPass statements:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ALPHA1 history access &lt;br /&gt;
ProxyPass /alpha1/history/   http://alphacpc09.cern.ch:8072/HS/  retry=1 &lt;br /&gt;
ProxyPass /alpha1/           http://alphacpc09.cern.ch:8071/     retry=1 &lt;br /&gt;
 &lt;br /&gt;
ProxyHTMLEnable On  &lt;br /&gt;
ProxyHTMLURLMap http://alphacpc09.cern.ch:8072/HS/ /alpha1/history/ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
;adjust:&lt;br /&gt;
*&amp;quot;alpha1&amp;quot; is the experiment name&lt;br /&gt;
*&amp;quot;alphacpc09.cern.ch&amp;quot; is the machine running mhttpd&lt;br /&gt;
*&amp;quot;8071&amp;quot; is the port number of the main mhttpd &lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&amp;quot;mhttpd -p 8071 -D&amp;quot; &amp;lt;/span&amp;gt;  or  &lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt; &amp;quot;mhttpd  -D --oldserver 8071 --nomg&amp;quot; &amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;quot;8072&amp;quot; is the port number of the history mhttpd &lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&amp;quot;mhttpd -p 8072 -D -H&amp;quot; &amp;lt;/span&amp;gt;  or  &lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt; &amp;quot;mhttpd  -D -H --oldserver 8072 --nomg&amp;quot; &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]] [[Category:Buffer]] [[Category:Driver]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Security&amp;diff=2529</id>
		<title>Security</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Security&amp;diff=2529"/>
		<updated>2016-06-13T23:04:04Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
= Links =&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:3;-moz-column-count:3;-webkit-column-count:3&amp;quot;&amp;gt;&lt;br /&gt;
* [[mhttpd]] web server&lt;br /&gt;
* [[odbedit]]&lt;br /&gt;
* [[/Experiment ODB tree #/Experiment/Security |/Experiment/Security]] ODB subtree&lt;br /&gt;
* [[mserver]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
= Access Control to a MIDAS experiment =&lt;br /&gt;
&lt;br /&gt;
Historically, by default there has been no restriction for any user to connect locally or remotely to a given experiment.  This has now changed (August 2015). &lt;br /&gt;
The Web Server [[mhttpd]] by default now requires an SSL Certificate and a username and password (see [[#Web Access]]).&lt;br /&gt;
&lt;br /&gt;
Other network security issues have also been addressed (see  [https://midas.triumf.ca/elog/Midas/1088 Note 1088]). Changes to [[mserver]] (August 2015) make the default behaviour to reject all external network connections ([https://midas.triumf.ca/elog/Midas/1090 Note 1090]), so that only programs running on the localhost will be allowed. To allow access from remote machines, the user will have to take action as described [[#MIDAS programs on remote machines|below]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Web Access ==&lt;br /&gt;
In versions prior to May 2015, the default web access to MIDAS and ELOG uses the &amp;quot;http:&amp;quot; protocol which is insecure. In this case, all information is transmitted as clear text meaning that secret, confidential and sensitive information (such as the MIDAS and ELOG passwords and usernames) can be stolen &amp;quot;easily&amp;quot;. This means that even &amp;quot;password protected&amp;quot; MIDAS and ELOG pages are not adequately protected if accessed using the &amp;quot;http&amp;quot; method. Until now, an SSL (https) proxy had to be set up to provide reasonable security for experiments.&lt;br /&gt;
&lt;br /&gt;
Recent versions of elogd (ELOG) do support SSL https:// connections, and&lt;br /&gt;
the Web Server [[mhttpd]] has recently (May 2015) been updated to use OpenSSL to provide secure HTTPS connections via the [https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose] web server. This limits access by default, by requiring a username and password - see [[mhttpd#HTTPS/SSL server (Mongoose)|HTTPS/SSL server (Mongoose)]] for more information. This option provides a similar level of security to an HTTP proxy.&lt;br /&gt;
 &lt;br /&gt;
=== Which security option to choose? ===&lt;br /&gt;
&lt;br /&gt;
For a small operation that does not require root access to the host computer, mhttpd with mongoose is a good light weight solution. It is ideal for small experiments that until now have been using the &amp;quot;http:&amp;quot; protocol for mhttpd.&lt;br /&gt;
&lt;br /&gt;
For a more elaborate setup with private networks etc., APACHE https proxy is probably better. For big experiments, resources like webcams,ganglia, couchdb, etc. also need password protection and APACHE https can provide all this.&lt;br /&gt;
&lt;br /&gt;
=== Which one is easier to setup? ===&lt;br /&gt;
&lt;br /&gt;
*  mhttpd with mongoose is fairly simple - you have to create a password file and provide a properly signed https certificate - see [[mhttpd#HTTPS/SSL server (Mongoose)|HTTPS/SSL server (Mongoose)]]&lt;br /&gt;
*  apache httpd is fairly straightforward if you follow well written instructions (such as we provide for using it with midas), but you do need root access and you do have to edit a good number of config files. Note that mhttpd with mongoose can be run with an SSL proxy - see [[Setup MIDAS experiment#using an HTTPS/SSL proxy]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== MIDAS programs running on localhost ==&lt;br /&gt;
&lt;br /&gt;
Out-of-the-box MIDAS is now secure (August 2015). By default, connections from the outside are not possible.  MIDAS RPC TCP ports are bound to the localhost interface.&lt;br /&gt;
This configuration is suitable for testing MIDAS on a laptop and for running a simple experiment where all programs run on one machine.&lt;br /&gt;
MIDAS ports (except for the mhttpd web ports) do not show up on network port scans.&lt;br /&gt;
&lt;br /&gt;
The change in binding UDP ports is generally incompatible with previous versions of MIDAS, so all MIDAS programs should be rebuild and restarted. If rebuilding all MIDAS programs is &lt;br /&gt;
impossible see  [https://midas.triumf.ca/elog/Midas/1090 Note 1090]).&lt;br /&gt;
&lt;br /&gt;
[[mserver]] will still work in this localhost-restricted configuration - one should use  &amp;quot;[[odbedit]] -h localhost&amp;quot; to connect. Multiple mserver instances on &lt;br /&gt;
the same machine - using different TCP ports via &amp;quot;-p&amp;quot; and ODB [[/Experiment ODB tree#midas server port|/Experiment/midas server port]] - are still supported.&lt;br /&gt;
&lt;br /&gt;
== MIDAS programs on remote machines ==&lt;br /&gt;
&lt;br /&gt;
To run MIDAS programs on remote machines the following is now required:&lt;br /&gt;
# change the ODB setting [[/Experiment ODB tree#Enable non-localhost RPC|/Experiment/Security/Enable non-localhost RPC]] to &amp;quot;yes&amp;quot; and restart [[mserver]]&lt;br /&gt;
# add the hostnames of all remote machines that will run MIDAS programs to the MIDAS RPC access control list in ODB key [[/Experiment ODB tree#Allowed hosts|/Experiment/Security/RPC hosts/Allowed hosts]].&lt;br /&gt;
&lt;br /&gt;
To avoid &amp;quot;guessing&amp;quot; the host names expected by MIDAS, follow the following procedure: &lt;br /&gt;
* On the local machine (&amp;quot;daq06&amp;quot;) set ODB key &amp;quot;enable non-localhost rpc&amp;quot; to &amp;quot;yes&amp;quot; and restart the [[mserver]] (step 1 above)&lt;br /&gt;
* go to the remote machine (&amp;quot;ladd21&amp;quot;) and try to start the MIDAS program, i.e. &amp;quot;[[odbedit]] -h daq06&amp;quot;. This will bomb and there will be a message in the [[Message System#midas.log|Midas log file]] rejecting the connection from unallowed host &#039;ladd21.triumf.ca&#039;. &lt;br /&gt;
* Add this host to &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;/Experiment/Security/RPC hosts/Allowed hosts&amp;lt;/span&amp;gt;. &lt;br /&gt;
* After you add this hostname to &amp;lt;span style=&amp;quot;color: purple; font-style:italic;&amp;quot;&amp;gt;RPC hosts&amp;lt;/span&amp;gt;, you should see messages in the [[Message System#midas.log|Midas log file]] about reloading the access control list&lt;br /&gt;
* try connecting again, it should work now.&lt;br /&gt;
 &lt;br /&gt;
;NOTE&lt;br /&gt;
If MIDAS clients have to connect from random hosts (i.e. dynamically assigned random DHCP addresses), one can disable the host name checks by setting ODB key [[/Experiment ODB tree#Disable RPC hosts check|/experiment/security/Disable RPC hosts check]] to &amp;quot;yes&amp;quot;. This configuration is insecure and should only be done on a private network behind a firewall.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= ODB access control =&lt;br /&gt;
Note that &#039;&#039;&#039;other forms of ODB access control&#039;&#039;&#039; independent of these security features is also available which can protect the experiment from accidental access by authorized users:&lt;br /&gt;
*    Write access can be restricted while a run is in progress (see [[Lock when running]] )&lt;br /&gt;
*    Individual keys or subtrees in the experiment&#039;s ODB can be set &amp;quot;read only&amp;quot; with the [[odbedit]] command chmod.&lt;br /&gt;
*    [[Custom Page|Custom web pages]] can provide experimenters with access to a subset of ODB keys necessary for the experiment. By [[Status Page#suppressed|hiding]] the [[ODB Page]] access button, the ODB can be protected from non-expert access via the web server.   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
------------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:whitesmoke&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Security on OLDER (pre-August 2015) versions of MIDAS =&lt;br /&gt;
&lt;br /&gt;
Versions of MIDAS older than August 2015 are vulnerable to malicious/unauthorized access. Network security on old versions can be enhanced by implementing a &#039;&#039;&#039;firewall&#039;&#039;&#039; and/or restrictions on off-site access. This kind of security can be provided by [[Setup MIDAS experiment#Setting up an HTTP proxy|setting up an HTTP proxy]] to [[mhttpd]] .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Protect experiment from accidental access (old MIDAS versions) ==&lt;br /&gt;
&lt;br /&gt;
The MIDAS system provides a means to setup access restrictions using the ODB in order to protect the experiment from accidental or unauthorized access. &#039;&#039;&#039;This will not stop malicious or determined hackers&#039;&#039;&#039; but may prevent mistakes by authorized users.  These security features are still available, but their usefulness has largely been superceded by the improved security features implemented August 2015 (see [[#Access Control to a MIDAS experiment]]);&lt;br /&gt;
&lt;br /&gt;
There are two levels of access restriction available each of which can be enabled independently:&lt;br /&gt;
&lt;br /&gt;
*    To restrict write access via the web by requiring a password before any parameter can be changed.&lt;br /&gt;
*    To require a password before MIDAS clients can start running on the host.&lt;br /&gt;
&lt;br /&gt;
The user can select either or both of these security features.&lt;br /&gt;
&lt;br /&gt;
== Restrict user access (old MIDAS versions) ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE: this is not proof against malicious access.&#039;&#039;&#039; See [[#Access Control to a MIDAS experiment]].&lt;br /&gt;
&lt;br /&gt;
The ODB [[/Experiment ODB tree #/Experiment/Security |/Experiment/Security]] subtree can also be used to restrict access to the experiment via the Web. This subtree is automatically created (if not already present) when the   {{Odbedit cmd|cmd=webpasswd}} is issued as follows:&lt;br /&gt;
&lt;br /&gt;
  C:\online&amp;gt;odbedit&lt;br /&gt;
  [local:Default:S]/&amp;gt;cd Experiment/&lt;br /&gt;
  [local]/&amp;gt;webpasswd&lt;br /&gt;
  Password:&amp;lt;xxxx&amp;gt;&lt;br /&gt;
  Retype password:&amp;lt;xxxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the {{Odbedit cmd|cmd=webpasswd}}, a new ODB key i.e. [[/Experiment ODB tree #/Experiment/Security/Web Password |/Experiment/Security/Web Password]] will &lt;br /&gt;
be present containing the encrypted web password.&lt;br /&gt;
&lt;br /&gt;
If this web access restriction is set up, the user will be requested to provide the &amp;quot;Web Password&amp;quot; when accessing the requested experiment in &amp;quot;Write Access&amp;quot; mode. The &amp;quot;Read Only Access&amp;quot; mode is still available to all users of older versions of [[mhttpd]], or those who supply the username and password now required by [[mhttpd]] (May 2015). &lt;br /&gt;
&lt;br /&gt;
 [local:bnqr:S]/Experiment&amp;gt;ls Security/&lt;br /&gt;
 Web Password                    pon4@#@%SSDF2&lt;br /&gt;
&lt;br /&gt;
== Restrict client access (old MIDAS versions) ==&lt;br /&gt;
&#039;&#039;&#039;NOTE: this is not proof against malicious access.&#039;&#039;&#039; See [[#Access Control to a MIDAS experiment]].&lt;br /&gt;
&lt;br /&gt;
In order to restrict accidental access to the experiment, a password mechanism can to be defined. This is provided by the [[/Experiment ODB tree #/Experiment/Security |/Experiment/Security]] subtree in odb. This subtree is automatically created (if not already present) when the [[odbedit]] command passwd is issued as follows:&lt;br /&gt;
&lt;br /&gt;
  C:\online&amp;gt;odbedit&lt;br /&gt;
  [local:Default:S]/&amp;gt;cd Experiment/&lt;br /&gt;
  [local]/&amp;gt;passwd&lt;br /&gt;
  Password:&amp;lt;xxxx&amp;gt;&lt;br /&gt;
  Retype password:&amp;lt;xxxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After running the {{Odbedit cmd|cmd=passwd}}, the  {{Odbpath|path=/Experiment/Security}} subtree will be present.&lt;br /&gt;
&lt;br /&gt;
=== Allowing access without password (old MIDAS versions) ===&lt;br /&gt;
NOTE: This feature has been superceded by [[#Access Control to a MIDAS experiment]] for [[mhttpd]] versions May 2015 or later.&lt;br /&gt;
&lt;br /&gt;
While  [[#Restrict client access|restricting access]] can make sense to deny access to outsider to a given experiment, it can be annoying for the people working directly at the back-end computer or for an automatic frontend reloading mechanism. To address this problem, specific hosts and clients can be exempt from having to supply a password before being granted full access.&lt;br /&gt;
&lt;br /&gt;
==== Allowed hosts (old MIDAS versions) ====&lt;br /&gt;
NOTE: This feature has been superceded by [[#Access Control to a MIDAS experiment]] for [[mhttpd]] versions May 2015 or later.&lt;br /&gt;
&lt;br /&gt;
Hostnames to be allowed full access to the ODB are listed in the [[/Experiment ODB tree #/Experiment/Security/Allowed hosts subtree |/Experiment/Security/Allowed hosts]] subtree, e.g.&lt;br /&gt;
&lt;br /&gt;
  [local]/&amp;gt;cd &amp;quot;/Experiment/Security/Allowed hosts&amp;quot;&lt;br /&gt;
  [local]rhosts&amp;gt;create int myhost.domain&lt;br /&gt;
  [local]rhosts&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;myHost.domain&amp;gt; is to be replaced by the full IP address of the host requesting full clearance, e.g &amp;quot;pierre.triumf.ca&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Allowed programs (old MIDAS versions) ====&lt;br /&gt;
NOTE: This feature has been superceded by [[#Access Control to a MIDAS experiment]] for [[mhttpd]] versions May 2015 or later.&lt;br /&gt;
&lt;br /&gt;
Programs (i.e. clients) to be allowed full access to the ODB (regardless of the node on which they are running) can be listed in the&lt;br /&gt;
[[/Experiment ODB tree #/Experiment/Security/Allowed programs subtree |/Experiment/Security/Allowed programs]] subtree, &lt;br /&gt;
&lt;br /&gt;
  [local]/&amp;gt;cd &amp;quot;/Experiment/Security/Allowed programs&amp;quot;&lt;br /&gt;
  [local]:S&amp;gt;create int mstat&lt;br /&gt;
  [local]:S&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;  &amp;lt;!-- obsolescent - silver --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Security]] [[Category:Experiment]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Mhttpd&amp;diff=2528</id>
		<title>Mhttpd</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Mhttpd&amp;diff=2528"/>
		<updated>2016-06-13T22:58:17Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
= Links =&lt;br /&gt;
{{mhttpdpages3|[[Mhttpd.js|MIDAS Javascript Library]]|[[odbedit]]|[[Security]]}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Purpose =&lt;br /&gt;
The {{Utility|name=mhttpd}} utility runs the &#039;&#039;&#039;MIDAS Web Server&#039;&#039;&#039; which allows the user to communicate with an experiment using any web browser. It is used primarily for run control. &lt;br /&gt;
&lt;br /&gt;
= Web security =&lt;br /&gt;
As part of the recent upgrade to MIDAS [[Security]], the MIDAS Web Server {{Utility|name=mhttpd}} is now (May 2015) explicitly linked with OpenSSL to provide secure HTTPS connections via the [https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose] web server.  To connect to an experiment using {{Utility|name=mhttpd}}, a username and password are required.&lt;br /&gt;
By default, users can connect from anywhere, providing they know the correct username and password. However, &#039;&#039;&#039;web access can be restricted&#039;&#039;&#039; by using the {{Utility|name=mhttpd}} access control list in the ODB at [[/Experiment ODB tree#mhttpd hosts subtree|Allowed hosts]], and/or by using the &amp;quot;-a&amp;quot; argument to  {{Utility|name=mhttpd}}.&lt;br /&gt;
&lt;br /&gt;
Alternatively, {{Utility|name=mhttpd}} can be run securely behind an Apache HTTPS proxy (see [[Security]] for details). In this case, the Mongoose/OpenSSL web server should be disabled using the arguments supplied to  {{Utility|name=mhttpd}} - see [[#To start the webserver using the oldserver|starting the web server using the oldserver]].&lt;br /&gt;
&lt;br /&gt;
The option of building  {{Utility|name=mhttpd}} without OpenSSL is also supported (see [https://midas.triumf.ca/elog/Midas/1069]). &lt;br /&gt;
 &lt;br /&gt;
= Arguments =&lt;br /&gt;
       -h connect to midas server [[mserver]] on given host&lt;br /&gt;
       -e experiment to connect to&lt;br /&gt;
       -v display verbose HTTP communication&lt;br /&gt;
       -D become a daemon&lt;br /&gt;
       -E only display ELog system&lt;br /&gt;
       -H only display history plots&lt;br /&gt;
       -a only allow access for specific host(s), several [-a Hostname] statements might be given (default list&lt;br /&gt;
                   in ODB at [[/Experiment ODB tree#mhttpd hosts subtree|/Experiment/security/mhttpd hosts/allowed hosts]])&lt;br /&gt;
       --http port - bind to specified HTTP port (default is ODB [[/Experiment ODB tree#midas http port|/Experiment/midas http port]])&lt;br /&gt;
       --https port - bind to specified HTTPS port (default is ODB [[/Experiment ODB tree#midas https port|/Experiment/midas https port]])&lt;br /&gt;
       --nomg use the old mhttpd web server&lt;br /&gt;
       --oldserver [port] - use the old web server on given port&lt;br /&gt;
       --nooldserver - do not use the old mhttpd web server&lt;br /&gt;
       -help display usage information&lt;br /&gt;
 &lt;br /&gt;
 If using an old version (before May 2015), see [[#Insecure (pre-May 2015) versions|old server]] argument list.      &lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
== To start the webserver using HTTPS/SSL (Mongoose) ==&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd&amp;quot;&#039;&#039; or &lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd -v&amp;quot;&#039;&#039; to get debug information, or&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd -D&amp;quot;&#039;&#039; to run in the background&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd -a myHost1 -a myHost2&amp;quot;&#039;&#039; to restrict web access&lt;br /&gt;
All are equivalent to&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd --https 8443 --http 8080&amp;quot;&#039;&#039;&lt;br /&gt;
Starting {{Utility|name=mhttpd}} like this will redirect the default HTTP port of 8080 to the secure HTTPS port 8443. If the ports are not supplied, the default ports will be read from the ODB keys [[/Experiment ODB tree#midas http port|midas http port]] and [[/Experiment ODB tree#midas https port|midas https port]]. If ports are supplied, their values will overwrite the default values stored in the ODB. When {{Utility|name=mhttpd}} is started with a secure port for the first time, a password file (and optionally an SSL certificate)  need to be created. See [[#HTTPS/SSL server (Mongoose)|mhttpd HTTPS/SSL server]] for more information.&lt;br /&gt;
&lt;br /&gt;
If {{Utility|name=mhttpd}} is started on IP host machine &amp;quot;myhost&amp;quot; using the default ports, the [[#Features|&#039;&#039;Midas status page&#039;&#039;]] can be accessed by pointing a web browser to &lt;br /&gt;
* https://myhost.mydomain:8443&lt;br /&gt;
* or to http://myhost.mydomain:8080 which will be redirected automatically to https://myhost.mydomain:8443&lt;br /&gt;
&lt;br /&gt;
The automatic redirect may be convenient for users who are used to using {{Utility|name=mhttpd}} with a particular HTTP port (e.g. 8080) for their experiment. The redirect can be disabled by setting the ODB key [[/Experiment ODB tree#http redirect to https|http redirect to https]] to &amp;quot;n&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Multiple experiments ===&lt;br /&gt;
If [[Exptab|multiple experiments]] run on the same host, a web server for each experiment must be started on a different port, e.g.&lt;br /&gt;
*           &#039;&#039;&amp;quot;mhttpd -e expt1 -D&amp;quot;&#039;&#039;                           use default ports&lt;br /&gt;
*           &#039;&#039;&amp;quot;mhttpd -e expt2 --http 8081 --https 8444 -D&amp;quot;&#039;&#039;  use supplied ports&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  To start the webserver using the oldserver  ==&lt;br /&gt;
To run a new version of {{Utility|name=mhttpd}} using the old server (i.e. NOT the Mongoose/HTTPS server)&lt;br /&gt;
* &#039;&#039;&amp;quot;mhttpd --oldserver 8081 --nomg&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This command is useful for running new versions of {{Utility|name=mhttpd}} using an Apache HTTPS proxy (see [[Security]]).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Features =&lt;br /&gt;
The Midas web server {{Utility|name=mhttpd}} provides a means for run control including monitoring of the run parameters.&lt;br /&gt;
Its main feature is a web page invoked through any web browser accessing the Midas experimental URL at a defined port (see [[#Usage|Usage]]).  &lt;br /&gt;
&lt;br /&gt;
The contents of this &#039;&#039;&#039;Midas status page&#039;&#039;&#039; is composed with minimal information relative to the experiment. It contains a collection of buttons and links to other pages to further describe and control the configuration of the experiment. &lt;br /&gt;
&lt;br /&gt;
* Minimal display on the main [[Status Page]]&lt;br /&gt;
** Experiment name, time &amp;amp; date, page refresh rate&lt;br /&gt;
** Standard Menu Buttons (see below)&lt;br /&gt;
** User defined buttons (e.g. alias links, run scripts, custom pages etc.)&lt;br /&gt;
** run comments and condition display section (if enabled)&lt;br /&gt;
** Equipment list with current running condition, number of event received, event rate, data rate for each equipment.&lt;br /&gt;
** Data logging statistics (number of event recorded, data size recorder, compression factor, usage storage level) if enabled. &lt;br /&gt;
** Secondary Data logging (data mover) with statistics if enabled.&lt;br /&gt;
** Single line of the most recent Midas message.&lt;br /&gt;
** Table of the current applications connected to this experiment.&lt;br /&gt;
&lt;br /&gt;
* Standard Menu Buttons&lt;br /&gt;
** Transition the state of the run (stopped/running/paused), allows user running condition parameters to be entered at the start state (see [[Edit-on-start Parameters]]).&lt;br /&gt;
** Access to the full [[Online Database]] for data display and/or data content modification. &lt;br /&gt;
** Display the [[Message Page]], which shows messages generated by the MIDAS [Message System]] as well as the user using cm_msg() functions.&lt;br /&gt;
** Access to [[ELOG Page]] switches to the predefined &amp;quot;electronic logbook&amp;quot;.&lt;br /&gt;
** Access to the [[Alarms Page]] for monitoring the different type of alarms (evaluated, programs, internals, periodic).&lt;br /&gt;
** Access to the [[Programs Page]]  for a status or interaction with the current running applications part of the Midas experiment.&lt;br /&gt;
** Access to the [[History Page]] for graphical data representation of any ODB variables and acquired data.&lt;br /&gt;
** Access to the Midas Slow Control Bus devices [[MSCB Page]] connected to this experiment.&lt;br /&gt;
** Access to the [[Sequencer Page]] control/monitoring page for [[Sequencer]] i.e. interactive loading/saving/running of a run sequence based on any ODB parameters.&lt;br /&gt;
** Access to the [[Chat Page]] for communication between users on the same experiment.&lt;br /&gt;
** Access to the [[Help Page]] with short-cut to the Midas Help documentation resource and other information.&lt;br /&gt;
* Links&lt;br /&gt;
** links to all the listed equipments invoking a dedicated page for the display and possible control of the equipment parameters.&lt;br /&gt;
** link to the logger configuration (if present) for the data recording.&lt;br /&gt;
** link to the possible secondary logging configuration parameters (if present).&lt;br /&gt;
&lt;br /&gt;
Other features include a JSON interface and Javascript library used for implementing interactive [[Custom Page|custom pages]] for MIDAS experiments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= HTTPS/SSL server (Mongoose) =&lt;br /&gt;
&lt;br /&gt;
The HTTPS/SSL  ([https://bitbucket.org/tmidas/midas/src/ecb9a8537448a8a43f7f9a2bfdb82e578208cde3/doc/mongoose/?at=develop Mongoose]) server is activated by running {{Utility|name=mhttpd}}, and by default it listens on ports 8080 and 8443 (see [[#Usage]]).  &lt;br /&gt;
&lt;br /&gt;
{{Utility|name=mhttpd}} with Mongoose requires an &#039;&#039;&#039;SSL Certificate&#039;&#039;&#039; and a &#039;&#039;&#039;password file&#039;&#039;&#039;.  Ideally, an SSL Certificate issued by a well-known authority trusted by your browser should be used.&lt;br /&gt;
&lt;br /&gt;
The first time {{Utility|name=mhttpd}} is run, if it does not find an SSL Certificate, it will print instructions on how to [[#Create an SSL certificate|create a self-signed SSL Certificate]]. If it finds no existing password file, it will then print instructions on how to [[#Create a password file|create a password file]] (see below for examples).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Create an SSL certificate ==&lt;br /&gt;
If no [[#HTTPS/SSL server (Mongoose)|more secure]] SSL Certificate is available, then create a self-signed certificate by running {{Utility|name=mhttpd}},&lt;br /&gt;
and following the printed instructions :&lt;br /&gt;
 [user@dasdevpc2 test]$ mhttpd&lt;br /&gt;
 Web server will listen on ports &amp;quot;8080r,8443s&amp;quot;&lt;br /&gt;
 [mhttpd,ERROR] [mhttpd.cxx:17086:mongoose,ERROR] cannot find SSL certificate file &amp;quot;/home/user/online/test/ssl_cert.pem&amp;quot;&lt;br /&gt;
 [mhttpd,ERROR] [mhttpd.cxx:17087:mongoose,ERROR] please create SSL certificate file: openssl req -new -nodes -newkey rsa:2048&lt;br /&gt;
 -sha256 -out  ssl_cert.csr -keyout ssl_cert.key; openssl x509 -req -days 365 -sha256 -in ssl_cert.csr -signkey ssl_cert.key &lt;br /&gt;
 -out ssl_cert.pem; cat ssl_cert.key &amp;gt;&amp;gt; ssl_cert.pem&lt;br /&gt;
 could not start the mongoose web server, see messages and midas.log, bye!&lt;br /&gt;
&lt;br /&gt;
The certificate and key should be placed in one PEM file called ssl_cert.pem located in either MIDAS environment variables [[MIDAS environment variables#MIDAS_DIR|MIDAS_DIR]] or [[MIDAS environment variables#MIDASSYS|MIDASSYS]], and the permissions on the file should be 600  or only owner read/write.&lt;br /&gt;
 [user@dasdevpc2 test] chmod 600 ssl_cert.pem&lt;br /&gt;
&lt;br /&gt;
== Create a password file ==&lt;br /&gt;
Once a valid certificate is generated, when  {{Utility|name=mhttpd}} is restarted, you will need to create a password file. &lt;br /&gt;
   &lt;br /&gt;
 [user@dasdevpc2 test]$ mhttpd&lt;br /&gt;
 Web server will listen on ports &amp;quot;8080r,8443s&amp;quot;&lt;br /&gt;
 Web server will use SSL certificate file &amp;quot;/home/user/online/test/ssl_cert.pem&amp;quot;&lt;br /&gt;
 [mhttpd,ERROR] [mhttpd.cxx:17137:mongoose,ERROR] mongoose web server cannot find password file &amp;quot;/home/user/online/test/htpasswd.txt&amp;quot;&lt;br /&gt;
 [mhttpd,ERROR] [mhttpd.cxx:17138:mongoose,ERROR] please create password file: htdigest -c /home/user/online/test/htpasswd.txt test midas&lt;br /&gt;
 could not start the mongoose web server, see messages and midas.log, bye!&lt;br /&gt;
&lt;br /&gt;
Each person who is to have access to the experiment should create their own username and password. The first user (e.g. mary) creates the password file e.g. htpasswd.txt&lt;br /&gt;
 [user@dasdevpc2 test]$ htdigest -c /home/user/online/test/htpasswd.txt test mary&lt;br /&gt;
 Adding password for mary in realm test.&lt;br /&gt;
 New password:&lt;br /&gt;
 Re-type new password:&lt;br /&gt;
 [user@dasdevpc2 test]$ mhttpd&lt;br /&gt;
 Web server will listen on ports &amp;quot;8080r,8443s&amp;quot;&lt;br /&gt;
 Web server will use SSL certificate file &amp;quot;/home/user/online/test/ssl_cert.pem&amp;quot;&lt;br /&gt;
 Web server will use authentication realm &amp;quot;test&amp;quot;, password file &amp;quot;./htpasswd.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Access to the [[#Features|&#039;&#039;Midas status page&#039;&#039;]] can be obtained by pointing a web browser to &lt;br /&gt;
 https://myhost.mydomain:8443&lt;br /&gt;
The first time you connect you will be asked for a username and password. &lt;br /&gt;
Now that the password file has been created, subsequent users may create their own username and password in the same file by omitting &amp;quot;-c&amp;quot; argument in htdigest, e.g.&lt;br /&gt;
  htdigest  /home/user/online/test/htpasswd.txt test john&lt;br /&gt;
&lt;br /&gt;
Web access can be restricted to certain hosts if desired (see [[#Web security]]).&lt;br /&gt;
 &lt;br /&gt;
Documentation for the version of mongoose included with MIDAS can be found at [http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/mongoose/ Mongoose documentation]. &lt;br /&gt;
&lt;br /&gt;
For more information see [https://midas.triumf.ca/elog/Midas/1062 Elog note 1062]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
--------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color:whitesmoke; font-size:90%&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= HTTP only (pre-May 2015) versions =&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
* HTTP-only (pre-May2015) versions of mhttpd should only be used &#039;&#039;&#039;behind a firewall&#039;&#039;&#039;&lt;br /&gt;
* If Web [[Security]] is an issue, update to the latest version of mhttpd which uses HTTPS/OpenSSL.&lt;br /&gt;
&lt;br /&gt;
== Arguments (old version) ==&lt;br /&gt;
&lt;br /&gt;
    -p port        : port number e.g. 8080 (no default). See [[#Usage|usage]].&lt;br /&gt;
   [-h hostname ]  : see [[Common Parameters to MIDAS Utilities]]&lt;br /&gt;
   [-e experiment] : see [[Common Parameters to MIDAS Utilities]]&lt;br /&gt;
   [-v]            : display verbose HTTP communication&lt;br /&gt;
   [-D]            : starts program as a daemon&lt;br /&gt;
   [-E]            : only display ELog system&lt;br /&gt;
   [-H]            : only display history plots&lt;br /&gt;
   [-a hostname]   : only allow access for specific host(s). Several [-a Hostname] statements might be given&lt;br /&gt;
   [-help]  &lt;br /&gt;
&lt;br /&gt;
== Usage (old version) ==  &lt;br /&gt;
The command &#039;&#039;&#039;mhttpd -p port&#039;&#039;&#039; can be used to start the web server (http version). In this case, the TCP/IP port number is &#039;&#039;&#039;required&#039;&#039;&#039; as an argument in order to listen to the web-based request.&lt;br /&gt;
&amp;lt;br&amp;gt;e.g. if mhttpd is started on IP host machine &amp;quot;myhost&amp;quot; on port 8081 as follows&lt;br /&gt;
: mhttpd -p 8081 -D&lt;br /&gt;
access to the [[#Features|&#039;&#039;Midas status page&#039;&#039;]] can be obtained by pointing a web browser to &lt;br /&gt;
 http://myhost.mydomain:8081&lt;br /&gt;
&lt;br /&gt;
;Note &lt;br /&gt;
If [[Exptab|multiple experiments]] run on the same host, a web server for each experiment must be started on a different port, e.g.&lt;br /&gt;
           mhttpd -e expt1 -p 8081 -D&lt;br /&gt;
           mhttpd -e expt2 -p 8082 -D&lt;br /&gt;
&lt;br /&gt;
== Improve Security with SSL Proxy ==&lt;br /&gt;
Improved security for HTTP is gained by using an SSL (https) proxy. See [[Setup MIDAS experiment#mhttpd with HTTP|Setting up an SSL proxy]].&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Utilities]]&lt;br /&gt;
[[Category:Web server mhttpd]]&lt;br /&gt;
[[Category:Run control]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Common_Parameters_to_MIDAS_Utilities&amp;diff=2527</id>
		<title>Common Parameters to MIDAS Utilities</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Common_Parameters_to_MIDAS_Utilities&amp;diff=2527"/>
		<updated>2016-06-09T02:36:25Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Common Input Parameters =&lt;br /&gt;
Each of the [[Application listing|MIDAS utilities]] define a number of input parameters. The following parameters are common to many :&lt;br /&gt;
&lt;br /&gt;
;  [-e &amp;lt;exptname&amp;gt; ] :specifies the [[MIDAS Experiment Name|MIDAS Experiment]] to connect to (where multiple experiments are defined on the MIDAS host (see [[exptab]]). &lt;br /&gt;
* This option supersedes the default experiment name given by the environment variable [[Environment Variables#MIDAS_EXPT_NAME|MIDAS_EXPT_NAME]] , if defined. &lt;br /&gt;
* If multiple experiments are defined, unless  [[Environment Variables#MIDAS_EXPT_NAME|MIDAS_EXPT_NAME]] is defined or this argument is supplied, the application will request the experiment name.&lt;br /&gt;
* If the environment variable [[Environment Variables#MIDAS_DIR|MIDAS_DIR]] is defined (i.e. single default experiment), both the &#039;&#039;exptname&#039;&#039;  input parameter  and environment variable [[Environment Variables#MIDAS_EXPT_NAME|MIDAS_EXPT_NAME]] will be superseded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; [-h &amp;lt;hostname&amp;gt; ]  : connect to midas server [[mserver]] on given host &#039;&#039;hostname&#039;&#039;, i.e. specifies the [[MIDAS Host Name |MIDAS Host]] to connect to when connecting to an experiment running on a &#039;&#039;&#039;remote&#039;&#039;&#039; host. If the experiment is running on the &#039;&#039;&#039;local&#039;&#039;&#039; host, this argument need not be supplied.&lt;br /&gt;
&lt;br /&gt;
* If &#039;&#039;hostname&#039;&#039; &#039;&#039;&#039;is&#039;&#039;&#039; supplied :&lt;br /&gt;
** &#039;&#039;hostname&#039;&#039;  must be a valid IP host name. &lt;br /&gt;
** &#039;&#039;hostname&#039;&#039; supersedes the default hostname given by the environment variable [[Environment Variables#MIDAS_SERVER_HOST|MIDAS_SERVER_HOST]] , if defined.  &lt;br /&gt;
** the [[mserver]] utility &#039;&#039;&#039;must&#039;&#039;&#039; be running on the remote host.&lt;br /&gt;
* If more than one copy of &amp;lt;span style=&amp;quot;color:darkcyan;font-style:italic&amp;quot;&amp;gt;mserver&amp;lt;/span&amp;gt; is running, the  &amp;lt;span style=&amp;quot;color:darkcyan;font-style:italic&amp;quot;&amp;gt;mserver&amp;lt;/span&amp;gt; portname must be specified, e.g.&lt;br /&gt;
 odbedit -h myhost:1173 -e myexpt -c &amp;quot;ls /Experiment&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
* If the environment variable [[Environment Variables#MIDAS_DIR|MIDAS_DIR]] is defined (i.e. single default experiment), both the &#039;&#039;hostname&#039;&#039; input parameter  and environment variable  [[Environment Variables#MIDAS_SERVER_HOST|MIDAS_SERVER_HOST]] will be superseded.&lt;br /&gt;
&lt;br /&gt;
[[Category:Utilities]] [[Category:Appendices]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Start_Page&amp;diff=2459</id>
		<title>Start Page</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Start_Page&amp;diff=2459"/>
		<updated>2016-03-10T02:01:55Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Pagelinks}}&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
{{mhttpdpages1|[[Message System]]}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Purpose =&lt;br /&gt;
The purpose of the [[mhttpd]] Start page is to&lt;br /&gt;
display the run number &#039;&#039;and any defined [[Edit-on-start Parameters]]&#039;&#039; for the user to optionally edit, prior to the run starting.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Access the Start page =&lt;br /&gt;
The Start Page is accessed from the [[Status Page]] (or one of the other Pages) by clicking on the menu-button&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: #444444; background-color: #CCCCCC; font-style:italic; font-size: 90; padding:0.25em;&lt;br /&gt;
	padding-left: 0.5em;padding-right: 0.5em;border:1px solid #808080;border-radius: 5px;margin-bottom:1px;&amp;quot;&amp;gt;Start&amp;lt;/span&amp;gt; i.e. by &#039;&#039;&#039;starting a run&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:If &amp;quot;Start&amp;quot; button is not present on the Status Page, it may have been [[Status Page#page-switch-buttons|suppressed]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
Figure 1 shows examples of the Start page with and without  [[Edit-on-start Parameters]] defined.  Note that in Figure 1c the edit-on-start parameter &amp;quot;number of cycles&amp;quot; has a &#039;&#039;&#039;parameter comment&#039;&#039;&#039; associated with it (see [[Edit-on-start Parameters#edit-on-start parameter comments|defining parameter comments]]).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;  cellpadding=&amp;quot;50&amp;quot; cellspacing=&amp;quot;50&amp;quot;&lt;br /&gt;
|+ Figure 1 Start Page&lt;br /&gt;
|-&lt;br /&gt;
!Figure 1a No edit-on-start parameters defined !! Figure 1b One edit-on-start parameters defined&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Mhstart1.gif|border|400px|Figure 1a: No edit-on-start parameters defined ]]|| [[File:Mhstart.gif|border|400px|Figure 1b: One edit-on-start parameter defined ]] &lt;br /&gt;
|-&lt;br /&gt;
!colspan=2|Figure 1c: Many edit-on-start parameters defined&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[File:Mhstart2.gif|left|border|1000px|Figure 1c: Many edit-on-start parameters defined]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:mhttpd Pages]]&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
	<entry>
		<id>https://daq00.triumf.ca/MidasWiki/index.php?title=Template:Mhttpdpages&amp;diff=2458</id>
		<title>Template:Mhttpdpages</title>
		<link rel="alternate" type="text/html" href="https://daq00.triumf.ca/MidasWiki/index.php?title=Template:Mhttpdpages&amp;diff=2458"/>
		<updated>2016-03-10T02:00:35Z</updated>

		<summary type="html">&lt;p&gt;Suz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
Usage: {{mhttpdpages}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:5;-moz-column-count:5;-webkit-column-count:5&amp;quot;&amp;gt;&lt;br /&gt;
* [[mhttpd|mhttpd web server]]&lt;br /&gt;
* [[Status Page]]&lt;br /&gt;
* [[Start Page]]&lt;br /&gt;
* [[ODB Page]]&lt;br /&gt;
* [[Message Page]]&lt;br /&gt;
* [[Programs Page]]&lt;br /&gt;
* [[Alarms Page]]&lt;br /&gt;
* [[History Page]]&lt;br /&gt;
* [[ELOG Page]]&lt;br /&gt;
* [[Chat Page]]&lt;br /&gt;
* [[Help Page]]&lt;br /&gt;
* [[Config Page]]&lt;br /&gt;
* [[Custom Page]]&lt;br /&gt;
* [[MSCB Page]]&lt;br /&gt;
* [[Sequencer Page]]&lt;br /&gt;
* [[odbedit]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Suz</name></author>
	</entry>
</feed>