text:
require 'dazeus/event/action'
require 'dazeus/event/alias'
require 'dazeus/event/command'
require 'dazeus/event/event'
require 'dazeus/event/message'
require 'dazeus/event/names'
require 'dazeus/event/whois'

module Dazeus
  class Dazeus
    attr_accessor :conn
    attr_reader :handshake

    Protocol = 1

    def initialize(connection)
      @conn = connection
      @subscribers = {}
      @handshake = false
    end

    def networks
      response = send_receive({:get => 'networks'})
      return [] unless response['success']
      response['networks']
    end

    def channels(network)
      response = send_receive({:get => 'channels', :params => [network]})
      return [] unless response['success']
      response['channels']
    end

    def message(network, channel, message)
      response = send_receive({:do => 'message', :params => [network, channel, message]})
      response['success']
    end

    def action(network, channel, message)
      response = send_receive({:do => 'action', :params => [network, channel, message]})
      response['success']
    end

    def reply(network, channel, nick, message, highlight=true, action=false)
      bot_nick = self.nick(network)
      if channel == bot_nick
        if action
          self.action(network, nick, message)
        else
          self.message(network, nick, message)
        end
      else
        message = nick + ': ' + message if highlight
        if action
          self.action(network, channel, message)
        else
          self.message(network, channel, message)
        end
      end
    end

    def send_names(network, channel)
      response = send_receive({:do => 'names', :params => [network, channel]})
      response['success']
    end

    def names(network, channel, &block)
      fn = lambda do |response|
        unsubscribe('NAMES', &fn)
        block.call(response)
      end
      subscribe('NAMES', &fn)
      send_names(network, channel)
    end

    def names_sync(network, channel)
      resolved = false
      result = nil
      names(network, channel) do |names|
        resolved = true
        result = names
      end

      # Wait for the names request to be resolved
      loop do
        break if resolved
        once
      end
      result
    end

    def send_whois(network, nick)
      response = send_receive({:do => 'whois', :params => [network, nick]})
      response['success']
    end

    def whois(network, nick, &block)
      fn = lambda do |response|
        block.call(response)
        unsubscribe('WHOIS', &fn)
      end
      subscribe('WHOIS', &fn)
      send_whois(network, nick)
    end

    def whois_sync(network, nick)
      resolved = false
      result = nil
      whois(network, nick) do |whois|
        resolved = true
        result = whois
      end

      # Wait for the whois request to be resolved
      loop do
        break if resolved
        once
      end
      result
    end

    def join(network, channel)
      response = send_receive({:do => 'join', :params => [network, channel]})
      response['success']
    end

    def part(network, channel)
      response = send_receive({:do => 'part', :params => [network, channel]})
      response['success']
    end

    def nick(network)
      response = send_receive({:get => 'nick', :params => [network]})
      return nil unless response['success']
      response['nick']
    end

    def do_handshake(name, version, config=nil)
      config = name if config == nil
      response = send_receive({:do => 'handshake', :params => [name, version, Protocol, config]})
      @handshake = true if response['success']
      response['success']
    end

    def get_config(name, group=:plugin)
      return nil unless group == :core || @handshake
      response = send_receive({:get => 'config', :params => [group.to_s, name]})
      return nil unless response['success'] && response.key?('value')
      response['value']
    end

    def highlight_character
      get_config('highlight', :core)
    end

    def get_property(name, scope=[])
      data = {:do => 'property', :params => ['get', name]}
      data[:scope] = scope if scope.length > 0
      response = send_receive(data)
      return nil unless response['success'] && response.key?('value')
      response['value']
    end

    def set_property(name, value, scope=[])
      data = {:do => 'property', :params => ['set', name, value]}
      data[:scope] = scope if scope.length > 0
      response = send_receive(data)
      response['success']
    end

    def unset_property(name, scope=[])
      data = {:do => 'property', :params => ['unset', name]}
      data[:scope] = scope if scope.length > 0
      response = send_receive(data)
      response['success']
    end

    def get_property_keys(name, scope=[])
      data = {:do => 'property', :params => ['keys', name]}
      data[:scope] = scope if scope.length > 0
      response = send_receive(data)
      return [] unless response['success'] && response.key?('keys')
      response['keys']
    end

    def subscribe(event, &callback)
      success = true
      event.upcase.split(' ').each do |ev|
        ev = Event::Alias.resolve(ev)
        @subscribers[ev] = [] unless @subscribers.has_key?(ev)
        if @subscribers[ev].length == 0
          response = send_receive({:do => 'subscribe', :params => [ev]})
          success = success && response['success']
        end
        @subscribers[ev].push callback
      end
      success
    end

    def unsubscribe(event, &callback)
      success = true
      event.upcase.split(' ').each do |ev|
        ev = Event::Alias.resolve(ev)
        @subscribers[ev] = [] unless @subscribers.has_key?(ev)
        precount = @subscribers[ev].length
        @subscribers[ev].delete callback
        if precount > 0 && @subscribers[ev].length == 0
          response = send_receive({:do => 'unsubscribe', :params => [ev]})
          success = success && response['success']
        end
      end
      success
    end

    def on_command(command, network=nil, &callback)
      @subscribers['COMMAND'] = [] unless @subscribers.has_key?('COMMAND')
      @subscribers['COMMAND'][command] = [] unless @subscribers['COMMAND'].has_key?(command)
      success = true
      if @subscribers['COMMAND'][command].length == 0
        response = send_receive({:do => 'command', :params => [command]})
        success = response['success']
      end
      @subscribers['COMMAND'][command].push [network, callback]
      success
    end

    def once
      handle_event conn.receive
    end

    def run
      loop do
        break if conn.closed?
        once
      end
    end
    alias_method :start, :run

    def close
      conn.close
    end
    alias_method :stop, :close

    private
      def send_receive(message)
        conn.send message
        response = nil
        loop do
          break if conn.closed?
          response = conn.receive
          break unless handle_event response
        end

        return {} if response == nil
        response
      end

      def handle_event(response)
        if response.has_key?('event')
          event = response['event'].upcase
          obj = case event
            when 'PRIVMSG', 'PRIVMSG_ME' then Event::Message.new(response, self)
            when 'COMMAND' then Event::Command.new(response, self)
            when 'ACTION', 'ACTION_ME' then Event::Action.new(response, self)
            when 'NAMES' then Event::Names.new(response, self)
            when 'WHOIS' then Event::Whois.new(response, self)
            else Event::Event.new(response, self)
          end

          if event == 'COMMAND'
            @subscribers[event][obj['params'][3]].each do |callback|
              callback.call(obj)
            end
          else
            @subscribers[event].each do |callback|
              callback.call(obj)
            end
          end
          true
        else
          false
        end
      end
  end
end


text:
/**
 */
package org.osate.xtext.aadl2.agcl.agcl.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.osate.xtext.aadl2.agcl.agcl.AgclPackage;
import org.osate.xtext.aadl2.agcl.agcl.PSLBiconditional;
import org.osate.xtext.aadl2.agcl.agcl.PSLExpression;

/**
 *
 * An implementation of the model object 'PSL Biconditional'.
 *
 *

 * The following features are implemented:
 *

 *
{@link org.osate.xtext.aadl2.agcl.agcl.impl.PSLBiconditionalImpl#getLeft Left}

 *
{@link org.osate.xtext.aadl2.agcl.agcl.impl.PSLBiconditionalImpl#getRight Right}

 *

 *

 *
 * @generated
 */
public class PSLBiconditionalImpl extends PSLExpressionImpl implements PSLBiconditional
{
  /**
   * The cached value of the '{@link #getLeft() Left}' containment reference.
   *
   *
   * @see #getLeft()
   * @generated
   * @ordered
   */
  protected PSLExpression left;

  /**
   * The cached value of the '{@link #getRight() Right}' containment reference.
   *
   *
   * @see #getRight()
   * @generated
   * @ordered
   */
  protected PSLExpression right;

  /**
   *
   *
   * @generated
   */
  protected PSLBiconditionalImpl()
  {
    super();
  }

  /**
   *
   *
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return AgclPackage.Literals.PSL_BICONDITIONAL;
  }

  /**
   *
   *
   * @generated
   */
  public PSLExpression getLeft()
  {
    return left;
  }

  /**
   *
   *
   * @generated
   */
  public NotificationChain basicSetLeft(PSLExpression newLeft, NotificationChain msgs)
  {
    PSLExpression oldLeft = left;
    left = newLeft;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgclPackage.PSL_BICONDITIONAL__LEFT, oldLeft, newLeft);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   *
   *
   * @generated
   */
  public void setLeft(PSLExpression newLeft)
  {
    if (newLeft != left)
    {
      NotificationChain msgs = null;
      if (left != null)
        msgs = ((InternalEObject)left).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AgclPackage.PSL_BICONDITIONAL__LEFT, null, msgs);
      if (newLeft != null)
        msgs = ((InternalEObject)newLeft).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AgclPackage.PSL_BICONDITIONAL__LEFT, null, msgs);
      msgs = basicSetLeft(newLeft, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, AgclPackage.PSL_BICONDITIONAL__LEFT, newLeft, newLeft));
  }

  /**
   *
   *
   * @generated
   */
  public PSLExpression getRight()
  {
    return right;
  }

  /**
   *
   *
   * @generated
   */
  public NotificationChain basicSetRight(PSLExpression newRight, NotificationChain msgs)
  {
    PSLExpression oldRight = right;
    right = newRight;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgclPackage.PSL_BICONDITIONAL__RIGHT, oldRight, newRight);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   *
   *
   * @generated
   */
  public void setRight(PSLExpression newRight)
  {
    if (newRight != right)
    {
      NotificationChain msgs = null;
      if (right != null)
        msgs = ((InternalEObject)right).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AgclPackage.PSL_BICONDITIONAL__RIGHT, null, msgs);
      if (newRight != null)
        msgs = ((InternalEObject)newRight).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AgclPackage.PSL_BICONDITIONAL__RIGHT, null, msgs);
      msgs = basicSetRight(newRight, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, AgclPackage.PSL_BICONDITIONAL__RIGHT, newRight, newRight));
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case AgclPackage.PSL_BICONDITIONAL__LEFT:
        return basicSetLeft(null, msgs);
      case AgclPackage.PSL_BICONDITIONAL__RIGHT:
        return basicSetRight(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case AgclPackage.PSL_BICONDITIONAL__LEFT:
        return getLeft();
      case AgclPackage.PSL_BICONDITIONAL__RIGHT:
        return getRight();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case AgclPackage.PSL_BICONDITIONAL__LEFT:
        setLeft((PSLExpression)newValue);
        return;
      case AgclPackage.PSL_BICONDITIONAL__RIGHT:
        setRight((PSLExpression)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case AgclPackage.PSL_BICONDITIONAL__LEFT:
        setLeft((PSLExpression)null);
        return;
      case AgclPackage.PSL_BICONDITIONAL__RIGHT:
        setRight((PSLExpression)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case AgclPackage.PSL_BICONDITIONAL__LEFT:
        return left != null;
      case AgclPackage.PSL_BICONDITIONAL__RIGHT:
        return right != null;
    }
    return super.eIsSet(featureID);
  }

} //PSLBiconditionalImpl

redpajama_set_name: RedPajamaGithub


text:
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem139.py
#
# Pythagorean tiles
# =================
# Published on Saturday, 27th January 2007, 09:00 am
#
# Let (a, b, c) represent the three sides of a right angle triangle with
# integral length sides. It is possible to place four such triangles together
# to form a square with length c. For example, (3, 4, 5) triangles can be
# placed together to form a 5 by 5 square with a 1 by 1 hole in the middle and
# it can be seen that the 5 by 5 square can be tiled with twenty-five 1 by 1
# squares.    However, if (5, 12, 13) triangles were used then the hole would
# measure 7 by 7 and these could not be used to tile the 13 by 13 square. Given
# that the perimeter of the right triangle is less than one-hundred million,
# how many Pythagorean triangles would allow such a tiling to take place?

import projecteuler as pe

def main():
    pass

if __name__ == "__main__":
    main()


text:
.. _General_Issues:

General Issues
==============

Downloading and Sending Logs
----------------------------

***************
Accessing Logs
***************

Depending on whether you are using Hadoop with H2O and whether the job is currently running, there are different ways of obtaining the logs for H2O.

**Note**: Unless otherwise specified, the following methods work the same for the first version of H2O (H2O1) and H2O-dev (which uses a UI known as H2O-Flow).

Copy and email the logs to support@h2o.ai or submit them to h2ostream@googlegroups.com with a brief description of your Hadoop environment, including the Hadoop distribution and version.

********************
Without Running Jobs
********************

- If you are using Hadoop and the job is not running, view the logs by using the ``yarn logs -applicationId`` command. When you start an H2O instance, the complete command displays in the output:

::

	amy@mr-0xb1:~/h2o-2.5.0.99999/hadoop$ hadoop jar h2odriver_hdp1.3.2.jar water.hadoop.h2odriver
	-libjars ../h2o.jar -mapperXmx 10g -nodes 4 -output output903 -verbose:class
	Determining driver host interface for mapper->driver callback...
    [Possible callback IP address: 192.168.1.161]
    [Possible callback IP address: 127.0.0.1]
	Using mapper->driver callback IP address and port: 192.168.1.161:37244
	(You can override these with -driverif and -driverport.)
	Driver program compiled with MapReduce V1 (Classic)
	Memory Settings:
	mapred.child.java.opts:      -Xms10g -Xmx10g -verbose:class
	mapred.map.child.java.opts:  -Xms10g -Xmx10g -verbose:class
	Extra memory percent:        10
	mapreduce.map.memory.mb:     11264
	Job name 'H2O_74206' submitted
	JobTracker job ID is 'job_201407040936_0030'
	For YARN users, logs command is 'yarn logs -applicationId application_201407040936_0030'
	Waiting for H2O cluster to come up...

In the above example, the command is specified in the next to last line (``For YARN users, logs command is...``). The command is unique for each instance. In Terminal, enter ``yarn logs -applicationId application_<UniqueID>`` to view the logs (where ``<UniqueID>`` is the number specified in the next to last line of the output that displayed when you created the cluster).

""""""""

- Use YARN to obtain the ``stdout`` and ``stderr`` logs that are used for troubleshooting. To learn how to access YARN based on management software, version, and job status, see "Accessing YARN".

 1. Click the **Applications** link to view all jobs, then click the **History** link for the job.

	.. image:: images/YARN_AllApps_History.png
	   :width: 100%

 2. Click the **logs** link.

	.. image:: images/YARN_History_Logs.png
	   :width: 100%

 3. 	Copy the information that displays and send it in an email to support@h2o.ai.

	.. image:: images/YARN_History_Logs2.png
	   :width: 100%

""""""""""""

******************
With Running Jobs
******************

If you are using Hadoop and the job is still running:

- Use YARN to obtain the ``stdout`` and ``stderr`` logs that are used for troubleshooting. To learn how to access YARN based on management software, version, and job status, see "Accessing YARN".

 1. Click the **Applications** link to view all jobs, then click the **ApplicationMaster** link for the job.

	.. image:: images/YARN_AllApps_AppMaster.png
	   :width: 100%

 2. Select the job from the list of active jobs.

	.. image:: images/YARN_AppMaster_Job.png
	   :width: 100%

 3. Click the **logs** link.

	 .. image:: images/YARN_AppMaster_Logs.png
	    :width: 100%

 4. 	Send the contents of the displayed files to support@h2o.ai.

	.. image:: images/YARN_AppMaster_Logs2.png
	   :width: 100%

""""""""

- (H2O1) Go to the H2O web UI and select **Admin** > **Inspect Log** or go to http://localhost:54321/LogView.html. To download the logs, click the **Download Logs** button.

 When you view the log, the output displays the location of log directory after ``Log dir:`` (as shown in the last line in the following example):

::

	08-Jan 12:27:39.099 172.16.2.188:54321    28195 main      INFO WATER: ----- H2O started -----
	08-Jan 12:27:39.100 172.16.2.188:54321    28195 main      INFO WATER: Build git branch: rel-mirzakhani
	08-Jan 12:27:39.100 172.16.2.188:54321    28195 main      INFO WATER: Build git hash: ae31ed04e47d826b73e7180e07ba00db13e879f3
	08-Jan 12:27:39.100 172.16.2.188:54321    28195 main      INFO WATER: Build git describe: jenkins-rel-mirzakhani-2
	08-Jan 12:27:39.100 172.16.2.188:54321    28195 main      INFO WATER: Build project version: 2.8.3.2
	08-Jan 12:27:39.101 172.16.2.188:54321    28195 main      INFO WATER: Built by: 'jenkins'
	08-Jan 12:27:39.101 172.16.2.188:54321    28195 main      INFO WATER: Built on: 'Thu Dec 18 18:54:25 PST 2014'
	08-Jan 12:27:39.101 172.16.2.188:54321    28195 main      INFO WATER: Java availableProcessors: 32
	08-Jan 12:27:39.102 172.16.2.188:54321    28195 main      INFO WATER: Java heap totalMemory: 0.96 gb
	08-Jan 12:27:39.102 172.16.2.188:54321    28195 main      INFO WATER: Java heap maxMemory: 0.96 gb
	08-Jan 12:27:39.102 172.16.2.188:54321    28195 main      INFO WATER: Java version: Java 1.7.0_72 (from Oracle Corporation)
	08-Jan 12:27:39.103 172.16.2.188:54321    28195 main      INFO WATER: OS   version: Linux 3.13.0-43-generic (amd64)
	08-Jan 12:27:39.106 172.16.2.188:54321    28195 main      INFO WATER: Machine physical memory: 251.89 gb
	08-Jan 12:27:39.235 172.16.2.188:54321    28195 main      INFO WATER: ICE root: '/home2/hdp/yarn/usercache/H2O-User/appcache/application_1420450259209_0017'
	08-Jan 12:27:39.238 172.16.2.188:54321    28195 main      INFO WATER: Possible IP Address: br2 (br2), 172.16.2.188
	08-Jan 12:27:39.238 172.16.2.188:54321    28195 main      INFO WATER: Possible IP Address: lo (lo), 127.0.0.1
	08-Jan 12:27:39.330 172.16.2.188:54321    28195 main      INFO WATER: Internal communication uses port: 54322
	+                                                                     Listening for HTTP and REST traffic on  http://172.16.2.188:54321/
	08-Jan 12:27:39.372 172.16.2.188:54321    28195 main      INFO WATER: H2O cloud name: 'H2O_45911'
	08-Jan 12:27:39.372 172.16.2.188:54321    28195 main      INFO WATER: (v2.8.3.2) 'H2O_45911' on /172.16.2.188:54321, discovery address /237.88.97.222:60760
	08-Jan 12:27:39.372 172.16.2.188:54321    28195 main      INFO WATER: If you have trouble connecting, try SSH tunneling from your local machine (e.g., via port 55555):
	+                                                                       1. Open a terminal and run 'ssh -L 55555:localhost:54321 yarn@172.16.2.188'
	+                                                                       2. Point your browser to http://localhost:55555
	08-Jan 12:27:39.377 172.16.2.188:54321    28195 main      DEBG WATER: Announcing new Cloud Membership: [/172.16.2.188:54321]
	08-Jan 12:27:39.379 172.16.2.188:54321    28195 main      INFO WATER: Cloud of size 1 formed [/172.16.2.188:54321 (00:00:00.000)]
	08-Jan 12:27:39.379 172.16.2.188:54321    28195 main      INFO WATER: Log dir: '/home2/hdp/yarn/usercache/H2O-User/appcache/application_1420450259209_0017/h2ologs'

""""""""""

- (H2O1) In Terminal, enter ``cd /tmp/h2o-<UserName>/h2ologs`` (where ``<UserName>`` is your computer user name), then enter ``ls -l`` to view a list of the log files. The ``httpd`` log contains the request/response status of all REST API transactions.
  The rest of the logs use the format ``h2o_\<IPaddress>\_<Port>-<LogLevel>-<LogLevelName>.log``, where ``<IPaddress>`` is the bind address of the H2O instance, ``<Port>`` is the port number, ``<LogLevel>`` is the numerical log level (1-6, with 6 as the highest severity level), and ``<LogLevelName>`` is the name of the log level (trace, debug, info, warn, error, or fatal).

""""""""""

- (H2O1) Download the logs using R. In R, enter the command ``h2o.downloadAllLogs(client = localH2O,filename = "logs.zip")`` (where ``client`` is the H2O cluster and ``filename`` is the specified filename for the logs).

""""""""

Accessing YARN
---------------

Methods for accessing YARN vary depending on the default management software and version, as well as job status.

***********
Cloudera 4
***********

1. In Cloudera Manager, click the **yarn** link in the cluster section.
  .. image:: images/Logs_cloudera4_1.png
     :width: 50%

2. Click the **Web UI** drop-down menu. If the job is running, select **ResourceManager Web UI**. If the job is not running, select **HistoryServer Web UI**.

 .. image:: images/Logs_cloudera4_2.png
    :width: 50%

""""""

***********
Cloudera 5
***********

1. In Cloudera Manager, click the **YARN** link in the cluster section.
  .. image:: images/Logs_cloudera5_1.png
     :width: 50%

2. In the Quick Links section, select **ResourceManager Web UI** if the job is running or select **HistoryServer Web UI** if the job is not running.

 .. image:: images/Logs_cloudera5_2.png
    :width: 50%

""""""""""

*******
Ambari
*******

1. From the Ambari Dashboard, select **YARN**.

  .. image:: images/Logs_ambari1.png
     :width: 50%

2. From the Quick Links drop-down menu, select **ResourceManager UI**.

  .. image:: images/Logs_ambari2.png
     :width: 50%

""""""""""

For Non-Hadoop Users
--------------------

*********************
Without Current Jobs
*********************

If you are not using Hadoop and the job is not running:

- (H2O1) In Terminal, enter ``cd /tmp/h2o-<UserName>/h2ologs`` (where ``<UserName>`` is your computer user name), then enter `ls -l` to view a list of the log files. The ``httpd`` log contains the request/response status of all REST API transactions.
 The rest of the logs use the format ``h2o_\<IPaddress>\_<Port>-<LogLevel>-<LogLevelName>.log``, where ``<IPaddress>`` is the bind address of the H2O instance, `<Port>` is the port number, ``<LogLevel>`` is the numerical log level (1-6, with 6 as the highest severity level), and ``<LogLevelName>`` is the name of the log level (trace, debug, info, warn, error, or fatal).

""""""

******************
With Current Jobs
******************

If you are not using Hadoop and the job is still running:

- (H2O1) Go to the H2O web UI and select **Admin** > **Inspect Log** or go to http://localhost:54321/LogView.html. To download the logs, click the **Download Logs** button.

	.. Image:: images/Logsdownload.png
   		:width: 70%

 When you view the log, the output displays the location of log directory after ``Log dir:`` (as shown in the last line in the following example):

::

	08-Jan 13:04:47.018 172.16.2.20:20002     2067  main      INFO WATER: ----- H2O started -----
	08-Jan 13:04:47.018 172.16.2.20:20002     2067  main      INFO WATER: Build git branch: rel-mirzakhani
	08-Jan 13:04:47.018 172.16.2.20:20002     2067  main      INFO WATER: Build git hash: ae31ed04e47d826b73e7180e07ba00db13e879f3
	08-Jan 13:04:47.019 172.16.2.20:20002     2067  main      INFO WATER: Build git describe: jenkins-rel-mirzakhani-2
	08-Jan 13:04:47.019 172.16.2.20:20002     2067  main      INFO WATER: Build project version: 2.8.3.2
	08-Jan 13:04:47.019 172.16.2.20:20002     2067  main      INFO WATER: Built by: 'jenkins'
	08-Jan 13:04:47.019 172.16.2.20:20002     2067  main      INFO WATER: Built on: 'Thu Dec 18 18:54:25 PST 2014'
	08-Jan 13:04:47.019 172.16.2.20:20002     2067  main      INFO WATER: Java availableProcessors: 8
	08-Jan 13:04:47.020 172.16.2.20:20002     2067  main      INFO WATER: Java heap totalMemory: 0.24 gb
	08-Jan 13:04:47.020 172.16.2.20:20002     2067  main      INFO WATER: Java heap maxMemory: 0.89 gb
	08-Jan 13:04:47.020 172.16.2.20:20002     2067  main      INFO WATER: Java version: Java 1.7.0_67 (from Oracle Corporation)
	08-Jan 13:04:47.021 172.16.2.20:20002     2067  main      INFO WATER: OS   version: Mac OS X 10.9.5 (x86_64)
	08-Jan 13:04:47.060 172.16.2.20:20002     2067  main      INFO WATER: Machine physical memory: 16.00 gb
	08-Jan 13:04:47.214 172.16.2.20:20002     2067  main      INFO WATER: ICE root: '/tmp/h2o-H2O-User'
	08-Jan 13:04:47.218 172.16.2.20:20002     2067  main      INFO WATER: Possible IP Address: en0 (en0), fe80:0:0:0:82e6:50ff:fe1e:1480%4
	08-Jan 13:04:47.218 172.16.2.20:20002     2067  main      INFO WATER: Possible IP Address: en0 (en0), 172.16.2.20
	08-Jan 13:04:47.218 172.16.2.20:20002     2067  main      INFO WATER: Possible IP Address: lo0 (lo0), fe80:0:0:0:0:0:0:1%1
	08-Jan 13:04:47.218 172.16.2.20:20002     2067  main      INFO WATER: Possible IP Address: lo0 (lo0), 0:0:0:0:0:0:0:1
	08-Jan 13:04:47.218 172.16.2.20:20002     2067  main      INFO WATER: Possible IP Address: lo0 (lo0), 127.0.0.1
	08-Jan 13:04:47.246 172.16.2.20:20002     2067  main      INFO WATER: Internal communication uses port: 20003
	+                                                                     Listening for HTTP and REST traffic on  http://172.16.2.20:20002/
	08-Jan 13:04:47.286 172.16.2.20:20002     2067  main      INFO WATER: H2O cloud name: 'H2O-User'
	08-Jan 13:04:47.286 172.16.2.20:20002     2067  main      INFO WATER: (v2.8.3.2) 'H2O-User' on /172.16.2.20:20002, discovery address /236.56.107.204:60472
	08-Jan 13:04:47.286 172.16.2.20:20002     2067  main      INFO WATER: If you have trouble connecting, try SSH tunneling from your local machine (e.g., via port 55555):
	+                                                                       1. Open a terminal and run 'ssh -L 55555:localhost:20002 H2O-User@172.16.2.20'
	+                                                                       2. Point your browser to http://localhost:55555
	08-Jan 13:04:47.290 172.16.2.20:20002     2067  main      DEBG WATER: Announcing new Cloud Membership: [/172.16.2.20:20002]
	08-Jan 13:04:47.292 172.16.2.20:20002     2067  main      INFO WATER: Cloud of size 1 formed [/172.16.2.20:20002 (00:00:00.000)]
	08-Jan 13:04:47.292 172.16.2.20:20002     2067  main      INFO WATER: Log dir: '/tmp/h2o-H2O-User/h2ologs'

""""""""""""

- (H2O1) In Terminal, enter ``cd /tmp/h2o-<UserName>/h2ologs`` (where ``<UserName>`` is your computer user name), then enter `ls -l` to view a list of the log files. The ``httpd`` log contains the request/response status of all REST API transactions.
 The rest of the logs use the format ``h2o_\<IPaddress>\_<Port>-<LogLevel>-<LogLevelName>.log``, where ``<IPaddress>`` is the bind address of the H2O instance, `<Port>` is the port number, ``<LogLevel>`` is the numerical log level (1-6, with 6 as the highest severity level), and ``<LogLevelName>`` is the name of the log level (trace, debug, info, warn, error, or fatal).

""""""""

- (H2O1) To view the REST API logs from R:
 1. In R, enter ``h2o.startLogging()``. The output displays the location of the REST API logs:

::

	> h2o.startLogging()
	Appending REST API transactions to log file /var/folders/ylcq5nhky53hjcl9wrqxt39kz80000gn/T//RtmpE7X8Yv/rest.log

2. Copy the displayed file path.
	 Enter ``less`` and paste the file path.
3. Press Enter. A time-stamped log of all REST API transactions displays.

	::

		------------------------------------------------------------

		Time:     2015-01-06 15:46:11.083

		GET       http://172.16.2.20:54321/3/Cloud.json
		postBody:

		curlError:         FALSE
		curlErrorMessage:
		httpStatusCode:    200
		httpStatusMessage: OK
		millis:            3

		{"__meta":{"schema_version":	1,"schema_name":"CloudV1","schema_type":"Iced"},"version":"0.1.17.1009","cloud_name":...[truncated]}
		-------------------------------------------------------------

""""

- (H2O1) Download the logs using R. In R, enter the command ``h2o.downloadAllLogs(client = localH2O,filename = "logs.zip")`` (where ``client`` is the H2O cluster and ``filename`` is the specified filename for the logs).

""""""""""""""""""""""""

Tunneling between servers with H\ :sub:`2`\ O
"""""""""""""""""""""""""""""""""""""""""""""

1. Use ssh to log in to the machine where H2O will run.
2. Start an instance of H2O by locating the working directory and calling a java command similar to the following example.

 The port number chosen here is arbitrary; yours may be different.
 ::

 $ java -jar h2o.jar -port  55599

 This returns output similar to the following:

::

	irene@mr-0x3:~/target$ java -jar h2o.jar -port 55599
	04:48:58.053 main      INFO WATER: ----- H2O started -----
	04:48:58.055 main      INFO WATER: Build git branch: master
	04:48:58.055 main      INFO WATER: Build git hash: 64fe68c59ced5875ac6bac26a784ce210ef9f7a0
	04:48:58.055 main      INFO WATER: Build git describe: 64fe68c
	04:48:58.055 main      INFO WATER: Build project version: 1.7.0.99999
	04:48:58.055 main      INFO WATER: Built by: 'Irene'
	04:48:58.055 main      INFO WATER: Built on: 'Wed Sep  4 07:30:45 PDT 2013'
	04:48:58.055 main      INFO WATER: Java availableProcessors: 4
	04:48:58.059 main      INFO WATER: Java heap totalMemory: 0.47 gb
	04:48:58.059 main      INFO WATER: Java heap maxMemory: 6.96 gb
	04:48:58.060 main      INFO WATER: ICE root: '/tmp'
	04:48:58.081 main      INFO WATER: Internal communication uses port: 55600
	+                                  Listening for HTTP and REST traffic on
	+                                  http://192.168.1.173:55599/
	04:48:58.109 main      INFO WATER: H2O cloud name: 'irene'
	04:48:58.109 main      INFO WATER: (v1.7.0.99999) 'irene' on
	/192.168.1.173:55599, discovery address /230 .252.255.19:59132
	04:48:58.111 main      INFO WATER: Cloud of size 1 formed [/192.168.1.173:55599]
	04:48:58.247 main      INFO WATER: Log dir: '/tmp/h2ologs'

3. Log into the remote machine where the running instance of H2O will be forwarded using a command similar to the following (where users specified port numbers and IP address will be different)

 ::

	ssh -L 55577:localhost:55599 irene@192.168.1.173

4. Check the cluster status.

You are now using H2O from localhost:55577, but the
instance of H2O is running on the remote server (in this
case the server with the ip address 192.168.1.xxx) at port number 55599.

To see this in action note that the web UI is pointed at
localhost:55577, but that the cluster status shows the cluster running
on 192.168.1.173:55599

.. Image:: Clusterstattunnel.png
    :width: 70%

""""""""""""""""""""""""""""

Common Troubleshooting Questions
""""""""""""""""""""""""""""""""

**Why is "Upload" is no longer working?**

This can occur when a user's local disk is full or almost full.
Free up space on your local disk, and the behavior should resolve.

""""""""""""""""""""

**What the 'Exclude' field on the Parse page mean?**

In the event a directory rather than a single file is imported, the user can choose certain files to drop or not parse.
All other files in the folder if not specified in the "Exclude" argument are parsed together as a single data object with the common header.

""""""""""""""""""

**Why is H2O not launching from the command line?**

::

   $ java -jar h2o.jar &

   % Exception in thread "main" java.lang.ExceptionInInitializerError
   at java.lang.Class.initializeClass(libgcj.so.10)
   at water.Boot.getMD5(Boot.java:73)
   at water.Boot.<init>(Boot.java:114)
   at water.Boot.<clinit>(Boot.java:57)
   at java.lang.Class.initializeClass(libgcj.so.10)
    Caused by: java.lang.IllegalArgumentException
   at java.util.regex.Pattern.compile(libgcj.so.10)
   at water.util.Utils.<clinit>(Utils.java:1286)
   at java.lang.Class.initializeClass(libgcj.so.10)
   ...4 more

The only prerequiste for running H\ :sub:`2`\ O is a compatiable version of Java. We recommend `Oracle's Java 1.7 <http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html>`_.

""""""""""""""""""""

**I launched H2O instances on my nodes but why won't they cloud up?**

When launching without specifying the IP address by adding argument -ip:

::

  $ java -Xmx20g -jar h2o.jar -flatfile flatfile.txt -port 54321

and multiple local IP addresses are detected, H2O will fall back to default 127.0.0.1 as shown below:

::

  10:26:32.266 main      WARN WATER: Multiple local IPs detected:
  +                                    /198.168.1.161  /198.168.58.102
  +                                  Attempting to determine correct address...
  10:26:32.284 main      WARN WATER: Failed to determine IP, falling back to localhost.
  10:26:32.325 main      INFO WATER: Internal communication uses port: 54322
  +                                  Listening for HTTP and REST traffic
  +                                  on http://127.0.0.1:54321/
  10:26:32.378 main      WARN WATER: Flatfile configuration does not include self:
  /127.0.0.1:54321 but contains [/192.168.1.161:54321, /192.168.1.162:54321]

To avoid falling back to 127.0.0.1 on servers with multiple local IP addresses just run the command with the -ip argument forcing a launch at the appropriate location:

::

  $ java -Xmx20g -jar h2o.jar -flatfile flatfile.txt -ip 192.168.1.161 -port 54321

""""""""""""""""""""""

**Parse Error: "Parser setup appears to be broken, got SVMLight data with (estimated) 0 columns."**

H2O does not currently support a leading label line. Convert a row from:

::

  i 702101:1 732101:1 803101:1 808101:1 727101:1 906101:1 475101:1
  j 702101:1 732101:1 803101:1 808101:1 727101:1 906101:1 475101:1

to

::

  1 702101:1 732101:1 803101:1 808101:1 727101:1 906101:1 475101:1
  2 702101:1 732101:1 803101:1 808101:1 727101:1 906101:1 475101:1

and the file should parse.

""""""""""""""""""""

**How do I export a model with more than 10 trees?**

Please `contact us <support@h2o.ai>`_ for a license that will allow you to run H2O with the following `-license` argument and export larger models.

::

  java -Xmx1g -jar h2o.jar -license h2oeval.asc

""""""""""""""""""""""


text:
(function(){
  var metas = document.getElementsByTagName("meta");
  for (var i = 0, n = metas.length; i < n; ++i) {
    var meta = metas[i], name = meta.getAttribute("name");
    if (name == "gwt:module") {
      var modName, content = meta.getAttribute("content");
      if (content) {
        var eqPos = content.lastIndexOf("=");
        if (eqPos != -1) {
          modName = content.substring(eqPos + 1);
          content = content.substring(0, eqPos) + '/' + modName;
        } else {
          modName = content;
        }
        document.write('<script src="' + content + '.nocache.js"></script>');
      }
    }
  }
})();


text:
<?php

namespace Napp\AeroGearPush;

use Napp\AeroGearPush\Client\CurlClient;
use Napp\AeroGearPush\Exception\AeroGearMissingOAuthTokenException;
use Napp\AeroGearPush\Exception\AeroGearPushException;
use Napp\AeroGearPush\Request\CreateAndroidVariantRequest;
use Napp\AeroGearPush\Request\CreateIosVariantRequest;
use Napp\AeroGearPush\Request\CreateSimplePushVariantRequest;
use Napp\AeroGearPush\Request\DeleteApplicationRequest;
use Napp\AeroGearPush\Request\GetApplicationInstallationRequest;
use Napp\AeroGearPush\Request\GetApplicationRequest;
use Napp\AeroGearPush\Request\GetMetricsDashboardRequest;
use Napp\AeroGearPush\Request\GetMetricsMessagesRequest;
use Napp\AeroGearPush\Request\GetSysInfoHealthRequest;
use Napp\AeroGearPush\Request\SenderPushRequest;
use Napp\AeroGearPush\Request\RegistryDeviceImporterRequest;

/**
 * Class AeroGearPush
 *
 * @package Napp
 */
class AeroGearPush
{
    /**
     * @var
     */
    private $applicationId;

    /**
     * @var
     */
    private $masterSecret;

    /**
     * @var
     */
    private $serverUrl;

    /**
     * @var \Napp\AeroGearPush\Client\CurlClient
     */
    private $curlClient;

    /**
     * @var
     */
    private $verifySSL;

    /**
     * AeroGearPush constructor.
     */
    public function __construct($serverUrl = false, $options = [])
    {
        if (false == $serverUrl || false == parse_url($serverUrl)) {
            throw new AeroGearPushException('No, or malformed serverUrl available');
        }

        $this->setServerUrl($serverUrl);

        if (0 < count($options)) {
            foreach ($options as $option => $value) {
                $this->$option = $value;
            }
        }

        $this->curlClient = new CurlClient();
    }

    /**
     * @param $name
     *
     * @return mixed
     */
    public function __get($name)
    {
        return $this->$name;
    }

    /**
     * @param $verifySSL
     *
     * @return $this
     */
    public function setValidateSSL($verifySSL)
    {
        $this->verifySSL = $verifySSL;

        return $this;
    }

    /**
     * @param $applicationId
     *
     * @return $this
     */
    public function setApplicationId($applicationId)
    {
        $this->applicationId = $applicationId;

        return $this;
    }

    /**
     * @param $serverUrl
     *
     * @return $this
     */
    public function setServerUrl($serverUrl)
    {
        $this->serverUrl = $serverUrl;

        return $this;
    }

    /**
     * @param $masterSecret
     *
     * @return $this
     */
    public function setMasterSecret($masterSecret)
    {
        $this->masterSecret = $masterSecret;

        return $this;
    }

    /**
     * @param \Napp\AeroGearPush\Request\GetSysInfoHealthRequest $request
     *
     * @return string
     * @throws \Napp\AeroGearPush\Exception\AeroGearMissingOAuthTokenException
     * @throws \Napp\AeroGearPush\Exception\AeroGearPushException
     */
    public function sysInfoHealth(GetSysInfoHealthRequest $request)
    {
        if (!isset($request->OAuthToken)) {
            throw new AeroGearMissingOAuthTokenException();
        }
        if (!empty($request->headers)) {
            $request->data['headers'] = $request->headers;
        }

        $response = $this->curlClient->call(
          $request->method,
          $this->serverUrl,
          $request->endpoint,
          [],
          $request->data,
          [
            'verifySSL'  => false,
            'OAuthToken' => $request->OAuthToken,
          ]
        );

        return $response;
    }

    /**
     * GET dashboard data.
     *
     * @param \Napp\AeroGearPush\Request\GetMetricsDashboardRequest $request
     *
     * @return mixed
     * @throws \Napp\AeroGearPush\Exception\AeroGearPushException
     */
    public function metricsDashboard(GetMetricsDashboardRequest $request)
    {
        if (!empty($request->headers)) {
            $request->data['headers'] = $request->headers;
        }

        $response = $this->curlClient->call(
          $request->method,
          $this->serverUrl,
          $request->endpoint.(isset($request->type) ? '/'.$request->type : null),
          [],
          $request->data,
          [
            'verifySSL'  => false,
            'OAuthToken' => $request->OAuthToken,
          ]
        );

        return $response;
    }

    /**
     * GET info about submitted push messages for the given Push Application
     *
     * @param \Napp\AeroGearPush\Request\GetMetricsMessagesRequest $request
     *
     * @return mixed
     * @throws \Napp\AeroGearPush\Exception\AeroGearPushException
     */
    public function metricsMessages(GetMetricsMessagesRequest $request)
    {
        if (!empty($request->headers)) {
            $request->data['headers'] = $request->headers;
        }

        $response = $this->curlClient->call(
          $request->method,
          $this->serverUrl,
          $request->endpoint.(!empty($request->pushAppId) ? '/'.$request->pushAppId : ''),
          [],
          $request->data,
          [
            'verifySSL'  => false,
            'OAuthToken' => $request->OAuthToken,
            'queryParam' => isset($request->queryParam) ? $request->queryParam : false,
          ]
        );

        return $response;
    }

    /**
     * @param \Napp\AeroGearPush\Request\CreateSimplePushVariantRequest $request
     *
     * @return mixed
     * @throws \Napp\AeroGearPush\Exception\AeroGearPushException
     */
    public function createSimplePushVariant(CreateSimplePushVariantRequest $request)
    {
        if (null == $request->pushAppId) {
            throw new AeroGearPushException('No pushAppId.');
        }

        if (!empty($request->headers)) {
            $request->data['headers'] = $request->headers;
        }

        $response = $this->curlClient->call(
          $request->method,
          $this->serverUrl,
          $request->endpoint.'/'.$request->pushAppId.'/simplePush',
          [],
          $request->data,
          [
            'verifySSL'  => false,
            'OAuthToken' => $request->OAuthToken,
          ]
        );

        return $response;
    }

    /**
     * @param \Napp\AeroGearPush\Request\CreateIosVariantRequest $request
     *
     * @return mixed
     * @throws \Napp\AeroGearPush\Exception\AeroGearPushException
     */
    public function createIosVariant(CreateIosVariantRequest $request)
    {
        if (null == $request->pushAppId) {
            throw new AeroGearPushException('No pushAppId.');
        }

        if (!empty($request->headers)) {
            $request->data['headers'] = $request->headers;
        }

        $response = $this->curlClient->call(
          $request->method,
          $this->serverUrl,
          $request->endpoint.'/'.$request->pushAppId.'/ios',
          [],
          $request->data,
          [
            'verifySSL'  => false,
            'OAuthToken' => $request->OAuthToken,
          ]
        );

        return $response;
    }

    /**
     * @param \Napp\AeroGearPush\Request\CreateAndroidVariantRequest $request
     *
     * @return mixed
     * @throws \Napp\AeroGearPush\Exception\AeroGearPushException
     */
    public function createAndroidVariant(CreateAndroidVariantRequest $request)
    {
        if (null == $request->pushAppId) {
            throw new AeroGearPushException('No pushAppId.');
        }

        // Check for required googleKey field.
        if (!isset($request->data['googleKey'])) {
            throw new AeroGearPushException("Required field 'googleKey' not set.");
        }

        if (!empty($request->headers)) {
            $request->data['headers'] = $request->headers;
        }

        $response = $this->curlClient->call(
          $request->method,
          $this->serverUrl,
          $request->endpoint.'/'.$request->pushAppId.'/android',
          [],
          $request->data,
          [
            'verifySSL'  => false,
            'OAuthToken' => $request->OAuthToken,
          ]
        );

        return $response;
    }

    /**
     * @param $request
     *
     * @return mixed
     * @throws \Napp\AeroGearPush\Exception\AeroGearPushException
     */
    public function createApplication($request)
    {
        // Check for required data fields.
        if (!isset($request->pushAppId)) {
            if (!isset($request->data['name'])) {
                throw new AeroGearPushException("Required field 'name' not set.");
            }
        }

        if (!empty($request->headers)) {
            $request->data['headers'] = $request->headers;
        }

        $response = $this->curlClient->call(
          $request->method,
          $this->serverUrl,
          $request->endpoint.(isset($request->pushAppId) ? '/'.$request->pushAppId : null),
          [],
          $request->data,
          [
            'verifySSL'  => false,
            'OAuthToken' => $request->OAuthToken,
          ]
        );

        return $response;
    }

    /**
     * @param \Napp\AeroGearPush\Request\GetApplicationInstallationRequest $request
     *
     * @return mixed
     * @throws \Napp\AeroGearPush\Exception\AeroGearPushException
     */
    public function getApplicationInstallation(GetApplicationInstallationRequest $request)
    {
        if (null == $request->variantId) {
            throw new AeroGearPushException('No variantId.');
        }

        if (!empty($request->headers)) {
            $request->data['headers'] = $request->headers;
        }

        // Replace the TOKEN with the valid variantId.
        $request->endpoint = str_replace(
          'VARIANTID',
          $request->variantId,
          $request->endpoint
        );

        // If an installationId is present in url, attach to endpoint.
        if (isset($request->installationId)) {
            $request->endpoint .= '/'.$request->installationId;
        }

        $response = $this->curlClient->call(
          $request->method,
          $this->serverUrl,
          $request->endpoint,
          [],
          $request->data,
          [
            'verifySSL'  => false,
            'OAuthToken' => $request->OAuthToken,
          ]
        );

        return $response;
    }

    /**
     * @param \Napp\AeroGearPush\Request\GetApplicationRequest $request
     *
     * @return mixed
     * @throws \Napp\AeroGearPush\Exception\AeroGearPushException
     */
    public function getApplication(GetApplicationRequest $request)
    {
        if (!empty($request->headers)) {
            $request->data['headers'] = $request->headers;
        }

        $response = $this->curlClient->call(
          $request->method,
          $this->serverUrl,
          $request->endpoint.(isset($request->pushAppId) ? '/'.$request->pushAppId : false),
          [],
          $request->data,
          [
            'verifySSL'  => false,
            'OAuthToken' => $request->OAuthToken,
            'queryParam' => isset($request->queryParam) ? $request->queryParam : false,
          ]
        );

        return $response;
    }

    /**
     * @param \Napp\AeroGearPush\Request\DeleteApplicationRequest $request
     *
     * @return array
     * @throws \Napp\AeroGearPush\Exception\AeroGearPushException
     */
    public function deleteApplication(DeleteApplicationRequest $request)
    {
        if (null == $request->pushAppId) {
            throw new AeroGearPushException('No pushAppId.');
        }

        if (!empty($request->headers)) {
            $request->data['headers'] = $request->headers;
        }

        $response = $this->curlClient->call(
          $request->method,
          $this->serverUrl,
          $request->endpoint.'/'.$request->pushAppId,
          [],
          $request->data,
          [
            'verifySSL'  => false,
            'OAuthToken' => $request->OAuthToken,
          ]
        );

        return $response;
    }

    /**
     * @param \Napp\AeroGearPush\Request\SenderPushRequest $request
     *
     * @return array
     * @throws \Napp\AeroGearPush\Exception\AeroGearPushException
     */
    public function senderPush(SenderPushRequest $request)
    {
        if (empty($request->message) || empty($request->criteria)) {
            throw new AeroGearPushException("Required fields 'message' and 'criteria' have to be present.");
        }

        $data = [
          'message'  => $request->message,
          'criteria' => $request->criteria,
        ];

        $auth = $request->auth;

        $response = $this->curlClient->call(
          $request->method,
          $this->serverUrl,
          $request->endpoint,
          $auth,
          $data,
          [
            'verifySSL' => false,
          ]
        );

        return $response;
    }

    /**
     * @param RegistryDeviceImporterRequest $request
     * @return \Psr\Http\Message\StreamInterface
     * @throws AeroGearPushException
     * @throws Exception\AeroGearAuthErrorException
     * @throws Exception\AeroGearBadRequestException
     * @throws Exception\AeroGearNotFoundException
     */
    public function registryDeviceImporter(RegistryDeviceImporterRequest $request)
    {
        // API endpoint requires tokens to be a multipart form upload
        $data = ['file' => $request->data['tokens']];
        $auth = $request->auth;
        $response = $this->curlClient->call(
            $request->method,
            $this->serverUrl,
            $request->endpoint,
            $auth,
            $data,
            [
                'verifySSL' => false,
            ]
        );
        return $response;
    }
}


text:
walker
======

Dungeon walker, a game for the terminal in bash

### Requirements

A Mac or Linux computer with the bash shell.

### Playing

Open a terminal, navigate to the walker directory, and run

    ./walker

Use w/a/s/d to navigate the dungeons, making it to your
exit by walking on positive tiles, and avoiding dangerous
creatures.  Press e to exit if the tile is an exit, or
spacebar/return to wait a turn.

### Additional controls

Press 3 to reset, 5 to move onto the next level, 1
to return to the main menu, and 0 to quit.

### Map making

Good luck!  It's pretty confusing, but look into the
`help` directory `levelformat.txt` for how the levels
are created.


text:
package org.apache.lucene.store;

import java.io.IOException;

public class MockLockFactoryWrapper extends LockFactory {
  MockDirectoryWrapper dir;
  LockFactory delegate;

  public MockLockFactoryWrapper(MockDirectoryWrapper dir, LockFactory delegate) {
    this.dir = dir;
    this.delegate = delegate;
  }

  @Override
  public void setLockPrefix(String lockPrefix) {
    delegate.setLockPrefix(lockPrefix);
  }

  @Override
  public String getLockPrefix() {
    return delegate.getLockPrefix();
  }

  @Override
  public Lock makeLock(String lockName) {
    return new MockLock(delegate.makeLock(lockName), lockName);
  }

  @Override
  public void clearLock(String lockName) throws IOException {
    delegate.clearLock(lockName);
    dir.openLocks.remove(lockName);
  }

  @Override
  public String toString() {
    return "MockLockFactoryWrapper(" + delegate.toString() + ")";
  }

  private class MockLock extends Lock {
    private Lock delegateLock;
    private String name;

    MockLock(Lock delegate, String name) {
      this.delegateLock = delegate;
      this.name = name;
    }

    @Override
    public boolean obtain() throws IOException {
      if (delegateLock.obtain()) {
        dir.openLocks.add(name);
        return true;
      } else {
        return false;
      }
    }

    @Override
    public void release() throws IOException {
      delegateLock.release();
      dir.openLocks.remove(name);
    }

    @Override
    public boolean isLocked() throws IOException {
      return delegateLock.isLocked();
    }
  }
}


text:
module RuboCop
  module Cop
    # Common functionality for cops checking for missing space after
    # punctuation.
    module SpaceAfterPunctuation
      MSG = 'Space missing after %<token>s.'

      def on_new_investigation
        each_missing_space(processed_source.tokens) do |token|
          add_offense(token.pos, message: format(MSG, token: kind(token))) do |corrector|
            PunctuationCorrector.add_space(corrector, token)
          end
        end
      end

      private

      def each_missing_space(tokens)
        tokens.each_cons(2) do |token1, token2|
          next unless kind(token1)
          next unless space_missing?(token1, token2)
          next unless space_required_before?(token2)

          yield token1
        end
      end

      def space_missing?(token1, token2)
        same_line?(token1, token2) && token2.column == token1.column + offset
      end

      def space_required_before?(token)
        !(allowed_type?(token) || (token.right_curly_brace? && space_forbidden_before_rcurly?))
      end

      def allowed_type?(token)
        %i[tRPAREN tRBRACK tPIPE].include?(token.type)
      end

      def space_forbidden_before_rcurly?
        style = space_style_before_rcurly
        style == 'no_space'
      end

      # The normal offset, i.e., the distance from the punctuation
      # token where a space should be, is 1.
      def offset
        1
      end
    end
  end
end


text:
module YARD
  module Parser
    module C
      class CParser < Base
        def initialize(source, file = '(stdin)')
          @file = file
          @namespaces = {}
          @content = source
          @index = 0
          @line = 1
          @state = nil
          @newline = true
          @statements = []
          @last_comment = nil
          @last_statement = nil
        end

        def parse
          parse_toplevel
          enumerator
        end

        def enumerator
          @statements
        end

        def tokenize
          raise NotImplementedError, "no tokenization support for C/C++ files"
        end

        private

        def parse_toplevel
          advance_loop do
            case char
            when /['"]/; consume_quote(char)
            when '#'; consume_directive
            when '/'; consume_comment
            when /\s/; consume_whitespace
            when '}'; advance # Skip possible C++ namespace closing brackets.
            else consume_toplevel_statement
            end
          end
        end

        def consume_quote(type = '"')
          advance
          advance_loop do
            case char
            when "\n"; advance; nextline
            when '\\'; advance(2)
            when type; advance; return
            else advance
            end
          end
        end

        def consume_directive
          return(advance) unless @newline
          @last_comment = nil
          @last_statement = nil
          advance_loop do
            if char == '\\' && nextchar =~ /[\r\n]/
              advance_loop { advance; break(nextline) if char == "\n" }
            elsif char == "\n"
              return
            end
            advance
          end
        end

        def consume_toplevel_statement
          @newline = false
          start = @index
          line = @line
          decl = consume_until(/[{;]/)
          return nil if decl =~ /\A\s*\Z/
          # Skip C++ namespace - treat content as top level statement.
          return nil if decl =~ /\A(namespace)/
          statement = ToplevelStatement.new(nil, @file, line)
          @statements << statement
          attach_comment(statement)
          stmts = nil
          if prevchar == '{'
            stmts = consume_body_statements
            if decl =~ /\A(typedef|enum|class|#{struct}|union)/
              consume_until(';')
            end
          end
          statement.source = @content[start..@index]
          statement.block = stmts
          statement.declaration = decl # rubocop:disable Lint/UselessSetterCall
        end

        def consume_body_statements
          stmts = []
          brace_level = 1
          loop do
            strip_non_statement_data
            start = @index
            line = @line
            consume_until(/[{};]/)
            brace_level += 1 if prevchar == '{'
            brace_level -= 1 if prevchar == '}'

            break if prevchar.empty? || (brace_level <= 0 && prevchar == '}')
            src = @content[start...@index]
            next unless src && src !~ /\A\s*\Z|\A\}\Z/

            stmt = BodyStatement.new(src, @file, line)
            attach_comment(stmt)
            stmts << stmt
          end
          stmts
        end

        def strip_non_statement_data
          start = @index
          loop do
            start = @index
            case char
            when /\s/; consume_whitespace
            when '#';  consume_directive
            when '/';  consume_comment
            end

            break if start == @index
          end
        end

        def consume_whitespace
          advance_loop { nextline if char == "\n"; break if char =~ /\S/; advance }
        end

        def consume_comment(add_comment = true)
          return(advance) unless nextchar == '*' || nextchar == '/'
          line = @line
          type = nextchar == '*' ? :multi : :line
          advance(2)
          comment = String.new("")
          advance_loop do
            comment << char
            if type == :multi
              nextline if char == "\n"
              if char(2) == '*/'
                if add_comment
                  comment << '/'
                  stmt = Comment.new(comment, @file, line)
                  stmt.type = type
                  attach_comment(stmt)
                  @statements << stmt
                end
                return advance(2)
              end
            elsif char == "\n"
              if add_comment
                stmt = Comment.new(comment[0...-1], @file, line)
                stmt.type = type
                attach_comment(stmt)
                @statements << stmt
              end
              return
            end
            advance
          end
        end

        def consume_until(end_char, bracket_level = 0, brace_level = 0, add_comment = true)
          end_char = /#{end_char}/ if end_char.is_a?(String)
          start = @index
          advance_loop do
            chr = char
            case chr
            when /\s/; consume_whitespace
            when /['"]/; consume_quote(char)
            when '#'; consume_directive
            when '/'; consume_comment(add_comment)
            when '{'; advance; brace_level += 1
            when '}'; advance; brace_level -= 1
            when '('; advance; bracket_level += 1
            when ')'; advance; bracket_level -= 1
            else advance
            end
            @newline = false if chr !~ /\s/

            if chr =~ end_char
              break if chr == '{' || chr == '('
              break if bracket_level <= 0 && brace_level <= 0
            end
          end
          @content[start...@index]
        end

        def attach_comment(statement)
          if Comment === statement
            if @last_statement && @last_statement.line == statement.line
              @last_statement.comments = statement
              statement.statement = @last_statement
            end
            @last_comment = statement
            @last_statement = nil
          else
            if @last_comment
              statement.comments = @last_comment
              @last_comment.statement = statement
            end
            @last_statement = statement
            @last_comment = nil
          end
        end

        def advance(num = 1) @index += num end
        def back(num = 1) @index -= num end

        def advance_loop
          yield while @index <= @content.size
        end

        def nextline
          @line += 1
          @newline = true
        end

        def char(num = 1) @content[@index, num] end
        def prevchar(num = 1) @content[@index - 1, num] end
        def nextchar(num = 1) @content[@index + 1, num] end

        def struct
          /struct\s[a-zA-Z0-9]+\s\{/
        end
      end
    end
  end
end


text:
@section('content')

Options:

All Users

Create New User

	@if( $errors->has('userActionDone') )

          {{ $errors->first('userActionDone', ':message') }}
          ×

	@endif
	@if( $errors->has('userActionError') )

          {{ $errors->first('userActionError', ':message') }}
          ×

	@endif

You have {{ count($users) }} users register :-)

	      Insert Date
	      Post Title
	      Options

	    @foreach($users as $user)

	    	{{ $user->role->name }}
	    	{{ $user->username }}
	    	id) }}" title="Edit {{ $user->username }}">Edit

	    @endforeach

@stop


text:
using System;
using AWSAppender.Core.Layout;
using AWSAppender.Core.PatternConverter;
using NUnit.Framework;
using log4net;
using log4net.Config;
using log4net.Core;
using log4net.Repository;

namespace CloudWatchAppender.Tests
{
    [TestFixture]
    public class PatternConverterTests
    {

        [TearDown]
        public void TearDown()
        {
            GlobalContext.Properties.Remove("prop1");
            ThreadContext.Properties.Remove("prop1");
        }

        [Test]
        public void TestStackTracePattern()
        {
            StringAppender stringAppender = new StringAppender();
            stringAppender.Layout = new PatternLayout("%stacktrace{2}");

            ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
            BasicConfigurator.Configure(rep, stringAppender);

            ILog log1 = LogManager.GetLogger(rep.Name, "TestStackTracePattern");

            log1.Info("TestMessage");
#if !MONO
            Assert.AreEqual("System.RuntimeMethodHandle.InvokeMethod > CloudWatchAppender.Tests.PatternConverterTests.TestStackTracePattern", stringAppender.GetString(), "stack trace value set");
#else
            Assert.AreEqual("MonoMethod.InternalInvoke > PatternConverterTests.TestStackTracePattern", stringAppender.GetString(), "stack trace value set");
#endif
            stringAppender.Reset();
        }

        [Test]
        public void NamedPatternConverterWithoutPrecisionShouldReturnFullName()
        {
            StringAppender stringAppender = new StringAppender();
            log4net.Layout.PatternLayout layout = new log4net.Layout.PatternLayout();
            layout.AddConverter("message-as-name", typeof(MessageAsNamePatternConverter));
            layout.ConversionPattern = "%message-as-name";
            layout.ActivateOptions();
            stringAppender.Layout = layout;
            ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
            BasicConfigurator.Configure(rep, stringAppender);
            ILog log1 = LogManager.GetLogger(rep.Name, "TestAddingCustomPattern");

            log1.Info("NoDots");
            Assert.AreEqual("NoDots", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("One.Dot");
            Assert.AreEqual("One.Dot", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("Tw.o.Dots");
            Assert.AreEqual("Tw.o.Dots", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("TrailingDot.");
            Assert.AreEqual("TrailingDot.", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info(".LeadingDot");
            Assert.AreEqual(".LeadingDot", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            // empty string and other evil combinations as tests for of-by-one mistakes in index calculations
            log1.Info(string.Empty);
            Assert.AreEqual(string.Empty, stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info(".");
            Assert.AreEqual(".", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("x");
            Assert.AreEqual("x", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();
        }

        [Test]
        public void NamedPatternConverterWithPrecision1ShouldStripLeadingStuffIfPresent()
        {
            StringAppender stringAppender = new StringAppender();
            log4net.Layout.PatternLayout layout = new log4net.Layout.PatternLayout();
            layout.AddConverter("message-as-name", typeof(MessageAsNamePatternConverter));
            layout.ConversionPattern = "%message-as-name{1}";
            layout.ActivateOptions();
            stringAppender.Layout = layout;
            ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
            BasicConfigurator.Configure(rep, stringAppender);
            ILog log1 = LogManager.GetLogger(rep.Name, "TestAddingCustomPattern");

            log1.Info("NoDots");
            Assert.AreEqual("NoDots", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("One.Dot");
            Assert.AreEqual("Dot", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("Tw.o.Dots");
            Assert.AreEqual("Dots", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            //This behaviour differs from the log4net source.
            log1.Info("TrailingDot.");
            Assert.AreEqual("TrailingDot", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info(".LeadingDot");
            Assert.AreEqual("LeadingDot", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            // empty string and other evil combinations as tests for of-by-one mistakes in index calculations
            log1.Info(string.Empty);
            Assert.AreEqual(string.Empty, stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("x");
            Assert.AreEqual("x", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info(".");
            Assert.AreEqual(".", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();
        }

        [Test]
        public void NamedPatternConverterWithPrecision2ShouldStripLessLeadingStuffIfPresent()
        {
            StringAppender stringAppender = new StringAppender();
            log4net.Layout.PatternLayout layout = new log4net.Layout.PatternLayout();
            layout.AddConverter("message-as-name", typeof(MessageAsNamePatternConverter));
            layout.ConversionPattern = "%message-as-name{2}";
            layout.ActivateOptions();
            stringAppender.Layout = layout;
            ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
            BasicConfigurator.Configure(rep, stringAppender);
            ILog log1 = LogManager.GetLogger(rep.Name, "TestAddingCustomPattern");

            log1.Info("NoDots");
            Assert.AreEqual("NoDots", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("One.Dot");
            Assert.AreEqual("One/Dot", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("Tw.o.Dots");
            Assert.AreEqual("o/Dots", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("TrailingDot.");
            Assert.AreEqual("TrailingDot", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info(".LeadingDot");
            Assert.AreEqual("LeadingDot", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            // empty string and other evil combinations as tests for of-by-one mistakes in index calculations
            log1.Info(string.Empty);
            Assert.AreEqual(string.Empty, stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("x");
            Assert.AreEqual("x", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info(".");
            Assert.AreEqual(".", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();
        }

        [Test]
        public void NamedPatternConverterWithPrecisionMinus2ShouldStripLastTwoElements()
        {
            StringAppender stringAppender = new StringAppender();
            log4net.Layout.PatternLayout layout = new log4net.Layout.PatternLayout();
            layout.AddConverter("message-as-name", typeof(MessageAsNamePatternConverter));
            layout.ConversionPattern = "%message-as-name{-2}";
            layout.ActivateOptions();
            stringAppender.Layout = layout;
            ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
            BasicConfigurator.Configure(rep, stringAppender);
            ILog log1 = LogManager.GetLogger(rep.Name, "TestAddingCustomPattern");

            log1.Info("Tw.o.Dots");
            Assert.AreEqual("Tw/o", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("NoDots");
            Assert.AreEqual("NoDots", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("One.Dot");
            Assert.AreEqual("One/Dot", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("TrailingDot.");
            Assert.AreEqual("TrailingDot", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info(".LeadingDot");
            Assert.AreEqual("LeadingDot", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            // empty string and other evil combinations as tests for of-by-one mistakes in index calculations
            log1.Info(string.Empty);
            Assert.AreEqual(string.Empty, stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info("x");
            Assert.AreEqual("x", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();

            log1.Info(".");
            Assert.AreEqual(".", stringAppender.GetString(), "%message-as-name not registered");
            stringAppender.Reset();
        }

    }

    internal class MessageAsNamePatternConverter : LoggerPatternConverter
    {
        protected override string GetFullyQualifiedName(LoggingEvent loggingEvent)
        {
            return loggingEvent.MessageObject.ToString();
        }
    }
}


text:
using UnityEngine;
using System.Collections;

public class MouseAttractController : MonoBehaviour
{
    private Rigidbody rb;
    private GameObject player;
	public Camera thisCamera;

    // Use this for initialization
    void Start()
    {
		player = Statics.PlayerBall;
        rb = player.GetComponent<Rigidbody>();
        Statics.levelDescription = "Something different";
    }

    // Update is called once per frame
    void Update()
    {

    }

    // FixedUpdate is called before performing
    // physics calculations.
    void FixedUpdate() {
        if (Input.GetMouseButton(0)) {
            var mousePos = Input.mousePosition;
            mousePos = thisCamera.ScreenToWorldPoint(mousePos);

            var moveBy = mousePos - player.transform.position;
            moveBy.y = 0;

            rb.velocity = new Vector3(0, 0, 0);
            rb.velocity = moveBy;
        }
    }
}


text:
package org.assertj.core.internal.strings;

import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatNullPointerException;
import static org.assertj.core.error.ShouldBeEqualNormalizingWhitespace.shouldBeEqualNormalizingWhitespace;
import static org.assertj.core.internal.ErrorMessages.charSequenceToLookForIsNull;
import static org.assertj.core.test.CharArrays.arrayOf;
import static org.assertj.core.test.TestData.someInfo;

import java.util.stream.Stream;

import org.assertj.core.internal.StringsBaseTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

/**
 * Tests for <code>{@link org.assertj.core.internal.Strings#assertEqualsNormalizingWhitespace(org.assertj.core.api.AssertionInfo, CharSequence, CharSequence)} </code>.
 *
 * @author Alex Ruiz
 * @author Joel Costigliola
 * @author Alexander Bischof
 * @author Dan Corder
 */
public class Strings_assertEqualsNormalizingWhitespace_Test extends StringsBaseTest {

  @Test
  public void should_fail_if_actual_is_null_and_expected_is_not() {
    assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> strings.assertEqualsNormalizingWhitespace(someInfo(),
                                                                                null,
                                                                                "Luke"))
                                                   .withMessage(format(shouldBeEqualNormalizingWhitespace(null,
                                                                                "Luke").create()));
  }

  @Test
  public void should_fail_if_actual_is_not_null_and_expected_is_null() {
    assertThatNullPointerException().isThrownBy(() -> strings.assertEqualsNormalizingWhitespace(someInfo(), "Luke",
                                                                                null))
                                    .withMessage(charSequenceToLookForIsNull());
  }

  @Test
  public void should_fail_if_both_Strings_are_not_equal_after_whitespace_is_normalized() {
    assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> strings.assertEqualsNormalizingWhitespace(someInfo(),
                                                                                "Yoda",
                                                                                "Luke"))
                                                   .withMessage(format(shouldBeEqualNormalizingWhitespace("Yoda",
                                                                                "Luke").create()));
  }

  @ParameterizedTest
  @MethodSource("equalNormalizingWhitespaceGenerator")
  public void should_pass_if_both_Strings_are_equal_after_whitespace_is_normalized(String actual, String expected) {
    strings.assertEqualsNormalizingWhitespace(someInfo(), actual, expected);
  }

  public static Stream<Arguments> equalNormalizingWhitespaceGenerator() {
    return Stream.of(Arguments.of("my   foo bar", "my foo bar"),
                     Arguments.of("  my foo bar  ", "my foo bar"),
                     Arguments.of(" my\tfoo bar ", " my foo bar"),
                     Arguments.of(" my foo    bar ", "my foo bar"),
                     Arguments.of(" my foo    bar ", "  my foo bar   "),
                     Arguments.of("       ", " "),
                     Arguments.of(" my\tfoo bar ", new String(arrayOf(' ', 'm', 'y', ' ', 'f', 'o', 'o', ' ', 'b', 'a', 'r'))),
                     Arguments.of(" my\tfoo bar ", " my\tfoo bar "),   // same
                     Arguments.of(null, null),   // null
                     Arguments.of(" \t \t", " "),
                     Arguments.of(" abc", "abc "));
  }
}


text:
/* Created on Nov 20, 2008 */
package edu.unl.act.rma.firm.core;

import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.text.DateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.thoughtworks.xstream.annotations.XStreamAlias;

/**
 *
 * @author Ian Cottingham
 *
 */
@Entity
@Table(name="LogEntries")
@TableGenerator(name="LOG_ENTRY_GEN", table="GENERATOR_TABLE")
@XStreamAlias("LogEntry")
public class LogEntry implements Serializable {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private static final DateFormat TIME_FORMAT = DateFormat.getTimeInstance(DateFormat.FULL);
	private static final DateFormat DATE_FORMAT = DateFormat.getDateInstance(DateFormat.MEDIUM);

	private int id;
	private String type;
	private String appender;
	private String className;
	private String message;
	private String stackTrace;
	private Date timeStamp;

	public LogEntry() {
		this.timeStamp = new Date(System.currentTimeMillis());
	}

	@Id
	@GeneratedValue(strategy=GenerationType.TABLE, generator="LOG_ENTRY_GEN")
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getAppender() {
		return appender;
	}

	public void setAppender(String appender) {
		this.appender = appender;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	@Column(columnDefinition="longtext")
	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	@Column(columnDefinition="longtext")
	public String getStackTrace() {
		return stackTrace;
	}

	public void setStackTrace(String stackTrace) {
		this.stackTrace = stackTrace;
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getTimeStamp() {
		return timeStamp;
	}

	public void setTimeStamp(Date timeStamp) {
		this.timeStamp = timeStamp;
	}

	@Override
	public String toString() {
		StringWriter str_writer = new StringWriter();
		PrintWriter out = new PrintWriter(str_writer);

		out.printf("[%s|%s] registered on %s at %s in class %s: %s\n", this.type, this.appender, DATE_FORMAT.format(this.timeStamp), TIME_FORMAT.format(this.timeStamp), this.className, this.message);
		if ( this.stackTrace != null ) {
			out.printf("-- Begin Stack Trace --\n%s\n--End STack Trace--", this.stackTrace);
		}

		return str_writer.toString();
	}

	public boolean isShowStackTrace() {
		return ((stackTrace != null) && !(stackTrace.trim().equals("")));
	}

}


text:
export const canUseDOM = (() =>
  typeof window !== 'undefined' &&
  window.document &&
  window.document.createElement &&
  window.matchMedia)();

export const settings = {
  palm: { max: 600 },
  lap: { max: 959, min: 601 },
  portable: { max: 959 },
  desk: { min: 960 }
};

export function generateMatchMediaString({ min, max }) {
  const minStr = min ? `(min-width: ${min}px)` : null;
  const maxStr = max ? `(max-width: ${max}px)` : null;

  let str = minStr && maxStr ? `${minStr} and ${maxStr}` : minStr || maxStr;

  return str;
}

export const matchMediaQueries = Object.keys(settings).reduce(
  (acc, breakpoint) => {
    acc[breakpoint] = generateMatchMediaString(settings[breakpoint]);
    return acc;
  },
  {}
);

export const mediaQueries = Object.keys(matchMediaQueries).reduce(
  (acc, breakpoint) => {
    acc[breakpoint] = `@media screen and ${matchMediaQueries[breakpoint]}`;
    return acc;
  },
  {}
);

let breakpoints = [];
let breakpointsString = '';

export function setBreakpoints(arr) {
  breakpoints = arr;
  breakpointsString = breakpoints.toString();
  return breakpoints;
}

export function getBreakpoints(asString) {
  return asString ? breakpointsString : [].concat(breakpoints);
}

export function clearBreakpoints() {
  breakpoints = [];
  return breakpoints;
}

export function isDifferent(arr) {
  return arr.toString() !== breakpointsString;
}

export function findBreakpoints() {
  if (!canUseDOM) return getBreakpoints();

  const newBreakpoints = Object.keys(matchMediaQueries).filter(
    breakpoint => window.matchMedia(matchMediaQueries[breakpoint]).matches
  );

  return isDifferent(newBreakpoints) && setBreakpoints(newBreakpoints);
}

export const optimizedResize = (function() {
  const callbacks = new Map();
  let running = false;

  function resize() {
    if (!running) {
      running = true;

      if (window.requestAnimationFrame) {
        window.requestAnimationFrame(runCallbacks);
      } else {
        setTimeout(runCallbacks, 66);
      }
    }
  }

  function runCallbacks() {
    const values = callbacks.values();
    let more = true;
    while (more) {
      const { done, value: callback } = values.next();
      if (done) {
        more = false;
      } else {
        callback();
      }
    }
    running = false;
  }

  function addCallback(callback, key) {
    if (typeof callback === 'function') {
      callbacks.set(key || callback, callback);
    }
  }

  function removeCallback(key) {
    callbacks.delete(key);
  }

  return {
    init(callback) {
      window.addEventListener('resize', resize);
      addCallback(callback);
    },
    add(callback, key) {
      addCallback(callback, key);
    },
    remove(key) {
      removeCallback(key);
    }
  };
})();

export function findMatch(...arr) {
  return matchBreakpoints(breakpoints, arr);
}

export function matchBreakpoints(breakpoints, arr) {
  if (typeof breakpoints === 'string') {
    breakpoints = breakpoints.split(',');
  }
  let breakpoint = false;
  if (!arr || arr.length === 0) return breakpoint;
  if (breakpoints.length === 0) findBreakpoints();

  for (let i = 0, len = arr.length; i < len; i++) {
    if (breakpoints.indexOf(arr[i]) !== -1) {
      breakpoint = arr[i];
      break;
    }
  }

  return breakpoint;
}

const valunit = /(\d+)(\w+)/;
export function doubleUnit(str) {
  const [, val, unit] = str.match(valunit);
  return `${val * 2}${unit}`;
}

export const vertical = {
  top: 'flex-start',
  center: 'center',
  bottom: 'flex-end'
};

export const horizontal = {
  left: 'flex-start',
  center: 'center',
  right: 'flex-end'
};

export const variables = {
  gutter: '11px'
};

export function assign(target) {
  if (target == null) {
    throw new TypeError('Object.assign target cannot be null or undefined');
  }

  const to = Object(target);
  const hasOwnProperty = Object.prototype.hasOwnProperty;

  for (let nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
    const nextSource = arguments[nextIndex];
    if (nextSource == null) {
      continue;
    }

    const source = Object(nextSource);

    // We don't currently support accessors nor proxies. Therefore this
    // copy cannot throw. If we ever supported this then we must handle
    // exceptions and side-effects. We don't support symbols so they won't
    // be transferred.

    for (const key in source) {
      if (hasOwnProperty.call(source, key)) {
        to[key] = source[key];
      }
    }
  }

  return to;
}

if (canUseDOM) {
  if (window.__flexr) {
    setBreakpoints(window.__flexr);
  } else {
    findBreakpoints();
  }
}

let INITIAL_BREAKPOINT = getBreakpoints(true);
let hydrating = false;

export function getInitialBreakpoints() {
  if (!canUseDOM) {
    return getBreakpoints(true);
  }
  return hydrating ? INITIAL_BREAKPOINT : null;
}

export function ssrWillHydrate() {
  hydrating = true;
  findBreakpoints();
}

export function ssrDidHydrate() {
  hydrating = false;
  INITIAL_BREAKPOINT = getBreakpoints(true);
}

export function calcWidth(size) {
  if (typeof size === 'number') {
    return {
      width: size < 1 ? `${Math.round(size * 10000) / 100}%` : `${size}px`
    };
  }

  const [numerator, denominator] = size ? size.split('/') : [];
  return {
    width: `${100 / denominator * numerator}%`
  };
}

export function handleFlexSize({ breakpoint, grow, size }) {
  const growStyle =
    typeof grow === 'number' ? grow : grow === false ? 0 : undefined;

  return breakpoint && breakpoint !== 'hidden'
    ? calcWidth(breakpoint)
    : size
      ? calcWidth(size)
      : growStyle !== undefined
        ? {
            flex: `${growStyle} 1 auto`,
            WebkitFlex: `${growStyle} 1 auto`,
            msFlex: `${growStyle} 1 auto`
          }
        : null;
}


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Video extends CI_Controller {
	public function __construct() {
	    parent::__construct();
	    //Loading url helper
		$this->load->helper('url');
		$this->load->helper('cookie');
		$this->load->model('login_model');
		$this->load->model('register_model');
		$this->load->library('form_validation');

		$this->load->helper(array('form', 'url'));
		$this->load->helper('download');
		$this->load->helper('array');
		set_time_limit(3600);
    }

    public function index() {

		if($this->input->cookie('estore_auth')!='') {
	   		if($this->login_model->authentication()) {

		    	$this->load->view('templates/header');
		    	$data['document'] = 1;
		    	$this->load->view('pages/upload_vid', $data);
				$this->load->view('pages/sidebar');
				$this->load->view('templates/footer');
	    	} else {
	    		// Redirecting To Login Page
				$this->load->view('templates/header');
		        $this->load->view('pages/login');
				$this->load->view('templates/footer');
	    	}
		} else {
			// Redirecting To Login Page
			$this->load->view('templates/header');
	        $this->load->view('pages/login');
			$this->load->view('templates/footer');
		}

    }

    public function do_upload() {

		if($this->input->cookie('estore_auth')!='') {
	   		if($this->login_model->authentication()) {
		    	//For upload section
		    	$pieces = explode(",", $_COOKIE["estore_auth"]);
	    		$username = $pieces[0];

		    	$config['upload_path']          = './uploads/'.$username.'/video';
		        $config['allowed_types']        = 'mp4';
		        $config['max_size']             = 10240000;

		        $this->load->library('upload', $config);

		        if ( !($this->upload->do_upload()) )  {
		            $error = array('error' => $this->upload->display_errors());

		            $this->load->view('templates/header');
					$this->load->view('pages/upload_vid', $error);
					$data['document'] = 1;
					$this->load->view('pages/sidebar', $data);
					$this->load->view('templates/footer');
		            }
		        else {
		            $data = array('upload_data' => $this->upload->data());
		            //get name of the uploaded file
		            $data['file_name'] = $this->upload->data('file_name');

		            $this->register_model->upload_video($data['file_name']);

		            $this->load->view('templates/header');
		            $data['document'] = 1;
		            $data['page'] = 'video/';
		            $this->load->view('pages/upload_success', $data);
		            $this->load->view('pages/sidebar');
					$this->load->view('templates/footer');
		        }

	    	} else {
	    		// Redirecting To Login Page
				$this->load->view('templates/header');
		        $this->load->view('pages/login');
				$this->load->view('templates/footer');
	    	}
		} else {
			// Redirecting To Login Page
			$this->load->view('templates/header');
	        $this->load->view('pages/login');
			$this->load->view('templates/footer');
		}

    }

    public function download_vid() {

    	if($this->input->cookie('estore_auth')!='') {
	   		if($this->login_model->authentication()) {

		    	if(null !==($this->input->post('check-download'))) {
		    		$data['check_download'] = $this->input->post('check-download');

		    		force_download($data['check_download'], NULL);
		    	}

		    	$data['display_query'] = $this->register_model->show_video();

		    	$this->load->view('templates/header');
		        $this->load->view('pages/download_vid', $data);
		        $data['document'] = 1;
				$this->load->view('pages/sidebar', $data);
				$this->load->view('templates/footer');
	    	} else {
	    		// Redirecting To Login Page
				$this->load->view('templates/header');
		        $this->load->view('pages/login');
				$this->load->view('templates/footer');
	    	}
		} else {
			// Redirecting To Login Page
			$this->load->view('templates/header');
	        $this->load->view('pages/login');
			$this->load->view('templates/footer');
		}

    }

    public function delete_vid() {

    	if($this->input->cookie('estore_auth')!='') {
	   		if($this->login_model->authentication()) {

		    	if(null !==($this->input->post('check-delete'))) {
		    		$data['check_delete'] = $this->input->post('check-delete');

		    		$this->register_model->delete_video($data['check_delete']);
		    	}

		    	$data['display_query'] = $this->register_model->show_video();

		    	$this->load->view('templates/header');
		        $this->load->view('pages/delete_vid', $data);
		        $data['document'] = 1;
				$this->load->view('pages/sidebar', $data);
				$this->load->view('templates/footer');
	    	} else {
	    		// Redirecting To Login Page
				$this->load->view('templates/header');
		        $this->load->view('pages/login');
				$this->load->view('templates/footer');
	    	}
		} else {
			// Redirecting To Login Page
			$this->load->view('templates/header');
	        $this->load->view('pages/login');
			$this->load->view('templates/footer');
		}

    }

}


text:
package com.exp.cemk.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.util.Timer;
import java.util.TimerTask;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;

import com.cemk.exp.sendMail.SendAttachmentMail;
import com.cemk.exp.sendMail.SendMailConstants;

import test.SpringDataAccessConstants;

public class TimerClass {
	private static final Logger logger = Logger.getLogger(TimerClass.class);

	public static void scheduledBackup(int hour, int min) {
		Timer timer = new Timer();
		long milliseconds = DateUtil.getTimeDiffFromCurrentTime(hour, min);
		long delay = 24 * 60 * 60 * 1000;
		logger.info("Timer will start after: "
				+ DateUtil.getHourMinSecond(milliseconds));
		// long delay = 1000;
		timer.schedule(new TimerTask() {
			public void run() {
				logger.info("+--------------------------------------+");
				logger.info("|    MYSQL Data Scheduler Started      |");
				logger.info("+--------------------------------------+");

				String username = CommonUtil
						.getFromEnvironment(SpringDataAccessConstants.DBUSERNAME_CONTEXT);
				String password = CommonUtil
						.getFromEnvironment(SpringDataAccessConstants.DBPASSWD_CONTEXT);
				String databaseName = CommonUtil
						.getFromEnvironment(SpringDataAccessConstants.DBNAME_CONTEXT);

				String path = System.getProperty("user.home") + File.separator
						+ "Ihalkhata Data Backup";
				logger.info("Backup Output path: " + path);
				File backup = new File(path);
				if (!backup.exists())
					backup.mkdirs();
				boolean deleteStatus = CommonUtil.deleteAllFiles(path, ".sql");
				if (!StringUtils.isEmpty(username)
						&& !StringUtils.isEmpty(password)
						&& !StringUtils.isEmpty(databaseName)
						&& !StringUtils.isEmpty(path) && deleteStatus) {
					if (TimerClass.backupDB(username, password, databaseName,
							backup)) {
						logger.info("+--------------------------------------+");
						logger.info("|    MYSQL Data Scheduler Job ended    |");
						logger.info("+--------------------------------------+");
					}
				} else {
					logger.info("+--------------------------------------+");
					logger.info("|   Context Reading Failed             |");
					logger.info("+--------------------------------------+");
				}
			}
		}, milliseconds, delay);

	}

	public static boolean backupDB(String dbUserName, String dbPassword,
			String dbName, File path) {
		String outputFileName = dbName + "_"
				+ DateUtil.getFormatedCurrentDate("dd-MMM-yyyy@HH-mm-ss")
				+ ".sql";
		String executeCmd = "mysqldump --user=" + dbUserName + " --password="
				+ dbPassword + " " + dbName + " -r " + outputFileName;
		// logger.info("executeCmd: "+executeCmd);
		Process runtimeProcess;
		try {
			String line;
			runtimeProcess = Runtime.getRuntime().exec(executeCmd, null, path);
			BufferedReader input = new BufferedReader(new InputStreamReader(
					runtimeProcess.getInputStream()));
			BufferedReader error = new BufferedReader(new InputStreamReader(
					runtimeProcess.getErrorStream()));

			if (input.readLine() != null)
				logger.info("OUTPUT");
			while ((line = input.readLine()) != null)
				logger.info(line);
			input.close();

			if (error.readLine() != null)
				logger.info("ERROR");
			while ((line = error.readLine()) != null)
				logger.info(line);
			error.close();

			int processComplete = runtimeProcess.waitFor();

			if (processComplete == 0) {
				logger.info("+--------------------------------------+");
				logger.info("|   Backup created successfully        |");
				logger.info("+--------------------------------------+");
				logger.info("+----------------------------------------------------+");
				logger.info("|   Backup File: " + outputFileName + "       |");
				logger.info("+----------------------------------------------------+");
				outputFileName = System.getProperty("user.home")
						+ File.separator + "Ihalkhata Data Backup"
						+ File.separator + outputFileName;
				/*SendAttachmentMail.getInstance().sendAttachmentEmail(
						SendMailConstants.admin, "BackUp File", outputFileName);*/
				return true;
			} else {
				logger.info("+--------------------------------------+");
				logger.info("|   Could not create the backup        |");
				logger.info("+--------------------------------------+");
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}

		return false;
	}

}


text:
require 'spec_helper'

describe Root do

  let(:root) { Root.new(true, true) }
  let(:pwd) { `pwd`.sub(/\n/, '') }

  describe '#rails_root' do

    context 'determining the root of rails project' do

      it 'should find the pwd' do
        root.find_rails_root(true, true)
        root.rails_root.should == pwd
      end

    end

    context 'determining if rails project and at root' do

      it 'should call database if rails app' do
        File.stub(:directory?).with("#{pwd}/config").and_return(true)
        File.stub(:directory?).with("#{pwd}/app").and_return(true)
        Root.any_instance.stub(:database)
        root.should_not_receive(:p)
        root.find_rails_root(true, true)
      end

      it 'should warn if not a rails app' do
        root.should_receive(:p)
        root.find_rails_root(true, true)
      end

    end

  end

  describe "#database" do

    context "calling database class to load db info" do

      it 'should instaniate database class and call load' do
        root.db = Database.new(pwd, true, true)
        Database.any_instance.should_receive(:load)
        root.database
      end

    end

  end

end


text:
@interface ZDAuxViewController ()

@property (weak, nonatomic) IBOutlet UILabel *projectName;
@property (weak, nonatomic) IBOutlet UILabel *bandName;
@property (weak, nonatomic) IBOutlet UILabel *yearName;

@end

@implementation ZDAuxViewController

//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
#pragma mark - Constructor
//---------------------------------------------------------------------------------------
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
#pragma mark - Controller Lifecycle
//---------------------------------------------------------------------------------------
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    [[self projectName] setText:[[self theProject] name]];
    [[self bandName] setText:[[self theProject] band]];
    [[self yearName] setText:[NSString stringWithFormat:@"%@", [[self theProject] year]]];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end


text: package com.crawljax.plugins.testilizer.generated.wolfcms_RAND;