text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectCodeStyleSettingsManager">
    <option name="PER_PROJECT_SETTINGS">
      <value>
        <Objective-C>
          <option name="INDENT_NAMESPACE_MEMBERS" value="0" />
          <option name="KEEP_NESTED_NAMESPACES_IN_ONE_LINE" value="true" />
          <option name="NAMESPACE_BRACE_PLACEMENT" value="2" />
          <option name="FUNCTION_BRACE_PLACEMENT" value="2" />
          <option name="FUNCTION_PARAMETERS_WRAP" value="5" />
          <option name="FUNCTION_CALL_ARGUMENTS_WRAP" value="5" />
          <option name="CLASS_CONSTRUCTOR_INIT_LIST_WRAP" value="5" />
          <option name="CLASS_CONSTRUCTOR_INIT_LIST_NEW_LINE_BEFORE_COLON" value="0" />
          <option name="CLASS_CONSTRUCTOR_INIT_LIST_NEW_LINE_AFTER_COLON" value="2" />
          <option name="SUPERCLASS_LIST_AFTER_COLON" value="1" />
        </Objective-C>
        <Objective-C-extensions>
          <option name="GENERATE_INSTANCE_VARIABLES_FOR_PROPERTIES" value="ASK" />
          <option name="RELEASE_STYLE" value="IVAR" />
          <option name="TAG_PREFIX_OF_BLOCK_COMMENT" value="AT" />
          <option name="TAG_PREFIX_OF_LINE_COMMENT" value="BACK_SLASH" />
          <option name="TYPE_QUALIFIERS_PLACEMENT" value="BEFORE" />
          <file>
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
          </file>
          <class>
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
          </class>
          <extensions>
            <pair source="cpp" header="h" />
            <pair source="c" header="h" />
          </extensions>
        </Objective-C-extensions>
        <Objective-C-extensions>
          <option name="GENERATE_INSTANCE_VARIABLES_FOR_PROPERTIES" value="ASK" />
          <option name="RELEASE_STYLE" value="IVAR" />
          <option name="TYPE_QUALIFIERS_PLACEMENT" value="BEFORE" />
          <file>
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
          </file>
          <class>
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
          </class>
          <extensions>
            <pair source="cpp" header="h" />
            <pair source="c" header="h" />
          </extensions>
        </Objective-C-extensions>
        <XML>
          <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
        </XML>
        <codeStyleSettings language="ObjectiveC">
          <option name="BRACE_STYLE" value="2" />
          <option name="CLASS_BRACE_STYLE" value="2" />
        </codeStyleSettings>
      </value>
    </option>
    <option name="PREFERRED_PROJECT_CODE_STYLE" value="Don" />
  </component>
</project>


text:
using FG5EParser.Base_Class;
using FG5eParserModels.DM_Modules;
using System;
using System.Collections.Generic;
using System.IO;

namespace FG5EParser.WriterClasses
{
    class EncounterWriter
    {
        public List<Encounter> compileEncounterList(string _inputLocation, string _moduleName)
        {
            try
            {
                var _lines = File.ReadLines(_inputLocation);
                List<string> _basic = new List<string>();
                Encounters _encounterObject = new Encounters();

                // Get all the lines from the reader
                foreach (string item in _lines)
                {
                    if(!string.IsNullOrEmpty(item)) _basic.Add(item);
                }
                return _encounterObject.bindValuesNew(_basic);
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated Jul 15, 2015 1:51:54 PM by Hibernate Tools 3.6.0 -->
<hibernate-mapping>
    <class name="com.jotase.crystalsystem.models.Replacement" table="replacement" catalog="cristal">
        <composite-id name="id" class="com.jotase.crystalsystem.models.ReplacementId">
            <key-property name="id" type="int">
                <column name="id" />
            </key-property>
            <key-property name="glassesId" type="int">
                <column name="glasses_id" />
            </key-property>
            <key-property name="glassesOrderGlassId" type="int">
                <column name="glasses_orderGlass_id" />
            </key-property>
            <key-property name="glassesOrderGlassBudgetId" type="int">
                <column name="glasses_orderGlass_budget_id" />
            </key-property>
            <key-property name="glassesOrderGlassBudgetCostumersId" type="int">
                <column name="glasses_orderGlass_budget_costumers_id" />
            </key-property>
        </composite-id>
        <many-to-one name="glasses" class="com.jotase.crystalsystem.models.Glasses" update="false" insert="false" fetch="select">
            <column name="glasses_id" not-null="true" />
            <column name="glasses_orderGlass_id" not-null="true" />
            <column name="glasses_orderGlass_budget_id" not-null="true" />
            <column name="glasses_orderGlass_budget_costumers_id" not-null="true" />
        </many-to-one>
        <property name="state" type="java.lang.Integer">
            <column name="state" />
        </property>
        <property name="comment" type="string">
            <column name="comment" length="100" />
        </property>
    </class>
</hibernate-mapping>


text:
from ghostlines.storage.app_storage import AppStorage
from ghostlines.windows.account_details_window import AccountDetailsWindow
from ghostlines.windows.sign_in_window import SignInWindow

class AccountWindow(object):

    def __init__(self, sign_in=SignInWindow, account_details=AccountDetailsWindow):
        if self.is_logged_in:
            self.window = account_details(logout_window=sign_in)
        else:
            self.window = sign_in(success_window=account_details)

    @property
    def is_logged_in(self):
        token = AppStorage("accessToken").retrieve()
        # TODO: Retrieve returns NSNull if set to None. Empty string is
        # used to clear password for now, so check for None or ''
        return token != '' and token is not None

    def open(self):
        self.window.open()


text:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <LinearLayout android:orientation="vertical"
        android:layout_height="match_parent"
        android:layout_width="match_parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Enter a string:"></TextView>
            <EditText
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/txtInput"></EditText>

        </LinearLayout>

        <TextView
            android:id="@+id/txtOutput"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Output Goes here"
            android:textSize="36sp"></TextView>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/btnSendText"
            android:text="Send"></Button>

    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>


text:
{{extend "layout.html"}}

{{=H2(module_name)}}

{{=T("The Incident Reporting System allows the General Public to Report Incidents & have these Tracked.")}}

{{=T("Features Include")}}:

{{=LI(A("Add Report", _href=URL(r=request, f="ireport", args="create")))}}
{{=LI(A("List Reports", _href=URL(r=request, f="ireport")))}}
{{=LI(A("Show Map", _href=URL(r=request, f="maps")))}}


text:
.class Lcom/baidu/mapapi/Mj$1;
.super Landroid/os/Handler;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/baidu/mapapi/Mj;->a(Ljava/lang/String;Lcom/baidu/mapapi/MKGeneralListener;)Z
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic a:Lcom/baidu/mapapi/Mj;

# direct methods
.method constructor <init>(Lcom/baidu/mapapi/Mj;)V
    .locals 0

    iput-object p1, p0, Lcom/baidu/mapapi/Mj$1;->a:Lcom/baidu/mapapi/Mj;

    invoke-direct {p0}, Landroid/os/Handler;-><init>()V

    return-void
.end method

# virtual methods
.method public handleMessage(Landroid/os/Message;)V
    .locals 4

    iget-object v0, p1, Landroid/os/Message;->obj:Ljava/lang/Object;

    check-cast v0, Lcom/baidu/mapapi/Mj$a;

    iget v1, v0, Lcom/baidu/mapapi/Mj$a;->a:I

    iget v2, v0, Lcom/baidu/mapapi/Mj$a;->b:I

    iget v3, v0, Lcom/baidu/mapapi/Mj$a;->c:I

    iget v0, v0, Lcom/baidu/mapapi/Mj$a;->d:I

    invoke-static {v1, v2, v3, v0}, Lcom/baidu/mapapi/Mj;->MsgMapProc(IIII)I

    invoke-super {p0, p1}, Landroid/os/Handler;->handleMessage(Landroid/os/Message;)V

    return-void
.end method


text:
using UnityEngine;

using Unity.Data;
using Unity.GuiStyle;

using System;

//using Monoamp.Common.Utility;

namespace Unity.View
{
	public abstract class AViewDrag
	{
        public abstract void Awake();
        public abstract void Start();
        public abstract void Update();
        public abstract void OnGUI();
        public abstract void OnRenderObject();
        public abstract void OnAudioFilterRead( float[] aSoundBuffer, int aChannels, int aSampleRate );
        public abstract void OnApplicationQuit();

		protected Rect rectWindow;
		private Rect rectWindowPre;

		//private Texture2D textureCursorMove;
		private Texture2D textureCursorVirtical;
		private Texture2D textureCursorHorizontal;
		private Texture2D textureCursorRightUpLeftDown;
		private Texture2D textureCursorLeftUpRightDown;

		private bool isOnFrameRectTop;
		private bool isOnFrameRectBottom;
		private bool isOnFrameRectLeft;
		private bool isOnFrameRectRight;

		protected delegate void CloseWindow();
		private CloseWindow closeWindow;

		protected AViewDrag( CloseWindow aCloseWindow, Rect aRectWindow )
		{
            closeWindow = aCloseWindow;
            rectWindow = aRectWindow;
            rectWindowPre = rectWindow;

			//textureCursorMove = ( Texture2D )Resources.Load( "Cursor/Move", typeof( Texture2D ) );
			textureCursorVirtical = ( Texture2D )Resources.Load( "Cursor/Virtical", typeof( Texture2D ) );
			textureCursorHorizontal = ( Texture2D )Resources.Load( "Cursor/Horizontal", typeof( Texture2D ) );
			textureCursorRightUpLeftDown = ( Texture2D )Resources.Load( "Cursor/diagonal45", typeof( Texture2D ) );
			textureCursorLeftUpRightDown = ( Texture2D )Resources.Load( "Cursor/diagonal135", typeof( Texture2D ) );

			isOnFrameRectTop = false;
			isOnFrameRectBottom = false;
			isOnFrameRectLeft = false;
			isOnFrameRectRight = false;
		}

		protected void ControlWindow()
        {
            GUI.DragWindow( new Rect( 4.0f, 4.0f, rectWindow.width - 8.0f, 20.0f ) );

			GUILayout.BeginHorizontal();
			{
				GUILayout.FlexibleSpace();

				if( GUILayout.Button( "", GuiStyleSet.StyleWindow.buttonMinimize ) == true )
				{
					rectWindow = rectWindowPre;
				}

				if( GUILayout.Button( "", GuiStyleSet.StyleWindow.buttonMaximize ) == true )
				{
					rectWindowPre = rectWindow;
					rectWindow = new Rect( 0, 0, Screen.width, Screen.height );
				}

				if( GUILayout.Button( "", GuiStyleSet.StyleWindow.buttonClose ) == true )
				{
					closeWindow();
				}
			}
			GUILayout.EndHorizontal();
		}

		public void ResizeWindow()
		{
			int lPositionX = ( int )rectWindow.x;
			int lPositionY = ( int )rectWindow.y;
			int lWidth = ( int )rectWindow.width;
			int lHeight = ( int )rectWindow.height;

			Rect lFrameRectTop = new Rect( lPositionX - 2.0f, lPositionY - 2.0f, lWidth + 4.0f, 5.0f );
			Rect lFrameRectBottom = new Rect( lPositionX - 2.0f, lPositionY + lHeight - 3.0f, lWidth + 4.0f, 5.0f );
			Rect lFrameRectLeft = new Rect( lPositionX - 2.0f, lPositionY - 2.0f, 5.0f, lHeight + 4.0f );
			Rect lFrameRectRight = new Rect( lPositionX + lWidth - 3.0f, lPositionY - 2.0f, 5.0f, lHeight + 4.0f );

			if( Input.GetMouseButton( 0 ) == false )
			{
				isOnFrameRectTop = false;
				isOnFrameRectBottom = false;
				isOnFrameRectLeft = false;
				isOnFrameRectRight = false;

				if( lFrameRectTop.Contains( Event.current.mousePosition ) )
				{
					isOnFrameRectTop = true;
				}

				if( lFrameRectBottom.Contains( Event.current.mousePosition ) )
				{
					isOnFrameRectBottom = true;
				}

				if( lFrameRectLeft.Contains( Event.current.mousePosition ) )
				{
					isOnFrameRectLeft = true;
				}

				if( lFrameRectRight.Contains( Event.current.mousePosition ) )
				{
					isOnFrameRectRight = true;
				}
			}
			else
			{
				if( isOnFrameRectTop == true )
				{
					ChangeTopSplitTexture();
				}

				if( isOnFrameRectBottom == true )
				{
					ChangeBottomSplitTexture();
				}

				if( isOnFrameRectLeft == true )
				{
					ChangeLeftSplitTexture();
				}

				if( isOnFrameRectRight == true )
				{
					ChangeRightSplitTexture();
				}

				if( isOnFrameRectTop == false && isOnFrameRectBottom == false && isOnFrameRectLeft == false && isOnFrameRectRight == false )
				{
					//MoveSplitTexture( aCurrent, aEditorWindow, aScale );
				}
			}

			if( isOnFrameRectTop == true )
			{
				Cursor.SetCursor( textureCursorVirtical, new Vector2( 16.0f, 16.0f ), CursorMode.Auto );
			}

			if( isOnFrameRectBottom == true )
            {
				Cursor.SetCursor( textureCursorVirtical, new Vector2( 16.0f, 16.0f ), CursorMode.Auto );
			}

			if( isOnFrameRectLeft == true )
            {
				Cursor.SetCursor( textureCursorHorizontal, new Vector2( 16.0f, 16.0f ), CursorMode.Auto );
			}

			if( isOnFrameRectRight == true )
            {
				Cursor.SetCursor( textureCursorHorizontal, new Vector2( 16.0f, 16.0f ), CursorMode.Auto );
			}

			if( ( isOnFrameRectTop == true && isOnFrameRectLeft == true ) || ( isOnFrameRectBottom == true && isOnFrameRectRight == true ) )
            {
				Cursor.SetCursor( textureCursorLeftUpRightDown, new Vector2( 16.0f, 16.0f ), CursorMode.Auto );
			}

			if( ( isOnFrameRectTop == true && isOnFrameRectRight == true ) || ( isOnFrameRectBottom == true && isOnFrameRectLeft == true ) )
            {
				Cursor.SetCursor( textureCursorRightUpLeftDown, new Vector2( 16.0f, 16.0f ), CursorMode.Auto );
            }
		}

		private void ChangeTopSplitTexture()
		{
			float lPositionY = Event.current.mousePosition.y;

			if( lPositionY < rectWindow.y + rectWindow.height - 20.0f )
			{
				rectWindow.height += rectWindow.y - lPositionY;
				rectWindow.y = lPositionY;
			}
		}

		private void ChangeBottomSplitTexture()
		{
			float lPositionY = Event.current.mousePosition.y;

			if( lPositionY > rectWindow.y + 20.0f )
			{
				rectWindow.height = lPositionY - rectWindow.y + 1.0f;
			}
		}

		private void ChangeLeftSplitTexture()
		{
			float lPositionX = Event.current.mousePosition.x;

			if( lPositionX < rectWindow.x + rectWindow.width - 20.0f )
			{
				rectWindow.width += rectWindow.x - lPositionX;
				rectWindow.x = lPositionX;
			}
		}

		private void ChangeRightSplitTexture()
		{
			float lPositionX = Event.current.mousePosition.x;

			if( lPositionX > rectWindow.x + 20.0f )
			{
				rectWindow.width = lPositionX - rectWindow.x + 1.0f;
			}
		}
	}
}


text:
import React from 'react';
import { FixtureElementId } from 'react-cosmos-shared2/fixtureState';
import { FixtureId } from 'react-cosmos-shared2/renderer';
import { createPlugin, PluginContext } from 'react-plugin';
import { SidePanelRowSlotProps } from '../../shared/slots/SidePanelRowSlot';
import { TreeExpansion } from '../../shared/treeExpansion';
import {
  FixtureExpansionGroup,
  getFixtureExpansion,
  updateElementExpansion,
} from '../../shared/valueInputTree';
import { StorageSpec } from '../Storage/public';
import { ClassStatePanel } from './ClassStatePanel';
import { ClassStatePanelSpec } from './public';
import { CLASS_STATE_TREE_EXPANSION_STORAGE_KEY } from './shared';

type ClassStatePanelContext = PluginContext<ClassStatePanelSpec>;

const { namedPlug, register } = createPlugin<ClassStatePanelSpec>({
  name: 'classStatePanel',
});

namedPlug<SidePanelRowSlotProps>(
  'sidePanelRow',
  'classState',
  ({ pluginContext, slotProps }) => {
    const { fixtureId, fixtureState, onFixtureStateChange } = slotProps;
    const { fixtureExpansion, onElementExpansionChange } = useFixtureExpansion(
      pluginContext,
      fixtureId
    );

    return (
      <ClassStatePanel
        fixtureState={fixtureState}
        fixtureExpansion={fixtureExpansion}
        onFixtureStateChange={onFixtureStateChange}
        onElementExpansionChange={onElementExpansionChange}
      />
    );
  }
);

register();

const DEFAULT_TREE_EXPANSION = {};

function useFixtureExpansion(
  context: ClassStatePanelContext,
  fixtureId: FixtureId
) {
  const { getMethodsOf } = context;
  const storage = getMethodsOf<StorageSpec>('storage');

  const classStateExpansion =
    storage.getItem<FixtureExpansionGroup>(
      CLASS_STATE_TREE_EXPANSION_STORAGE_KEY
    ) || DEFAULT_TREE_EXPANSION;
  const fixtureExpansion = getFixtureExpansion(classStateExpansion, fixtureId);

  const onElementExpansionChange = React.useCallback(
    (elementId: FixtureElementId, treeExpansion: TreeExpansion) => {
      storage.setItem(
        CLASS_STATE_TREE_EXPANSION_STORAGE_KEY,
        updateElementExpansion(
          classStateExpansion,
          fixtureId,
          elementId,
          treeExpansion
        )
      );
    },
    [storage, classStateExpansion, fixtureId]
  );

  return {
    fixtureExpansion,
    onElementExpansionChange,
  };
}


text:
* [Hadoop](hadoop/README.md)
    * [Release](hadoop/Release.md)
    * [HDFS](hadoop/HDFS.md)
    * [Map Reduce](hadoop/MapReduce.md)
* [Ambari](modules/ambari/README.md)
* [Hive](modules/hive/README.md)
* [Pig](modules/pig/README.md)
* [Hardware](hardware/README.md)
* [Distributions](distributions/README.md)
    * [Cloudera](distributions/Cloudera.md)
    * [MapR](distributions/MapR.md)
    * [Hortonworks](distributions/Hortonworks.md)


text:
package org.example.domain.excludem2m;

import com.avaje.ebean.annotation.History;
import org.example.domain.BaseModel;
import org.example.domain.finder.ContactFinder;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Contact entity bean.
 */
@History
@Entity
@Table(name="contact")
public class ContactExcludeM2M extends BaseModel {

  /**
   * Convenience Finder for 'active record' style.
   */
  public static final ContactFinder find = new ContactFinder();

  @ManyToOne(optional=false)
  ContactExcludeM2M customer;

  @Column(length=50)
  String firstName;

  @Column(length=50)
  String lastName;

  @Column(length=200)
  String email;

  @Column(length=20)
  String phone;

  /**
   * Default constructor.
   */
  public ContactExcludeM2M() {
  }

  /**
   * Construct with a firstName and lastName.
   */
  public ContactExcludeM2M(String firstName, String lastName) {
    this.firstName = firstName;
    this.lastName = lastName;
  }

  public String getFirstName() {
    return firstName;
  }

  public void setFirstName(String firstName) {
    this.firstName = firstName;
  }

  public String getLastName() {
    return lastName;
  }

  public void setLastName(String lastName) {
    this.lastName = lastName;
  }

  public String getEmail() {
    return email;
  }

  public void setEmail(String email) {
    this.email = email;
  }

  public String getPhone() {
    return phone;
  }

  public void setPhone(String phone) {
    this.phone = phone;
  }

  public ContactExcludeM2M getCustomer() {
    return customer;
  }

  public void setCustomer(ContactExcludeM2M customer) {
    this.customer = customer;
  }

}


text:
@interface BNRCollectionLayout : UICollectionViewLayout

@end


text:
<fieldset>
    <legend><?php echo lang('set_option_extended'); ?></legend>
    <?php
    foreach ($extendedSettings as $field) :
        if (empty($field['permission'])
            || $this->auth->has_permission($field['permission'])
        ) :
            $field_control = '';
            switch ($field['form_detail']['type']) {
                case 'dropdown':
                    echo form_dropdown(
                        $field['form_detail']['settings'],
                        $field['form_detail']['options'],
                        set_value($field['name'], isset($settings["ext.{$field['name']}"]) ? $settings["ext.{$field['name']}"] : ''),
                        $field['label']
                    );
                    break;
                case 'checkbox':
                    $field_control = form_checkbox(
                        $field['form_detail']['settings'],
                        $field['form_detail']['value'],
                        isset($settings["ext.{$field['name']}"]) && $field['form_detail']['value'] == $settings["ext.{$field['name']}"]
                    );
                    break;
                case 'state_select':
                    if (! is_callable('state_select')) {
                        $this->load->config('address');
                        $this->load->helper('address');
                    }
                    $stateFieldId = $field['name'];
                    $stateValue = isset($settings["ext.{$field['name']}"]) ? $settings["ext.{$field['name']}"] : $defaultState;
                    $field_control = state_select(
                        set_value($field['name'], $stateValue),
                        $defaultState,
                        $defaultCountry,
                        $field['name'],
                        'span6 chzn-select'
                    );
                    break;
                case 'country_select':
                    if (! is_callable('country_select')) {
                        $this->load->config('address');
                        $this->load->helper('address');
                    }
                    $countryFieldId = $field['name'];
                    $countryValue = isset($settings["ext.{$field['name']}"]) ? $settings["ext.{$field['name']}"] : $defaultCountry;
                    $field_control = country_select(
                        set_value($field['name'], $countryValue),
                        $defaultCountry,
                        $field['name'],
                        'span6 chzn-select'
                    );
                    break;
                default:
                    $form_method = "form_{$field['form_detail']['type']}";
                    if (is_callable($form_method)) {
                        echo $form_method(
                            $field['form_detail']['settings'],
                            set_value($field['name'], isset($settings["ext.{$field['name']}"]) ? $settings["ext.{$field['name']}"] : ''),
                            $field['label']
                        );
                    }
                    break;
            }

            if (! empty($field_control)) :
    ?>
    <div class="control-group<?php echo form_error($field['name']) ? $errorClass : ''; ?>">
        <label class="control-label" for="<?php echo $field['name']; ?>"><?php echo $field['label']; ?>

            <?php echo $field_control; ?>

    <?php
            endif;
        endif;
    endforeach;
    if (! empty($countryFieldId) && ! empty($stateFieldId)) {
        Assets::add_js(
            $this->load->view('users/country_state_js',
                array(
                    'country_name' => $countryFieldId,
                    'country_value' => $countryValue,
                    'state_name' => $stateFieldId,
                    'state_value' => $stateValue,
                ),
                true
            ),
            'inline'
        );
    }
    ?>
</fieldset>


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="RemoveOrderLineActionPresenter.cs" company="Sitecore Corporation">
//   Copyright (c) Sitecore Corporation 1999-2015
// </copyright>
// <summary>
//   Defines the delete order line column presenter class.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
// Copyright 2015 Sitecore Corporation A/S
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
//       http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.
// -------------------------------------------------------------------------------------------

namespace Sitecore.Ecommerce.Apps.OrderManagement.Presenters
{
  using System.Collections.Generic;
  using System.Linq;
  using ContextStrategies;
  using Diagnostics;
  using Ecommerce.OrderManagement;
  using Ecommerce.OrderManagement.Orders;
  using Merchant.OrderManagement;
  using Sitecore.Web.UI.WebControls;
  using Views;

  /// <summary>
  /// Defines the delete order line column presenter class.
  /// </summary>
  public class RemoveOrderLineActionPresenter
  {
    /// <summary>
    /// The view.
    /// </summary>
    private readonly IRemoveOrderLineActionView view;

    /// <summary>
    /// The resolving strategy
    /// </summary>
    private UblEntityResolvingStrategy resolvingStrategy;

    /// <summary>
    /// The order processing strategy.
    /// </summary>
    private OrderProcessingStrategy processingStrategy;

    /// <summary>
    /// The merchant order processor.
    /// </summary>
    private MerchantOrderProcessor orderProcessor;

    /// <summary>
    /// ActionContext instance.
    /// </summary>
    private ActionContext actionContext;

    /// <summary>
    /// Initializes a new instance of the <see cref="RemoveOrderLineActionPresenter"/> class.
    /// </summary>
    /// <param name="view">The view.</param>
    public RemoveOrderLineActionPresenter([NotNull]IRemoveOrderLineActionView view)
    {
      Assert.ArgumentNotNull(view, "view");

      this.view = view;
    }

    /// <summary>
    /// Gets or sets the resolving strategy.
    /// </summary>
    /// <value>
    /// The resolving strategy.
    /// </value>
    [NotNull]
    public virtual UblEntityResolvingStrategy ResolvingStrategy
    {
      get
      {
        return this.resolvingStrategy ?? (this.resolvingStrategy = new OnDefaultPageStrategy());
      }

      set
      {
        Assert.ArgumentNotNull(value, "value");

        this.resolvingStrategy = value;
      }
    }

    /// <summary>
    /// Gets or sets the order line procfessing strategy.
    /// </summary>
    /// <value>
    /// The order line processing strategy.
    /// </value>
    [NotNull]
    public OrderProcessingStrategy ProcessingStrategy
    {
      get
      {
        return this.processingStrategy ?? (this.processingStrategy = Context.Entity.Resolve<OrderProcessingStrategy>("RemoveOrderLine"));
      }

      set
      {
        Assert.ArgumentNotNull(value, "value");

        this.processingStrategy = value;
      }
    }

    /// <summary>
    /// Gets or sets the order processor.
    /// </summary>
    /// <value>
    /// The order processor.
    /// </value>
    [NotNull]
    public MerchantOrderProcessor OrderProcessor
    {
      get
      {
        return this.orderProcessor ?? (this.orderProcessor = Context.Entity.Resolve<MerchantOrderProcessor>());
      }

      set
      {
        Assert.ArgumentNotNull(value, "value");

        this.orderProcessor = value;
      }
    }

    /// <summary>
    /// Gets or sets the context.
    /// </summary>
    /// <value>
    /// The context.
    /// </value>
    [NotNull]
    protected ActionContext ActionContext
    {
      get
      {
        Assert.IsNotNull(this.actionContext, "Action context cannot be null.");

        return this.actionContext;
      }

      set
      {
        Assert.ArgumentNotNull(value, "value");

        this.actionContext = value;
      }
    }

    /// <summary>
    /// Executs the specified context.
    /// </summary>
    /// <param name="context">The context.</param>
    public void Execute([NotNull]ActionContext context)
    {
      Assert.ArgumentNotNull(context, "context");
      this.ActionContext = context;

      var orderLine = this.GetOrderLine();

      if (orderLine != null && this.view.RemovalConfirm(this.ActionContext))
      {
        this.OrderProcessor.OrderProcessingStrategy = this.ProcessingStrategy;

        IDictionary<string, object> parameters = new Dictionary<string, object> { { "orderline", orderLine } };
        string result = this.OrderProcessor.ProcessOrder(orderLine.Order, parameters);

        if (result == OrderProcessingStrategy.SuccessfulResult)
        {
          this.view.Refresh(this.ActionContext);
          this.view.ShowSuccessMessage(this.ActionContext);
        }
      }
    }

    /// <summary>
    /// Queries the state.
    /// </summary>
    /// <param name="context">The context.</param>
    public void QueryState([NotNull]ActionContext context)
    {
      Assert.ArgumentNotNull(context, "context");
      this.ActionContext = context;

      var order = this.GetOrder();

      Assert.IsNotNull(order, "Unable to initialize action. Order cannot be null.");
      Assert.IsNotNull(order.State, "Unable to initialize action. Order.State cannot be null.");

      if (order.OrderLines.Count == 1 || (order.State.Code == OrderStateCode.InProcess &&
        order.State.Substates.Any(s => (s.Code == OrderStateCode.InProcessShippedInFull || s.Code == OrderStateCode.InProcessCapturedInFull) && s.Active)))
      {
        this.view.IsActionDisabled = true;
      }
    }

    /// <summary>
    /// Gets the order.
    /// </summary>
    /// <returns>The order.</returns>
    [NotNull]
    protected virtual Order GetOrder()
    {
      var order = this.ResolvingStrategy.GetEntity(this.ActionContext) as Order;

      Assert.IsNotNull(order, "Unable to initialize action. Order cannot be null.");

      return order;
    }

    /// <summary>
    /// Gets the order line.
    /// </summary>
    /// <returns>The order line.</returns>
    [CanBeNull]
    protected virtual OrderLine GetOrderLine()
    {
      var orderLineId = this.view.GetSelectedOrderLineId(this.ActionContext);
      if (string.IsNullOrEmpty(orderLineId))
      {
        this.view.ShowErrorMessage(this.ActionContext);
        return null;
      }

      var order = this.GetOrder();

      var alias = long.Parse(orderLineId);
      var orderLine = order.OrderLines.SingleOrDefault(ol => ol.Alias == alias);

      return orderLine;
    }
  }
}


text:
@echo off

set SolutionDir=%~dp0
set AssemblyName=TaskParallel
set SourceCodePath=%SolutionDir%

echo Copying source files...

CALL %SolutionDir%tools\nuget_source.bat %SolutionDir% %AssemblyName% %SourceCodePath% || EXIT /B 1

echo Preparing files for packaging...

CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% net35-cf %AssemblyName% || EXIT /B 1
CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% net35-client %AssemblyName% || EXIT /B 1
CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% net40 %AssemblyName% || EXIT /B 1
CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% net45 %AssemblyName% || EXIT /B 1
CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% net451 %AssemblyName% || EXIT /B 1
CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% net452 %AssemblyName% || EXIT /B 1
CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% net46 %AssemblyName% || EXIT /B 1
CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% net461 %AssemblyName% || EXIT /B 1
CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% net462 %AssemblyName% || EXIT /B 1
CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% netstandard1.0 %AssemblyName% || EXIT /B 1
CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% netstandard1.3 %AssemblyName% || EXIT /B 1
CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% profile259 %AssemblyName% || EXIT /B 1
CALL %SolutionDir%tools\nuget_prepare.bat %SolutionDir% profile328 %AssemblyName% || EXIT /B 1

echo Copy complete. Starting NuGet packaging...

CALL %SolutionDir%tools\nuget_pack.bat %SolutionDir% %AssemblyName% || EXIT /B 1

echo Packaging complete

EXIT /B %ERRORLEVEL%


text:
# Using Log4j in Cloud Enabled Applications

## The Twelve-Factor Application

The Logging Guidelines for [The Twelve-Factor App](https://12factor.net/logs) state that all logs should be routed
unbuffered to stdout. Since this is the least common denominator it is guaranteed to work for all applications. However,
as with any set of general guidelines, choosing the least common denominator approach comes at a cost. Some of the costs
in Java applications include:

1. Java stack traces are multi-line log messages. The standard docker log driver cannot handle these properly. See
[Docker Issue #22920](https://github.com/moby/moby/issues/22920) which was closed with the message "Don't Care".
Solutions for this are to:
    a. Use a docker log driver that does support multi-line log message,
    b. Use a logging format that does not produce multi-line messages,
    c. Log from Log4j directly to a logging forwarder or aggregator and bypass the docker logging driver.
1. When logging to stdout in Docker, log events pass through Java's standard output handling which is then directed
to the operating system so that the output can be piped into a file. The overhead of all this is measurably slower
than just writing directly to a file as can be seen in these benchmark results where logging
to stdout is 16-20 times slower over repeated runs than logging directly to the file. The results below were obtained by
running the [Output Benchmark](https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/OutputBenchmark.java)
on a 2018 MacBook Pro with a 2.9GHz Intel Core i9 processor and a 1TB SSD.  However, these results alone would not be
enough to argue against writing to the standard output stream as they only amount to about 14-25 microseconds
per logging call vs 1.5 microseconds when writing to the file.
    ```
        Benchmark                  Mode  Cnt       Score       Error  Units
        OutputBenchmark.console   thrpt   20   39291.885 ±  3370.066  ops/s
        OutputBenchmark.file      thrpt   20  654584.309 ± 59399.092  ops/s
        OutputBenchmark.redirect  thrpt   20   70284.576 ±  7452.167  ops/s
    ```
1. When performing audit logging using a framework such as log4j-audit guaranteed delivery of the audit events
is required. Many of the options for writing the output, including writing to the standard output stream, do
not guarantee delivery. In these cases the event must be delivered to a "forwarder" that acknowledges receipt
only when it has placed the event in durable storage, such as what [Apache Flume](https://flume.apache.org/)
or [Apache Kafka](https://kafka.apache.org/) will do.

## Logging Approaches

All the solutions discussed on this page are predicated with the idea that log files cannot permanently
reside on the file system and that all log events should be routed to one or more log analysis tools that will
be used for reporting and alerting. There are many ways to forward and collect events to be sent to the
log analysis tools.

Note that any approach that bypasses Docker's logging drivers requires Log4j's
[Docker Lookup](lookups.html#DockerLookup) to allow Docker attributes to be injected into the log events.

### Logging to the Standard Output Stream

As discussed above, this is the recommended 12-Factor approach for applications running in a docker container.
The Log4j team does not recommend this approach for performance reasons.

![Stdout](../images/DockerStdout.png "Application Logging to the Standard Output Stream")

### Logging to the Standard Output Stream with the Docker Fluentd Logging Driver

Docker provides alternate [logging drivers](https://docs.docker.com/config/containers/logging/configure/),
such as [gelf](https://docs.docker.com/config/containers/logging/gelf/) or
[fluentd](https://docs.docker.com/config/containers/logging/fluentd/), that
can be used to redirect the standard output stream to a log forwarder or log aggregator.

When routing to a log forwarder it is expected that the forwarder will have the same lifetime as the
application. If the forwarder should fail the management tools would be expected to also terminate
other containers dependent on the forwarder.

![Docker Fluentbit](../images/DockerFluentd.png "Logging via StdOut using the Docker Fluentd Logging Driver to Fluent-bit")

As an alternative the logging drivers could be configured to route events directly to a logging aggregator.
This is generally not a good idea as the logging drivers only allow a single host and port to be configured.
The docker documentation isn't clear but infers that log events will be dropped when log events cannot be
delivered so this method should not be used if a highly available solution is required.

![Docker Fluentd](../images/DockerFluentdAggregator.png "Logging via StdOut using the Docker Fluentd Logging Driver to Fluentd")

### Logging to a File

While this is not the recommended 12-Factor approach, it performs very well. However, it requires that the
application declares a volume where the log files will reside and then configures the log forwarder to tail
those files. Care must also be taken to automatically manage the disk space used for the logs, which Log4j
can perform via the "Delete" action on the [RollingFileAppender](appenders.html#RollingFileAppender).

![File](../images/DockerLogFile.png "Logging to a File")

### Sending Directly to a Log Forwarder via TCP

Sending logs directly to a Log Forwarder is simple as it generally just requires that the forwarder's
host and port be configured on a SocketAppender with an appropriate layout.

![TCP](../images/DockerTCP.png "Application Logging to a Forwarder via TCP")

### Sending Directly to a Log Aggregator via TCP

Similar to sending logs to a forwarder, logs can also be sent to a cluster of aggregators. However,
setting this up is not as simple since, to be highly available, a cluster of aggregators must be used.
However, the SocketAppender currently can only be configured with a single host and port. To allow
for failover if the primary aggregator fails the SocketAppender must be enclosed in a
[FailoverAppender](appenders.html#FailoverAppender),
which would also have the secondary aggregator configured. Another option is to have the SocketAppender
point to a highly available proxy that can forward to the Log Aggregator.

If the log aggregator used is Apache Flume or Apache Kafka (or similar) the Appenders for these support
being configured with a list of hosts and ports so high availability is not an issue.

![Aggregator](../images/LoggerAggregator.png "Application Logging to an Aggregator via TCP")

## Logging using Elasticsearch, Logstash, and Kibana

There are various approaches with different trade-offs for ingesting logs into
an ELK stack. Here we will briefly cover how one can forward Log4j generated
events first to Logstash and then to Elasticsearch.

### Log4j Configuration

### JsonTemplateLayout
Log4j provides a multitude of JSON generating layouts. In particular, [JSON
Template Layout](layouts.html#JSONTemplateLayout) allows full schema
customization and bundles ELK-specific layouts by default, which makes it a
great fit for the bill. Using the EcsLayout template as shown below will generate data in Kibana where
the message displayed exactly matches the message passed to Log4j and most of the event attributes, including
any exceptions, are present as individual attributes that can be displayed. Note, however that stack traces
will be formatted without newlines.

    <Socket name="Logstash"
            host="${sys:logstash.host}"
            port="12345"
            protocol="tcp"
            bufferedIo="true">
      <JsonTemplateLayout eventTemplateUri="classpath:EcsLayout.json">
        <EventTemplateAdditionalField key="containerId" value="${docker:containerId:-}"/>
        <EventTemplateAdditionalField key="application" value="${lower:${spring:spring.application.name:-spring}}"/>
        <EventTemplateAdditionalField key="kubernetes.serviceAccountName" value="${k8s:accountName:-}"/>
        <EventTemplateAdditionalField key="kubernetes.containerId" value="${k8s:containerId:-}"/>
        <EventTemplateAdditionalField key="kubernetes.containerName" value="${k8s:containerName:-}"/>
        <EventTemplateAdditionalField key="kubernetes.host" value="${k8s:host:-}"/>
        <EventTemplateAdditionalField key="kubernetes.labels.app" value="${k8s:labels.app:-}"/>
        <EventTemplateAdditionalField key="kubernetes.labels.pod-template-hash" value="${k8s:labels.podTemplateHash:-}"/>
        <EventTemplateAdditionalField key="kubernetes.master_url" value="${k8s:masterUrl:-}"/>
        <EventTemplateAdditionalField key="kubernetes.namespaceId" value="${k8s:namespaceId:-}"/>
        <EventTemplateAdditionalField key="kubernetes.namespaceName" value="${k8s:namespaceName:-}"/>
        <EventTemplateAdditionalField key="kubernetes.podID" value="${k8s:podId:-}"/>
        <EventTemplateAdditionalField key="kubernetes.podIP" value="${k8s:podIp:-}"/>
        <EventTemplateAdditionalField key="kubernetes.podName" value="${k8s:podName:-}"/>
        <EventTemplateAdditionalField key="kubernetes.imageId" value="${k8s:imageId:-}"/>
        <EventTemplateAdditionalField key="kubernetes.imageName" value="${k8s:imageName:-}"/>
      </JsonTemplateLayout>
    </Socket>

#### Gelft Template

The JsonTemplateLayout can also be used to generate JSON that matches the GELF specification which can format
the message attribute using a pattern in accordance with the PatternLayout. For example, the following
template, named EnhancedGelf.json, can be used to generate GELF-compliant data that can be passed to Logstash.
With this template the message attribute will include the thread id, level, specific ThreadContext attributes,
the class name, method name, and line number as well as the message. If an exception is included it will also
be included with newlines. This format follows very closely what you would see in a typical log file on disk
using the PatternLayout but has the additional advantage of including the attributes as separate fields that
can be queried.

    {
        "version": "1.1",
        "host": "${hostName}",
        "short_message": {
            "$resolver": "message",
            "stringified": true
        },
        "full_message": {
            "$resolver": "message",
            "pattern": "[%t] %-5p %X{requestId, sessionId, loginId, userId, ipAddress, corpAcctNumber} %C{1.}.%M:%L - %m",
            "stringified": true
        },
        "timestamp": {
            "$resolver": "timestamp",
            "epoch": {
                "unit": "secs"
            }
        },
        "level": {
            "$resolver": "level",
            "field": "severity",
            "severity": {
                "field": "code"
            }
        },
        "_logger": {
            "$resolver": "logger",
            "field": "name"
        },
        "_thread": {
            "$resolver": "thread",
            "field": "name"
        },
        "_mdc": {
            "$resolver": "mdc",
            "flatten": {
                "prefix": "_"
            },
            "stringified": true
        }
    }

The logging configuration to use this template would be

    <Socket name="Elastic"
            host="\${sys:logstash.search.host}"
            port="12222"
            protocol="tcp"
            bufferedIo="true">
      <JsonTemplateLayout eventTemplateUri="classpath:EnhancedGelf.json" nullEventDelimiterEnabled="true">
        <EventTemplateAdditionalField key="containerId" value="${docker:containerId:-}"/>
        <EventTemplateAdditionalField key="application" value="${lower:${spring:spring.application.name:-spring}}"/>
        <EventTemplateAdditionalField key="kubernetes.serviceAccountName" value="${k8s:accountName:-}"/>
        <EventTemplateAdditionalField key="kubernetes.containerId" value="${k8s:containerId:-}"/>
        <EventTemplateAdditionalField key="kubernetes.containerName" value="${k8s:containerName:-}"/>
        <EventTemplateAdditionalField key="kubernetes.host" value="${k8s:host:-}"/>
        <EventTemplateAdditionalField key="kubernetes.labels.app" value="${k8s:labels.app:-}"/>
        <EventTemplateAdditionalField key="kubernetes.labels.pod-template-hash" value="${k8s:labels.podTemplateHash:-}"/>
        <EventTemplateAdditionalField key="kubernetes.master_url" value="${k8s:masterUrl:-}"/>
        <EventTemplateAdditionalField key="kubernetes.namespaceId" value="${k8s:namespaceId:-}"/>
        <EventTemplateAdditionalField key="kubernetes.namespaceName" value="${k8s:namespaceName:-}"/>
        <EventTemplateAdditionalField key="kubernetes.podID" value="${k8s:podId:-}"/>
        <EventTemplateAdditionalField key="kubernetes.podIP" value="${k8s:podIp:-}"/>
        <EventTemplateAdditionalField key="kubernetes.podName" value="${k8s:podName:-}"/>
        <EventTemplateAdditionalField key="kubernetes.imageId" value="${k8s:imageId:-}"/>
        <EventTemplateAdditionalField key="kubernetes.imageName" value="${k8s:imageName:-}"/>
      </JsonTemplateLayout>
    </Socket>

The significant difference with this configuration from the first example is that it references the
custom template and it specifies an event delimiter of a null character ('\0');

**Note**: The level being passed with the above template does not strictly conform to the GELF spec as the
Level being passed is the Log4j Level NOT the Level defined in the GELF spec. However, testing has shown
that Logstash, Elk, and Kibana are pretty tolerant of whatever data is passed to it.

#### Custom Template

Another option is to use a custom template, possibly based on one of the standard templates. The template
below is loosely based on ECS but a) adds the spring boot application name, b) formats the message
using PatternLayout, formats Map Messages as event.data attributes while setting the event action based on
any Marker included in the event, includes all the ThreadContext attributes.

**Note**: The Json Template Layout escapes control sequences so messages that contain '\n' will have those
control sequences copied as "\n" into the text rather than converted to a newline character. This bypasses
many problems that occur with Log Forwarders such as Filebeat and FluentBit/Fluentd. Kibana will correctly
interpret these squences as newlines and display them correctly. Also note that the message pattern does
not contain a timestamp. Kibana will display the timestamp field in its own column so placing it in the
message would be redundant.

    {
      "@timestamp": {
        "$resolver": "timestamp",
        "pattern": {
          "format": "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
          "timeZone": "UTC"
        }
      },
      "ecs.version": "1.11.0",
      "log.level": {
        "$resolver": "level",
        "field": "name"
      },
      "application": "\${lower:\${spring:spring.application.name}}",
      "short_message": {
        "$resolver": "message",
        "stringified": true
      },
      "message": {
        "$resolver": "pattern",
        "pattern": "[%t] %X{requestId, sessionId, loginId, userId, ipAddress, accountNumber} %C{1.}.%M:%L - %m%n"
      },
      "process.thread.name": {
        "$resolver": "thread",
        "field": "name"
      },
      "log.logger": {
        "$resolver": "logger",
        "field": "name"
      },
      "event.action": {
        "$resolver": "marker",
        "field": "name"
      },
      "event.data": {
        "$resolver": "map",
        "stringified": true
      },
      "labels": {
        "$resolver": "mdc",
        "flatten": true,
        "stringified": true
      },
      "tags": {
        "$resolver": "ndc"
      },
      "error.type": {
        "$resolver": "exception",
        "field": "className"
      },
      "error.message": {
        "$resolver": "exception",
        "field": "message"
      },
      "error.stack_trace": {
        "$resolver": "exception",
        "field": "stackTrace",
        "stackTrace": {
          "stringified": true
        }
      }
    }

Finally, the GelfLayout can be used to generate GELF compliant output. Unlike the JsonTemplateLayout it
adheres closely to the GELF spec.

    <Socket name="Elastic" host="${sys:elastic.search.host}" port="12222" protocol="tcp" bufferedIo="true">
      <GelfLayout includeStackTrace="true" host="${hostName}" includeThreadContext="true" includeNullDelimiter="true"
                  compressionType="OFF">
        <ThreadContextIncludes>requestId,sessionId,loginId,userId,ipAddress,callingHost</ThreadContextIncludes>
        <MessagePattern>%d [%t] %-5p %X{requestId, sessionId, loginId, userId, ipAddress} %C{1.}.%M:%L - %m%n</MessagePattern>
        <KeyValuePair key="containerId" value="${docker:containerId:-}"/>
        <KeyValuePair key="application" value="${lower:${spring:spring.application.name:-spring}}"/>
        <KeyValuePair key="kubernetes.serviceAccountName" value="${k8s:accountName:-}"/>
        <KeyValuePair key="kubernetes.containerId" value="${k8s:containerId:-}"/>
        <KeyValuePair key="kubernetes.containerName" value="${k8s:containerName:-}"/>
        <KeyValuePair key="kubernetes.host" value="${k8s:host:-}"/>
        <KeyValuePair key="kubernetes.labels.app" value="${k8s:labels.app:-}"/>
        <KeyValuePair key="kubernetes.labels.pod-template-hash" value="${k8s:labels.podTemplateHash:-}"/>
        <KeyValuePair key="kubernetes.master_url" value="${k8s:masterUrl:-}"/>
        <KeyValuePair key="kubernetes.namespaceId" value="${k8s:namespaceId:-}"/>
        <KeyValuePair key="kubernetes.namespaceName" value="${k8s:namespaceName:-}"/>
        <KeyValuePair key="kubernetes.podID" value="${k8s:podId:-}"/>
        <KeyValuePair key="kubernetes.podIP" value="${k8s:podIp:-}"/>
        <KeyValuePair key="kubernetes.podName" value="${k8s:podName:-}"/>
        <KeyValuePair key="kubernetes.imageId" value="${k8s:imageId:-}"/>
        <KeyValuePair key="kubernetes.imageName" value="${k8s:imageName:-}"/>
      </GelfLayout>
    </Socket>

#### Logstash Configuration with Gelf

We will configure Logstash to listen on TCP port 12345 for payloads of type JSON
and then forward these to (either console and/or) an Elasticsearch server.

    input {
      tcp {
        port => 12345
        codec => "json"
      }
    }

    output {

      # (Un)comment for debugging purposes.
      # stdout { codec => rubydebug }

      # Modify the hosts value to reflect where elasticsearch is installed.
      elasticsearch {
        hosts => ["http://localhost:9200/"]
        index => "app-%{application}-%{+YYYY.MM.dd}"
      }

    }

#### Logstash Configuration with JsonTemplateLayout

When one of the GELF compliant formats is used Logstash should be configured as

   gelf {
           host => "localhost"
           use_tcp => true
           use_udp => false
           port => 12222
           type => "gelf"
         }
       }

       filter {
         # These are GELF/Syslog logging levels as defined in RFC 3164. Map the integer level to its human readable format.
         translate {
           field => "[level]"
           destination => "[levelName]"
           dictionary => {
             "0" => "EMERG"
             "1" => "ALERT"
             "2" => "CRITICAL"
             "3" => "ERROR"
             "4" => "WARN"
             "5" => "NOTICE"
             "6" => "INFO"
             "7" => "DEBUG"
           }
         }
       }

       output {
         # (Un)comment for debugging purposes
         # stdout { codec => rubydebug }
         # Modify the hosts value to reflect where elasticsearch is installed.
         elasticsearch {
           hosts => ["http://localhost:9200/"]
           index => "app-%{application}-%{+YYYY.MM.dd}"
         }
       }
#### Filebeat configuration with JsonTemplateLayout

When using a JsonTemplateLayout that complies with ECS (or is similar to the custom template previously shown)
the configuration of filebeat is straightforward.

    filebeat.inputs:
    - type: log
      enabled: true
      json.keys_under_root: true
      paths:
        - /var/log/apps/*.log

### Kibana
Using the EnhancedGelf template, the GelfLayout or the custom template the above configurations the message
field will contain a fully formatted log event just as it would  appear in a file Appender. The ThreadContext
attributes, custome fields, thread name, etc. will all be available as attributes on each log event that can
be used for filtering. The result will resemble
![](../images/kibana.png)

## Managing Logging Configuration

Spring Boot provides another least common denominator approach to logging configuration. It will let you set the
log level for various Loggers within an application which can be dynamically updated via REST endpoints provided
by Spring. While this works in a lot of cases it does not support any of the more advanced filtering features of
Log4j. For example, since it cannot add or modify any Filters other than the log level of a logger, changes cannot be made to allow
all log events for a specific user or customer to temporarily be logged
(see [DynamicThresholdFilter](filters.html#DynamicThresholdFilter) or
[ThreadContextMapFilter](filters.html#ThreadContextMapFilter)) or any other kinds of changes to filters.
Also, in a microservices, clustered environment it is quite likely that these changes will need to be propagated
to multiple servers at the same time. Trying to achieve this via REST calls could be difficult.

Since its first release Log4j has supported reconfiguration through a file.
Beginning with Log4j 2.12.0 Log4j also supports accessing the configuration via HTTP(S) and monitoring the file
for changes by using the HTTP "If-Modified-Since" header. A patch has also been integrated into Spring Cloud Config
starting with versions 2.0.3 and 2.1.1 for it to honor the If-Modified-Since header. In addition, the
log4j-spring-cloud-config project will listen for update events published by Spring Cloud Bus and then verify
that the configuration file has been modified, so polling via HTTP is not required.

Log4j also supports composite configurations. A distributed application spread across microservices could
share a common configuration file that could be used to control things like enabling debug logging for a
specific user.

While the standard Spring Boot REST endpoints to update logging will still work any changes made by those
REST endpoints will be lost if Log4j reconfigures itself do to changes in the logging configuration file.

Further information regarding integration of the log4j-spring-cloud-config-client can be found at
[Log4j Spring Cloud Config Client](../log4j-spring-cloud-config/log4j-spring-cloud-config-client/index.html).

## Integration with Spring Boot

Log4j integrates with Spring Boot in 2 ways:

1. A Spring Lookup can be used to access the Spring application configuration from Log4j configuration files.
2. Log4j will access the Spring configuration when it is trying to resolve log4j system properties.

Both of these require that the log4j-spring-cloud-client jar is included in the application.

## Integration with Docker

Applications within a Docker container that log using a Docker logging driver can include special
attributes in the formatted log event as described at
[Customize Log Driver Output](https://docs.docker.com/config/containers/logging/log_tags/). Log4j
provides similar functionality via the [Docker Lookup](lookups.html#DockerLookup). More information on
Log4j's Docker support may also be found at [Log4j-Docker](../log4j-docker/index.html).

## Integration with Kubernetes

Applications managed by Kubernetes can bypass the Docker/Kubernetes logging infrastructure and log directly to
either a sidecar forwarder or a logging aggragator cluster while still including all the kubernetes
attributes by using the Log4j 2 [Kubernetes Lookup](lookups.html#KubernetesLookup). More information on
Log4j's Kubernetes support may also be found at [Log4j-Kubernetes](../log4j-kubernetes/index.html).

## Appender Performance
The numbers in the table below represent how much time in seconds was required for the application to
call `logger.debug(...)` 100,000 times. These numbers only include the time taken to deliver to the specifically
noted endpoint and many not include the actual time required before they are available for viewing. All
measurements were performed on a MacBook Pro with a 2.9GHz Intel Core I9 processor with 6 physical and 12
logical cores, 32GB of 2400 MHz DDR4 RAM, and 1TB of Apple SSD storage. The VM used by Docker was managed
by VMWare Fusion and had 4 CPUs and 2 GB of RAM. These number should be used for relative performance comparisons
as the results on another system may vary considerably.

The sample application used can be found under the log4j-spring-cloud-config/log4j-spring-cloud-config-samples
directory in the Log4j [source repository](https://github.com/apache/logging-log4j2).

| Test                    | 1 Thread | 2 Threads | 4 Threads | 8 Threads |
|------------------------ |---------:|----------:|----------:|----------:|
|Flume Avro |||||
|- Batch Size 1 - JSON    |49.11     |46.54      |46.70      |44.92      |
|- Batch Size 1 - RFC5424 |48.30     |45.79      |46.31      |45.50      |
|- Batch Size 100 - JSON  | 6.33     |3.87       |3.57       |3.84       |
|- Batch Size 100 - RFC5424 | 6.08   |3.69       |3.22       |3.11       |
|- Batch Size 1000 - JSON | 4.83     |3.20       |3.02       |2.11       |
|- Batch Size 1000 - RFC5424 | 4.70  |2.40       |2.37       |2.37       |
|Flume Embedded |||||
| - RFC5424               |3.58      |2.10       |2.10       |2.70       |
| - JSON                  |4.20      |2.49       |3.53       |2.90       |
|Kafka Local JSON |||||
| - sendSync true         |58.46     |38.55      |19.59      |19.01      |
| - sendSync false        |9.8       |10.8       |12.23      |11.36      |
|Console|||||
| - JSON / Kubernetes     |3.03      |3.11       |3.04       |2.51       |
| - JSON                  |2.80      |2.74       |2.54       |2.35       |
| - Docker fluentd driver |10.65     |9.92       |10.42      |10.27      |
|Rolling File|||||
| - RFC5424               |1.65      |0.94       |1.22       |1.55
| - JSON                  |1.90      |0.95       |1.57       |1.94       |
|TCP - Fluent Bit - JSON  |2.34      |2.167      |1.67       |2.50       |
|Async Logger|||||
|- TCP - Fluent Bit - JSON|0.90      |0.58       |0.36       |0.48       |
|- Console - JSON         |0.83      |0.57       |0.55       |0.61       |
|- Flume Avro - 1000 - JSON|0.76     |0.37       |0.45       |0.68       |

Notes:

1. Flume Avro - Buffering is controlled by the batch size. Each send is complete when the remote
acknowledges the batch was written to its channel. These number seem to indicate Flume Avro could
benefit from using a pool of RPCClients, at least for a batchSize of 1.
1. Flume Embedded - This is essentially asynchronous as it writes to an in-memory buffer. It is
unclear why the performance isn't closer to the AsyncLogger results.
1. Kafka was run in standalone mode on the same laptop as the application. See  sendSync set to true
requires waiting for an ack from Kafka for each log event.
1. Console - System.out is redirected to a file by Docker. Testing shows that it would be much
slower if it was writing to the terminal screen.
1. Rolling File - Test uses the default buffer size of 8K.
1. TCP to Fluent Bit - The Socket Appender uses a default buffer size of 8K.
1. Async Loggers - These all write to a circular buffer and return to the application. The actual
I/O will take place on a separate thread. If writing the events is performed more slowly than
events are being created eventually the buffer will fill up and logging will be performed at
the same pace that log events are written.

## Logging Recommendations

1. Use asynchronous logging unless guaranteed delivery is absolutely required. As
the performance numbers show, so long as the volume of logging is not high enough to fill up the
circular buffer the overhead of logging will almost be unnoticeable to the application.
1. If overall performance is a consideration or you require multiline events such as stack traces
be processed properly then log via TCP to a companion container that acts as a log forwarder or directly
to a log aggregator as shown above in [Logging with ELK](#ELK). Use the
Log4j Docker Lookup to add the container information to each log event.
1. Whenever guaranteed delivery is required use Flume Avro with a batch size of 1 or another Appender such
as the Kafka Appender with syncSend set to true that only return control after the downstream agent
acknowledges receipt of the event. Beware that using an Appender that writes each event individually should
be kept to a minimum since it is much slower than sending buffered events.
1. Logging to files within the container is discouraged. Doing so requires that a volume be declared in
the Docker configuration and that the file be tailed by a log forwarder. However, it performs
better than logging to the standard output stream. If logging via TCP is not an option and
proper multiline handling is required then consider this option.


text:
package unity3d

import (
	"fmt"
	"net/url"
	"github.com/zquestz/s/providers"
)

func init() {
	providers.AddProvider("unity3d", &Unity3DProvider{})
}

//Unity3DProvider adheres to the Provider interface.
type Unity3DProvider struct {
}

//BuildURI generates a search URL for Unity3D.
func (p *Unity3DProvider) BuildURI(q string) string {
	return fmt.Sprintf("https://unity3d.com/search?gq=%s", url.QueryEscape(q))
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>uff</groupId>
    <artifactId>prov-viewer</artifactId>
    <version>1.3.1</version>
    <packaging>jar</packaging>
    <!--<name>Prov Viewer</name>-->
    <!--<url>http://maven.apache.org</url> -->
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <keystore.path>cert/temp.keystore</keystore.path>
        <keystore.type>JKS</keystore.type>
        <keystore.alias>dev</keystore.alias>
        <keystore.password>dev_password</keystore.password>
        <keystore.store.password>${keystore.password}</keystore.store.password>
        <keystore.key.password>${keystore.password}</keystore.key.password>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <!--Download Dependencies -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.8</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--Class Path-->
            <!---->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>dependencies/</classpathPrefix>
                            <mainClass>br.uff.ic.provviewer.GraphFrame</mainClass>
                        </manifest>
                    </archive>

                    <excludes>
                        <exclude>**/*.bmp</exclude>
                        <exclude>**/*.png</exclude>
                        <exclude>**/*.jpg</exclude>
                        <exclude>**/*.jpeg</exclude>
                        <exclude>**/*.gif</exclude>
                        <exclude>**/*.xml</exclude>
                        <exclude>**/*.sql</exclude>
                        <exclude>**/*.log4j</exclude>
                        <exclude>**/*.properties</exclude>
                        <exclude>**/*.sh</exclude>
                    </excludes>

                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>unknown-jars-temp-repo</id>
            <name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
            <url>file:${project.basedir}/lib</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.sf.jung</groupId>
            <artifactId>jung-graph-impl</artifactId>
            <version>2.0.1</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>net.sf.jung</groupId>
            <artifactId>jung-algorithms</artifactId>
            <version>2.0.1</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>net.sf.jung</groupId>
            <artifactId>jung-visualization</artifactId>
            <version>2.0.1</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>jpl</groupId>
            <artifactId>jpl</artifactId>
            <version>3.1.4-alpha</version>
        </dependency>
        <dependency>
            <groupId>org.apache.directory.studio</groupId>
            <artifactId>org.apache.commons.io</artifactId>
            <version>2.4</version>
        </dependency>
    </dependencies>
</project>


text:
package coe618.dyna.models;

/**
 * This class is the model for the card structure interface and implements the
 * properties common to all cards.
 * @author Josh Williams, Sander Fels-Leong and Philip Feldman
 */
public abstract class Card {

    /**
     * This is constructor than initalizes the class using all instance properties.
     * @param _setNumber The unique card set number.
     * @param _name The unique name.
     * @param _type The card type.
     * @param _cost The cost to cast this card.
     * @param _effect The effect of the card.
     * @param _artwork A string with the folder URL.
     */
    public Card(int _setNumber, String _name, String _type, int _cost, String _effect, String _artwork) {
        this._setNumber = _setNumber;
        this._name = _name;
        this._type = _type;
        this._cost = _cost;
        this._effect = _effect;
        this._artwork = _artwork;
    }

    /**
     *  This is a constructor initalizes the class using the string representation.
     * @param compressedObject a csv representation of a card.
     */
    public Card (String compressedObject){

        String[] tokens =compressedObject.split(",");
           _type = tokens[0];
           _name = tokens[1];
           _setNumber = Integer.parseInt(tokens[2]);
           _cost =  Integer.parseInt(tokens[3]);
           _effect = tokens[4];
           _artwork = tokens[5];
    }
	private final int _setNumber;
	private final String _name;
        private final String _type;
	private final int _cost;
	private final String _effect;
	private final String _artwork;

    /**
     * This method returns the string representation to store class in a file.
     * @return a comma seperated list of instance variables
     */
    @Override
    public String toString() {
        return _type + "," +_name + "," + _setNumber+","+_cost+","+_effect+","+_artwork;
    }

    /**
     * Returns the set number of a card.
     * @return an integer with a unique number.
     */
    public int getSetNumber() {
        return _setNumber;
    }

    /**
     * Returns the name of card.
     * @return a string with card name.
     */
    public String getName() {
        return _name;
    }

    /**
     * Returns the card type.
     * @return returns a string with card type.
     */
    public String getType() {
        return _type;
    }

    /**
     * Returns the card cost to play it.
     * @return  an integer with the cost to use card.
     */
    public int getCost() {
        return _cost;
    }

    /**
     * Returns the effect text.
     * @return a string with the card effect.
     */
    public String getEffect() {
        return _effect;
    }

    /**
     * Returns the artwork url of the object.
     * @return a string with url of art.
     */
    public String getArtwork() {
        return _artwork;
    }

}


text: Count numbers that don 8217 t contain 3


text:
using System;

namespace Dot42
{
    /// <summary>
    /// Mark a library project reference.
    /// </summary>
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public sealed class LibraryProjectReferenceAttribute : Attribute
	{
        /// <summary>
        /// Default ctor
        /// </summary>
        public LibraryProjectReferenceAttribute(string libraryPackageName)
        {
        }
	}
}


text:
package native

import (
	"crypto/rand"
	"crypto/rsa"
	"crypto/x509"
	"encoding/pem"
	"sync"
	"time"

	"github.com/gravitational/teleport"
	"github.com/gravitational/teleport/lib/defaults"
	"github.com/gravitational/teleport/lib/utils"

	log "github.com/Sirupsen/logrus"
	"github.com/gravitational/trace"
	"golang.org/x/crypto/ssh"
)

var (
	// this global configures how many pre-caluclated keypairs to keep in the
	// background (perform key genreation in a separate goroutine, useful for
	// web sesssion for snappy UI)
	PrecalculatedKeysNum = 10

	// only one global copy of 'nauth' exists
	singleton nauth = nauth{
		closeC: make(chan bool),
	}
)

type keyPair struct {
	privPem  []byte
	pubBytes []byte
}

type nauth struct {
	generatedKeysC chan keyPair
	closeC         chan bool
	mutex          sync.Mutex
}

// New returns a pointer to a key generator for production purposes
func New() *nauth {
	singleton.mutex.Lock()
	defer singleton.mutex.Unlock()

	if singleton.generatedKeysC == nil && PrecalculatedKeysNum > 0 {
		singleton.generatedKeysC = make(chan keyPair, PrecalculatedKeysNum)
		go singleton.precalculateKeys()
	}
	return &singleton
}

// Close() closes and re-sets the key generator (better to call it only once,
// when the process is stopping, to avoid costly re-initialization)
func (n *nauth) Close() {
	n.mutex.Lock()
	defer n.mutex.Unlock()

	close(n.closeC)
	n.generatedKeysC = nil
	n.closeC = make(chan bool)
}

// GetNewKeyPairFromPool returns pre-generated keypair from a channel, which
// gets replenished by `precalculateKeys` goroutine
func (n *nauth) GetNewKeyPairFromPool() ([]byte, []byte, error) {
	select {
	case key := <-n.generatedKeysC:
		return key.privPem, key.pubBytes, nil
	default:
		return n.GenerateKeyPair("")
	}
}

func (n *nauth) precalculateKeys() {
	for {
		privPem, pubBytes, err := n.GenerateKeyPair("")
		if err != nil {
			log.Errorf(err.Error())
			continue
		}
		key := keyPair{
			privPem:  privPem,
			pubBytes: pubBytes,
		}

		select {
		case <-n.closeC:
			log.Infof("[KEYS] precalculateKeys() exited")
			return
		case n.generatedKeysC <- key:
			continue
		}
	}
}

// GenerateKeyPair returns fresh priv/pub keypair, takes about 300ms to execute
func (n *nauth) GenerateKeyPair(passphrase string) ([]byte, []byte, error) {
	priv, err := rsa.GenerateKey(rand.Reader, 2048)
	if err != nil {
		return nil, nil, err
	}
	privDer := x509.MarshalPKCS1PrivateKey(priv)
	privBlock := pem.Block{
		Type:    "RSA PRIVATE KEY",
		Headers: nil,
		Bytes:   privDer,
	}
	privPem := pem.EncodeToMemory(&privBlock)

	pub, err := ssh.NewPublicKey(&priv.PublicKey)
	if err != nil {
		return nil, nil, err
	}
	pubBytes := ssh.MarshalAuthorizedKey(pub)
	return privPem, pubBytes, nil
}

func (n *nauth) GenerateHostCert(privateSigningKey, publicKey []byte, hostname, authDomain string, roles teleport.Roles, ttl time.Duration) ([]byte, error) {
	if err := roles.Check(); err != nil {
		return nil, trace.Wrap(err)
	}
	pubKey, _, _, _, err := ssh.ParseAuthorizedKey(publicKey)
	if err != nil {
		return nil, err
	}
	validBefore := uint64(ssh.CertTimeInfinity)
	if ttl != 0 {
		b := time.Now().Add(ttl)
		validBefore = uint64(b.Unix())
	}
	cert := &ssh.Certificate{
		ValidPrincipals: []string{hostname},
		Key:             pubKey,
		ValidBefore:     validBefore,
		CertType:        ssh.HostCert,
	}
	cert.Permissions.Extensions = make(map[string]string)
	cert.Permissions.Extensions[utils.CertExtensionRole] = roles.String()
	cert.Permissions.Extensions[utils.CertExtensionAuthority] = string(authDomain)
	signer, err := ssh.ParsePrivateKey(privateSigningKey)
	if err != nil {
		return nil, err
	}
	if err := cert.SignCert(rand.Reader, signer); err != nil {
		return nil, err
	}
	return ssh.MarshalAuthorizedKey(cert), nil
}

func (n *nauth) GenerateUserCert(pkey, key []byte, teleportUsername string, allowedLogins []string, ttl time.Duration) ([]byte, error) {
	if ttl < defaults.MinCertDuration {
		return nil, trace.BadParameter("wrong certificate TTL")
	}
	if len(allowedLogins) == 0 {
		return nil, trace.BadParameter("allowedLogins: need allowed OS logins")
	}
	pubKey, _, _, _, err := ssh.ParseAuthorizedKey(key)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	validBefore := uint64(ssh.CertTimeInfinity)
	if ttl != 0 {
		b := time.Now().Add(ttl)
		validBefore = uint64(b.Unix())
		log.Infof("generated user key for %v with expiry on (%v) %v", allowedLogins, validBefore, b)
	}
	// we do not use any extensions in users certs because of this:
	// https://bugzilla.mindrot.org/show_bug.cgi?id=2387
	cert := &ssh.Certificate{
		KeyId:           teleportUsername, // we have to use key id to identify teleport user
		ValidPrincipals: allowedLogins,
		Key:             pubKey,
		ValidBefore:     validBefore,
		CertType:        ssh.UserCert,
	}
	cert.Permissions.Extensions = map[string]string{
		"permit-pty":             "",
		"permit-port-forwarding": "",
	}

	signer, err := ssh.ParsePrivateKey(pkey)
	if err != nil {
		return nil, err
	}
	if err := cert.SignCert(rand.Reader, signer); err != nil {
		return nil, err
	}
	return ssh.MarshalAuthorizedKey(cert), nil
}


text:
//
// Novell.Directory.Ldap.Rfc2251.RfcUnbindRequest.cs
//
// Author:
//   Sunil Kumar (Sunilk@novell.com)
//
// (C) 2003 Novell, Inc (http://www.novell.com)
//

using System;
using Novell.Directory.Ldap.Asn1;
using Novell.Directory.Ldap;
using Novell.Directory.Ldap.Utilclass;

namespace Novell.Directory.Ldap.Rfc2251
{

	///  Represents the Ldap Unbind request.
	///
	///

	/// UnbindRequest ::= [APPLICATION 2] NULL
	///

	///
	public class RfcUnbindRequest:Asn1Null, RfcRequest
	{

		//*************************************************************************
		// Constructor for UnbindRequest
		//*************************************************************************

		///  Construct an RfCUnbind Request
		public RfcUnbindRequest():base()
		{
			return ;
		}

		//*************************************************************************
		// Accessors
		//*************************************************************************

		///  Override getIdentifier to return an application-wide id.
		///

		/// ID = CLASS: APPLICATION, FORM: PRIMITIVE, TAG: 2. (0x42)
		///

		///
		public override Asn1Identifier getIdentifier()
		{
			return new Asn1Identifier(Asn1Identifier.APPLICATION, false, LdapMessage.UNBIND_REQUEST);
		}

		public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request)
		{
			throw new LdapException(ExceptionMessages.NO_DUP_REQUEST, new System.Object[]{"unbind"}, LdapException.Ldap_NOT_SUPPORTED, (System.String) null);
		}

		public System.String getRequestDN()
		{
			return null;
		}
	}
}


text:
/*
Theme Name: Arclite
Theme URI: http://digitalnature.ro/projects/arclite
Description: Simple but elegant theme with lots of theme options. Designed by digitalnature.
Version: 1.5.4
Author: digitalnature
Author URI: http://digitalnature.ro
Tags: light, brown, two-columns, flexible-width, right-sidebar, theme-options, threaded-comments, custom-header

  Arclite Wordpress theme
    http://digitalnature.ro/projects/arclite

  Design and coding by digitalnature
    http://digitalnature.ro

  The CSS, XHTML and design is released under GPL.
    http://www.opensource.org/licenses/gpl-license.php

*/
/* global prop. */
* {
    margin: 0;
    padding: 0
    }
/* try to use custom fonts trough css3 (opera 10+, safari 3.1+ and ff 3.5+) */
@font-face {
    font-family: "Union";
    src: url(/static/fonts/union.ttf) format("truetype")
    }
@font-face {
    font-family: "Share";
    src: url(/static/fonts/share.ttf) format("truetype")
    }
/*** COMMON ELEMENTS ***/
html, body {
    height: 100%
    }
html {
    font-size: 100%
    }
body {
    font-family: "Lucida Grande", "Lucida Sans Unicode", Calibri, Arial, Helvetica, Sans, FreeSans, Jamrul, Garuda, Kalimati;
    font-size: 0.8em;
    font-style: normal;
    color: #000;
    background: #261c13;
    min-height: 100%;
    height: auto !important;
    /* ie6 ignores it */
    height: 100%;
    /* fix */
    position: relative
    }
/* links */
a {
    color: #0071bb
    }
a:hover {
    color: #f44365;
    text-decoration: none
    }
/* headings */
h1 {
    font-family: "Union", "Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, Sans, FreeSans, Jamrul, Garuda, Kalimati;
    font-weight: bold;
    font-size: 360%;
    letter-spacing: -0.04em;
    line-height: 100%;
    margin: 0.5em 0 0.5em
    }
h3 {
    font-family: "Arial Black", Arial, Helvetica, Sans, FreeSans, Jamrul, Garuda, Kalimati;
    font-size: 180%;
    font-weight: normal;
    letter-spacing: -0.04em;
    line-height: 110%;
    margin: 0.5em 0 0.2em;
    text-shadow: #fff 1px 1px 1px
    }
h4 {
    font-family: "Share", "Arial Narrow", Arial, Sans;
    font-size: 200%;
    font-weight: normal;
    margin: 0.5em 0 0.2em
    }
/* tables */
/* forms */
input {
    font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, Sans, FreeSans, Jamrul, Garuda, Kalimati;
    font-size: 100%;
    margin: 0.5em 0
    }
input {
    padding: 0.2em 0.4em
    }
form {
    margin-top: 2em
    }
form label {
    font-weight: normal
    }
/* lists */
ul {
    margin: 0.4em 0 1em;
    line-height: 150%
    }
ul li {
    list-style-position: outside;
    margin-left: 1.6em
    }
dl {
    padding: 0.3em 0 0.8em
    }
dt {
    margin: 0.5em 0
    }
dd.error {
    margin-bottom: 1.5em
    }
/* other */
p {
    margin: 1em 0;
    line-height: 150%;
    font-size: 1.125em
    }
/*** BASIC LAYOUT ***/
#page {
    width: 100%;
    margin: 0 auto;
    position: relative
    }
.block-content {
    width: 100% !important;
    width: 960px;
    /* for ie 6 */
    min-width: 780px;
    max-width: 1200px;
    margin: 0 auto;
    display: block
    }
#main-wrap1 {
    background: #eeead9
    }
#main-wrap2 {
    border-top: 1px solid #fff
    }
#main {
    padding-top: 20px
    }
.mask-main {
    position: relative;
    /* This fixes the IE7 overflow hidden bug */
    clear: both;
    float: left;
    width: 100%;
    overflow: hidden;
    /* This chops off any overhanging divs */
    }
.mask-main .mask-left {
    float: left;
    width: 100%;
    position: relative
    }
.mask-main .col1 {
    float: left;
    position: relative;
    padding: 0;
    overflow: hidden
    }
/*** 2 column layout ***/
#page.with-sidebar .mask-main .col1 {
    width: 600px
    }
/*** 3 column layout ***/
.clear-content {
    height: 1px;
    clear: both;
    display: block
    }
/*** HEADER ***/
#header {
    height: 190px;
    position: relative;
    z-index: 1000;
    color: #fff
    }
#header-wrap {
    width: 100%;
    background: #261c13
    }
#pagetitle {
    padding: 3em 0 0 1em
    }
#pagetitle h1.logo {
    font-family: "Arial Black", Arial, Helvetica, Sans, FreeSans, Jamrul, Garuda, Kalimati;
    font-size: 500%;
    float: left;
    padding: 0.1em 0 0 0;
    margin: 0;
    letter-spacing: -0.085em;
    font-variant: small-caps;
    font-weight: normal;
    color: #eeeadb
    }
#pagetitle h4 {
    float: left;
    border-left: 1px solid #8e7762;
    padding: 0.6em 0 0.6em 0.8em;
    margin-left: 1em;
    color: #e9e2c9
    }
/* search */
/* main navigation */
#nav-wrap1 {
    background: transparent url(/static/images/nav-left.png) no-repeat left top;
    padding-left: 25px;
    position: absolute;
    z-index: 100;
    top: 170px;
    left: 1em;
    height: 64px
    }
#nav-wrap2 {
    background: transparent url(/static/images/nav-bg.png) no-repeat right top;
    padding-right: 25px;
    height: 64px;
    float: left
    }
#nav-wrap2 ul#nav, #nav-wrap2 ul#nav li {
    padding: 0;
    margin: 0;
    list-style-type: none
    }
#nav-wrap2 ul#nav {
    background: transparent url(/static/images/nav-div.png) no-repeat right top;
    padding-right: 2px;
    display: block;
    height: 64px
    }
#nav-wrap2 ul#nav li {
    display: inline;
    float: left;
    position: relative;
    background: transparent url(/static/images/nav-div.png) no-repeat left top;
    padding-left: 2px
    }
#nav-wrap2 ul#nav li a {
    display: block;
    margin-top: 1px;
    height: 35px;
    float: left;
    color: #b5d1e6;
    text-decoration: none;
    font-size: 120%
    }
#nav-wrap2 ul#nav li a:hover {
    color: #fff
    }
#nav-wrap2 ul#nav .fadeThis {
    position: relative;
    z-index: 1;
    background: none
    }
#nav-wrap2 ul#nav li a span {
    display: block;
    margin-top: 6px;
    padding: 0 8px
    }
/* sub-menus */
/* active submenus */
/* IE 7 bug-fixes */
#nav-wrap2 ul#nav li:hover {
    z-index: 100
    }
/*** MAIN CONTENT ***/
#main-content {
    padding: 2em 1em
    }
/* post */
.post {
    margin: 1em 0
    }
h3.post-title {
    font-family: "Union", "Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, Sans, FreeSans, Jamrul, Garuda, Kalimati;
    margin: 0;
    padding: 0.8em 0 0.1em 0;
    font-size: 180%;
    font-weight: bold;
    letter-spacing: -0.04em;
    text-shadow: #fff 1px 1px 1px
    }
/* large title on single page */
.post .post-content {
    clear: left;
    padding-bottom: 0.4em
    }
/* tags */
/* comments */
/* comment form */
/*** SIDEBAR ***/
/* sidebar menu */
/* sub menus */
/* rss popups */
/* box */
/*** FOOTER ***/
#footer {
    padding: 1em 0;
    color: #e7e0c7;
    border-top: 1px solid #fff
    }
#footer a {
    color: #a59079
    }
#footer .copyright {
    text-align: center;
    font-size: 85%
    }
/* footer links/widgets */
/* no point to add more than 6 widgets, unreadable */
/*** MISC ***/
div.clear {
    clear: both;
    height: 1px
    }
/* clearfix */
.clearfix:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden
    }
.clearfix {
    min-width: 0;
    /* trigger hasLayout for IE7 */
    display: inline-block;
    /* \*/
    display: block;
    /* Hide from IE Mac */
    }
* html .clearfix {
    /* \*/
    height: 1%;
    /* Hide from IE Mac */
    }
.error {
    color: #ed1f24
    }
/*** WORDPRESS SPECIFIC STYLES ***/
/* pagination */
/* navigation links */
/* captions, thumbnail images in posts */
/* no border on smilies */
/* Sociable plugin adjustment */
/* customize specific widgets */
/* no .box style on calendar */
/* no border on smilies */
/* from http://wp-themes.com/wp-content/themes/arclite/options/content-default.css */
/* default content background (light brown + noise) */
#main-wrap1 {
    background: transparent url(/static/images/main-bg.jpg) repeat center top
    }
#main-wrap2 {
    background: transparent url(/static/images/main-top.jpg) repeat-x center top
    }
#main {
    background: transparent url(/static/images/main-center.jpg) no-repeat center top
    }
/* from http://wp-themes.com/wp-content/themes/arclite/options/header-default.css */
/* default header */
#header {
    background: transparent url(/static/images/header-center.jpg) no-repeat center top
    }
#header-wrap {
    background: transparent url(/static/images/header-bg.jpg) repeat-x center top
    }
code {
    font-family: "Andale Mono", "Monaco", monospace;
    font-size: larger
    }


text:
package com.novaordis.gc.cli.command;

import com.novaordis.gc.cli.Command;
import com.novaordis.gc.cli.Configuration;
import com.novaordis.gc.model.event.*;
import com.novaordis.gc.model.event.cms.CMSEvent;
import org.apache.log4j.Logger;

import java.util.Iterator;
import java.util.List;

public class InfoCommand implements Command
{
    // Constants ---------------------------------------------------------------------------------------------------------------------------

    private static final Logger log = Logger.getLogger(InfoCommand.class);

    // Static ------------------------------------------------------------------------------------------------------------------------------

    // Attributes --------------------------------------------------------------------------------------------------------------------------

    private Configuration c;

    // Constructors ------------------------------------------------------------------------------------------------------------------------

    public InfoCommand(Configuration c, Iterator<String> args)
    {
        this.c = c;
        log.debug("ignored " + args);
    }

    // Command implementation --------------------------------------------------------------------------------------------------------------

    @Override
    public boolean needsGcData()
    {
        return true;
    }

    @Override
    public void execute(List<GCEvent> events) throws Exception
    {
        int fullCCnt = 0;
        int ngCCnt = 0;
        int sdCnt = 0;
        String algorithm = "Parallel";
        long tfc = 0L;

        for(GCEvent e: events)
        {
            if (e instanceof FullCollection)
            {
                fullCCnt ++;
                tfc += e.getDuration();
            }
            else if (e instanceof NewGenerationCollection)
            {
                ngCCnt ++;
            }
            else if (e instanceof Shutdown)
            {
                sdCnt ++;
            }
            else if (e instanceof CMSEvent)
            {
                algorithm = "CMS";
            }
        }

        long begin = events.get(0).getTime();
        long end = events.get(events.size() - 1).getTime();
        long elapsedMs = end - begin;

        System.out.println("");
        System.out.println("File:                           " + c.getGCLogFile().getAbsolutePath());
        Long timeOrigin = c.getTimeOrigin();
        System.out.println("Time Origin:                    " +
                (timeOrigin == null ? "N/A" : Configuration.TIMESTAMP_DISPLAY_FORMAT.format(c.getTimeOrigin())));
        System.out.println("Beginning:                      " + Configuration.TIMESTAMP_DISPLAY_FORMAT.format(begin));
        System.out.println("End:                            " + Configuration.TIMESTAMP_DISPLAY_FORMAT.format(end));
        System.out.println("GC collection algorithm:        " + algorithm);
        System.out.println("New generation collections:     " + ngCCnt);
        System.out.println("Full collections:               " + fullCCnt);
        System.out.println("Shutdown events:                " + sdCnt);
        System.out.println("Elapsed time:                   " +
                Configuration.DURATION_SECONDS_FORMAT.format((float) elapsedMs / 1000) + " seconds");
        System.out.println("Time spent in full collections: " +
                Configuration.DURATION_SECONDS_FORMAT.format((float)tfc / 1000) + " seconds");
        System.out.println("Percentage:                     " +
                Configuration.PERCENTAGE_FORMAT.format(((float) tfc / (float) elapsedMs) * 100) + "%");
    }

    // Public ------------------------------------------------------------------------------------------------------------------------------

    // Package protected -------------------------------------------------------------------------------------------------------------------

    // Protected ---------------------------------------------------------------------------------------------------------------------------

    // Private -----------------------------------------------------------------------------------------------------------------------------

    // Inner classes -----------------------------------------------------------------------------------------------------------------------
}


text:
#pragma once
#include <cstdint>

namespace dai {
/**
 * Camera sensor image orientation / pixel readout.
 * This exposes direct sensor settings. 90 or 270 degrees rotation is not available.
 *
 * AUTO denotes that the decision will be made by device (e.g. on OAK-1/megaAI: ROTATE_180_DEG).
 */
enum class CameraImageOrientation : int32_t { AUTO = -1, NORMAL, HORIZONTAL_MIRROR, VERTICAL_FLIP, ROTATE_180_DEG };

}  // namespace dai


text:
package com.google.cloud.storage.contrib.nio;

import static com.google.common.truth.Truth.assertThat;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.net.SocketTimeoutException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Unit tests for {@link CloudStorageConfiguration}. */
@RunWith(JUnit4.class)
public class CloudStorageConfigurationTest {

  @Rule public final ExpectedException thrown = ExpectedException.none();

  @Test
  public void testBuilder() {
    CloudStorageConfiguration config =
        CloudStorageConfiguration.builder()
            .workingDirectory("/omg")
            .permitEmptyPathComponents(true)
            .stripPrefixSlash(false)
            .usePseudoDirectories(false)
            .blockSize(666)
            .retryableHttpCodes(ImmutableList.of(1, 2, 3))
            .reopenableExceptions(
                ImmutableList.<Class<? extends Exception>>of(SocketTimeoutException.class))
            .build();
    assertThat(config.workingDirectory()).isEqualTo("/omg");
    assertThat(config.permitEmptyPathComponents()).isTrue();
    assertThat(config.stripPrefixSlash()).isFalse();
    assertThat(config.usePseudoDirectories()).isFalse();
    assertThat(config.blockSize()).isEqualTo(666);
    assertThat(config.retryableHttpCodes()).isEqualTo(ImmutableList.of(1, 2, 3));
    assertThat(config.reopenableExceptions())
        .isEqualTo(ImmutableList.<Class<? extends Exception>>of(SocketTimeoutException.class));
  }

  @Test
  public void testFromMap() {
    CloudStorageConfiguration config =
        CloudStorageConfiguration.fromMap(
            new ImmutableMap.Builder<String, Object>()
                .put("workingDirectory", "/omg")
                .put("permitEmptyPathComponents", true)
                .put("stripPrefixSlash", false)
                .put("usePseudoDirectories", false)
                .put("blockSize", 666)
                .put("retryableHttpCodes", ImmutableList.of(1, 2, 3))
                .put(
                    "reopenableExceptions",
                    ImmutableList.<Class<? extends Exception>>of(SocketTimeoutException.class))
                .build());
    assertThat(config.workingDirectory()).isEqualTo("/omg");
    assertThat(config.permitEmptyPathComponents()).isTrue();
    assertThat(config.stripPrefixSlash()).isFalse();
    assertThat(config.usePseudoDirectories()).isFalse();
    assertThat(config.blockSize()).isEqualTo(666);
    assertThat(config.retryableHttpCodes()).isEqualTo(ImmutableList.of(1, 2, 3));
    assertThat(config.reopenableExceptions())
        .isEqualTo(ImmutableList.<Class<? extends Exception>>of(SocketTimeoutException.class));
  }

  @Test
  public void testFromMap_badKey_throwsIae() {
    thrown.expect(IllegalArgumentException.class);
    CloudStorageConfiguration.fromMap(ImmutableMap.of("lol", "/omg"));
  }

  @Test
  /** Spot check that our defaults are applied. */
  public void testSomeDefaults() {
    for (CloudStorageConfiguration config :
        ImmutableList.of(
            CloudStorageConfiguration.DEFAULT, CloudStorageConfiguration.builder().build())) {
      assertThat(config.retryableHttpCodes()).contains(503);
      assertThat(config.reopenableExceptions()).contains(SocketTimeoutException.class);
    }
  }
}


text:
../Contents/Resources/Spoon\ 3\ beta\ 5\ processor.app/Contents/Linux/lib/spoon/4.4.7-2357/spoonvm ../Contents/Resources/Spoon\ 3\ beta\ 5\ processor.app/Contents/Resources/946BE974-48B7-4D11-B209-6355B3E49722.image &
sleep 5
xdg-open http://localhost:8090/README.html &


text:
REST API
========

Many functionalities of INDRA can be used via a REST API. This enables
making use of INDRA's knowledge sources and assembly capabilities in a
RESTful, platform independent fashion. The REST service is available as a
public web service at http://api.indra.bio:8000 and can also be run locally.

Local installation and use
--------------------------
Running the REST service requires the `flask`, `flask_restx`, `flask_cors`
and `docstring-parser`
packages to be installed in addition to all the other requirements of INDRA.
The REST service can be launched by running `api.py` in the `rest_api` folder
within `indra`.

As an alternative, the REST service can be run via the INDRA Docker without
the need for installing any dependencies as follows:

.. code-block:: sh

    docker pull labsyspharm/indra
    docker run -id -p 8080:8080 --entrypoint python labsyspharm/indra /sw/indra/rest_api/api.py

Documentation
-------------
The specific end-points and input/output parameters offered by the REST API
are documented at http://api.indra.bio:8000 or the local address on which
the API is running.


text:
module Rules
  class FirstTimeRule
    def broken?(submission)
      !submission.first_time
    end
  end
end