text:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE appref SYSTEM "appref.dtd">

<appref>

    <copyright>
      <year>1997</year><year>2016</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

    </legalnotice>

    <title>snmp</title>
    <prepared></prepared>
    <responsible></responsible>
    <docno></docno>
    <approved></approved>
    <checked></checked>
    <date></date>
    <rev></rev>
    <file>snmp.xml</file>

  <app>snmp</app>
  <appsummary>The SNMP Application</appsummary>
  <description>

This chapter describes the <c>snmp</c>
    application in OTP.  The SNMP application provides the following
    services:

    <list type="bulleted">
      <item>

a multilingual extensible SNMP agent

      </item>
      <item>

a SNMP manager

      </item>
      <item>

a MIB compiler

      </item>
    </list>

  </description>

    <marker id="configuration_params"></marker>
    <title>Configuration</title>

The following configuration parameters are defined for the SNMP
      application. Refer to application(3) for more information about
      configuration parameters.

The snmp part of the config file specifying the configuration
      parameters is basically the following tuple:

      {snmp, snmp_components_config()}

A minimal config file for starting a node with both a manager
      and an agent:

      [{snmp,
        [{agent, [{db_dir, "/tmp/snmp/agent/db"},
                  {config, [{dir, "/tmp/snmp/agent/conf"}]}]},
         {manager, [{config, [{dir, "/tmp/snmp/manager/conf"},
                              {db_dir, "/tmp/snmp/manager/db"}]}]}]}
        ]
       }
      ].

Each snmp component has its own set of configuration parameters,
      even though some of the types are common to both components.

      snmp_components_config() -> [snmp_component_config()]
      snmp_component_config() -> {agent, agent_options()} | {manager, manager_options()}
      agent_options() = [agent_option()]
      agent_option() = {restart_type,     restart_type()}     |
                       {agent_type,       agent_type()}       |
                       {agent_verbosity,  verbosity()}        |
                       {discovery,        agent_discovery()}  |
                       {versions,         versions()}         |
                       {gb_max_vbs,       gb_max_vbs()}       |
                       {priority,         priority()}         |
                       {multi_threaded,   multi_threaded()}   |
                       {db_dir,           db_dir()}           |
                       {db_init_error,    db_init_error()}    |
                       {local_db,         local_db()}         |
                       {net_if,           agent_net_if()}     |
                       {mibs,             mibs()}             |
                       {mib_storage,      mib_storage()}      |
                       {mib_server,       mib_server()}       |
                       {audit_trail_log,  audit_trail_log()}  |
                       {error_report_mod, error_report_mod()} |
                       {note_store,       note_store()}       |
                       {symbolic_store,   symbolic_store()}   |
                       {target_cache,     target_cache()}     |
                       {config,           agent_config()}
      manager_options() = [manager_option()]
      manager_option() = {restart_type,             restart_type()}    |
                         {net_if,                   manager_net_if()}  |
                         {server,                   server()}          |
                         {note_store,               note_store()}      |
                         {config,                   manager_config()}  |
                         {inform_request_behaviour, manager_irb()}     |
                         {mibs,                     manager_mibs()}    |
                         {priority,                 priority()}        |
                         {audit_trail_log,          audit_trail_log()} |
                         {versions,                 versions()}        |
                         {def_user_mod,             def_user_module()  |
                         {def_user_data,            def_user_data()}

    <marker id="agent_opts_and_types"></marker>

Agent specific config options and types:

    <taglist>
      <tag><marker id="agent_type"></marker>
        <c><![CDATA[agent_type() = master | sub <optional>]]></c></tag>
      <item>

If <c>master</c>, one master agent is
          started. Otherwise, no agents are started.

Default is <c>master</c>.

      </item>

      <tag><marker id="agent_disco"></marker>
        <c><![CDATA[agent_discovery() = [agent_discovery_opt()] <optional>]]></c></tag>
      <item>

<c>agent_discovery_opt() =
          {terminating, agent_terminating_discovery_opts()} |
          {originating, agent_originating_discovery_opts()}</c>

The <c>terminating</c> options effects discovery initiated by
          a manager.

The <c>originating</c> options effects discovery initiated
          by this agent.

For defaults see the options in <c>agent_discovery_opt()</c>.

      </item>

      <tag><marker id="agent_term_disco_opts"></marker>
        <c><![CDATA[agent_terminating_discovery_opts() = [agent_terminating_discovery_opt()] <optional>]]></c></tag>
      <item>

<c>agent_terminating_discovery_opt() =
          {enable, boolean()} |
          {stage2, discovery | plain} |
          {trigger_username, string()}</c>

These are options effecting discovery <c>terminating</c> in this
          agent (i.e. initiated by a manager).

The default values for the <c>terminating</c>
          discovery options are:

        <list type="bulleted">
          <item>enable: <c>true</c></item>
          <item>stage2: <c>discovery</c></item>
          <item>trigger_username: <c>""</c></item>
        </list>
      </item>

      <tag><marker id="agent_orig_disco_opts"></marker>
        <c><![CDATA[agent_originating_discovery_opts() = [agent_originating_discovery_opt()] <optional>]]></c></tag>
      <item>

<c>agent_originating_discovery_opt() =
          {enable, boolean()}</c>

These are options effecting discovery <c>originating</c> in this
          agent.

The default values for the <c>originating</c>
          discovery options are:

        <list type="bulleted">
          <item>enable: <c>true</c></item>
        </list>
      </item>

      <tag><marker id="agent_mt"></marker>
        <c><![CDATA[multi_threaded() = bool() <optional>]]></c></tag>
      <item>

If <c>true</c>, the agent is multi-threaded, with one
          thread for each get request.

Default is <c>false</c>.

      </item>

      <tag><marker id="agent_data_dir"></marker>
        <c><![CDATA[db_dir() = string() <mandatory>]]></c></tag>
      <item>

Defines where the SNMP agent internal db files are stored.

      </item>

      <tag><marker id="agent_gb_max_vbs"></marker>
        <c><![CDATA[gb_max_vbs() = pos_integer() | infinity <optional>]]></c></tag>
      <item>

Defines the maximum number of varbinds allowed
	in a Get-BULK response.

Default is <c>1000</c>.

      </item>

      <tag><marker id="agent_local_db"></marker>
        <c><![CDATA[local_db() = [local_db_opt()] <optional>]]></c></tag>
      <item>

<c>local_db_opt() = {repair, agent_repair()} | {auto_save, agent_auto_save()} |   {verbosity, verbosity()}</c>

Defines options specific for the SNMP agent local database.

For defaults see the options in <c>local_db_opt()</c>.

      </item>

      <tag><marker id="agent_ldb_repair"></marker>
        <c><![CDATA[agent_repair() = false | true | force <optional>]]></c></tag>
      <item>

When starting snmpa_local_db it always tries to open an
          existing database. If <c>false</c>, and some errors occur, a new
          database is created instead. If <c>true</c>, an existing file
          will be repaired. If <c>force</c>, the table will be repaired
          even if it was properly closed.

Default is <c>true</c>.

      </item>

      <tag><marker id="agent_ldb_auto_save"></marker>
        <c><![CDATA[agent_auto_save() = integer() | infinity <optional>]]></c></tag>
      <item>

The auto save interval. The table is flushed to disk
          whenever not accessed for this amount of time.

Default is <c>5000</c>.

      </item>

      <tag><marker id="agent_net_if"></marker>
        <c><![CDATA[agent_net_if() = [agent_net_if_opt()] <optional>]]></c></tag>
      <item>

<c>agent_net_if_opt() = {module, agent_net_if_module()} |  {verbosity, verbosity()} |  {options, agent_net_if_options()}</c>

Defines options specific for the SNMP agent network interface
          entity.

For defaults see the options in <c>agent_net_if_opt()</c>.

      </item>

      <tag><marker id="agent_ni_module"></marker>
        <c><![CDATA[agent_net_if_module() = atom() <optional>]]></c></tag>
      <item>

Module which handles the network interface part for the
          SNMP agent. Must implement the
          <seealso marker="snmpa_network_interface">snmpa_network_interface</seealso> behaviour.

Default is <c>snmpa_net_if</c>.

      </item>

      <tag><marker id="agent_ni_opts"></marker>
        <c><![CDATA[agent_net_if_options() = [agent_net_if_option()] <optional>]]></c></tag>
      <item>

<c>agent_net_if_option() = {bind_to, bind_to()} |
            {sndbuf, sndbuf()} |
            {recbuf, recbuf()} |
            {no_reuse, no_reuse()} |
	    {req_limit, req_limit()} |
            {filter, agent_net_if_filter_options()}</c>

These options are actually specific to the used module.
          The ones shown here are applicable to the default
          <c>agent_net_if_module()</c>.

For defaults see the options in <c>agent_net_if_option()</c>.

      </item>

      <tag><marker id="agent_ni_req_limit"></marker>
        <c><![CDATA[req_limit() = integer() | infinity <optional>]]></c></tag>
      <item>

Max number of simultaneous requests handled by the agent.

Default is <c>infinity</c>.

      </item>

      <tag><marker id="agent_ni_filter_opts"></marker>
        <c><![CDATA[agent_net_if_filter_options() = [agent_net_if_filter_option()] <optional>]]></c></tag>
      <item>

<c>agent_net_if_filter_option() = {module, agent_net_if_filter_module()}</c>

These options are actually specific to the used module.
	  The ones shown here are applicable to the default
	  <c><![CDATA[agent_net_if_filter_module()]]></c>.

For defaults see the options in
          <c>agent_net_if_filter_option()</c>.

      </item>

      <tag><marker id="agent_ni_filter_module"></marker>
        <c><![CDATA[agent_net_if_filter_module() = atom() <optional>]]></c></tag>
      <item>

Module which handles the network interface filter part for the
	  SNMP agent. Must implement the
	  <seealso marker="snmpa_network_interface_filter">snmpa_network_interface_filter</seealso> behaviour.

Default is <c>snmpa_net_if_filter</c>.

      </item>

      <tag><marker id="agent_mibs"></marker>
        <c><![CDATA[agent_mibs() = [string()] <optional>]]></c></tag>
      <item>

Specifies a list of MIBs (including path) that defines which MIBs
          are initially loaded into the SNMP master agent.

Note that the following mibs will always be loaded:

        <list type="bulleted">
          <item>version v1: <c>STANDARD-MIB</c></item>
          <item>version v2: <c>SNMPv2</c></item>
          <item>version v3: <c>SNMPv2</c>, <c>SNMP-FRAMEWORK-MIB</c>
           and <c>SNMP-MPD-MIB</c></item>
        </list>

Default is <c>[]</c>.

      </item>

      <tag><marker id="agent_mib_storage"></marker>
        <c><![CDATA[mib_storage() = [mib_storage_opt()] <optional>]]></c></tag>
      <item>

<c>mib_storage_opt() = {module, mib_storage_module()} |  {options, mib_storage_options()}</c>

This option specifies how basic mib data is stored.
	This option is used by two parts of the snmp agent:
	The mib-server and the symbolic-store.

Default is <c>[{module, snmpa_mib_storage_ets}]</c>.

      </item>

      <tag><marker id="agent_mst_module"></marker>
        <c><![CDATA[mib_storage_module() = snmpa_mib_data_ets | snmpa_mib_data_dets | snmpa_mib_data_mnesia | module()]]></c></tag>
      <item>

Defines the mib storage module of the SNMP agent as defined by the
	<seealso marker="snmpa_mib_storage">snmpa_mib_storage</seealso>
	behaviour.

Several entities (<c>mib-server</c> via the its data module and
	the <c>symbolic-store</c>) of the snmp agent uses this for storage
	of miscelaneous mib related data retrieved while loading a mib.

There are several implementations provided with the agent:
	<c>snmpa_mib_storage_ets</c>, <c>snmpa_mib_storage_dets</c> and
	<c>snmpa_mib_storage_mnesia</c>.

Default module is <c>snmpa_mib_storage_ets</c>.

      </item>

      <tag><marker id="agent_mst_options"></marker>
        <c><![CDATA[mib_storage_options() = list() <optional>]]></c></tag>
      <item>

This is implementattion depended. That is, it depends on the
	module. For each module a specific set of options are valid.
	For the module provided with the app, these options are supported:

        <list type="bulleted">
          <item>

<c>snmpa_mib_storage_ets</c>: <c>{dir, filename()} | {action, keep | clear}, {checksum, boolean()}</c>

	    <list>
	      <item>

<c>dir</c> - If present, points to a directory where a file
		to which all data in the ets table is "synced".

Also, when a table is opened this file is read,
		if it exists.

By default, this will not be used.

	      </item>
	      <item>

<c>action</c> - Specifies the behaviour when a non-empty
		file is found: Keep its content or clear it out.

Default is <c>keep</c>.

	      </item>
	      <item>

<c>checksum</c> - Defines if the file is checksummed
		or not.

Default is <c>false</c>.

	      </item>
	    </list>
	  </item>
          <item>

<c>snmpa_mib_storage_dets</c>: <c>{dir, filename()} | {action, keep | clear}, {auto_save, default | pos_integer()} | {repair, force | boolean()}</c>

	    <list>
	      <item>

<c>dir</c> - This mandatory option points to a
		directory where to place the file of a dets table.

	      </item>
	      <item>

<c>action</c> - Specifies the behaviour when a non-empty
		file is found: Keep its content or clear it out.

Default is <c>keep</c>.

	      </item>
	      <item>

<c>auto_save</c> - Defines the dets auto-save frequency.

Default is <c>default</c>.

	      </item>
	      <item>

<c>repair</c> - Defines the dets repair behaviour.

Default is <c>false</c>.

	      </item>
	    </list>
	  </item>
          <item>

<c>snmpa_mib_storage_mnesia</c>: <c>{action, keep | clear}, {nodes, [node()]}</c>

	    <list>
	      <item>

<c>action</c> - Specifies the behaviour when a non-empty,
		already existing, table: Keep its content or clear it out.

Default is <c>keep</c>.

	      </item>
	      <item>

<c>nodes</c> - A list of node names (or an atom
		describing a list of nodes) defining where to open the table.
		Its up to the user to ensure that mnesia is actually running
		on the specified nodes.

The following distinct values are recognised:

		<list>
		  <item>

<c>[]</c> - Translated into a list of the own node: <c>[node()]</c>

		  </item>
		  <item>

<c>all</c> - <c>erlang:nodes()</c>

		  </item>
		  <item>

<c>visible</c> - <c>erlang:nodes(visible)</c>

		  </item>
		  <item>

<c>connected</c> - <c>erlang:nodes(connected)</c>

		  </item>
		  <item>

<c>db_nodes</c> - <c>mnesia:system_info(db_nodes)</c>

		  </item>
		</list>

Default is the result of the call: <c>erlang:nodes()</c>.

	      </item>
	    </list>
	  </item>
        </list>
      </item>

      <tag><marker id="agent_mib_server"></marker>
        <c><![CDATA[mib_server() = [mib_server_opt()] <optional>]]></c></tag>
      <item>

<c>mib_server_opt() = {mibentry_override, mibentry_override()} |  {trapentry_override, trapentry_override()} |  {verbosity, verbosity()} | {cache, mibs_cache()} | {data_module, mib_server_data_module()}</c>

Defines options specific for the SNMP agent mib server.

For defaults see the options in <c>mib_server_opt()</c>.

      </item>

      <tag><marker id="agent_ms_meo"></marker>
        <c><![CDATA[mibentry_override() = bool() <optional>]]></c></tag>
      <item>

If this value is false, then when loading a mib each mib-
          entry is checked prior to installation of the mib.
          The purpose of the check is to prevent that the same symbolic
          mibentry name is used for different oid's.

Default is <c>false</c>.

      </item>

      <tag><marker id="agent_ms_teo"></marker>
        <c><![CDATA[trapentry_override() = bool() <optional>]]></c></tag>
      <item>

If this value is false, then when loading a mib each trap
          is checked prior to installation of the mib.
          The purpose of the check is to prevent that the same symbolic
          trap name is used for different trap's.

Default is <c>false</c>.

      </item>

      <tag><marker id="agent_ms_data_module"></marker>
        <c><![CDATA[mib_server_data_module() = snmpa_mib_data_tttn | module() <optional>]]></c></tag>
      <item>

Defines the backend data module of the SNMP agent mib-server as
	defined by the
	<seealso marker="snmpa_mib_data">snmpa_mib_data</seealso>
	behaviour.

At present only the default module is provided with the agent,
	<c>snmpa_mib_data_tttn</c>.

Default module is <c>snmpa_mib_data_tttn</c>.

      </item>

      <tag><marker id="agent_ms_cache"></marker>
        <c><![CDATA[mibs_cache() = bool() | mibs_cache_opts() <optional>]]></c></tag>
      <item>

Shall the agent utilize the mib server lookup cache or not.

Default is <c>true</c> (in which case the <c>mibs_cache_opts()</c>
          default values apply).

      </item>

      <tag><marker id="agent_ms_cache_opts"></marker>
        <c><![CDATA[mibs_cache_opts() = [mibs_cache_opt()] <optional>]]></c></tag>
      <item>

<c>mibs_cache_opt() = {autogc, mibs_cache_autogc()} | {gclimit, mibs_cache_gclimit()} | {age, mibs_cache_age()}</c>

Defines options specific for the SNMP agent mib server cache.

For defaults see the options in <c>mibs_cache_opt()</c>.

      </item>

      <tag><marker id="agent_ms_cache_autogc"></marker>
        <c><![CDATA[mibs_cache_autogc() = bool() <optional>]]></c></tag>
      <item>

Defines if the mib server shall perform cache gc automatically or
	leave it to the user (see
	<seealso marker="snmpa#gc_mibs_cache">gc_mibs_cache/0,1,2,3</seealso>).

Default is <c>true</c>.

      </item>

      <tag><marker id="agent_ms_cache_age"></marker>
        <c><![CDATA[mibs_cache_age() = integer() > 0 <optional>]]></c></tag>
      <item>

Defines how old the entries in the cache will be allowed
	to become before they are GC'ed (assuming GC is performed).
	Each entry in the cache is "touched" whenever it is accessed.

The age is defined in milliseconds.

Default is <c>10 timutes</c>.

      </item>

      <tag><marker id="agent_ms_cache_gclimit"></marker>
        <c><![CDATA[mibs_cache_gclimit() = integer() > 0 | infinity <optional>]]></c></tag>
      <item>

When performing a GC, this is the max number of cache entries
	that will be deleted from the cache.

The reason for having this limit is that if the cache is
	large, the GC can potentially take a long time, during which
	the agent is locked.

Default is <c>100</c>.

      </item>

      <tag><marker id="agent_error_report_mod"></marker>
        <c><![CDATA[error_report_mod() = atom() <optional>]]></c></tag>
      <item>

Defines an error report module, implementing the
          <seealso marker="snmpa_error_report">snmpa_error_report</seealso>
          behaviour. Two modules are provided with the toolkit:
          <c>snmpa_error_logger</c> and <c>snmpa_error_io</c>.

Default is <c>snmpa_error_logger</c>.

      </item>

      <tag><marker id="agent_symbolic_store"></marker>
        <c>symbolic_store() = [symbolic_store_opt()]</c></tag>
      <item>

<c>symbolic_store_opt() = {verbosity, verbosity()}</c>

Defines options specific for the SNMP agent symbolic store.

For defaults see the options in <c>symbolic_store_opt()</c>.

      </item>

      <tag><marker id="agent_target_cache"></marker>
        <c>target_cache() = [target_cache_opt()]</c></tag>
      <item>

<c>target_cache_opt() = {verbosity, verbosity()}</c>

Defines options specific for the SNMP agent target cache.

For defaults see the options in <c>target_cache_opt()</c>.

      </item>

      <tag><marker id="agent_config"></marker>
        <c><![CDATA[agent_config() = [agent_config_opt()] <mandatory>]]></c></tag>
      <item>

<c>agent_config_opt() = {dir, agent_config_dir()} |  {force_load, force_load()} | {verbosity, verbosity()}</c>

Defines specific config related options for the SNMP agent.

For defaults see the options in <c>agent_config_opt()</c>.

      </item>

      <tag><marker id="agent_config_dir"></marker>
        <c><![CDATA[agent_config_dir = dir() <mandatory>]]></c></tag>
      <item>

Defines where the SNMP agent configuration files are stored.

      </item>

      <tag><marker id="agent_force_load"></marker>
        <c><![CDATA[force_load() = bool() <optional>]]></c></tag>
      <item>

If <c>true</c> the configuration files are re-read
          during start-up, and the contents of the configuration
          database ignored.  Thus, if <c>true</c>, changes to
          the configuration database are lost upon reboot of the
          agent.

Default is <c>false</c>.

      </item>
    </taglist>

    <marker id="manager_opts_and_types"></marker>

Manager specific config options and types:

    <taglist>
      <tag><marker id="manager_server"></marker>
        <c><![CDATA[server() = [server_opt()] <optional>]]></c></tag>
      <item>

<c>server_opt() = {timeout, server_timeout()} |  {verbosity, verbosity()}</c>

Specifies the options for the manager server process.

Default is <c>silence</c>.

      </item>

      <tag><marker id="manager_server_timeout"></marker>
        <c><![CDATA[server_timeout() = integer() <optional>]]></c></tag>
      <item>

Asynchronous request cleanup time. For every requests,
          some info is stored internally, in order to be able to
          deliver the reply (when it arrives) to the proper destination.
          If the reply arrives, this info will be deleted. But if
          there is no reply (in time), the info has to be deleted
          after the best before time has been passed.
          This cleanup will be performed at regular intervals, defined
          by the <c>server_timeout()</c> time.
          The information will have an best before time,
          defined by the <c>Expire</c> time given when calling the
          request function (see
          <seealso marker="snmpm#async_get">async_get</seealso>,
          <seealso marker="snmpm#async_get_next">async_get_next</seealso> and
          <seealso marker="snmpm#async_set">async_set</seealso>).

Time in milli-seconds.

Default is <c>30000</c>.

      </item>

      <tag><marker id="manager_config"></marker>
        <c><![CDATA[manager_config() = [manager_config_opt()] <mandatory>]]></c></tag>
      <item>

<c>manager_config_opt() = {dir, manager_config_dir()} |  {db_dir, manager_db_dir()} |  {db_init_error, db_init_error()} |  {repair, manager_repair()} |  {auto_save, manager_auto_save()} |  {verbosity, verbosity()}</c>

Defines specific config related options for the SNMP manager.

For defaults see the options in <c>manager_config_opt()</c>.

      </item>

      <tag><marker id="manager_config_dir"></marker>
        <c><![CDATA[manager_config_dir = dir() <mandatory>]]></c></tag>
      <item>

Defines where the SNMP manager configuration files are stored.

      </item>

      <tag><marker id="manager_config_db_dir"></marker>
        <c><![CDATA[manager_db_dir = dir() <mandatory>]]></c></tag>
      <item>

Defines where the SNMP manager store persistent data.

      </item>

      <tag><marker id="manager_config_repair"></marker>
        <c><![CDATA[manager_repair() = false | true | force <optional>]]></c></tag>
      <item>

Defines the repair option for the persistent database (if
          and how the table is repaired when opened).

Default is <c>true</c>.

      </item>

      <tag><marker id="manager_config_auto_save"></marker>
        <c><![CDATA[manager_auto_save() = integer() | infinity <optional>]]></c></tag>
      <item>

The auto save interval. The table is flushed to disk
          whenever not accessed for this amount of time.

Default is <c>5000</c>.

      </item>

      <tag><marker id="manager_irb"></marker>
        <c><![CDATA[manager_irb() = auto | user | {user, integer()} <optional>]]></c></tag>
      <item>

This option defines how the manager will handle the sending of
          response (acknowledgment) to received inform-requests.

        <list type="bulleted">
          <item>

<c>auto</c> - The manager will autonomously send response
              (acknowledgment> to inform-request messages.

          </item>
          <item>

<c>{user, integer()}</c> - The manager will send response
              (acknowledgment) to inform-request messages when the
              <seealso marker="snmpm_user#handle_inform">handle_inform</seealso>
              function completes. The integer is the time, in milli-seconds,
              that the manager will consider the stored inform-request info
              valid.

          </item>
          <item>

<c>user</c> - Same as <c>{user, integer()}</c>, except that
              the default time, 15 seconds (15000), is used.

          </item>
        </list>

See
          <seealso marker="snmpm_network_interface">snmpm_network_interface</seealso>,
          <seealso marker="snmpm_user">handle_inform</seealso> and
          <seealso marker="snmp_manager_netif">definition of the manager net if</seealso> for more info.

Default is <c>auto</c>.

      </item>

      <tag><marker id="manager_mibs"></marker>
        <c><![CDATA[manager_mibs() = [string()] <optional>]]></c></tag>
      <item>

Specifies a list of MIBs (including path) and defines which MIBs
          are initially loaded into the SNMP manager.

Default is <c>[]</c>.

      </item>

      <tag><marker id="manager_net_if"></marker>
        <c><![CDATA[manager_net_if() = [manager_net_if_opt()] <optional>]]></c></tag>
      <item>

<c>manager_net_if_opt() = {module, manager_net_if_module()} |
          {verbosity, verbosity()} |
          {options, manager_net_if_options()}</c>

Defines options specific for the SNMP manager network interface
          entity.

For defaults see the options in <c>manager_net_if_opt()</c>.

      </item>

      <tag><marker id="manager_ni_opts"></marker>
        <c><![CDATA[manager_net_if_options() = [manager_net_if_option()] <optional>]]></c></tag>
      <item>

<c>manager_net_if_option() = {bind_to, bind_to()} |
          {sndbuf, sndbuf()} |
          {recbuf, recbuf()} |
          {no_reuse, no_reuse()} |
          {filter, manager_net_if_filter_options()} </c>

These options are actually specific to the used module.
	The ones shown here are applicable to the default
	<c>manager_net_if_module()</c>.

For defaults see the options in <c>manager_net_if_option()</c>.

      </item>

      <tag><marker id="manager_ni_module"></marker>
        <c><![CDATA[manager_net_if_module() = atom() <optional>]]></c></tag>
      <item>

The module which handles the network interface part for the
          SNMP manager. It must implement the
          <seealso marker="snmpm_network_interface">snmpm_network_interface</seealso> behaviour.

Default is <c>snmpm_net_if</c>.

      </item>

      <tag><marker id="manager_ni_filter_opts"></marker>
        <c><![CDATA[manager_net_if_filter_options() = [manager_net_if_filter_option()] <optional>]]></c></tag>
      <item>

<c>manager_net_if_filter_option() = {module, manager_net_if_filter_module()}</c>

These options are actually specific to the used module.
	  The ones shown here are applicable to the default
	  <c><![CDATA[manager_net_if_filter_module()]]></c>.

For defaults see the options in
          <c>manager_net_if_filter_option()</c>.

      </item>

      <tag><marker id="manager_ni_filter_module"></marker>
        <c><![CDATA[manager_net_if_filter_module() = atom() <optional>]]></c></tag>
      <item>

Module which handles the network interface filter part for the
	  SNMP manager. Must implement the
	  <seealso marker="snmpm_network_interface_filter">snmpm_network_interface_filter</seealso> behaviour.

Default is <c>snmpm_net_if_filter</c>.

      </item>

      <tag><marker id="manager_def_user_module"></marker>
        <c><![CDATA[def_user_module() = atom() <optional>]]></c></tag>
      <item>

The module implementing the default user. See the
          <seealso marker="snmpm_user">snmpm_user</seealso> behaviour.

Default is <c>snmpm_user_default</c>.

      </item>

      <tag><marker id="manager_def_user_data"></marker>
        <c><![CDATA[def_user_data() = term() <optional>]]></c></tag>
      <item>

Data for the default user. Passed to the user module when
          calling the callback functions.

Default is <c>undefined</c>.

      </item>
    </taglist>

    <marker id="common_types"></marker>

Common config types:

    <taglist>
      <tag><marker id="restart_type"></marker>
        <c>restart_type() = permanent | transient | temporary</c></tag>
      <item>

See <seealso marker="stdlib:supervisor#child_spec">supervisor</seealso>
          documentation for more info.

Default is <c>permanent</c> for the agent and <c>transient</c>
          for the manager.

      </item>

      <tag><marker id="db_init_error"></marker>
        <c>db_init_error() = terminate | create | create_db_and_dir</c></tag>
      <item>

Defines what to do if the agent or manager is unable to open an
          existing database file. <c>terminate</c> means that the
          agent/manager will terminate and <c>create</c> means that the
          agent/manager will remove the faulty file(s) and create new ones,
          and <c>create_db_and_dir</c> means that the agent/manager will
          create the database file along with any missing parent directories
          for the database file.

Default is <c>terminate</c>.

      </item>

      <tag><marker id="prio"></marker>
        <c><![CDATA[priority() = atom() <optional>]]></c></tag>
      <item>

Defines the Erlang priority for all SNMP processes.

Default is <c>normal</c>.

      </item>

      <tag><marker id="versions"></marker>
        <c><![CDATA[versions() = [version()] <optional>]]></c></tag>
      <item>

<c>version() = v1 | v2 | v3</c>

Which SNMP versions shall be accepted/used.

Default is <c>[v1,v2,v3]</c>.

      </item>

      <tag><marker id="verbosity"></marker>
        <c><![CDATA[verbosity() = silence | info | log | debug | trace <optional>]]></c></tag>
      <item>

Verbosity for a SNMP process. This specifies now much debug info
          is printed.

Default is <c>silence</c>.

      </item>

      <tag><marker id="bind_to"></marker>
        <c><![CDATA[bind_to() = bool() <optional>]]></c></tag>
      <item>

If <c>true</c>, net_if binds to the IP address.
          If <c>false</c>, net_if listens on any IP address on the host
          where it is running.

Default is <c>false</c>.

      </item>

      <tag><marker id="no_reuse"></marker>
        <c><![CDATA[no_reuse() = bool() <optional>]]></c></tag>
      <item>

If <c>true</c>, net_if does not specify that the IP
          and port address should be reusable. If <c>false</c>,
          the address is set to reusable.

Default is <c>false</c>.

      </item>

      <tag><marker id="recbuf"></marker>
        <c><![CDATA[recbuf() = integer() <optional>]]></c></tag>
      <item>

Receive buffer size.

Default value is defined by <c>gen_udp</c>.

      </item>

      <tag><marker id="sndbuf"></marker>
        <c><![CDATA[sndbuf() = integer() <optional>]]></c></tag>
      <item>

Send buffer size.

Default value is defined by <c>gen_udp</c>.

      </item>

      <tag><marker id="note_store"></marker>
        <c><![CDATA[note_store() = [note_store_opt()] <optional>]]></c></tag>
      <item>

<c>note_store_opt() = {timeout, note_store_timeout()} |  {verbosity, verbosity()}</c>

Specifies the start-up verbosity for the SNMP note store.

For defaults see the options in <c>note_store_opt()</c>.

      </item>

      <tag><marker id="ns_timeout"></marker>
        <c><![CDATA[note_store_timeout() = integer() <optional>]]></c></tag>
      <item>

Note cleanup time. When storing a note in the note store,
          each note is given lifetime. Every <c>timeout</c> the note_store
          process performs a GC to remove the expired note's. Time in
          milli-seconds.

Default is <c>30000</c>.

      </item>

      <tag><marker id="audit_trail_log"></marker>
        <c><![CDATA[audit_trail_log() = [audit_trail_log_opt()] <optional>]]></c></tag>
      <item>

<c>audit_trail_log_opt() = {type, atl_type()} | {dir, atl_dir()} |  {size, atl_size()} |  {repair, atl_repair()} | {seqno, atl_seqno()}</c>

If present, this option specifies the options for the
          audit trail logging. The <c>disk_log</c> module is used
          to maintain a wrap log. If present, the <c>dir</c> and
          <c>size</c> options are mandatory.

If not present, audit trail logging is not used.

      </item>

      <tag><marker id="atl_type"></marker>
        <c><![CDATA[atl_type() = read | write | read_write <optional>]]></c></tag>
      <item>

Specifies what type of an audit trail log should be used.
          The effect of the type is actually different for the the agent
          and the manager.

For the agent:

        <list type="bulleted">
          <item>If <c>write</c> is specified, only set requests are logged.  </item>
          <item>If <c>read</c> is specified, only get requests are logged.  </item>
          <item>If <c>read_write</c>, all requests are logged.  </item>
        </list>

For the manager:

        <list type="bulleted">
          <item>If <c>write</c> is specified, only sent messages are logged.  </item>
          <item>If <c>read</c> is specified, only received messages are logged.  </item>
          <item>If <c>read_write</c>, both outgoing and incoming messages are
           logged.  </item>
        </list>

Default is <c>read_write</c>.

      </item>

      <tag><marker id="atl_dir"></marker>
        <c><![CDATA[atl_dir = dir() <mandatory>]]></c></tag>
      <item>

Specifies where the audit trail log should be stored.

If <c>audit_trail_log</c> specifies that logging should take
          place, this parameter must be defined.

      </item>

      <tag><marker id="atl_size"></marker>
        <c><![CDATA[atl_size() = {integer(), integer()} <mandatory>]]></c></tag>
      <item>

Specifies the size of the audit
          trail log.  This parameter is sent to <c>disk_log</c>.

If <c>audit_trail_log</c> specifies that logging should
          take place, this parameter must be defined.

      </item>

      <tag><marker id="atl_repair"></marker>
        <c><![CDATA[atl_repair() = true | false | truncate | snmp_repair <optional>]]></c></tag>
      <item>

Specifies if and how the audit trail log shall be repaired
          when opened. Unless this parameter has the value <c>snmp_repair</c>
          it is sent to <c>disk_log</c>. If, on the other hand, the value is
          <c>snmp_repair</c>, snmp attempts to handle certain faults on its
          own. And even if it cannot repair the file, it does not truncate it
          directly, but instead moves it aside for later off-line
          analysis.

Default is <c>true</c>.

      </item>

      <tag><marker id="atl_seqno"></marker>
        <c><![CDATA[atl_seqno() = true | false <optional>]]></c></tag>
      <item>

Specifies if the audit trail log entries will be (sequence)
          numbered or not. The range of the sequence numbers are according
          to RFC 5424, i.e. 1 through 2147483647.

Default is <c>false</c>.

      </item>
    </taglist>

    <title>See Also</title>

application(3), disk_log(3)

</appref>


text:
require 'thread'

module Aws

  # Each Service module has its own Errors module, e.g. {S3::Errors}.
  module Errors

    # The base class for all errors returned by an Amazon Web Service.
    # All ~400 level client errors and ~500 level server errors are raised
    # as service errors.  This indicates it was an error returned from the
    # service and not one generated by the client.
    class ServiceError < RuntimeError

      # @param [Seahorse::Client::RequestContext] context
      # @param [String] message
      def initialize(context, message)
        @code = self.class.code
        @context = context
        super(message)
      end

      # @return [String]
      attr_reader :code

      # @return [Seahorse::Client::RequestContext] The context of the request
      #   that triggered the remote service to return this error.
      attr_reader :context

      class << self

        # @return [String]
        attr_accessor :code

      end
    end

    # Various plugins perform client-side checksums of responses.
    # This error indicates a checksum failed.
    class ChecksumError < RuntimeError; end

    # Raised when a {Service} is constructed and the specified shared
    # credentials profile does not exist.
    class NoSuchProfileError < RuntimeError; end

    # Raised when a {Service} is constructed and credentials are not
    # set, or the set credentials are empty.
    class MissingCredentialsError < RuntimeError; end

    # Raised when a {Service} is constructed and region is not specified.
    class MissingRegionError < ArgumentError; end

    # This module is mixed into another module, providing dynamic
    # error classes.  Error classes all inherit from {ServiceError}.
    #
    #     # creates and returns the class
    #     Aws::S3::Errors::MyNewErrorClass
    #
    # Since the complete list of possible AWS errors returned by services
    # is not known, this allows us to create them as needed.  This also
    # allows users to rescue errors by class without them being concrete
    # classes beforehand.
    #
    # @api private
    module DynamicErrors

      def self.extended(submodule)
        submodule.instance_variable_set("@const_set_mutex", Mutex.new)
        submodule.const_set(:ServiceError, Class.new(ServiceError))
      end

      def const_missing(constant)
        set_error_constant(constant)
      end

      # Given the name of a service and an error code, this method
      # returns an error class (that extends {ServiceError}.
      #
      #     Aws::S3::Errors.error_class('NoSuchBucket').new
      #     #=> #<Aws::S3::Errors::NoSuchBucket>
      #
      # @api private
      def error_class(error_code)
        constant = error_class_constant(error_code)
        if error_const_set?(constant)
          const_get(constant)
        else
          set_error_constant(constant)
        end
      end

      private

      # Convert an error code to an error class name/constant.
      # This requires filtering non-safe characters from the constant
      # name and ensuring it begins with an uppercase letter.
      # @param [String] error_code
      # @return [Symbol] Returns a symbolized constant name for the given
      #   `error_code`.
      def error_class_constant(error_code)
        constant = error_code.to_s
        constant = constant.gsub(/https?:.*$/, '')
        constant = constant.gsub(/[^a-zA-Z0-9]/, '')
        constant = 'Error' + constant unless constant.match(/^[a-z]/i)
        constant = constant[0].upcase + constant[1..-1]
        constant.to_sym
      end

      def set_error_constant(constant)
        @const_set_mutex.synchronize do
          # Ensure the const was not defined while blocked by the mutex
          if error_const_set?(constant)
            const_get(constant)
          else
            error_class = Class.new(const_get(:ServiceError))
            error_class.code = constant.to_s
            const_set(constant, error_class)
          end
        end
      end

      def error_const_set?(constant)
        # Purposefully not using #const_defined? as that method returns true
        # for constants not defined directly in the current module.
        constants.include?(constant.to_sym)
      end

    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
  </connectionStrings>
</configuration>


text:
'use strict';

var ansi = require('ansi');
var util = require('util');
var chalk = require('chalk');
var ReadlineInterface = require('readline').Interface;

exports.createInterface = function (options) { return new Interface(options); };

exports.Interface = Interface;

util.inherits(Interface, ReadlineInterface);
function Interface(options) {
  if (!(this instanceof Interface)) {
    return new Interface(options);
  }

  this.suggest = (options && options.suggest) || function () {
    return null;
  };

  this.colorize = (options && options.colorize) || function (str) {
    return str;
  };

  this._ansiCursor = ansi(options && options.output);
  ReadlineInterface.call(this, options);
}

Interface.prototype._originalWriteToOutput = ReadlineInterface.prototype._writeToOutput;
Interface.prototype._writeToOutput = function (stringToWrite) {
  if (stringToWrite === '\r\n' || stringToWrite === ' ') {
    this.output.write(stringToWrite);
    return;
  }
  if (!stringToWrite) return;

  var startsWithPrompt = stringToWrite.indexOf(this._prompt) === 0;
  if (startsWithPrompt) {
    this.output.write(this._prompt);
    stringToWrite = stringToWrite.substring(this._prompt.length);
    renderCurrentLine(this, stringToWrite, true);
  } else {
    this._originalWriteToOutput(stringToWrite);
  }
};

Interface.prototype._insertString = function(c) {
  if (this.cursor < this.line.length) {
    var beg = this.line.slice(0, this.cursor);
    var end = this.line.slice(this.cursor, this.line.length);
    this.line = beg + c + end;
    this.cursor += c.length;
    this._refreshLine();
  } else {
    this.line += c;
    this.cursor += c.length;
    this._refreshLine();
    this._moveCursor(0);
  }
};

function renderCurrentLine(self, stringToWrite, showSuggestions) {
  var suggestionPromise = showSuggestions ? self.suggest(stringToWrite) : null;
  if (suggestionPromise && typeof suggestionPromise.then === 'function') {
    suggestionPromise.then(afterSuggestion, function (err) {
      process.nextTick(function () { throw err; });
    });
  } else {
    afterSuggestion(suggestionPromise);
  }
  function afterSuggestion(suggestion) {
    var promptLength = self._prompt.length;
    var cursorPos = self._getCursorPos();
    var nX = cursorPos.cols;
    if (suggestion && suggestion.indexOf(stringToWrite) === 0) {
      self._ansiCursor.horizontalAbsolute(promptLength + 1).eraseLine().write(self.colorize(stringToWrite) + chalk.grey(suggestion.substring(stringToWrite.length)));
      self._ansiCursor.horizontalAbsolute(nX + 1);
    } else {
      self._ansiCursor.horizontalAbsolute(promptLength + 1).eraseLine().write(self.colorize(stringToWrite));
      self._ansiCursor.horizontalAbsolute(nX);
    }
  }
}


text:
;; Predicate definitions for MIPS.
;; Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
;;
;; This file is part of GCC.
;;
;; GCC is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; GCC is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; <http://www.gnu.org/licenses/>.

(define_predicate "const_uns_arith_operand"
  (and (match_code "const_int")
       (match_test "SMALL_OPERAND_UNSIGNED (INTVAL (op))")))

(define_predicate "uns_arith_operand"
  (ior (match_operand 0 "const_uns_arith_operand")
       (match_operand 0 "register_operand")))

(define_predicate "const_arith_operand"
  (and (match_code "const_int")
       (match_test "SMALL_OPERAND (INTVAL (op))")))

(define_predicate "arith_operand"
  (ior (match_operand 0 "const_arith_operand")
       (match_operand 0 "register_operand")))

(define_predicate "const_uimm6_operand"
  (and (match_code "const_int")
       (match_test "UIMM6_OPERAND (INTVAL (op))")))

(define_predicate "const_imm10_operand"
  (and (match_code "const_int")
       (match_test "IMM10_OPERAND (INTVAL (op))")))

(define_predicate "reg_imm10_operand"
  (ior (match_operand 0 "const_imm10_operand")
       (match_operand 0 "register_operand")))

(define_predicate "sle_operand"
  (and (match_code "const_int")
       (match_test "SMALL_OPERAND (INTVAL (op) + 1)")))

(define_predicate "sleu_operand"
  (and (match_operand 0 "sle_operand")
       (match_test "INTVAL (op) + 1 != 0")))

(define_predicate "const_0_operand"
  (and (match_code "const_int,const_double,const_vector")
       (match_test "op == CONST0_RTX (GET_MODE (op))")))

(define_predicate "reg_or_0_operand"
  (ior (and (match_operand 0 "const_0_operand")
	    (not (match_test "TARGET_MIPS16")))
       (match_operand 0 "register_operand")))

(define_predicate "const_1_operand"
  (and (match_code "const_int,const_double,const_vector")
       (match_test "op == CONST1_RTX (GET_MODE (op))")))

(define_predicate "reg_or_1_operand"
  (ior (match_operand 0 "const_1_operand")
       (match_operand 0 "register_operand")))

;; This is used for indexing into vectors, and hence only accepts const_int.
(define_predicate "const_0_or_1_operand"
  (and (match_code "const_int")
       (match_test "IN_RANGE (INTVAL (op), 0, 1)")))

(define_predicate "const_2_or_3_operand"
  (and (match_code "const_int")
       (match_test "IN_RANGE (INTVAL (op), 2, 3)")))

(define_predicate "const_0_to_3_operand"
  (and (match_code "const_int")
       (match_test "IN_RANGE (INTVAL (op), 0, 3)")))

(define_predicate "qi_mask_operand"
  (and (match_code "const_int")
       (match_test "UINTVAL (op) == 0xff")))

(define_predicate "hi_mask_operand"
  (and (match_code "const_int")
       (match_test "UINTVAL (op) == 0xffff")))

(define_predicate "si_mask_operand"
  (and (match_code "const_int")
       (match_test "UINTVAL (op) == 0xffffffff")))

(define_predicate "and_load_operand"
  (ior (match_operand 0 "qi_mask_operand")
       (match_operand 0 "hi_mask_operand")
       (match_operand 0 "si_mask_operand")))

(define_predicate "low_bitmask_operand"
  (and (match_test "ISA_HAS_EXT_INS")
       (match_code "const_int")
       (match_test "low_bitmask_len (mode, INTVAL (op)) > 16")))

(define_predicate "and_reg_operand"
  (ior (match_operand 0 "register_operand")
       (and (not (match_test "TARGET_MIPS16"))
	    (match_operand 0 "const_uns_arith_operand"))
       (match_operand 0 "low_bitmask_operand")
       (match_operand 0 "si_mask_operand")))

(define_predicate "and_operand"
  (ior (match_operand 0 "and_load_operand")
       (match_operand 0 "and_reg_operand")))

(define_predicate "d_operand"
  (and (match_code "reg")
       (match_test "TARGET_MIPS16
		    ? M16_REG_P (REGNO (op))
		    : GP_REG_P (REGNO (op))")))

(define_predicate "lo_operand"
  (and (match_code "reg")
       (match_test "REGNO (op) == LO_REGNUM")))

(define_predicate "hilo_operand"
  (and (match_code "reg")
       (match_test "MD_REG_P (REGNO (op))")))

(define_predicate "fcc_reload_operand"
  (and (match_code "reg,subreg")
       (match_test "ST_REG_P (true_regnum (op))")))

(define_predicate "muldiv_target_operand"
  (if_then_else (match_test "TARGET_MIPS16")
		(match_operand 0 "hilo_operand")
		(match_operand 0 "register_operand")))

(define_special_predicate "pc_or_label_operand"
  (match_code "pc,label_ref"))

(define_predicate "const_call_insn_operand"
  (match_code "const,symbol_ref,label_ref")
{
  enum mips_symbol_type symbol_type;

  if (!mips_symbolic_constant_p (op, SYMBOL_CONTEXT_CALL, &symbol_type))
    return false;

  switch (symbol_type)
    {
    case SYMBOL_ABSOLUTE:
      /* We can only use direct calls if we're sure that the target
	 function does not need $25 to be valid on entry.  */
      if (mips_use_pic_fn_addr_reg_p (op))
	return false;

      /* If -mlong-calls or if this function has an explicit long_call
	 attribute, we must use register addressing.  The
	 SYMBOL_FLAG_LONG_CALL bit is set by mips_encode_section_info.  */
      return !(GET_CODE (op) == SYMBOL_REF && SYMBOL_REF_LONG_CALL_P (op));

    case SYMBOL_GOT_DISP:
      /* Without explicit relocs, there is no special syntax for
	 loading the address of a call destination into a register.
	 Using "la $25,foo; jal $25" would prevent the lazy binding
	 of "foo", so keep the address of global symbols with the
	 jal macro.  */
      return !TARGET_EXPLICIT_RELOCS;

    default:
      return false;
    }
})

(define_predicate "call_insn_operand"
  (ior (match_operand 0 "const_call_insn_operand")
       (match_operand 0 "register_operand")))

;; A legitimate CONST_INT operand that takes more than one instruction
;; to load.
(define_predicate "splittable_const_int_operand"
  (match_code "const_int")
{
  /* When generating mips16 code, TARGET_LEGITIMATE_CONSTANT_P rejects
     CONST_INTs that can't be loaded using simple insns.  */
  if (TARGET_MIPS16)
    return false;

  /* Don't handle multi-word moves this way; we don't want to introduce
     the individual word-mode moves until after reload.  */
  if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
    return false;

  /* Otherwise check whether the constant can be loaded in a single
     instruction.  */
  return !LUI_INT (op) && !SMALL_INT (op) && !SMALL_INT_UNSIGNED (op);
})

(define_predicate "move_operand"
  ;; Allow HI and LO to be used as the source of a MIPS16 move.
  (ior (match_operand 0 "general_operand")
       (match_operand 0 "hilo_operand"))
{
  enum mips_symbol_type symbol_type;

  /* The thinking here is as follows:

     (1) The move expanders should split complex load sequences into
	 individual instructions.  Those individual instructions can
	 then be optimized by all rtl passes.

     (2) The target of pre-reload load sequences should not be used
	 to store temporary results.  If the target register is only
	 assigned one value, reload can rematerialize that value
	 on demand, rather than spill it to the stack.

     (3) If we allowed pre-reload passes like combine and cse to recreate
	 complex load sequences, we would want to be able to split the
	 sequences before reload as well, so that the pre-reload scheduler
	 can see the individual instructions.  This falls foul of (2);
	 the splitter would be forced to reuse the target register for
	 intermediate results.

     (4) We want to define complex load splitters for combine.  These
	 splitters can request a temporary scratch register, which avoids
	 the problem in (2).  They allow things like:

	      (set (reg T1) (high SYM))
	      (set (reg T2) (low (reg T1) SYM))
	      (set (reg X) (plus (reg T2) (const_int OFFSET)))

	 to be combined into:

	      (set (reg T3) (high SYM+OFFSET))
	      (set (reg X) (lo_sum (reg T3) SYM+OFFSET))

	 if T2 is only used this once.  */
  switch (GET_CODE (op))
    {
    case CONST_INT:
      return !splittable_const_int_operand (op, mode);

    case CONST:
    case SYMBOL_REF:
    case LABEL_REF:
      if (CONST_GP_P (op))
	return true;
      return (mips_symbolic_constant_p (op, SYMBOL_CONTEXT_LEA, &symbol_type)
	      && !mips_split_p[symbol_type]);

    case HIGH:
      op = XEXP (op, 0);
      return (mips_symbolic_constant_p (op, SYMBOL_CONTEXT_LEA, &symbol_type)
	      && !mips_split_hi_p[symbol_type]);

    default:
      return true;
    }
})

(define_predicate "cprestore_save_slot_operand"
  (and (match_code "mem")
       (match_test "mips_cprestore_address_p (XEXP (op, 0), false)")))

(define_predicate "cprestore_load_slot_operand"
  (and (match_code "mem")
       (match_test "mips_cprestore_address_p (XEXP (op, 0), true)")))

(define_predicate "consttable_operand"
  (match_test "CONSTANT_P (op)"))

(define_predicate "symbolic_operand"
  (match_code "const,symbol_ref,label_ref")
{
  enum mips_symbol_type type;
  return mips_symbolic_constant_p (op, SYMBOL_CONTEXT_LEA, &type);
})

(define_predicate "absolute_symbolic_operand"
  (match_code "const,symbol_ref,label_ref")
{
  enum mips_symbol_type type;
  return (mips_symbolic_constant_p (op, SYMBOL_CONTEXT_LEA, &type)
	  && type == SYMBOL_ABSOLUTE);
})

(define_predicate "symbolic_operand_with_high"
  (match_code "const,symbol_ref,label_ref")
{
  enum mips_symbol_type type;
  return (mips_symbolic_constant_p (op, SYMBOL_CONTEXT_LEA, &type)
	  && mips_hi_relocs[(int) type]);
})

(define_predicate "force_to_mem_operand"
  (match_code "const,symbol_ref,label_ref")
{
  enum mips_symbol_type symbol_type;
  return (mips_symbolic_constant_p (op, SYMBOL_CONTEXT_LEA, &symbol_type)
	  && mips_use_pcrel_pool_p[(int) symbol_type]);
})

(define_predicate "got_disp_operand"
  (match_code "const,symbol_ref,label_ref")
{
  enum mips_symbol_type type;
  return (mips_symbolic_constant_p (op, SYMBOL_CONTEXT_LEA, &type)
	  && type == SYMBOL_GOT_DISP);
})

(define_predicate "got_page_ofst_operand"
  (match_code "const,symbol_ref,label_ref")
{
  enum mips_symbol_type type;
  return (mips_symbolic_constant_p (op, SYMBOL_CONTEXT_LEA, &type)
	  && type == SYMBOL_GOT_PAGE_OFST);
})

(define_predicate "tls_reloc_operand"
  (match_code "const,symbol_ref,label_ref")
{
  enum mips_symbol_type type;
  return (mips_symbolic_constant_p (op, SYMBOL_CONTEXT_LEA, &type)
	  && (type == SYMBOL_DTPREL || type == SYMBOL_TPREL));
})

(define_predicate "symbol_ref_operand"
  (match_code "symbol_ref"))

(define_predicate "stack_operand"
  (and (match_code "mem")
       (match_test "mips_stack_address_p (XEXP (op, 0), GET_MODE (op))")))

(define_predicate "macc_msac_operand"
  (ior (and (match_code "plus") (match_test "ISA_HAS_MACC"))
       (and (match_code "minus") (match_test "ISA_HAS_MSAC")))
{
  rtx mult = XEXP (op, GET_CODE (op) == PLUS ? 0 : 1);
  rtx accum = XEXP (op, GET_CODE (op) == PLUS ? 1 : 0);
  return (GET_CODE (mult) == MULT
	  && REG_P (XEXP (mult, 0))
	  && REG_P (XEXP (mult, 1))
	  && REG_P (accum));
})

(define_predicate "equality_operator"
  (match_code "eq,ne"))

(define_predicate "extend_operator"
  (match_code "zero_extend,sign_extend"))

(define_predicate "trap_comparison_operator"
  (match_code "eq,ne,lt,ltu,ge,geu"))

(define_predicate "order_operator"
  (match_code "lt,ltu,le,leu,ge,geu,gt,gtu"))

;; For NE, cstore uses sltu instructions in which the first operand is $0.
;; This isn't possible in mips16 code.

(define_predicate "mips_cstore_operator"
  (ior (match_code "eq,gt,gtu,ge,geu,lt,ltu,le,leu")
       (and (match_code "ne") (not (match_test "TARGET_MIPS16")))))

(define_predicate "small_data_pattern"
  (and (match_code "set,parallel,unspec,unspec_volatile,prefetch")
       (match_test "mips_small_data_pattern_p (op)")))


text:
namespace BTCPayServer.Configuration
{
    public class DataDirectories
    {
        public string DataDir { get; set; }
        public string PluginDir { get; set; }
        public string TempStorageDir { get; set; }
        public string StorageDir { get; set; }
        public string TempDir { get; set; }
    }
}


text:
![](http://f.cl.ly/items/0W2i0E151s0B3S3x3E3W/ogp_.jpg)

iOS8-Sampler
============

[![License](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat
)](http://mit-license.org)
[![Twitter](https://img.shields.io/badge/twitter-@shu223-blue.svg?style=flat)](http://twitter.com/shu223)

Code examples for the new features of iOS 8.

## How to build

JUST BUILD basically, however please note below:

### Provisioning Profile

When try the HealthKit or HomeKit examples, you have to use a provisioning profile for which HealthKit or HomeKit are enabled.

## Contents

### Audio Effects

Distortion and Delay effect for audio using AVAudioEngine.

### New Image Filters

New filters of CIFilter such as CIGrassDistortion, CIDivideBlendMode, etc...

### Custom Filters

Custom CIFilter examples using CIKernel.

### Metal Basic

Render a set of cubes using Metal. Based on Apple's "MetalBasic3D" sample.

### Metal Uniform Streaming

Demo using a data buffer to set uniforms for the vertex and fragment shaders.

### SceneKit

Render a 2D image on 3D scene using SceneKit framework.

### HealthKit

Fetch all types of data which are available in HealthKit. Need to use a provisioning profile for which HealthKit is enabled.

### TouchID

Invoke Touch ID verification using LocalAuthentication.

### Touch Radius

Visualize the radiuses of touches using a new property of UITouch.

### Visual Effects

Example for UIBlurEffect and UIVibrancyEffect.

### Table Separator Effect

Example of separatorEffect which is a new property of UITableView.

### Ruby Annotation

Display the pronunciation of characters using CTRubyAnnotationRef.

### WebKit

Browsing example using WKWebView.

### UIAlertController

Show Alert or ActionSheet using UIAlertController.

### User Notification

Schedule a local notification which has custom actions using UIUserNotificationSettings.

### Altimeter

Get relative altitude using CMAltimeter. It works only on devices which have M8 motion co-processor.

### Pedometer

Counting steps demo using CMPedometer. It works only on devices which have M7 or M8 motion co-processor.

### AVKit

Media playback demo using AVKit framework.

### Histogram

Generate a histogram from an image using the filters CIAreaHistogram and CIHistogramDisplayFilter.

### Code Generator

Generate Aztec Code and 128 Barcode.

### New Fonts

Gallery of new fonts.

### Popover

Example of UIPopoverPresentationController.

### Table Row Action

Example of UITableViewRowAction.

### Accordion Fold Transition

Transitions from one image to another by folding like accordion. However it doesn't work correctly...**PULL REQUESTS welcome**!!

## Author

**Shuichi Tsutsumi**

iOS freelancer in Japan. Welcome works from abroad!

- PAST WORKS:  [My Profile Summary](https://medium.com/@shu223/my-profile-summary-f14bfc1e7099#.vdh0i7clr)
- PROFILES: [LinkedIn](https://www.linkedin.com/in/shuichi-tsutsumi-525b755b/)
- BLOG: [English](https://medium.com/@shu223/) / [Japanese](http://d.hatena.ne.jp/shu223/)
- CONTACTS:
  - [Twitter](https://twitter.com/shu223)
  - [Facebook](https://www.facebook.com/shuichi.tsutsumi)

## Special Thanks

Icons and LaunchImages are **designed by [Okazu](https://www.facebook.com/pashimo)**


text:
namespace design_pattern
{
	interface IMapEvent
	{
		int PosX { get; }
		int PosY { get; }

		void Update( IMapEventListener listener );
	}
}


text:
#ifndef API_VIDEO_VIDEO_CODEC_TYPE_H_
#define API_VIDEO_VIDEO_CODEC_TYPE_H_

namespace webrtc {

// GENERATED_JAVA_ENUM_PACKAGE: org.webrtc
enum VideoCodecType {
  // There are various memset(..., 0, ...) calls in the code that rely on
  // kVideoCodecGeneric being zero.
  kVideoCodecGeneric = 0,
  kVideoCodecVP8,
  kVideoCodecVP9,
  kVideoCodecAV1,
  kVideoCodecH264,
  kVideoCodecMultiplex,
};

}  // namespace webrtc

#endif  // API_VIDEO_VIDEO_CODEC_TYPE_H_


text:
package infinispan;

import java.io.Console;
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.AsyncContext;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *

 * A simple asynchronous servlet taking advantage of features added in 3.0.
 *

 *
 *

 * The servlet is registered and mapped to /AsynchronousServlet using the {@link WebServlet} annotation. The
 * {@link LongRunningService} is injected by CDI.
 *

 *
 *

 * It shows how to detach the execution of a long-running task from the request processing thread, so the thread is free
 * to serve other client requests. The long-running tasks are executed using a dedicated thread pool and create the
 * client response asynchronously using the {@link AsyncContext}.
 *

 *
 *

 * A long-running task in this context does not refer to a computation intensive task executed on the same machine but
 * could for example be contacting a third-party service that has limited resources or only allows for a limited number
 * of concurrent connections. Moving the calls to this service into a separate and smaller sized thread pool ensures
 * that less threads will be busy interacting with the long-running service and that more requests can be served that do
 * not depend on this service.
 *

 *
 * @author Christian Sadilek <csadilek@redhat.com>
 */
@SuppressWarnings("serial")
@WebServlet(value = "/test" )
public class TestServlet extends HttpServlet {

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse response) {
    // Here the request is put in asynchronous mode
	  response.setContentType("text/html");

      // Actual logic goes here.
      PrintWriter out=null;
	try {
		out = response.getWriter();

	        FootballManager manager = new FootballManager();

            manager.printTeams(out);

	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
      out.println("
Called Servlet
");
  }
}


text:
SCALA_VERSION_PROFILE := 2.11
SCALA_VERSION := 2.11.8
MXNET_VERSION := 1.2.0

ifeq ($(OS),Windows_NT)
	UNAME_S := Windows
else
	UNAME_S := $(shell uname -s)
endif

ifeq ($(UNAME_S), Windows)
	# TODO: currently scala package does not support windows
	SCALA_PKG_PROFILE := windows
else
	ifeq ($(UNAME_S), Darwin)
		SCALA_PKG_PROFILE := osx-x86_64-cpu
	else
		SCALA_PKG_PROFILE := linux-x86_64
		ifeq ($(USE_CUDA), 1)
        	SCALA_PKG_PROFILE := $(SCALA_PKG_PROFILE)-gpu
        else
        	SCALA_PKG_PROFILE := $(SCALA_PKG_PROFILE)-cpu
        endif
	endif
endif

scalademo:
	(mvn package -Dmxnet.profile=$(SCALA_PKG_PROFILE) \
		-Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE) \
		-Dmxnet.version=$(MXNET_VERSION) \
		-Dscala.version=$(SCALA_VERSION))

scalaclean:
	(mvn clean -Dmxnet.profile=$(SCALA_PKG_PROFILE) \
		-Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE) \
		-Dmxnet.version=$(MXNET_VERSION) \
		-Dscala.version=$(SCALA_VERSION))


text:
package us.kbase.kbasefeaturevalues;

import java.util.HashMap;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
 *
Original spec-file type: ValidateMatrixParams

 *

 * method - optional field specifying special type of validation
 *     necessary for particular clustering method.
 *

 *
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("com.googlecode.jsonschema2pojo")
@JsonPropertyOrder({
    "method",
    "input_data"
})
public class ValidateMatrixParams {

    @JsonProperty("method")
    private String method;
    @JsonProperty("input_data")
    private String inputData;
    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

    @JsonProperty("method")
    public String getMethod() {
        return method;
    }

    @JsonProperty("method")
    public void setMethod(String method) {
        this.method = method;
    }

    public ValidateMatrixParams withMethod(String method) {
        this.method = method;
        return this;
    }

    @JsonProperty("input_data")
    public String getInputData() {
        return inputData;
    }

    @JsonProperty("input_data")
    public void setInputData(String inputData) {
        this.inputData = inputData;
    }

    public ValidateMatrixParams withInputData(String inputData) {
        this.inputData = inputData;
        return this;
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperties(String name, Object value) {
        this.additionalProperties.put(name, value);
    }

    @Override
    public String toString() {
        return ((((((("ValidateMatrixParams"+" [method=")+ method)+", inputData=")+ inputData)+", additionalProperties=")+ additionalProperties)+"]");
    }

}


text:
.class public Landroid/support/v4/media/session/MediaControllerCompatApi21$TransportControls;
.super Ljava/lang/Object;
.source "MediaControllerCompatApi21.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v4/media/session/MediaControllerCompatApi21;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "TransportControls"
.end annotation

# direct methods
.method public constructor <init>()V
    .locals 0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static fastForward(Ljava/lang/Object;)V
    .locals 0

    check-cast p0, Landroid/media/session/MediaController$TransportControls;

    invoke-virtual {p0}, Landroid/media/session/MediaController$TransportControls;->fastForward()V

    return-void
.end method

.method public static pause(Ljava/lang/Object;)V
    .locals 0

    check-cast p0, Landroid/media/session/MediaController$TransportControls;

    invoke-virtual {p0}, Landroid/media/session/MediaController$TransportControls;->pause()V

    return-void
.end method

.method public static play(Ljava/lang/Object;)V
    .locals 0

    check-cast p0, Landroid/media/session/MediaController$TransportControls;

    invoke-virtual {p0}, Landroid/media/session/MediaController$TransportControls;->play()V

    return-void
.end method

.method public static rewind(Ljava/lang/Object;)V
    .locals 0

    check-cast p0, Landroid/media/session/MediaController$TransportControls;

    invoke-virtual {p0}, Landroid/media/session/MediaController$TransportControls;->rewind()V

    return-void
.end method

.method public static skipToNext(Ljava/lang/Object;)V
    .locals 0

    check-cast p0, Landroid/media/session/MediaController$TransportControls;

    invoke-virtual {p0}, Landroid/media/session/MediaController$TransportControls;->skipToNext()V

    return-void
.end method

.method public static skipToPrevious(Ljava/lang/Object;)V
    .locals 0

    check-cast p0, Landroid/media/session/MediaController$TransportControls;

    invoke-virtual {p0}, Landroid/media/session/MediaController$TransportControls;->skipToPrevious()V

    return-void
.end method

.method public static stop(Ljava/lang/Object;)V
    .locals 0

    check-cast p0, Landroid/media/session/MediaController$TransportControls;

    invoke-virtual {p0}, Landroid/media/session/MediaController$TransportControls;->stop()V

    return-void
.end method


text:
module RuboCop
  module Cop
    module Lint
      # This cop checks for duplicated keys in hash literals.
      #
      # This cop mirrors a warning in Ruby 2.2.
      #
      # @example
      #   hash = { food: 'apple', food: 'orange' }
      class DuplicatedKey < Cop
        MSG = 'Duplicated key in hash literal.'

        LITERALS = [:sym, :str, :float, :int]

        def on_hash(node)
          keys = []

          hash_pairs = *node
          hash_pairs.each do |pair|
            key, _value = *pair
            if keys.include?(key) && LITERALS.include?(key.type)
              add_offense(key, :expression)
            elsif keys.include?(key) && key.type == :array
              key.children.each do |child|
                return false unless LITERALS.include?(child.type)
              end
              add_offense(key, :expression)
            end
            keys << key
          end
        end
      end
    end
  end
end


text:
namespace hwy {

// Returns size in bytes of a vector, i.e. `Lanes(ScalableTag<uint8_t>())`.
//
// Do not cache the result, which may change after calling DisableTargets, or
// if software requests a different vector size (e.g. when entering/exiting SME
// streaming mode). Instead call this right before the code that depends on the
// result, without any DisableTargets or SME transition in-between. Note that
// this involves an indirect call, so prefer not to call this frequently nor
// unnecessarily.
size_t VectorBytes();

}  // namespace hwy

#endif  // HIGHWAY_HWY_PER_TARGET_H_


text:
<?php

class IndexController extends ControllerBase
{
    public function indexAction()
    {
        $this->response->redirect('article/list');
    }
}


text:
export class IngredientInRecipe
{
    constructor(grams : number, ingredient_id : number, recipe_id : number)
    {
        this.grams = grams;
        this.ingredient_id = ingredient_id;
        this.recipe_id = recipe_id;
    }

    id : number;
    grams : number;
    ingredient_id : number;
    recipe_id : number;
}


text:
/*
 * Spanish translation
 * @author Alex Vavilin <xand@xand.es>
 * @version 2010-09-22
 */
(function($) {
if (elFinder && elFinder.prototype.options && elFinder.prototype.options.i18n)
	elFinder.prototype.options.i18n.es = {
		/* errors */
		'Root directory does not exists'        : 'El directorio raíz no existe',
		'Unable to connect to backend'          : 'No se ha podido establecer la conexión con el servidor',
		'Access denied'                         : 'Acceso denegado',
		'Invalid backend configuration'         : 'La respuesta del servidor es incorrecta',
		'Unknown command'                       : 'Comando desconocido',
		'Command not allowed'                   : 'No puede ejecutar este comando',
		'Invalid parameters'                    : 'Parámetros incorrectos',
		'File not found'                        : 'Fichero no encontrado',
		'Invalid name'                          : 'Nombre incorrecto',
		'File or folder with the same name already exists' : 'Ya existe un fichero o un directorio con este nombre',
		'Unable to rename file'                 : 'No se ha podido cambiar el nombre al directorio',
		'Unable to create folder'               : 'No se ha podido crear el directorio',
		'Unable to create file'                 : 'No se ha podido crear el fichero',
		'No file to upload'                     : 'No hay ficheros para subir',
		'Select at least one file to upload'    : 'Seleccione, como mínimo un fichero, para subir',
		'File exceeds the maximum allowed filesize' : 'El tamaño del fichero es más grande que el tamaño máximo autorizado',
		'Data exceeds the maximum allowed size' : 'Los datos exceden el tamaño máximo permitido',
		'Not allowed file type'                 : 'Tipo de fichero no permitido',
		'Unable to upload file'                 : 'No se ha podido subir el fichero',
		'Unable to upload files'                : 'No se han podido subir los ficheros',
		'Unable to remove file'                 : 'No se ha podido eliminar el fichero',
		'Unable to save uploaded file'          : 'No se ha podido guardar el fichero subido',
		'Some files was not uploaded'           : 'Algunos ficheros no han podido ser subidos',
		'Unable to copy into itself'            : 'No se puede copiar dentro de sí mismo',
		'Unable to move files'                  : 'No se ha podido mover los ficheros',
		'Unable to copy files'                  : 'No se ha podido copiar los ficheros',
		'Unable to create file copy'            : 'No se ha podido crear copia del fichero',
		'File is not an image'                  : 'Este fichero no es una imagen',
		'Unable to resize image'                : 'No se han podido cambiar las dimensiones de la imagen',
		'Unable to write to file'               : 'No se ha podido escribir el fichero',
		'Unable to create archive'              : 'No se ha podido crear el archivo',
		'Unable to extract files from archive'  : 'No se ha podido extraer fichero desde archivo',
		'Unable to open broken link'            : 'No se puede abrir un enlace roto',
		'File URL disabled by connector config' : 'El acceso a las rutas de los ficheros está prohibido en la configuración del conector',
		/* statusbar */
		'items'          : 'objetos',
		'selected items' : 'objetos seleccionados',
		/* commands/buttons */
		'Back'                    : 'Atrás',
		'Reload'                  : 'Refrescar',
		'Open'                    : 'Abrir',
		'Preview with Quick Look' : 'Vista previa',
		'Select file'             : 'Seleccionar fichero',
		'New folder'              : 'Nueva carpeta',
		'New text file'           : 'Nuevo fichero',
		'Upload files'            : 'Subir ficheros',
		'Copy'                    : 'Copiar',
		'Cut'                     : 'Cortar',
		'Paste'                   : 'Pegar',
		'Duplicate'               : 'Duplicar',
		'Remove'                  : 'Eliminar',
		'Rename'                  : 'Cambiar nombre',
		'Edit text file'          : 'Editar fichero',
		'View as icons'           : 'Iconos',
		'View as list'            : 'Lista',
		'Resize image'            : 'Tamaño de imagen',
		'Create archive'          : 'Nuevo archivo',
		'Uncompress archive'      : 'Extraer archivo',
		'Get info'                : 'Propiedades',
		'Help'                    : 'Ayuda',
		'Dock/undock filemanager window' : 'Despegar/pegar el gestor de ficheros a la página',
		/* upload/get info dialogs */
		'Maximum allowed files size' : 'Tamaño máximo del fichero',
		'Add field'   : 'Añadir campo',
		'File info'   : 'Propiedades de fichero',
		'Folder info' : 'Propiedades de carpeta',
		'Name'        : 'Nombre',
		'Kind'        : 'Tipo',
		'Size'        : 'Tamaño',
		'Modified'    : 'Modificado',
		'Permissions' : 'Acceso',
		'Link to'     : 'Enlaza con',
		'Dimensions'  : 'Dimensiones',
		'Confirmation required' : 'Se requiere confirmación',
		'Are you sure you want to remove files?
 This cannot be undone!' : '¿Está seguir que desea eliminar el fichero?
Esta acción es irreversible.',
		/* permissions */
		'read'        : 'lectura',
		'write'       : 'escritura',
		'remove'      : 'eliminación',
		/* dates */
		'Jan'         : 'Ene',
		'Feb'         : 'Feb',
		'Mar'         : 'Mar',
		'Apr'         : 'Abr',
		'May'         : 'May',
		'Jun'         : 'Jun',
		'Jul'         : 'Jul',
		'Aug'         : 'Ago',
		'Sep'         : 'Sep',
		'Oct'         : 'Oct',
		'Nov'         : 'Nov',
		'Dec'         : 'Dec',
		'Today'       : 'Hoy',
		'Yesterday'   : 'Ayer',
		/* mimetypes */
		'Unknown'                           : 'Desconocido',
		'Folder'                            : 'Carpeta',
		'Alias'                             : 'Enlace',
		'Broken alias'                      : 'Enlace roto',
		'Plain text'                        : 'Texto',
		'Postscript document'               : 'Documento postscript',
		'Application'                       : 'Aplicación',
		'Microsoft Office document'         : 'Documento Microsoft Office',
		'Microsoft Word document'           : 'Documento Microsoft Word',
		'Microsoft Excel document'          : 'Documento Microsoft Excel',
		'Microsoft Powerpoint presentation' : 'Documento Microsoft Powerpoint',
		'Open Office document'              : 'Documento Open Office',
		'Flash application'                 : 'Aplicación Flash',
		'XML document'                      : 'Documento XML',
		'Bittorrent file'                   : 'Fichero bittorrent',
		'7z archive'                        : 'Archivo 7z',
		'TAR archive'                       : 'Archivo TAR',
		'GZIP archive'                      : 'Archivo GZIP',
		'BZIP archive'                      : 'Archivo BZIP',
		'ZIP archive'                       : 'Archivo ZIP',
		'RAR archive'                       : 'Archivo RAR',
		'Javascript application'            : 'Aplicación Javascript',
		'PHP source'                        : 'Documento PHP',
		'HTML document'                     : 'Documento HTML',
		'Javascript source'                 : 'Documento Javascript',
		'CSS style sheet'                   : 'Documento CSS',
		'C source'                          : 'Documento C',
		'C++ source'                        : 'Documento C++',
		'Unix shell script'                 : 'Script Unix shell',
		'Python source'                     : 'Documento Python',
		'Java source'                       : 'Documento Java',
		'Ruby source'                       : 'Documento Ruby',
		'Perl script'                       : 'Script Perl',
		'BMP image'                         : 'Imagen BMP',
		'JPEG image'                        : 'Imagen JPEG',
		'GIF Image'                         : 'Imagen GIF',
		'PNG Image'                         : 'Imagen PNG',
		'TIFF image'                        : 'Imagen TIFF',
		'TGA image'                         : 'Imagen TGA',
		'Adobe Photoshop image'             : 'Imagen Adobe Photoshop',
		'MPEG audio'                        : 'Audio MPEG',
		'MIDI audio'                        : 'Audio MIDI',
		'Ogg Vorbis audio'                  : 'Audio Ogg Vorbis',
		'MP4 audio'                         : 'Audio MP4',
		'WAV audio'                         : 'Audio WAV',
		'DV video'                          : 'Video DV',
		'MP4 video'                         : 'Video MP4',
		'MPEG video'                        : 'Video MPEG',
		'AVI video'                         : 'Video AVI',
		'Quicktime video'                   : 'Video Quicktime',
		'WM video'                          : 'Video WM',
		'Flash video'                       : 'Video Flash',
		'Matroska video'                    : 'Video Matroska',
		// 'Shortcuts' : 'Клавиши',
		'Select all files' : 'Seleccionar todos ficheros',
		'Copy/Cut/Paste files' : 'Copiar/Cortar/Pegar ficheros',
		'Open selected file/folder' : 'Abrir carpeta/fichero',
		'Open/close QuickLook window' : 'Abrir/Cerrar la ventana de vista previa',
		'Remove selected files' : 'Eliminar ficheros seleccionados',
		'Selected files or current directory info' : 'Información sobre los ficheros seleccionados en la carpeta actual',
		'Create new directory' : 'Nueva carpeta',
		'Open upload files form' : 'Abrir ventana para subir ficheros',
		'Select previous file' : 'Seleccionar el fichero anterior',
		'Select next file' : 'Seleccionar el fichero siguiente',
		'Return into previous folder' : 'Volver a la carpeta anterior',
		'Increase/decrease files selection' : 'Aumentar/disminuir la selección de ficheros',
		'Authors'                       : 'Autores',
		'Sponsors'  : 'Colaboradores',
		'elFinder: Web file manager'    : 'elFinder: Gestor de ficheros para la web',
		'Version'                       : 'Versión',
		'Copyright: Studio 42 LTD'      : 'Copyright: Studio 42',
		'Donate to support project development' : 'Ayuda al desarrollo',
		'Javascripts/PHP programming: Dmitry (dio) Levashov, dio@std42.ru' : 'Programación Javascripts/php: Dmitry (dio) Levashov, dio@std42.ru',
		'Python programming, techsupport: Troex Nevelin, troex@fury.scancode.ru' : 'Programación Python, soporte técnico: Troex Nevelin, troex@fury.scancode.ru',
		'Design: Valentin Razumnih'     : 'Diseño: Valentin Razumnyh',
		'Spanish localization'          : 'Traducción al español',
		'Icons' : 'Iconos',
		'License: BSD License'          : 'Licencia: BSD License',
		'elFinder documentation'        : 'Documentación elFinder',
		'Simple and usefull Content Management System' : 'Un CMS sencillo y cómodo',
		'Support project development and we will place here info about you' : 'Ayude al desarrollo del producto y la información sobre usted aparecerá aqui.',
		'Contacts us if you need help integrating elFinder in you products' : 'Pregúntenos si quiere integrar elFinder en su producto.',
		'elFinder support following shortcuts' : 'elFinder soporta los siguientes atajos de teclado',
		'helpText' : 'elFinder funciona igual que el gestor de ficheros de su PC.
Puede manipular los ficheros con la ayuda del panel superior, el menu o bien con atajos de teclado. Para mover fichero/carpetas simplemente arrastrelos a la carpeta deseada.	Si simultáneamente presiona la tecla Shift los ficheros se copiarán.'
		};

})(jQuery);


text:
<!DOCTYPE html>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

    <title>{{$pageTitle}}GOV.UK - The best place to find government services and information{{/pageTitle}}</title>

    <link href="{{assetPath}}stylesheets/govuk-template.css?0.12.0" media="screen" rel="stylesheet" type="text/css" />

    <link href="{{assetPath}}stylesheets/govuk-template-print.css?0.12.0" media="print" rel="stylesheet" type="text/css" />

      <link href="{{assetPath}}stylesheets/fonts.css?0.12.0" media="all" rel="stylesheet" type="text/css" />

    <link rel="shortcut icon" href="{{assetPath}}images/favicon.ico?0.12.0" type="image/x-icon" />

    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="{{assetPath}}images/apple-touch-icon-152x152.png?0.12.0">

    <link rel="apple-touch-icon-precomposed" sizes="120x120" href="{{assetPath}}images/apple-touch-icon-120x120.png?0.12.0">

    <link rel="apple-touch-icon-precomposed" sizes="76x76" href="{{assetPath}}images/apple-touch-icon-76x76.png?0.12.0">

    <link rel="apple-touch-icon-precomposed" href="{{assetPath}}images/apple-touch-icon-60x60.png?0.12.0">

    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta property="og:image" content="{{assetPath}}images/opengraph-image.png?0.12.0">

    {{$head}}{{/head}}

        Skip to main content

            {{$cookieMessage}}{{/cookieMessage}}

               GOV.UK

          {{$insideHeader}}{{/insideHeader}}

        {{$propositionHeader}}{{/propositionHeader}}

    {{$afterHeader}}{{/afterHeader}}

    {{$content}}{{/content}}

        {{$footerTop}}{{/footerTop}}

            {{$footerSupportLinks}}{{/footerSupportLinks}}

Open Government Licence

All content is available under the Open Government Licence v3.0, except where otherwise stated

            © Crown copyright

    {{$bodyEnd}}{{/bodyEnd}}


text:
<?php
/**
 * Created by Eton Digital.
 * User: Milos Milojevic (milos.milojevic@etondigital.com)
 * Date: 5/21/15
 * Time: 12:01 PM
 */

namespace ED\BlogBundle\Controller\Backend;

use Application\Sonata\MediaBundle\Entity\Media;
use Doctrine\Common\Collections\ArrayCollection;
use ED\BlogBundle\Event\MediaArrayEvent;
use ED\BlogBundle\Events\EDBlogEvents;
use ED\BlogBundle\Forms\MediaInfoType;
use ED\BlogBundle\Forms\ArticlePhotoType;
use ED\BlogBundle\Forms\MediaType;
use ED\BlogBundle\Handler\Pagination;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;

class MediaController extends DefaultController
{
    /**
     * @Route("/media/list", name="ed_blog_admin_media_list")
     */
    public function mediaListAction(Request $request)
    {
        $user = $this->getBlogUser();

        $formMedia = $this->createForm(new ArticlePhotoType());

        $paramsForTwig = array('form_media' => $formMedia->createView());
        $paginator = $this->get('ed_blog.paginator');
        $response = $this->getPaginated($paginator, $paramsForTwig);

        return $response;
    }

    private function getPaginated($paginator, $paramsForTwig = array(), $ajaxParams = array())
    {
        $mediaManager = $this->container->get('sonata.media.manager.media');

        $queryBuilder = $mediaManager->getObjectManager()->getRepository($mediaManager->getClass())->createQueryBuilder('m')
            ->select('m')
            ->innerJoin('m.galleryHasMedias', 'hasMedias')
            ->innerJoin('hasMedias.gallery','g')
            ->where('g.name= :mediaGallery')
            ->andWhere('hasMedias.enabled = 1')
            ->andWhere('m.enabled = 1')
            ->orderBy('m.id' , 'DESC')
            ->setParameter('mediaGallery', 'Media Library');

        $response = $paginator->paginate(
            $queryBuilder,
            'EDBlogBundle:Media:list',
            'EDBlogBundle:Global:paginationClassic',
            $paramsForTwig,
            Pagination::DOZEN,
            null,
            'EDBlogBundle:Global:paginationClassic.html.twig',
            $ajaxParams,
            'ed_blog_admin_media_list'
        );

        return $response;
    }

    /**
     * @Route("/media/upload", name="ed_blog_admin_media_upload")
     */
    public function uploadAction(Request $request)
    {
        $user = $this->getBlogUser();
        $mediaManager = $this->container->get('sonata.media.manager.media');

        $form = $this->createForm(new ArticlePhotoType());

        if ($request->getMethod() == 'POST')
        {
            $form->handleRequest($request);

            $dispatcher = $this->get('event_dispatcher');
            $attachment = $form['media']->getData();

            //to support single file upload (multiple=false)
            if (!is_array($attachment))
            {
                $attachment = array($attachment);
            }

            $mediaArray = new ArrayCollection();
            $errorArray = array();

            foreach ($attachment as $attached)
            {
                if(in_array($attached->getMimeType(), array(
                    'image/pjpeg', 'image/jpeg', 'image/png', 'image/x-png', 'image/gif',
                )))
                {
                    try {
                        $media = new Media();

                        $media->setBinaryContent($attached);
                        $media->setContext('default');
                        $media->setProviderName('sonata.media.provider.image');
                        $media->setName($attached->getClientOriginalName());
                        $media->setEnabled(true);

                        $mediaManager->save($media);
                        $mediaArray->add($media);
                    }
                    catch(\Exception $e)
                    {
                        $errorArray[] = array(
                            "name" => $attached->getClientOriginalName(),
                            "message" => $e->getMessage()
                        );
                    }
                }
                else
                {
                    $errorArray[] = array(
                        "name" => $attached->getClientOriginalName(),
                        "message" => "The file is unsupported");
                }
            }

            if(count($mediaArray))
            {
                $dispatcher->dispatch(EDBlogEvents::ED_BLOG_MEDIA_LIBRARY_MEDIA_UPLOADED, new MediaArrayEvent($mediaArray));
            }
        }

        $paginator = $this->get('ed_blog.paginator');
        $response = $this->getPaginated($paginator, array('form' => $form->createView()),  array('errors' => $errorArray));

        return $response;
    }

    /**
     * @Route("/media/upload/excerpt", name="ed_blog_admin_media_upload_excerpt")
     */
    public function uploadExcerptAction(Request $request)
    {
        $user = $this->getBlogUser();
        $mediaManager = $this->container->get('sonata.media.manager.media');
        $builder = $this->createFormBuilder();

        $form = $builder->add('excerptImage', 'file',
            array('required' => false)
        )->getForm();

        if ($request->getMethod() == 'POST')
        {
            $form->handleRequest($request);
            $attachment = $form['excerptImage']->getData();

            $media = new Media();
            $media->setBinaryContent($attachment);
            $media->setContext('default');
            $media->setProviderName('sonata.media.provider.image');
            $media->setName($attachment->getClientOriginalName());

            $mediaManager->save($media);

            return new JsonResponse(array('success' => 'true', 'id' => $media->getId(), 'href' => $this->generateUrl('ed_blog_admin_media_delete', array(
                'id' => $media->getId())),
                'media' => $this->renderView('EDBlogBundle:Media:image.html.twig', array('media' => $media))));
        }

        return new JsonResponse(array('success' => 'false'));
    }

    /**
     * Will remove Media from MediaLibrary, but not from file system!
     *
     * @Route("/media/delete/{id}", name="ed_blog_admin_media_delete")
     * @ParamConverter("media", class="ApplicationSonataMediaBundle:Media")
     */
    public function deleteAction(Request $request, Media $media)
    {
        $user = $this->getBlogUser();
        $mediaLibrary = $this->container->get('sonata.media.manager.gallery')->findOneBy(array('name' => 'Media Library'));
        $em = $this->getDoctrine()->getManager();

        foreach($media->getGalleryHasMedias() as $hasMedia)
        {
            if($hasMedia->getGallery() == $mediaLibrary)
            {
                $em->remove($hasMedia);
            }
        }

        $em->flush();

        if($request->isXmlHttpRequest())
        {
            return new JsonResponse(array('success' => 'true'));
        }

        return $this->redirectToRoute('ed_blog_admin_media_list');
    }

    /**
     * @Route("/media/edit-info/{id}", name="ed_blog_admin_media_edit_info")
     * @ParamConverter("media", class="ApplicationSonataMediaBundle:Media")
     */
    public function editInfoAction(Request $request, Media $media)
    {
        $user = $this->getBlogUser();

        $form = $this->createForm(new MediaInfoType(), array("description" => $media->getDescription()));

        if($request->isMethod('POST'))
        {
            $form->handleRequest($request);

            if ($form->isValid())
            {
                $media->setDescription($form['description']->getData());
                $em = $this->getDoctrine()->getManager();

                $em->persist($media);
                $em->flush();
            }

            if ($request->isXmlHttpRequest())
            {
                return new JsonResponse(array('success' => true));
            }
            else
            {
                return $this->redirectToRoute('ed_blog_admin_media_list');
            }
        }

        return $this->render("EDBlogBundle:Media:editInfoForm.html.twig", array(
            "id" => $media->getId(),
            "form" => $form->createView()
        ));
    }

    /**
     * @Route("/media/edit/{id}", name="ed_blog_admin_media_edit")
     * @ParamConverter("media", class="ApplicationSonataMediaBundle:Media")
     */
    public function editAction(Request $request, $media)
    {
        $user = $this->getBlogUser();
        $form = $this->createForm(new MediaType(), array(
            'name' => $media->getName(),
            'description' => $media->getDescription()
        ));

        if($request->isMethod('post'))
        {
            $form->handleRequest($request);

            if($form->isValid())
            {
                $media->setName( $form['title']->getData() . '.' . $form['extension']->getData()  );
                $media->setDescription( $form['description']->getData() );

                $em = $this->getDoctrine()->getManager();

                $em->persist($media);
                $em->flush();
            }
        }
        if($request->isXmlHttpRequest())
        {
            return new JsonResponse(array(
                "success" => true,
                "html" => $this->renderView('@EDBlog/Media/editForm.html.twig', array(
                    'media' => $media,
                    'form' => $form->createView()
                ))
            ));
        }
        else
        {
            return $this->render("@EDBlog/Media/edit.html.twig", array(
                'media' => $media,
                'form' => $form->createView()
            ));
        }
    }

    /**
     * @Route("/media/crop/{id}", name="ed_blog_admin_media_crop")
     * @ParamConverter("media", class="ApplicationSonataMediaBundle:Media")
     */
    public function cropAction(Request $request, $media)
    {
        $user = $this->getBlogUser();
        $mediaManager = $this->get('sonata.media.manager.media');

        $x = intval( $request->get('x', 0) );
        $y = intval( $request->get('y', 0) );
        $width = intval( $request->get('w', 0) );
        $height = intval( $request->get('h', 0) );
        $boxWidth = intval($request->get('box-width', 0));
        $origWidth = $media->getWidth();
        $origHeight = $media->getHeight();
        $origFile = $this->get('kernel')->getRootDir() . '/../web' .  $this->container->get( $media->getProviderName() )->generatePublicUrl($media, 'reference');
        $genaratedFile = $this->get('ed_media_handler')->generateNewFileName($origFile);

        if(!$width || !$height || !$origWidth || !$origHeight)
        {
            return new JsonResponse(array(
                'success' => false,
                'message' => 'Please select something.'
            ));
        }

        //calculate real coordinates and dimensions
        $boxHeight = round( ($boxWidth/$origWidth) * $origHeight);
        $widthRatio = $origWidth / $boxWidth;
        $heightRatio = $origHeight / $boxHeight;
        $realWidth = intval( round($width * $widthRatio, 0) );
        $realHeight = intval( round($height * $heightRatio, 0) );
        $realX = intval( round($x * $widthRatio) );
        $realY = intval( round($y * $heightRatio) );

        //create a new image from selection area
        $resource = false;
        $newResource = ImageCreateTrueColor($realWidth, $realHeight);

        switch ($media->getContentType())
        {
            case 'image/png':
                $resource = imagecreatefrompng($origFile);
                imagecopyresampled($newResource, $resource, 0, 0, $realX, $realY, $realWidth, $realHeight, $realWidth, $realHeight);
                $created = imagepng($newResource, $genaratedFile, 9);
                break;
            case 'image/gif':
                $resource = imagecreatefromgif($origFile);
                imagecopyresampled($newResource, $resource, 0, 0, $realX, $realY, $realWidth, $realHeight, $realWidth, $realHeight);
                $created = imagegif($newResource, $genaratedFile, 100);
                break;
            case 'image/jpeg':
                $resource = imagecreatefromjpeg($origFile);
                imagecopyresampled($newResource, $resource, 0, 0, $realX, $realY, $realWidth, $realHeight, $realWidth, $realHeight);
                $created = imagejpeg($newResource, $genaratedFile, 100);
                break;
        }

        if(!$resource)
        {
            return new JsonResponse(array(
                'success' => false,
                'message' => 'Sorry, this file format is unsupported.'
            ));
        }

        //create Media object from generated file
        $mediaNew = $this->get('ed_media_handler')->generateMediaFromFile($genaratedFile);
        $mediaManager->save($mediaNew);

        //Add media to Media Library
        $dispatcher = $this->get('event_dispatcher');
        $dispatcher->dispatch( EDBlogEvents::ED_BLOG_MEDIA_LIBRARY_MEDIA_UPLOADED, new MediaArrayEvent( array($mediaNew) ) );

        //finally generate thumbs
        $this->get( $media->getProviderName() )->generateThumbnails($media);

        return new JsonResponse( array(
            'success' => true,
            'html' => $this->renderView('@EDBlog/Media/cropPanel.html.twig', array(
                'media' => $mediaNew
            )),
            'redirectUrl' => $this->generateUrl('ed_blog_admin_media_edit', array('id' => $mediaNew->getId()), true),
            'message' => 'You will be redirected to your photo...'
        ) );
    }
}


text:
<?php
namespace PFBC;

abstract class ErrorView extends Base {
	protected $_form;

	public function __construct(array $properties = null) {
		$this->configure($properties);
	}

	public abstract function applyAjaxErrorResponse();

	public function clear() {
		echo 'jQuery("#', $this->_form->getAttribute("id"), ' .alert-danger").remove();';
	}

	public abstract function render();
	public abstract function renderAjaxErrorResponse();

	public function renderCSS() {}

	public function _setForm(Form $form) {
		$this->_form = $form;
	}
}