text:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You 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.
-->

<!-- Do not modify this file directly.  Instead, copy entries that you -->
<!-- wish to modify from this file into yarn-site.xml and change them -->
<!-- there.  If yarn-site.xml does not already exist, create it.      -->

<configuration>

  <!-- IPC Configs -->
  <property>
    <description>Factory to create client IPC classes.</description>
    <name>yarn.ipc.client.factory.class</name>
  </property>

  <property>
    <description>Type of serialization to use.</description>
    <name>yarn.ipc.serializer.type</name>
    <value>protocolbuffers</value>
  </property>

  <property>
    <description>Factory to create server IPC classes.</description>
    <name>yarn.ipc.server.factory.class</name>
  </property>

  <property>
    <description>Factory to create IPC exceptions.</description>
    <name>yarn.ipc.exception.factory.class</name>
  </property>

  <property>
    <description>Factory to create serializeable records.</description>
    <name>yarn.ipc.record.factory.class</name>
  </property>

  <property>
    <description>RPC class implementation</description>
    <name>yarn.ipc.rpc.class</name>
    <value>org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC</value>
  </property>

  <!-- Resource Manager Configs -->
  <property>
    <description>The hostname of the RM.</description>
    <name>yarn.resourcemanager.hostname</name>
    <value>localhost</value>
  </property>

  <property>
    <description>The address of the applications manager interface in the RM.
    </description>
    <name>yarn.resourcemanager.address</name>
    <value>${yarn.resourcemanager.hostname}:8032</value>
  </property>

  <property>
    <description>The number of threads used to handle applications manager
      requests.
    </description>
    <name>yarn.resourcemanager.client.thread-count</name>
    <value>50</value>
  </property>

  <property>
    <description>The expiry interval for application master reporting.
    </description>
    <name>yarn.am.liveness-monitor.expiry-interval-ms</name>
    <value>600000</value>
  </property>

  <property>
    <description>The Kerberos principal for the resource manager.</description>
    <name>yarn.resourcemanager.principal</name>
  </property>

  <property>
    <description>The address of the scheduler interface.</description>
    <name>yarn.resourcemanager.scheduler.address</name>
    <value>${yarn.resourcemanager.hostname}:8030</value>
  </property>

  <property>
    <description>Number of threads to handle scheduler interface.</description>
    <name>yarn.resourcemanager.scheduler.client.thread-count</name>
    <value>50</value>
  </property>

  <property>
    <description>
      This configures the HTTP endpoint for Yarn Daemons.The following
      values are supported:
      - HTTP_ONLY : Service is provided only on http
      - HTTPS_ONLY : Service is provided only on https
    </description>
    <name>yarn.http.policy</name>
    <value>HTTP_ONLY</value>
  </property>

  <property>
    <description>The http address of the RM web application.</description>
    <name>yarn.resourcemanager.webapp.address</name>
    <value>${yarn.resourcemanager.hostname}:8088</value>
  </property>

  <property>
    <description>The https adddress of the RM web application.</description>
    <name>yarn.resourcemanager.webapp.https.address</name>
    <value>${yarn.resourcemanager.hostname}:8090</value>
  </property>

  <property>
    <name>yarn.resourcemanager.resource-tracker.address</name>
    <value>${yarn.resourcemanager.hostname}:8031</value>
  </property>

  <property>
    <description>Are acls enabled.</description>
    <name>yarn.acl.enable</name>
    <value>false</value>
  </property>

  <property>
    <description>ACL of who can be admin of the YARN cluster.</description>
    <name>yarn.admin.acl</name>
    <value>*</value>
  </property>

  <property>
    <description>The address of the RM admin interface.</description>
    <name>yarn.resourcemanager.admin.address</name>
    <value>${yarn.resourcemanager.hostname}:8033</value>
  </property>

  <property>
    <description>Number of threads used to handle RM admin interface.
    </description>
    <name>yarn.resourcemanager.admin.client.thread-count</name>
    <value>1</value>
  </property>

  <property>
    <description>How often should the RM check that the AM is still alive.
    </description>
    <name>yarn.resourcemanager.amliveliness-monitor.interval-ms</name>
    <value>1000</value>
  </property>

  <property>
    <description>Maximum time to wait to establish connection to
      ResourceManager.
    </description>
    <name>yarn.resourcemanager.connect.max-wait.ms</name>
    <value>900000</value>
  </property>

  <property>
    <description>How often to try connecting to the
      ResourceManager.
    </description>
    <name>yarn.resourcemanager.connect.retry-interval.ms</name>
    <value>30000</value>
  </property>

  <property>
    <description>The maximum number of application attempts. It's a global
      setting for all application masters. Each application master can specify
      its individual maximum number of application attempts via the API, but the
      individual number cannot be more than the global upper bound. If it is,
      the resourcemanager will override it. The default number is set to 2, to
      allow at least one retry for AM.
    </description>
    <name>yarn.resourcemanager.am.max-attempts</name>
    <value>2</value>
  </property>

  <property>
    <description>How often to check that containers are still alive.
    </description>
    <name>yarn.resourcemanager.container.liveness-monitor.interval-ms</name>
    <value>600000</value>
  </property>

  <property>
    <description>The keytab for the resource manager.</description>
    <name>yarn.resourcemanager.keytab</name>
    <value>/etc/krb5.keytab</value>
  </property>

  <property>
    <description>How long to wait until a node manager is considered dead.
    </description>
    <name>yarn.nm.liveness-monitor.expiry-interval-ms</name>
    <value>600000</value>
  </property>

  <property>
    <description>How often to check that node managers are still alive.
    </description>
    <name>yarn.resourcemanager.nm.liveness-monitor.interval-ms</name>
    <value>1000</value>
  </property>

  <property>
    <description>Path to file with nodes to include.</description>
    <name>yarn.resourcemanager.nodes.include-path</name>
    <value></value>
  </property>

  <property>
    <description>Path to file with nodes to exclude.</description>
    <name>yarn.resourcemanager.nodes.exclude-path</name>
    <value></value>
  </property>

  <property>
    <description>Number of threads to handle resource tracker calls.
    </description>
    <name>yarn.resourcemanager.resource-tracker.client.thread-count</name>
    <value>50</value>
  </property>

  <property>
    <description>The class to use as the resource scheduler.</description>
    <name>yarn.resourcemanager.scheduler.class</name>
    <value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler</value>
  </property>

  <property>
    <description>The minimum allocation for every container request at the RM,
      in MBs. Memory requests lower than this won't take effect,
      and the specified value will get allocated at minimum.
    </description>
    <name>yarn.scheduler.minimum-allocation-mb</name>
    <value>1024</value>
  </property>

  <property>
    <description>The maximum allocation for every container request at the RM,
      in MBs. Memory requests higher than this won't take effect,
      and will get capped to this value.
    </description>
    <name>yarn.scheduler.maximum-allocation-mb</name>
    <value>8192</value>
  </property>

  <property>
    <description>The minimum allocation for every container request at the RM,
      in terms of virtual CPU cores. Requests lower than this won't take effect,
      and the specified value will get allocated the minimum.
    </description>
    <name>yarn.scheduler.minimum-allocation-vcores</name>
    <value>1</value>
  </property>

  <property>
    <description>The maximum allocation for every container request at the RM,
      in terms of virtual CPU cores. Requests higher than this won't take
      effect,
      and will get capped to this value.
    </description>
    <name>yarn.scheduler.maximum-allocation-vcores</name>
    <value>32</value>
  </property>

  <property>
    <description>Enable RM to recover state after starting. If true, then
      yarn.resourcemanager.store.class must be specified.
    </description>
    <name>yarn.resourcemanager.recovery.enabled</name>
    <value>false</value>
  </property>

  <property>
    <description>The class to use as the persistent store.

      If org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore
      is used, the store is implicitly fenced; meaning a single ResourceManager
      is able to use the store at any point in time. More details on this
      implicit fencing, along with setting up appropriate ACLs is discussed
      under yarn.resourcemanager.zk-state-store.root-node.acl.
    </description>
    <name>yarn.resourcemanager.store.class</name>
    <value>org.apache.hadoop.yarn.server.resourcemanager.recovery.FileSystemRMStateStore</value>
  </property>

  <property>
    <description>The maximum number of completed applications RM state
      store keeps, less than or equals to
      ${yarn.resourcemanager.max-completed-applications}.
      By default, it equals to
      ${yarn.resourcemanager.max-completed-applications}.
      This ensures that the applications kept in the state store are consistent
      with
      the applications remembered in RM memory.
      Any values larger than ${yarn.resourcemanager.max-completed-applications}
      will
      be reset to ${yarn.resourcemanager.max-completed-applications}.
      Note that this value impacts the RM recovery performance.Typically,
      a smaller value indicates better performance on RM recovery.
    </description>
    <name>yarn.resourcemanager.state-store.max-completed-applications</name>
    <value>${yarn.resourcemanager.max-completed-applications}</value>
  </property>

  <property>
    <description>Host:Port of the ZooKeeper server to be used by the RM. This
      must be supplied when using the ZooKeeper based implementation of the
      RM state store and/or embedded automatic failover in a HA setting.
    </description>
    <name>yarn.resourcemanager.zk-address</name>
    <!--value>127.0.0.1:2181</value-->
  </property>

  <property>
    <description>Number of times RM tries to connect to ZooKeeper.</description>
    <name>yarn.resourcemanager.zk-num-retries</name>
    <value>500</value>
  </property>

  <property>
    <description>Retry interval in milliseconds when connecting to ZooKeeper.
    </description>
    <name>yarn.resourcemanager.zk-retry-interval-ms</name>
    <value>2000</value>
  </property>

  <property>
    <description>Full path of the ZooKeeper znode where RM state will be
      stored. This must be supplied when using
      org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore
      as the value for yarn.resourcemanager.store.class
    </description>
    <name>yarn.resourcemanager.zk-state-store.parent-path</name>
    <value>/rmstore</value>
  </property>

  <property>
    <description>ZooKeeper session timeout in milliseconds. Session expiration
      is managed by the ZooKeeper cluster itself, not by the client. This value
      is
      used by the cluster to determine when the client's session expires.
      Expirations happens when the cluster does not hear from the client within
      the specified session timeout period (i.e. no heartbeat).
    </description>
    <name>yarn.resourcemanager.zk-timeout-ms</name>
    <value>10000</value>
  </property>

  <property>
    <description>ACL's to be used for ZooKeeper znodes.</description>
    <name>yarn.resourcemanager.zk-acl</name>
    <value>world:anyone:rwcda</value>
  </property>

  <property>
    <description>
      ACLs to be used for the root znode when using ZKRMStateStore in a HA
      scenario for fencing.

      ZKRMStateStore supports implicit fencing to allow a single
      ResourceManager write-access to the store. For fencing, the
      ResourceManagers in the cluster share read-write-admin privileges on the
      root node, but the Active ResourceManager claims exclusive create-delete
      permissions.

      By default, when this property is not set, we use the ACLs from
      yarn.resourcemanager.zk-acl for shared admin access and
      rm-address:random-number for username-based exclusive create-delete
      access.

      This property allows users to set ACLs of their choice instead of using
      the default mechanism. For fencing to work, the ACLs should be
      carefully set differently on each ResourceManger such that all the
      ResourceManagers have shared admin access and the Active ResourceManger
      takes over (exclusively) the create-delete access.
    </description>
    <name>yarn.resourcemanager.zk-state-store.root-node.acl</name>
  </property>

  <property>
    <description>URI pointing to the location of the FileSystem path where
      RM state will be stored. This must be supplied when using
      org.apache.hadoop.yarn.server.resourcemanager.recovery.FileSystemRMStateStore
      as the value for yarn.resourcemanager.store.class
    </description>
    <name>yarn.resourcemanager.fs.state-store.uri</name>
    <value>${hadoop.tmp.dir}/yarn/system/rmstore</value>
    <!--value>hdfs://localhost:9000/rmstore</value-->
  </property>

  <property>
    <description>hdfs client retry policy specification. hdfs client retry
      is always enabled. Specified in pairs of sleep-time and number-of-retries
      and (t0, n0), (t1, n1), ..., the first n0 retries sleep t0 milliseconds on
      average, the following n1 retries sleep t1 milliseconds on average, and so
      on.
    </description>
    <name>yarn.resourcemanager.fs.state-store.retry-policy-spec</name>
    <value>2000, 500</value>
  </property>

  <property>
    <description>Enable RM high-availability. When enabled,
      (1) The RM starts in the Standby mode by default, and transitions to
      the Active mode when prompted to.
      (2) The nodes in the RM ensemble are listed in
      yarn.resourcemanager.ha.rm-ids
      (3) The id of each RM either comes from yarn.resourcemanager.ha.id
      if yarn.resourcemanager.ha.id is explicitly specified or can be
      figured out by matching yarn.resourcemanager.address.{id} with local
      address
      (4) The actual physical addresses come from the configs of the pattern
      - {rpc-config}.{id}
    </description>
    <name>yarn.resourcemanager.ha.enabled</name>
    <value>false</value>
  </property>

  <property>
    <description>Enable automatic failover.
      By default, it is enabled only when HA is enabled
    </description>
    <name>yarn.resourcemanager.ha.automatic-failover.enabled</name>
    <value>true</value>
  </property>

  <property>
    <description>Enable embedded automatic failover.
      By default, it is enabled only when HA is enabled.
      The embedded elector relies on the RM state store to handle fencing,
      and is primarily intended to be used in conjunction with ZKRMStateStore.
    </description>
    <name>yarn.resourcemanager.ha.automatic-failover.embedded</name>
    <value>true</value>
  </property>

  <property>
    <description>The base znode path to use for storing leader information,
      when using ZooKeeper based leader election.
    </description>
    <name>yarn.resourcemanager.ha.automatic-failover.zk-base-path</name>
    <value>/yarn-leader-election</value>
  </property>

  <property>
    <description>Name of the cluster. In a HA setting,
      this is used to ensure the RM participates in leader
      election fo this cluster and ensures it does not affect
      other clusters
    </description>
    <name>yarn.resourcemanager.cluster-id</name>
    <!--value>yarn-cluster</value-->
  </property>

  <property>
    <description>The list of RM nodes in the cluster when HA is
      enabled. See description of yarn.resourcemanager.ha
      .enabled for full details on how this is used.
    </description>
    <name>yarn.resourcemanager.ha.rm-ids</name>
    <!--value>rm1,rm2</value-->
  </property>

  <property>
    <description>The id (string) of the current RM. When HA is enabled, this
      is an optional config. The id of current RM can be set by explicitly
      specifying yarn.resourcemanager.ha.id or figured out by matching
      yarn.resourcemanager.address.{id} with local address
      See description of yarn.resourcemanager.ha.enabled
      for full details on how this is used.
    </description>
    <name>yarn.resourcemanager.ha.id</name>
    <!--value>rm1</value-->
  </property>

  <property>
    <description>When HA is enabled, the class to be used by Clients, AMs and
      NMs to failover to the Active RM. It should extend
      org.apache.hadoop.yarn.client.RMFailoverProxyProvider
    </description>
    <name>yarn.client.failover-proxy-provider</name>
    <value>org.apache.hadoop.yarn.client.ConfiguredLeaderFailoverHAProxyProvider</value>
  </property>

  <property>
    <description>When HA is enabled, the max number of times
      FailoverProxyProvider should attempt failover. When set,
      this overrides the yarn.resourcemanager.connect.max-wait.ms. When
      not set, this is inferred from
      yarn.resourcemanager.connect.max-wait.ms.
    </description>
    <name>yarn.client.failover-max-attempts</name>
    <!--value>15</value-->
  </property>

  <property>
    <description>When HA is enabled, the sleep base (in milliseconds) to be
      used for calculating the exponential delay between failovers. When set,
      this overrides the yarn.resourcemanager.connect.* settings. When
      not set, yarn.resourcemanager.connect.retry-interval.ms is used instead.
    </description>
    <name>yarn.client.failover-sleep-base-ms</name>
    <!--value>500</value-->
  </property>

  <property>
    <description>When HA is enabled, the maximum sleep time (in milliseconds)
      between failovers. When set, this overrides the
      yarn.resourcemanager.connect.* settings. When not set,
      yarn.resourcemanager.connect.retry-interval.ms is used instead.
    </description>
    <name>yarn.client.failover-sleep-max-ms</name>
    <!--value>15000</value-->
  </property>

  <property>
    <description>When HA is enabled, the number of retries per
      attempt to connect to a ResourceManager. In other words,
      it is the ipc.client.connect.max.retries to be used during
      failover attempts
    </description>
    <name>yarn.client.failover-retries</name>
    <value>0</value>
  </property>

  <property>
    <description>When HA is enabled, the number of retries per
      attempt to connect to a ResourceManager on socket timeouts. In other
      words, it is the ipc.client.connect.max.retries.on.timeouts to be used
      during failover attempts
    </description>
    <name>yarn.client.failover-retries-on-socket-timeouts</name>
    <value>0</value>
  </property>

  <property>
    <description>The maximum number of completed applications RM keeps.
    </description>
    <name>yarn.resourcemanager.max-completed-applications</name>
    <value>10000</value>
  </property>

  <property>
    <description>Interval at which the delayed token removal thread runs
    </description>
    <name>yarn.resourcemanager.delayed.delegation-token.removal-interval-ms
    </name>
    <value>30000</value>
  </property>

  <property>
    <description>Interval for the roll over for the master key used to generate
      application tokens
    </description>
    <name>
      yarn.resourcemanager.application-tokens.master-key-rolling-interval-secs
    </name>
    <value>86400</value>
  </property>

  <property>
    <description>Interval for the roll over for the master key used to generate
      container tokens. It is expected to be much greater than
      yarn.nm.liveness-monitor.expiry-interval-ms and
      yarn.rm.container-allocation.expiry-interval-ms. Otherwise the
      behavior is undefined.
    </description>
    <name>
      yarn.resourcemanager.container-tokens.master-key-rolling-interval-secs
    </name>
    <value>86400</value>
  </property>

  <property>
    <description>The heart-beat interval in milliseconds for every NodeManager
      in the cluster.
    </description>
    <name>yarn.resourcemanager.nodemanagers.heartbeat-interval-ms</name>
    <value>1000</value>
  </property>

  <property>
    <description>The minimum allowed version of a connecting nodemanager. The
      valid values are
      NONE (no version checking), EqualToRM (the nodemanager's version is equal
      to
      or greater than the RM version), or a Version String.
    </description>
    <name>yarn.resourcemanager.nodemanager.minimum.version</name>
    <value>NONE</value>
  </property>

  <property>
    <description>Enable a set of periodic monitors (specified in
      yarn.resourcemanager.scheduler.monitor.policies) that affect the
      scheduler.
    </description>
    <name>yarn.resourcemanager.scheduler.monitor.enable</name>
    <value>false</value>
  </property>

  <property>
    <description>The list of SchedulingEditPolicy classes that interact with
      the scheduler. A particular module may be incompatible with the
      scheduler, other policies, or a configuration of either.
    </description>
    <name>yarn.resourcemanager.scheduler.monitor.policies</name>
    <value>org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.ProportionalCapacityPreemptionPolicy</value>
  </property>

  <property>
    <description>Number of worker threads that write the history data.
    </description>
    <name>
      yarn.resourcemanager.history-writer.multi-threaded-dispatcher.pool-size
    </name>
    <value>10</value>
  </property>

  <property>
    <description>The class to use as the configuration provider.
      If org.apache.hadoop.yarn.LocalConfigurationProvider is used,
      the local configuration will be loaded.
      If org.apache.hadoop.yarn.FileSystemBasedConfigurationProvider is used,
      the configuration which will be loaded should be uploaded to remote File
      system first.
    </description>>
    <name>yarn.resourcemanager.configuration.provider-class</name>
    <value>org.apache.hadoop.yarn.LocalConfigurationProvider</value>
    <!-- <value>org.apache.hadoop.yarn.FileSystemBasedConfigurationProvider</value> -->
  </property>

  <!-- HOPS Configs -->
  <property>
    <description>
      Enable the distributed ResourceTrackerService option.
      <name>hops.yarn.resourcemanager.distributed-rt.enable</name>
      <value>true</value>
    </description>
  </property>
  <property>
    <description>
      Set the PendingEvent retrieval period in milliseconds.
      <name>hops.yarn.resourcemanager.pending-events.retrieval.period</name>
      <value>1000</value>
    </description>
  </property>
  <property>
    <description>
      Set the PendingEvent batch size that is periodically retrieved. If set to
      zero, all events are retrieved.
      <name>hops.yarn.resourcemanager.pending-events.batch</name>
      <value>0</value>
    </description>
  </property>

  <!-- Node Manager Configs -->
  <property>
    <description>The hostname of the NM.</description>
    <name>yarn.nodemanager.hostname</name>
    <value>localhost</value>
  </property>

  <property>
    <description>The address of the container manager in the NM.</description>
    <name>yarn.nodemanager.address</name>
    <value>${yarn.nodemanager.hostname}:0</value>
  </property>

  <property>
    <description>Environment variables that should be forwarded from the
      NodeManager's environment to the container's.
    </description>
    <name>yarn.nodemanager.admin-env</name>
    <value>MALLOC_ARENA_MAX=$MALLOC_ARENA_MAX</value>
  </property>

  <property>
    <description>Environment variables that containers may override rather than
      use NodeManager's default.
    </description>
    <name>yarn.nodemanager.env-whitelist</name>
    <value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,HADOOP_YARN_HOME</value>
  </property>

  <property>
    <description>who will execute(launch) the containers.</description>
    <name>yarn.nodemanager.container-executor.class</name>
    <value>org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor
    </value>
    <!--<value>org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor</value>-->
  </property>

  <property>
    <description>Number of threads container manager uses.</description>
    <name>yarn.nodemanager.container-manager.thread-count</name>
    <value>20</value>
  </property>

  <property>
    <description>Number of threads used in cleanup.</description>
    <name>yarn.nodemanager.delete.thread-count</name>
    <value>4</value>
  </property>

  <property>
    <description>
      Number of seconds after an application finishes before the nodemanager's
      DeletionService will delete the application's localized file directory
      and log directory.

      To diagnose Yarn application problems, set this property's value large
      enough (for example, to 600 = 10 minutes) to permit examination of these
      directories. After changing the property's value, you must restart the
      nodemanager in order for it to have an effect.

      The roots of Yarn applications' work directories is configurable with
      the yarn.nodemanager.local-dirs property (see below), and the roots
      of the Yarn applications' log directories is configurable with the
      yarn.nodemanager.log-dirs property (see also below).
    </description>
    <name>yarn.nodemanager.delete.debug-delay-sec</name>
    <value>0</value>
  </property>

  <property>
    <description>Keytab for NM.</description>
    <name>yarn.nodemanager.keytab</name>
    <value>/etc/krb5.keytab</value>
  </property>

  <property>
    <description>List of directories to store localized files in. An
      application's localized file directory will be found in:
      ${yarn.nodemanager.local-dirs}/usercache/${user}/appcache/application_${appid}.
      Individual containers' work directories, called container_${contid}, will
      be subdirectories of this.
    </description>
    <name>yarn.nodemanager.local-dirs</name>
    <value>${hadoop.tmp.dir}/nm-local-dir</value>
  </property>

  <property>
    <description>It limits the maximum number of files which will be localized
      in a single local directory. If the limit is reached then sub-directories
      will be created and new files will be localized in them. If it is set to
      a value less than or equal to 36 [which are sub-directories (0-9 and then
      a-z)] then NodeManager will fail to start. For example; [for public
      cache] if this is configured with a value of 40 ( 4 files +
      36 sub-directories) and the local-dir is "/tmp/local-dir1" then it will
      allow 4 files to be created directly inside "/tmp/local-dir1/filecache".
      For files that are localized further it will create a sub-directory "0"
      inside "/tmp/local-dir1/filecache" and will localize files inside it
      until it becomes full. If a file is removed from a sub-directory that
      is marked full, then that sub-directory will be used back again to
      localize files.
    </description>
    <name>yarn.nodemanager.local-cache.max-files-per-directory</name>
    <value>8192</value>
  </property>

  <property>
    <description>Address where the localizer IPC is.</description>
    <name>yarn.nodemanager.localizer.address</name>
    <value>${yarn.nodemanager.hostname}:8040</value>
  </property>

  <property>
    <description>Interval in between cache cleanups.</description>
    <name>yarn.nodemanager.localizer.cache.cleanup.interval-ms</name>
    <value>600000</value>
  </property>

  <property>
    <description>Target size of localizer cache in MB, per local directory.
    </description>
    <name>yarn.nodemanager.localizer.cache.target-size-mb</name>
    <value>10240</value>
  </property>

  <property>
    <description>Number of threads to handle localization requests.
    </description>
    <name>yarn.nodemanager.localizer.client.thread-count</name>
    <value>5</value>
  </property>

  <property>
    <description>Number of threads to use for localization fetching.
    </description>
    <name>yarn.nodemanager.localizer.fetch.thread-count</name>
    <value>4</value>
  </property>

  <property>
    <description>
      Where to store container logs. An application's localized log directory
      will be found in ${yarn.nodemanager.log-dirs}/application_${appid}.
      Individual containers' log directories will be below this, in directories
      named container_{$contid}. Each container directory will contain the files
      stderr, stdin, and syslog generated by that container.
    </description>
    <name>yarn.nodemanager.log-dirs</name>
    <value>${yarn.log.dir}/userlogs</value>
  </property>

  <property>
    <description>Whether to enable log aggregation</description>
    <name>yarn.log-aggregation-enable</name>
    <value>false</value>
  </property>

  <property>
    <description>How long to keep aggregation logs before deleting them. -1
      disables.
      Be careful set this too small and you will spam the name node.
    </description>
    <name>yarn.log-aggregation.retain-seconds</name>
    <value>-1</value>
  </property>

  <property>
    <description>How long to wait between aggregated log retention checks.
      If set to 0 or a negative value then the value is computed as one-tenth
      of the aggregated log retention time. Be careful set this too small and
      you will spam the name node.
    </description>
    <name>yarn.log-aggregation.retain-check-interval-seconds</name>
    <value>-1</value>
  </property>

  <property>
    <description>Time in seconds to retain user logs. Only applicable if
      log aggregation is disabled
    </description>
    <name>yarn.nodemanager.log.retain-seconds</name>
    <value>10800</value>
  </property>

  <property>
    <description>Where to aggregate logs to.</description>
    <name>yarn.nodemanager.remote-app-log-dir</name>
    <value>/tmp/logs</value>
  </property>
  <property>
    <description>The remote log dir will be created at
      {yarn.nodemanager.remote-app-log-dir}/${user}/{thisParam}
    </description>
    <name>yarn.nodemanager.remote-app-log-dir-suffix</name>
    <value>logs</value>
  </property>

  <property>
    <description>Amount of physical memory, in MB, that can be allocated
      for containers.
    </description>
    <name>yarn.nodemanager.resource.memory-mb</name>
    <value>8192</value>
  </property>

  <property>
    <description>Whether physical memory limits will be enforced for
      containers.
    </description>
    <name>yarn.nodemanager.pmem-check-enabled</name>
    <value>true</value>
  </property>

  <property>
    <description>Whether virtual memory limits will be enforced for
      containers.
    </description>
    <name>yarn.nodemanager.vmem-check-enabled</name>
    <value>true</value>
  </property>

  <property>
    <description>Ratio between virtual memory to physical memory when
      setting memory limits for containers. Container allocations are
      expressed in terms of physical memory, and virtual memory usage
      is allowed to exceed this allocation by this ratio.
    </description>
    <name>yarn.nodemanager.vmem-pmem-ratio</name>
    <value>2.1</value>
  </property>

  <property>
    <description>Number of CPU cores that can be allocated
      for containers.
    </description>
    <name>yarn.nodemanager.resource.cpu-vcores</name>
    <value>8</value>
  </property>

  <property>
    <description>NM Webapp address.</description>
    <name>yarn.nodemanager.webapp.address</name>
    <value>${yarn.nodemanager.hostname}:8042</value>
  </property>

  <property>
    <description>How often to monitor containers.</description>
    <name>yarn.nodemanager.container-monitor.interval-ms</name>
    <value>3000</value>
  </property>

  <property>
    <description>Class that calculates containers current resource
      utilization.
    </description>
    <name>yarn.nodemanager.container-monitor.resource-calculator.class</name>
  </property>

  <property>
    <description>Frequency of running node health script.</description>
    <name>yarn.nodemanager.health-checker.interval-ms</name>
    <value>600000</value>
  </property>

  <property>
    <description>Script time out period.</description>
    <name>yarn.nodemanager.health-checker.script.timeout-ms</name>
    <value>1200000</value>
  </property>

  <property>
    <description>The health check script to run.</description>
    <name>yarn.nodemanager.health-checker.script.path</name>
    <value></value>
  </property>

  <property>
    <description>The arguments to pass to the health check script.</description>
    <name>yarn.nodemanager.health-checker.script.opts</name>
    <value></value>
  </property>

  <property>
    <description>Frequency of running disk health checker code.</description>
    <name>yarn.nodemanager.disk-health-checker.interval-ms</name>
    <value>120000</value>
  </property>

  <property>
    <description>The minimum fraction of number of disks to be healthy for the
      nodemanager to launch new containers. This correspond to both
      yarn-nodemanager.local-dirs and yarn.nodemanager.log-dirs. i.e. If there
      are less number of healthy local-dirs (or log-dirs) available, then
      new containers will not be launched on this node.
    </description>
    <name>yarn.nodemanager.disk-health-checker.min-healthy-disks</name>
    <value>0.25</value>
  </property>

  <property>
    <description>The maximum percentage of disk space utilization allowed after
      which a disk is marked as bad. Values can range from 0.0 to 100.0.
      If the value is greater than or equal to 100, the nodemanager will check
      for full disk. This applies to yarn-nodemanager.local-dirs and
      yarn.nodemanager.log-dirs.
    </description>
    <name>
      yarn.nodemanager.disk-health-checker.max-disk-utilization-per-disk-percentage
    </name>
    <value>100.0</value>
  </property>

  <property>
    <description>The minimum space that must be available on a disk for
      it to be used. This applies to yarn-nodemanager.local-dirs and
      yarn.nodemanager.log-dirs.
    </description>
    <name>yarn.nodemanager.disk-health-checker.min-free-space-per-disk-mb</name>
    <value>0</value>
  </property>

  <property>
    <description>The path to the Linux container executor.</description>
    <name>yarn.nodemanager.linux-container-executor.path</name>
  </property>

  <property>
    <description>The class which should help the LCE handle resources.
    </description>
    <name>yarn.nodemanager.linux-container-executor.resources-handler.class
    </name>
    <value>org.apache.hadoop.yarn.server.nodemanager.util.DefaultLCEResourcesHandler</value>
    <!-- <value>org.apache.hadoop.yarn.server.nodemanager.util.CgroupsLCEResourcesHandler</value> -->
  </property>

  <property>
    <description>The cgroups hierarchy under which to place YARN proccesses
      (cannot contain commas).
      If yarn.nodemanager.linux-container-executor.cgroups.mount is false (that
      is, if cgroups have
      been pre-configured), then this cgroups hierarchy must already exist and
      be writable by the
      NodeManager user, otherwise the NodeManager may fail.
      Only used when the LCE resources handler is set to the
      CgroupsLCEResourcesHandler.
    </description>
    <name>yarn.nodemanager.linux-container-executor.cgroups.hierarchy</name>
    <value>/hadoop-yarn</value>
  </property>

  <property>
    <description>Whether the LCE should attempt to mount cgroups if not found.
      Only used when the LCE resources handler is set to the
      CgroupsLCEResourcesHandler.
    </description>
    <name>yarn.nodemanager.linux-container-executor.cgroups.mount</name>
    <value>false</value>
  </property>

  <property>
    <description>Where the LCE should attempt to mount cgroups if not found.
      Common locations
      include /sys/fs/cgroup and /cgroup; the default location can vary
      depending on the Linux
      distribution in use. This path must exist before the NodeManager is
      launched.
      Only used when the LCE resources handler is set to the
      CgroupsLCEResourcesHandler, and
      yarn.nodemanager.linux-container-executor.cgroups.mount is true.
    </description>
    <name>yarn.nodemanager.linux-container-executor.cgroups.mount-path</name>
  </property>

  <property>
    <description>The UNIX user that containers will run as when
      Linux-container-executor
      is used in nonsecure mode (a use case for this is using cgroups).
    </description>
    <name>yarn.nodemanager.linux-container-executor.nonsecure-mode.local-user
    </name>
    <value>nobody</value>
  </property>

  <property>
    <description>The allowed pattern for UNIX user names enforced by
      Linux-container-executor when used in nonsecure mode (use case for this
      is using cgroups). The default value is taken from /usr/sbin/adduser
    </description>
    <name>
      yarn.nodemanager.linux-container-executor.nonsecure-mode.user-pattern
    </name>
    <value>^[_.A-Za-z0-9][-@_.A-Za-z0-9]{0,255}?[$]?$</value>
  </property>

  <property>
    <description>T-file compression types used to compress aggregated logs.
    </description>
    <name>yarn.nodemanager.log-aggregation.compression-type</name>
    <value>none</value>
  </property>

  <property>
    <description>The kerberos principal for the node manager.</description>
    <name>yarn.nodemanager.principal</name>
    <value></value>
  </property>

  <property>
    <description>the valid service name should only contain a-zA-Z0-9_ and can
      not start with numbers
    </description>
    <name>yarn.nodemanager.aux-services</name>
    <value></value>
    <!--<value>mapreduce_shuffle</value>-->
  </property>

  <property>
    <description>No. of ms to wait between sending a SIGTERM and SIGKILL to a
      container
    </description>
    <name>yarn.nodemanager.sleep-delay-before-sigkill.ms</name>
    <value>250</value>
  </property>

  <property>
    <description>Max time to wait for a process to come up when trying to
      cleanup a container
    </description>
    <name>yarn.nodemanager.process-kill-wait.ms</name>
    <value>2000</value>
  </property>

  <property>
    <description>Max time, in seconds, to wait to establish a connection to RM
      when NM starts.
      The NM will shutdown if it cannot connect to RM within the specified max
      time period.
      If the value is set as -1, then NM will retry forever.
    </description>
    <name>yarn.nodemanager.resourcemanager.connect.wait.secs</name>
    <value>900</value>
  </property>

  <property>
    <description>Time interval, in seconds, between each NM attempt to connect
      to RM.
    </description>
    <name>yarn.nodemanager.resourcemanager.connect.retry_interval.secs</name>
    <value>30</value>
  </property>

  <property>
    <description>The minimum allowed version of a resourcemanager that a
      nodemanager will connect to.
      The valid values are NONE (no version checking), EqualToNM (the
      resourcemanager's version is
      equal to or greater than the NM version), or a Version String.
    </description>
    <name>yarn.nodemanager.resourcemanager.minimum.version</name>
    <value>NONE</value>
  </property>

  <property>
    <description>Max number of threads in NMClientAsync to process container
      management events
    </description>
    <name>yarn.client.nodemanager-client-async.thread-pool-max-size</name>
    <value>500</value>
  </property>

  <property>
    <description>
      Maximum number of proxy connections for node manager. It should always be
      more than 1. NMClient and MRAppMaster will use this to cache connection
      with node manager. There will be at max one connection per node manager.
      Ex. configuring it to a value of 5 will make sure that client will at
      max have 5 connections cached with 5 different node managers. These
      connections will be timed out if idle for more than system wide idle
      timeout period. The token if used for authentication then it will be used
      only at connection creation time. If new token is received then earlier
      connection should be closed in order to use newer token. This and
      (yarn.client.nodemanager-client-async.thread-pool-max-size) are related
      and should be sync (no need for them to be equal).
    </description>
    <name>yarn.client.max-nodemanagers-proxies</name>
    <value>500</value>
  </property>

  <!--Map Reduce configuration-->
  <property>
    <name>yarn.nodemanager.aux-services.mapreduce_shuffle.class</name>
    <value>org.apache.hadoop.mapred.ShuffleHandler</value>
  </property>

  <property>
    <name>mapreduce.job.jar</name>
    <value/>
  </property>

  <property>
    <name>mapreduce.job.hdfs-servers</name>
    <value>${fs.defaultFS}</value>
  </property>

  <!-- WebAppProxy Configuration-->

  <property>
    <description>The kerberos principal for the proxy, if the proxy is not
      running as part of the RM.
    </description>
    <name>yarn.web-proxy.principal</name>
    <value/>
  </property>

  <property>
    <description>Keytab for WebAppProxy, if the proxy is not running as part of
      the RM.
    </description>
    <name>yarn.web-proxy.keytab</name>
  </property>

  <property>
    <description>The address for the web proxy as HOST:PORT, if this is not
      given then the proxy will run as part of the RM
    </description>
    <name>yarn.web-proxy.address</name>
    <value/>
  </property>

  <!-- Applications' Configuration-->

  <property>
    <description>
      CLASSPATH for YARN applications. A comma-separated list
      of CLASSPATH entries. When this value is empty, the following default
      CLASSPATH for YARN applications would be used.
      For Linux:
      $HADOOP_CONF_DIR,
      $HADOOP_COMMON_HOME/share/hadoop/common/*,
      $HADOOP_COMMON_HOME/share/hadoop/common/lib/*,
      $HADOOP_HDFS_HOME/share/hadoop/hdfs/*,
      $HADOOP_HDFS_HOME/share/hadoop/hdfs/lib/*,
      $HADOOP_YARN_HOME/share/hadoop/yarn/*,
      $HADOOP_YARN_HOME/share/hadoop/yarn/lib/*
      For Windows:
      %HADOOP_CONF_DIR%,
      %HADOOP_COMMON_HOME%/share/hadoop/common/*,
      %HADOOP_COMMON_HOME%/share/hadoop/common/lib/*,
      %HADOOP_HDFS_HOME%/share/hadoop/hdfs/*,
      %HADOOP_HDFS_HOME%/share/hadoop/hdfs/lib/*,
      %HADOOP_YARN_HOME%/share/hadoop/yarn/*,
      %HADOOP_YARN_HOME%/share/hadoop/yarn/lib/*
    </description>
    <name>yarn.application.classpath</name>
    <value></value>
  </property>

  <!-- Timeline Service's Configuration-->

  <property>
    <description>Indicate to clients whether timeline service is enabled or not.
      If enabled, clients will put entities and events to the timeline server.
    </description>
    <name>yarn.timeline-service.enabled</name>
    <value>true</value>
  </property>

  <property>
    <description>The hostname of the timeline service web application.
    </description>
    <name>yarn.timeline-service.hostname</name>
    <value>localhost</value>
  </property>

  <property>
    <description>This is default address for the timeline server to start the
      RPC server.
    </description>
    <name>yarn.timeline-service.address</name>
    <value>${yarn.timeline-service.hostname}:10200</value>
  </property>

  <property>
    <description>The http address of the timeline service web application.
    </description>
    <name>yarn.timeline-service.webapp.address</name>
    <value>${yarn.timeline-service.hostname}:8188</value>
  </property>

  <property>
    <description>The https address of the timeline service web application.
    </description>
    <name>yarn.timeline-service.webapp.https.address</name>
    <value>${yarn.timeline-service.hostname}:8190</value>
  </property>

  <property>
    <description>Store class name for timeline store.</description>
    <name>yarn.timeline-service.store-class</name>
    <value>org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.LeveldbTimelineStore</value>
  </property>

  <property>
    <description>Enable age off of timeline store data.</description>
    <name>yarn.timeline-service.ttl-enable</name>
    <value>true</value>
  </property>

  <property>
    <description>Time to live for timeline store data in milliseconds.
    </description>
    <name>yarn.timeline-service.ttl-ms</name>
    <value>604800000</value>
  </property>

  <property>
    <description>Store file name for leveldb timeline store.</description>
    <name>yarn.timeline-service.leveldb-timeline-store.path</name>
    <value>${yarn.log.dir}/timeline</value>
  </property>

  <property>
    <description>Length of time to wait between deletion cycles of leveldb
      timeline store in milliseconds.
    </description>
    <name>yarn.timeline-service.leveldb-timeline-store.ttl-interval-ms</name>
    <value>300000</value>
  </property>

  <property>
    <description>Size of read cache for uncompressed blocks for leveldb timeline
      store in bytes.
    </description>
    <name>yarn.timeline-service.leveldb-timeline-store.read-cache-size</name>
    <value>104857600</value>
  </property>

  <property>
    <description>Size of cache for recently read entity start times for leveldb
      timeline store in number of entities.
    </description>
    <name>
      yarn.timeline-service.leveldb-timeline-store.start-time-read-cache-size
    </name>
    <value>10000</value>
  </property>

  <property>
    <description>Size of cache for recently written entity start times for
      leveldb timeline store in number of entities.
    </description>
    <name>
      yarn.timeline-service.leveldb-timeline-store.start-time-write-cache-size
    </name>
    <value>10000</value>
  </property>

  <property>
    <description>Handler thread count to serve the client RPC requests.
    </description>
    <name>yarn.timeline-service.handler-thread-count</name>
    <value>10</value>
  </property>

  <property>
    <description>Indicate to ResourceManager as well as clients whether
      history-service is enabled or not. If enabled, ResourceManager starts
      recording historical data that ApplicationHistory service can consume.
      Similarly, clients can redirect to the history service when applications
      finish if this is enabled.
    </description>
    <name>yarn.timeline-service.generic-application-history.enabled</name>
    <value>false</value>
  </property>

  <property>
    <description>URI pointing to the location of the FileSystem path where
      the history will be persisted. This must be supplied when using
      org.apache.hadoop.yarn.server.applicationhistoryservice.FileSystemApplicationHistoryStore
      as the value for
      yarn.timeline-service.generic-application-history.store-class
    </description>
    <name>
      yarn.timeline-service.generic-application-history.fs-history-store.uri
    </name>
    <value>${hadoop.log.dir}/yarn/system/history</value>
  </property>

  <property>
    <description>T-file compression types used to compress history data.
    </description>
    <name>
      yarn.timeline-service.generic-application-history.fs-history-store.compression-type
    </name>
    <value>none</value>
  </property>

  <property>
    <description>Store class name for history store, defaulting to file
      system store
    </description>
    <name>yarn.timeline-service.generic-application-history.store-class</name>
    <value>org.apache.hadoop.yarn.server.applicationhistoryservice.FileSystemApplicationHistoryStore</value>
  </property>

  <!-- Other configuration -->
  <property>
    <description>The interval that the yarn client library uses to poll the
      completion status of the asynchronous API of application client protocol.
    </description>
    <name>yarn.client.application-client-protocol.poll-interval-ms</name>
    <value>200</value>
  </property>

  <property>
    <description>RSS usage of a process computed via
      /proc/pid/stat is not very accurate as it includes shared pages of a
      process. /proc/pid/smaps provides useful information like
      Private_Dirty, Private_Clean, Shared_Dirty, Shared_Clean which can be used
      for computing more accurate RSS. When this flag is enabled, RSS is
      computed
      as Min(Shared_Dirty, Pss) + Private_Clean + Private_Dirty. It excludes
      read-only shared mappings in RSS computation.
    </description>
    <name>
      yarn.nodemanager.container-monitor.procfs-tree.smaps-based-rss.enabled
    </name>
    <value>false</value>
  </property>
</configuration>


text:
<?php

class Aitsu_Validate_Loginunique extends Zend_Validate_Abstract {

	const LOGINUNIQUE = 'loginunique';
	protected $_id = null;

	protected $_messageTemplates = array (
		self :: LOGINUNIQUE => "'%value%' is not unique"
	);

	public function isValid($value) {

		$this->_setValue($value);

		if (!$this->_isUnique($value)) {
			$this->_error();
			return false;
		}

		return true;
	}

	protected function _isUnique($value) {

		if ($this->_id == null) {
			/*
			 * No exclusion is made.
			 */
			if (Aitsu_Db :: fetchOne('' .
				'select count(*) from _acl_user where login = :login ', array (
					':login' => $value
				)) > 0) {
				return false;
			}
		}

		if (Aitsu_Db :: fetchOne('' .
			'select count(*) from _acl_user ' .
			'where ' .
			'	login = :login ' .
			'	and userid != :userid ', array (
				':login' => $value,
				':userid' => $this->_id
			)) > 0) {
			return false;
		}

		return true;
	}

	public function setId($id) {

		$this->_id = $id;
	}

}
?>

redpajama_set_name: RedPajamaGithub


text:
package org.redpill.alfresco.s3;

import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.transfer.TransferManager;
import org.alfresco.repo.content.AbstractContentWriter;
import org.alfresco.service.cmr.repository.ContentIOException;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.util.GUID;
import org.alfresco.util.TempFileProvider;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.nio.channels.Channels;
import java.nio.channels.WritableByteChannel;

/**
 * S3 content writer
 *
 * @author Marcus Svartmark
 */
public class S3ContentWriter extends AbstractContentWriter {

  private static final Log LOG = LogFactory.getLog(S3ContentWriter.class);

  private final TransferManager transferManager;
  private final AmazonS3 client;
  private final String key;
  private final String bucketName;
  private File tempFile;
  private long size;

  public S3ContentWriter(String bucketName, String key, String contentUrl, ContentReader existingContentReader, AmazonS3 client, TransferManager transferManager) {
    super(contentUrl, existingContentReader);
    this.key = key;
    this.client = client;
    this.transferManager = transferManager;
    this.bucketName = bucketName;
    addListener(new S3WriteStreamListener(this));
  }

  @Override
  protected ContentReader createReader() throws ContentIOException {
    return new S3ContentReader(key, getContentUrl(), client, bucketName);
  }

  @Override
  protected WritableByteChannel getDirectWritableChannel() throws ContentIOException {
    try {
      String uuid = GUID.generate();
      if (LOG.isDebugEnabled()){
        LOG.debug("S3ContentWriter Creating Temp File: uuid=" + uuid);
      }
      tempFile = TempFileProvider.createTempFile(uuid, ".bin");
      OutputStream os = new FileOutputStream(tempFile);
      if (LOG.isDebugEnabled()){
        LOG.debug("S3ContentWriter Returning Channel to Temp File: uuid=" + uuid);
      }
      return Channels.newChannel(os);
    } catch (Throwable e) {
      throw new ContentIOException("S3ContentWriter.getDirectWritableChannel(): Failed to open channel. " + this, e);
    }
  }

  @Override
  public long getSize() {
    return this.size;
  }

  public void setSize(long size) {
    this.size = size;
  }

  public TransferManager getTransferManager() {
    return transferManager;
  }

  public String getBucketName() {
    return bucketName;
  }

  public String getKey() {
    return key;
  }

  public File getTempFile() {
    return tempFile;
  }
}


text:
package example2;

 public interface IRepository<T>
    {
      void add(T entity);
      void delete(T entity);
      void update(T entity);
      Iterable<T> getAll();
      T getById(int id);
    }


text:
[![Build Status](https://travis-ci.org/ethirajsrinivasan/rails-protip.svg?branch=master)](https://travis-ci.org/ethirajsrinivasan/rails-protip)
[![Code Climate](https://codeclimate.com/github/ethirajsrinivasan/rails-protip/badges/gpa.svg)](https://codeclimate.com/github/ethirajsrinivasan/rails-protip)
[![security](https://hakiri.io/github/ethirajsrinivasan/rails-protip/master.svg)](https://hakiri.io/github/ethirajsrinivasan/rails-protip/master)

rails-protip is tooltip gem based on jquery protip plugin

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'rails-protip'
```

And then execute:

    $ bundle install

Or install it yourself as:

    $ gem install rails-protip

To use this gem add this require statement to your application.js file:

    //= require protip

and in application.css file as follows

	*= require protip

## Usage

	<%= link_to "Go to the bar!","#bar", class: "protip", "data-pt-title"=> "You must be at least 18!"%>

You can also set default configuration in protip.yml under config folder, example

	scheme: "orange"
	skin: "square"

Support for animation is also provided, example

Go to the bar!

For further usage check http://protip.rocks

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ethirajsrinivasan/rails-protip.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).


text:
require './lib/sked'

environment ENV['RACK_ENV']
workers Sked::Settings.puma.workers
threads Sked::Settings.puma.threads_1, Sked::Settings.puma.threads_2
preload_app!

on_worker_boot do
  @sidekiq_pid ||= spawn("bundle exec sidekiq -r ./lib/sked.rb")
end


text:
namespace ipdb {
#define  IPv4  0x01
#define  IPv6  0x02
#define ErrFileSize "IP Database file size error."
#define ErrMetaData "IP Database metadata error."
//#define ErrReadFull "IP Database ReadFull error."
#define ErrDatabaseError "database error"
#define ErrIPFormat "Query IP Format error."
#define ErrNoSupportLanguage "language not support"
#define ErrNoSupportIPv4 "IPv4 not support"
#define ErrNoSupportIPv6 "IPv6 not support"
#define ErrDataNotExists "data is not exists"
    using namespace std;

    class MetaData {
    public:
        uint64_t Build{};             //`json:"build"`
        uint16_t IPVersion{};         //`json:"ip_version"`
        map<string, int> Languages; //`json:"languages"`
        int NodeCount{};              //`json:"node_count"`
        int TotalSize{};              //`json:"total_size"`
        vector<string> Fields;      //`json:"fields"`
        void Parse(const string &json);
    };

    class Reader {
        MetaData meta;
        int v4offset = 0;
        int fileSize = 0;
        int dataSize = 0;
        shared_ptr<u_char> data = nullptr;

        int readNode(int node, int index) const;

        string resolve(int node);

        int search(const u_char *ip, int bitCount) const;

        string find0(const string &addr);

        vector<string> find1(const string &addr, const string &language);

    public:
        ~Reader();

        explicit Reader(const string &file);

        vector<string> Find(const string &addr, const string &language);

        map<string, string> FindMap(const string &addr, const string &language);

        bool IsIPv4Support() const;

        bool IsIPv6Support() const;

        uint64_t BuildTime() const;

        vector<string> Languages();

        vector<string> Fields() const;
    };

    class ASNInfo {
        string asn;
        string reg;
        string cc;
        string net;
        string org;
        string type;
        string domain;
    public:
        explicit ASNInfo(const vector<string> &data, const vector<string> &fields);

        string GetAsn();

        string GetReg();

        string GetCc();

        string GetNet();

        string GetOrg();

        string GetType();

        string GetDomain();

        string str();
    };

    class DistrictInfo {
        string country_name;
        string region_name;
        string city_name;
        string district_name;
        string china_admin_code;
        string covering_radius;
        string latitude;
        string longitude;
    public:
        explicit DistrictInfo(const vector<string> &data, const vector<string> &fields);

        string GetCountryName();

        string GetRegionName();

        string GetCityName();

        string GetDistrictName();

        string GetChinaAdminCode();

        string GetCoveringRadius();

        string GetLatitude();

        string GetLongitude();

        string str();
    };

    class District : public Reader {
    public:
        explicit District(const string &file);

        DistrictInfo FindInfo(const string &addr, const string &language);
    };

    class CityInfo {
        string country_name;
        string region_name;
        string city_name;
        string owner_domain;
        string isp_domain;
        string latitude;
        string longitude;
        string timezone;
        string utc_offset;
        string china_admin_code;
        string idd_code;
        string country_code;
        string continent_code;
        string idc;
        string base_station;
        string country_code3;
        string european_union;
        string currency_code;
        string currency_name;
        string anycast;
        string line;
        shared_ptr<DistrictInfo> district_info;
        string route;
        string asn;
        vector<shared_ptr<ASNInfo>> asn_info;
        string area_code;
        string usage_type;
    public:
        explicit CityInfo(const vector<string> &data, const vector<string> &fields);

        string GetCountryName();

        string GetRegionName();

        string GetCityName();

        string GetOwnerDomain();

        string GetIspDomain();

        string GetLatitude();

        string GetLongitude();

        string GetTimezone();

        string GetUtcOffset();

        string GetChinaAdminCode();

        string GetIddCode();

        string GetCountryCode();

        string GetContinentCode();

        string GetIDC();

        string GetBaseStation();

        string GetCountryCode3();

        string GetEuropeanUnion();

        string GetCurrencyCode();

        string GetCurrencyName();

        string GetAnycast();

        string GetLine();

        shared_ptr<DistrictInfo> GetDistrictInfo();

        string GetRoute();

        string GetASN();

        vector<shared_ptr<ASNInfo>> GetASNInfo();

        string GetAreaCode();

        string GetUsageType();

        string str();
    };

    class City : public Reader {
    public:
        explicit City(const string &file);

        CityInfo FindInfo(const string &addr, const string &language);
    };

    class BaseStationInfo {
        string country_name;
        string region_name;
        string city_name;
        string owner_domain;
        string isp_domain;
        string base_station;
    public:
        explicit BaseStationInfo(const vector<string> &data, const vector<string> &fields);

        string GetCountryName();

        string GetRegionName();

        string GetCityName();

        string GetOwnerDomain();

        string GetIspDomain();

        string GetBaseStation();

        string str();
    };

    class BaseStation : public Reader {
    public:
        explicit BaseStation(const string &file);

        BaseStationInfo FindInfo(const string &addr, const string &language);
    };

    class IDCInfo {
        string country_name;
        string region_name;
        string city_name;
        string owner_domain;
        string isp_domain;
        string idc;
    public:
        explicit IDCInfo(const vector<string> &data, const vector<string> &fields);

        string GetCountryName();

        string GetRegionName();

        string GetCityName();

        string GetOwnerDomain();

        string GetIspDomain();

        string GetIDC();

        string str();
    };

    class IDC : public Reader {
    public:
        explicit IDC(const string &file);

        IDCInfo FindInfo(const string &addr, const string &language);
    };
}
#endif //IPDB_IPDB_H


text:
/*
 * Minio Cloud Storage, (C) 2016, 2017 Minio, Inc.
 *
 * 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.
 */

package cmd

import (
	"fmt"
	"testing"
)

// Tests healing of format XL.
func TestHealFormatXL(t *testing.T) {
	root, err := newTestConfig(globalMinioDefaultRegion)
	if err != nil {
		t.Fatal(err)
	}
	defer removeAll(root)

	nDisks := 16
	fsDirs, err := getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}

	endpoints, err := parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// Everything is fine, should return nil
	obj, _, err := initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}
	xl := obj.(*xlObjects)
	if err = healFormatXL(xl.storageDisks); err != nil {
		t.Fatal("Got an unexpected error: ", err)
	}

	removeRoots(fsDirs)

	fsDirs, err = getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}

	endpoints, err = parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// Disks 0..15 are nil
	obj, _, err = initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}
	xl = obj.(*xlObjects)
	for i := 0; i <= 15; i++ {
		xl.storageDisks[i] = nil
	}

	if err = healFormatXL(xl.storageDisks); err != errXLReadQuorum {
		t.Fatal("Got an unexpected error: ", err)
	}
	removeRoots(fsDirs)

	fsDirs, err = getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}

	endpoints, err = parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// One disk returns Faulty Disk
	obj, _, err = initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}
	xl = obj.(*xlObjects)
	for i := range xl.storageDisks {
		posixDisk, ok := xl.storageDisks[i].(*retryStorage)
		if !ok {
			t.Fatal("storage disk is not *retryStorage type")
		}
		xl.storageDisks[i] = newNaughtyDisk(posixDisk, nil, errDiskFull)
	}
	if err = healFormatXL(xl.storageDisks); err != errXLReadQuorum {
		t.Fatal("Got an unexpected error: ", err)
	}
	removeRoots(fsDirs)

	fsDirs, err = getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}

	endpoints, err = parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// One disk is not found, heal corrupted disks should return nil
	obj, _, err = initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}
	xl = obj.(*xlObjects)
	xl.storageDisks[0] = nil
	if err = healFormatXL(xl.storageDisks); err != nil {
		t.Fatal("Got an unexpected error: ", err)
	}
	removeRoots(fsDirs)

	fsDirs, err = getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}

	endpoints, err = parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// Remove format.json of all disks
	obj, _, err = initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}
	xl = obj.(*xlObjects)
	for i := 0; i <= 15; i++ {
		if err = xl.storageDisks[i].DeleteFile(".minio.sys", "format.json"); err != nil {
			t.Fatal(err)
		}
	}
	if err = healFormatXL(xl.storageDisks); err != nil {
		t.Fatal("Got an unexpected error: ", err)
	}
	removeRoots(fsDirs)

	fsDirs, err = getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}

	endpoints, err = parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// Corrupted format json in one disk
	obj, _, err = initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}
	xl = obj.(*xlObjects)
	for i := 0; i <= 15; i++ {
		if err = xl.storageDisks[i].AppendFile(".minio.sys", "format.json", []byte("corrupted data")); err != nil {
			t.Fatal(err)
		}
	}
	if err = healFormatXL(xl.storageDisks); err == nil {
		t.Fatal("Should get a json parsing error, ")
	}
	removeRoots(fsDirs)

	fsDirs, err = getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}

	endpoints, err = parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// Remove format.json on 3 disks.
	obj, _, err = initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}
	xl = obj.(*xlObjects)
	for i := 0; i <= 2; i++ {
		if err = xl.storageDisks[i].DeleteFile(".minio.sys", "format.json"); err != nil {
			t.Fatal(err)
		}
	}
	if err = healFormatXL(xl.storageDisks); err != nil {
		t.Fatal("Got an unexpected error: ", err)
	}
	removeRoots(fsDirs)

	fsDirs, err = getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}

	endpoints, err = parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// One disk is not found, heal corrupted disks should return nil
	obj, _, err = initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}
	xl = obj.(*xlObjects)
	for i := 0; i <= 2; i++ {
		if err = xl.storageDisks[i].DeleteFile(".minio.sys", "format.json"); err != nil {
			t.Fatal(err)
		}
	}
	posixDisk, ok := xl.storageDisks[3].(*retryStorage)
	if !ok {
		t.Fatal("storage disk is not *retryStorage type")
	}
	xl.storageDisks[3] = newNaughtyDisk(posixDisk, nil, errDiskNotFound)
	expectedErr := fmt.Errorf("Unable to initialize format %s and %s", errSomeDiskOffline, errSomeDiskUnformatted)
	if err = healFormatXL(xl.storageDisks); err != nil {
		if err.Error() != expectedErr.Error() {
			t.Fatal("Got an unexpected error: ", err)
		}
	}
	removeRoots(fsDirs)

	fsDirs, err = getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}

	endpoints, err = parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// One disk is not found, heal corrupted disks should return nil
	obj, _, err = initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}
	xl = obj.(*xlObjects)
	if err = obj.MakeBucket(getRandomBucketName()); err != nil {
		t.Fatal(err)
	}
	for i := 0; i <= 2; i++ {
		if err = xl.storageDisks[i].DeleteFile(".minio.sys", "format.json"); err != nil {
			t.Fatal(err)
		}
	}
	if err = healFormatXL(xl.storageDisks); err != nil {
		t.Fatal("Got an unexpected error: ", err)
	}
	removeRoots(fsDirs)
}

// Tests undoes and validates if the undoing completes successfully.
func TestUndoMakeBucket(t *testing.T) {
	root, err := newTestConfig(globalMinioDefaultRegion)
	if err != nil {
		t.Fatal(err)
	}
	defer removeAll(root)

	nDisks := 16
	fsDirs, err := getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}
	defer removeRoots(fsDirs)

	endpoints, err := parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// Remove format.json on 16 disks.
	obj, _, err := initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}

	bucketName := getRandomBucketName()
	if err = obj.MakeBucket(bucketName); err != nil {
		t.Fatal(err)
	}
	xl := obj.(*xlObjects)
	undoMakeBucket(xl.storageDisks, bucketName)

	// Validate if bucket was deleted properly.
	_, err = obj.GetBucketInfo(bucketName)
	if err != nil {
		err = errorCause(err)
		switch err.(type) {
		case BucketNotFound:
		default:
			t.Fatal(err)
		}
	}
}

// Tests quick healing of bucket and bucket metadata.
func TestQuickHeal(t *testing.T) {
	root, err := newTestConfig(globalMinioDefaultRegion)
	if err != nil {
		t.Fatal(err)
	}
	defer removeAll(root)

	nDisks := 16
	fsDirs, err := getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}
	defer removeRoots(fsDirs)

	endpoints, err := parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// Remove format.json on 16 disks.
	obj, _, err := initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}

	bucketName := getRandomBucketName()
	if err = obj.MakeBucket(bucketName); err != nil {
		t.Fatal(err)
	}

	xl := obj.(*xlObjects)
	for i := 0; i <= 2; i++ {
		if err = xl.storageDisks[i].DeleteVol(bucketName); err != nil {
			t.Fatal(err)
		}
	}

	// Heal the missing buckets.
	if err = quickHeal(xl.storageDisks, xl.writeQuorum, xl.readQuorum); err != nil {
		t.Fatal(err)
	}

	// Validate if buckets were indeed healed.
	for i := 0; i <= 2; i++ {
		if _, err = xl.storageDisks[i].StatVol(bucketName); err != nil {
			t.Fatal(err)
		}
	}

	// Corrupt one of the disks to return unformatted disk.
	posixDisk, ok := xl.storageDisks[0].(*retryStorage)
	if !ok {
		t.Fatal("storage disk is not *retryStorage type")
	}
	xl.storageDisks[0] = newNaughtyDisk(posixDisk, nil, errUnformattedDisk)
	if err = quickHeal(xl.storageDisks, xl.writeQuorum, xl.readQuorum); err != errUnformattedDisk {
		t.Fatal(err)
	}

	fsDirs, err = getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}
	defer removeRoots(fsDirs)

	endpoints, err = parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// One disk is not found, heal corrupted disks should return nil
	obj, _, err = initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}
	xl = obj.(*xlObjects)
	xl.storageDisks[0] = nil
	if err = quickHeal(xl.storageDisks, xl.writeQuorum, xl.readQuorum); err != nil {
		t.Fatal("Got an unexpected error: ", err)
	}

	fsDirs, err = getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}
	defer removeRoots(fsDirs)

	endpoints, err = parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	// One disk is not found, heal corrupted disks should return nil
	obj, _, err = initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}
	xl = obj.(*xlObjects)
	// Corrupt one of the disks to return unformatted disk.
	posixDisk, ok = xl.storageDisks[0].(*retryStorage)
	if !ok {
		t.Fatal("storage disk is not *retryStorage type")
	}
	xl.storageDisks[0] = newNaughtyDisk(posixDisk, nil, errDiskNotFound)
	if err = quickHeal(xl.storageDisks, xl.writeQuorum, xl.readQuorum); err != nil {
		t.Fatal("Got an unexpected error: ", err)
	}
}

// TestListBucketsHeal lists buckets heal result
func TestListBucketsHeal(t *testing.T) {
	root, err := newTestConfig("us-east-1")
	if err != nil {
		t.Fatal(err)
	}
	defer removeAll(root)

	nDisks := 16
	fsDirs, err := getRandomDisks(nDisks)
	if err != nil {
		t.Fatal(err)
	}
	defer removeRoots(fsDirs)

	endpoints, err := parseStorageEndpoints(fsDirs)
	if err != nil {
		t.Fatal(err)
	}

	obj, _, err := initObjectLayer(endpoints)
	if err != nil {
		t.Fatal(err)
	}

	// Create a bucket that won't get corrupted
	saneBucket := "sanebucket"
	if err = obj.MakeBucket(saneBucket); err != nil {
		t.Fatal(err)
	}

	// Create a bucket that will be removed in some disks
	corruptedBucketName := getRandomBucketName()
	if err = obj.MakeBucket(corruptedBucketName); err != nil {
		t.Fatal(err)
	}

	xl := obj.(*xlObjects)

	// Remove bucket in disk 0, 1 and 2
	for i := 0; i <= 2; i++ {
		if err = xl.storageDisks[i].DeleteVol(corruptedBucketName); err != nil {
			t.Fatal(err)
		}
	}

	// List the missing buckets.
	buckets, err := xl.ListBucketsHeal()
	if err != nil {
		t.Fatal(err)
	}

	// Check the number of buckets in list buckets heal result
	if len(buckets) != 1 {
		t.Fatalf("Length of missing buckets is incorrect, expected: 1, found: %d", len(buckets))
	}

	// Check the name of bucket in list buckets heal result
	if buckets[0].Name != corruptedBucketName {
		t.Fatalf("Name of missing bucket is incorrect, expected: %s, found: %s", corruptedBucketName, buckets[0].Name)
	}
}


text:
$:.unshift File.dirname(__FILE__)

# Include rails' active support for all the core extensions we love
begin
  require 'active_support'
rescue LoadError
  require 'rubygems'
  gem 'activesupport', ">=2.0.0"
  require 'active_support'
end

begin
  require 'builder'
rescue LoadError
  require 'rubygems'
  require 'builder'
end

require 'cgi'
require 'rexml/document'
require 'active_merchant/lib/utils'
require 'active_merchant/lib/error'
require 'active_merchant/lib/validateable'
require 'active_merchant/lib/connection'
require 'active_merchant/lib/posts_data'
require 'active_merchant/lib/post_data'
require 'active_merchant/lib/requires_parameters'
require 'active_merchant/lib/country'

require 'active_merchant/billing/avs_result'
require 'active_merchant/billing/cvv_result'
require 'active_merchant/billing/credit_card_methods'
require 'active_merchant/billing/credit_card_formatting'
require 'active_merchant/billing/credit_card'
require 'active_merchant/billing/base'
require 'active_merchant/billing/check'
require 'active_merchant/billing/gateways'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    autoload :Integrations, 'active_merchant/billing/integrations'
  end
end


text:
package uk.co.sftrabbit.stackanswers.fragment;

import android.app.ListFragment;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import java.util.Arrays;
import java.util.List;
import uk.co.sftrabbit.stackanswers.R;

public class SitesFragment extends ListFragment {
	private final List<Site> sites = Arrays.asList(new Site[] {
		new Site("Stack Overflow", "Professional and enthusiast programmers",
		         0),
		new Site("Super User", "Computer enthusiasts and power users",
		         0),
		new Site("Webmasters", "Pro webmasters",
		         0),
		new Site("Game Development", "Professional and independent game developers",
		         0),
		new Site("Photography", "Professional, enthusiast and " +
		         "amateur photographers", 0),
		new Site("Mathematics", "People studying math at any level and " +
		         "professionals in related fields", 0),
		new Site("Home Improvement", "Contractors and serious DIYers",
		         0)});

	private static final int LIST_PADDING_HORIZONTAL = 8;
	private static final int LIST_PADDING_VERTICAL = 8;
	private static final int LIST_ITEM_SEPERATION = 8;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setListAdapter(new SitesAdapter(getActivity(), sites,
		               R.layout.site_card));
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		final View view = super.onCreateView(inflater, container,
		                                     savedInstanceState);
		ListView listView = (ListView) view.findViewById(android.R.id.list);

		Resources resources = getResources();
		DisplayMetrics displayMetrics = resources.getDisplayMetrics();
		int paddingHorizontal = (int) TypedValue.applyDimension(
			TypedValue.COMPLEX_UNIT_DIP, LIST_PADDING_HORIZONTAL,
			displayMetrics);
		int paddingVertical = (int) TypedValue.applyDimension(
			TypedValue.COMPLEX_UNIT_DIP, LIST_PADDING_VERTICAL,
			displayMetrics);
		int seperation = (int) TypedValue.applyDimension(
			TypedValue.COMPLEX_UNIT_DIP, LIST_ITEM_SEPERATION,
			displayMetrics);

		listView.setPadding(paddingHorizontal, paddingVertical,
		                    paddingHorizontal, paddingVertical);
		listView.setClipToPadding(false);
		listView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);

		listView.setDivider(resources.getDrawable(android.R.color.transparent));
		listView.setDividerHeight(seperation);

		return view;
	}

	private class SitesAdapter extends BaseAdapter {
		private final Context context;
		private final List<Site> sites;
		private final int itemLayoutResource;

		public SitesAdapter(Context context, List<Site> sites,
				int itemLayoutResource) {
			this.context = context;
			this.sites = sites;
			this.itemLayoutResource = itemLayoutResource;
		}

		@Override
		public int getCount() {
			return sites.size();
		}

		@Override
		public Site getItem(int position) {
			return sites.get(position);
		}

		@Override
		public long getItemId(int position) {
			return position;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			View itemView = convertView;
			final Site site = sites.get(position);

			if (itemView == null) {
				final LayoutInflater inflater = (LayoutInflater)
					context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
				itemView = inflater.inflate(itemLayoutResource, parent, false);
			}

			final TextView nameView = (TextView)
				itemView.findViewById(R.id.site_title);
			if (nameView != null) {
				nameView.setText(site.getName());
			}

			final ImageView iconView = (ImageView)
				itemView.findViewById(R.id.site_image);
			if (iconView != null) {
				iconView.setImageResource(site.getIconResource());
			}

			return itemView;
		}
	}

	private class Site {
		private final String name;
		private final String audience;
		private final int iconResource;

		public Site(String name, String audience, int iconResource) {
			this.name = name;
			this.audience = audience;
			this.iconResource = iconResource;
		}

		public String getName() {
			return name;
		}

		public String getAudience() {
			return audience;
		}

		public int getIconResource() {
			return iconResource;
		}
	}
}


text:
import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger

# functions are mostly made by Sarah Otts
def add_to_database(verse_entries, db):
    logger.info("Adding {} entries to the database".format(len(verse_entries)))
    curs = db.cursor()
    #Replace old Ammianus entries with new ones to prevent duplications.
    curs.execute("DELETE FROM texts WHERE author='Ammianus'")
    for i, v in enumerate(verse_entries):
        data = curs.execute("SELECT * FROM texts")
        curs.execute("INSERT INTO texts VALUES (?,?,?,?,?,?,?, ?, ?, ?, ?)",
                     (None, v["title"], v["book"], "Latin", v["author"], v["date"],
                      v["chapter"], v["verse"], v["text"], v["link"], "prose"))

def add_entry_to_list(entries, title, book, author, date, chapter, verse, text, txturl):
    entry_dict = {"title": title, "book": book, "author": author, "date": date, "chapter": chapter,
                  "verse": verse, "text": text, "link": txturl}
    entries.append(entry_dict)

def get_verses(soup):
    # if there's nothing in the paragraph, return an empty array
    if len(soup.contents) == 0:
        return None
    # verses in prose is split by certain characters
    para_text = soup.get_text()

    verses = re.split('\[?[0-9]+[A-Z]?\]?|\[[ivx]+\]',
                      para_text)  # "[x]" can contain arabic numerals, lower case roman numerals, or upper case letters
    verses = [re.sub(r'^\s+', '', v) for v in verses]  # remove whitespace
    verses = [re.sub(r'^\n', '', v) for v in verses]  # remove \n
    verses = filter(lambda x: len(x) > 0, verses)

    # print verses
    return verses

def get_name_and_author_of_book(soup, url):
    # attempt to get it from the page title
    pagetitle = soup.title.string
    split_title = pagetitle.split(":")
    if len(split_title) >= 2:
        author = split_title[0]
        book = split_title[-1]

    # if that doesn't work, get the author from the page title and the next p-tag
    else:
        author = pagetitle
        book = soup.p.br.next_sibling

    # remove any surrounding spaces
    book = re.sub(r'^\s+|\s+$|\n', '', book)
    author = re.sub(r'^\s+|\s+$|\n', '', author)
    return [book, author]

def get_title_and_date(soup):
    title_soup = soup.find('h1')
    title = ""
    date = ""
    if title_soup != None:
        title = title_soup.string
    else:
        pagehead = soup.find('p', class_="pagehead")
        if (pagehead is not None):
            title = pagehead.find(text=True)
            if (pagehead.find('span') is not None):
                date = pagehead.find('span').string.replace("(", '').replace(")", '')
        else:
            h1 = soup.find('h1')
            title = h1.string
    if date is None or date == "":

        date_tag = soup.find('h2', class_='date')
        if (not date_tag is None):
            date = date_tag.find(text=True).replace('(', '').replace(')', '')
        else:
            date = ""

    date = date.replace(u"\u2013", '-')
    title = title.upper()

    return [title, date]

def main():
    # collection name: Ammianus
    ammaniusURL = 'http://www.thelatinlibrary.com/ammianus.html'
    siteURL = 'http://www.thelatinlibrary.com'
    ammaniusOpen = urllib.request.urlopen(ammaniusURL)
    soup = BeautifulSoup(ammaniusOpen, "html5lib")
    textsURL = []

    # search through Ammanius' soup for links to his works
    for a in soup.find_all('a', href=True):
        link = a['href']
        textsURL.append("{}/{}".format(siteURL, a['href']))
    # remove some unnecessary urls
    while ("http://www.thelatinlibrary.com/index.html" in textsURL):
        textsURL.remove("http://www.thelatinlibrary.com/index.html")
        textsURL.remove("http://www.thelatinlibrary.com/classics.html")
    logger.info("\n".join(textsURL))

    # extract data
    # get titles of Ammanius' collection
    title_dict_amm, date_dict_amm = get_title_and_date(soup)

    verses = []
    for work in textsURL:
        workURL = urllib.request.urlopen(work)
        soup = BeautifulSoup(workURL, "html5lib")
        book, author = get_name_and_author_of_book(soup, workURL)
        date = date_dict_amm
        # go through text to find chapters
        para = soup.findAll('p')[:-1]

        chapter = "1" #Note that chapters aren't integers.
        verse = 0
        text = ""

        for p in para:

            # make sure it's not a paragraph without the main text
            try:
                if p['class'][0].lower() in ['border', 'pagehead', 'shortborder',
                                             'smallboarder', 'margin', 'internal_navigation']: #not in the main text
                    continue
            except:
                pass

            chap_found = False

            # in other books, chapters are bold or italicized
            potential_chap = p.find('b')

            # some Ammianus texts have italic chapters
            if potential_chap is None:
                potential_chap = p.find('i')

            if potential_chap is not None:
                chapter = potential_chap.find(text=True)

                # Include italicized part in chap name
                italic = potential_chap.i
                if italic is not None:
                    chapter += italic.string
                chapter = chapter.replace("\n", "")

                chapter = chapter.replace(u'\xa0', '')
                chapnum = {'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X',
                           'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI'}
                if chapter in chapnum:
                    chapter = chapter.upper() #Roman numerals need to be uppercase
                else:
                    chapter = chapter.title()
                verse = 0
                continue
            # go through text to find verses
            if (get_verses(p)):
                for i, t in enumerate(get_verses(p)):
                    verse += 1
                    text = t
                    #The following line works in Python 2, but not here.
                    # text = unicode.encode(text, errors="ignore")

                    # add the entry
                    add_entry_to_list(verses, title_dict_amm, book, author, date, chapter,
                                      verse, text, work)

    with sqlite3.connect('texts.db') as db:
        # open cursor
        curs = db.cursor()
        # create the database if it doesn't already exist
        curs.execute(
            'CREATE TABLE IF NOT EXISTS texts (id INTEGER PRIMARY KEY, title TEXT, book TEXT,'
            ' language TEXT, author TEXT, date TEXT, chapter TEXT, verse TEXT, passage TEXT,'
            ' link TEXT, documentType TEXT)')
        db.commit()
        # put it all in the db
        add_to_database(verses,db)
        db.commit()

    logger.info("Process finished")

if __name__ == '__main__':
    main()


text:
package org.diirt.vtype.table;

/**
 *
 * @author carcassi
 */
public abstract class Column {

    private final String name;
    private final Class<?> type;
    private final boolean generated;

    public Column(String name, Class<?> type, boolean generated) {
        this.name = name;
        this.type = type;
        this.generated = generated;
    }

    public String getName() {
        return name;
    }

    public Class<?> getType() {
        return type;
    }

    public boolean isGenerated() {
        return generated;
    }

    public abstract Object getData(int size);

}


text:
package operatorlister

import (
	"fmt"
	"sync"

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/apimachinery/pkg/types"

	v1 "github.com/operator-framework/api/pkg/operators/v1"
	listers "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1"
)

type UnionOperatorGroupLister struct {
	csvListers map[string]listers.OperatorGroupLister
	csvLock    sync.RWMutex
}

// List lists all OperatorGroups in the indexer.
func (uol *UnionOperatorGroupLister) List(selector labels.Selector) (ret []*v1.OperatorGroup, err error) {
	uol.csvLock.RLock()
	defer uol.csvLock.RUnlock()

	set := make(map[types.UID]*v1.OperatorGroup)
	for _, cl := range uol.csvListers {
		csvs, err := cl.List(selector)
		if err != nil {
			return nil, err
		}

		for _, csv := range csvs {
			set[csv.GetUID()] = csv
		}
	}

	for _, csv := range set {
		ret = append(ret, csv)
	}

	return
}

// OperatorGroups returns an object that can list and get OperatorGroups.
func (uol *UnionOperatorGroupLister) OperatorGroups(namespace string) listers.OperatorGroupNamespaceLister {
	uol.csvLock.RLock()
	defer uol.csvLock.RUnlock()

	// Check for specific namespace listers
	if cl, ok := uol.csvListers[namespace]; ok {
		return cl.OperatorGroups(namespace)
	}

	// Check for any namespace-all listers
	if cl, ok := uol.csvListers[metav1.NamespaceAll]; ok {
		return cl.OperatorGroups(namespace)
	}

	return &NullOperatorGroupNamespaceLister{}
}

func (uol *UnionOperatorGroupLister) RegisterOperatorGroupLister(namespace string, lister listers.OperatorGroupLister) {
	uol.csvLock.Lock()
	defer uol.csvLock.Unlock()

	if uol.csvListers == nil {
		uol.csvListers = make(map[string]listers.OperatorGroupLister)
	}

	uol.csvListers[namespace] = lister
}

func (l *operatorsV1Lister) RegisterOperatorGroupLister(namespace string, lister listers.OperatorGroupLister) {
	l.operatorGroupLister.RegisterOperatorGroupLister(namespace, lister)
}

func (l *operatorsV1Lister) OperatorGroupLister() listers.OperatorGroupLister {
	return l.operatorGroupLister
}

// NullOperatorGroupNamespaceLister is an implementation of a null OperatorGroupNamespaceLister. It is
// used to prevent nil pointers when no OperatorGroupNamespaceLister has been registered for a given
// namespace.
type NullOperatorGroupNamespaceLister struct {
	listers.OperatorGroupNamespaceLister
}

// List returns nil and an error explaining that this is a NullOperatorGroupNamespaceLister.
func (n *NullOperatorGroupNamespaceLister) List(selector labels.Selector) (ret []*v1.OperatorGroup, err error) {
	return nil, fmt.Errorf("cannot list OperatorGroups with a NullOperatorGroupNamespaceLister")
}

// Get returns nil and an error explaining that this is a NullOperatorGroupNamespaceLister.
func (n *NullOperatorGroupNamespaceLister) Get(name string) (*v1.OperatorGroup, error) {
	return nil, fmt.Errorf("cannot get OperatorGroup with a NullOperatorGroupNamespaceLister")
}


text:
web-php-project
===============

Class project done with a MVC pattern in PHP. The goal was to create a small web app to manage a security system.

## Installation

You can download or clone the repo to your apache public folder. We used xampp, so if you're using xampp, you can put the project in the htdocs folder. Once that's done, run apache and MySQL servers and create a new database named "sistema_seguridad_administracion" and import the .sql file which is located in the sql folder.

Then, you wil need to copy this url and replace it in the init.php file found in the app folder. Look for something like this.

```php
'SITE_URL' => 'http://localhost/github/web-php-project/web-php-project/public/'
```

And replace the url with this one:

```
http://localhost/web-php-project/public/
```

Now, go to your browser and type:

```
localhost/web-php-project/public/
```

You should see the home page.

The last thing to do is create a user. To create a user, go to phpmyadmin and inside the categories table create a new category with id of '002' and title 'admin', you can put whatever you want in description. Then create a new user in the 'usuario' table. Now, go back to the login page and try to login.

If everything went well, then you are done!

For any problems, please leave an issue on the issues page.

##Note

This was a class project, so I will not be updating this repo for more features. I will only update it for any issues that may occur at its current point.

##License

The MIT License (MIT)

Copyright (c) 2014 Jose Padilla

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
static CGFloat kStatusViewHight = 44;

@interface StatusView : UIView

@end


text:
START_ATF_NAMESPACE
    struct _worlddb_potion_delay_info
    {
        unsigned int dwPotionDelay[38];
    public:
        _worlddb_potion_delay_info();
        void ctor__worlddb_potion_delay_info();
    };
    static_assert(ATF::checkSize<_worlddb_potion_delay_info, 152>(), "_worlddb_potion_delay_info");
END_ATF_NAMESPACE


text:
package org.umlg.sqlg.strategy.barrier;

import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimization.MessagePassingReductionStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.*;
import org.umlg.sqlg.strategy.SqlgGraphStepStrategy;
import org.umlg.sqlg.strategy.VertexStrategy;
import org.umlg.sqlg.structure.SqlgGraph;
import org.umlg.sqlg.util.SqlgTraversalUtil;

import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author Pieter Martin (https://github.com/pietermartin)
 *         Date: 2014/08/15
 */
public class SqlgVertexStepStrategy extends AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy> implements TraversalStrategy.OptimizationStrategy  {

    public SqlgVertexStepStrategy() {
        super();
    }

    @Override
    public void apply(final Traversal.Admin<?, ?> traversal) {
        //Only optimize SqlgGraph. StarGraph also passes through here.
        if (traversal.getGraph().isEmpty() || !(traversal.getGraph().orElseThrow(IllegalStateException::new) instanceof SqlgGraph)) {
            return;
        }
        if (!SqlgTraversalUtil.mayOptimize(traversal)) {
            return;
        }
        VertexStrategy.from(traversal).apply();
    }

    @Override
    public Set<Class<? extends OptimizationStrategy>> applyPost() {
        return Stream.of(
                MatchPredicateStrategy.class,
                RepeatUnrollStrategy.class,
                PathRetractionStrategy.class,
                MessagePassingReductionStrategy.class,
                IncidentToAdjacentStrategy.class
        ).collect(Collectors.toSet());
    }

    @Override
    public Set<Class<? extends OptimizationStrategy>> applyPrior() {
        return Stream.of(SqlgGraphStepStrategy.class, CountStrategy.class).collect(Collectors.toSet());
    }

}