text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Crawler.Tools;

namespace Crawler.Data
{
    public class Game
    {
        private int StringIndex => 1;
        private int HomePlayerIndex => 3;
        private int HomeWo => 5;
        private int HomeScoreIndex => 7;
        private int G1 => 9;
        private int G2 => 10;
        private int G3 => 11;
        private int G4 => 12;
        private int G5 => 13;
        private int AwayWo => 17;
        private int AwayScoreIndex => 15;
        private int AwayPlayerIndex => 19;

        public Player HomePlayer { get; set; }
        public Player AwayPlayer { get; set; }
        public int String { get; set; }
        public List<Score> Scores { get; set; }
        public int HomeScore { get; set; }
        public int AwayScore { get; set; }
        public bool HomeWalkover { get; set; }
        public bool AwayWalkover { get; set; }

        public Game(TableRow row)
        {
            String = Convert.ToInt32(row.TableDatas[StringIndex].Value);
            HomeWalkover = !string.IsNullOrEmpty(row.TableDatas[HomeWo].Value);
            HomePlayer = HomeWalkover?null: new Player(row.TableDatas[HomePlayerIndex]);
            AwayWalkover = !string.IsNullOrEmpty(row.TableDatas[AwayWo].Value);
            AwayPlayer = AwayWalkover ? null : new Player(row.TableDatas[AwayPlayerIndex]);
            if (!(AwayWalkover || HomeWalkover))
            {
                Scores = new List<Score>();
                for (int i = G1; i <= G5; i++)
                {
                    Scores.Add(new Score(row.TableDatas[i]));
                }
            }
            HomeScore = Convert.ToInt32(row.TableDatas[HomeScoreIndex].Value);
            AwayScore = Convert.ToInt32(row.TableDatas[AwayScoreIndex].Value);
        }

        public string ToJson()
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("\"Discipline\":\"" + "Squash\",\n");
            if (!(AwayWalkover || HomeWalkover))
            {
                builder.Append("\"Scoring System\":\"" + Scores[0].Scoring + "\",");
            }

            if (HomeWalkover)
            {
                builder.Append("\"Player 1 uid\":\"walkover\",\n");
            }
            else if (!string.IsNullOrEmpty(HomePlayer.Url))
            {
                builder.Append("\"Player 1 uid\":\"" + HomePlayer.Id + "\",");
                builder.Append("\"Player 1 First name\":\"" + HomePlayer.FirstName + "\",");
                builder.Append("\"Player 1 Last name\":\"" + HomePlayer.LastName + "\",");
            }
            if (AwayWalkover)
            {
                builder.Append("\"Player 2 uid\":\"walkover\",");
            }
            else if (!string.IsNullOrEmpty(AwayPlayer.Url))
            {
                builder.Append("\"Player 2 uid\":\"" + AwayPlayer.Id + "\",");
                builder.Append("\"Player 2 First name\":\"" + AwayPlayer.FirstName + "\",");
                builder.Append("\"Player 2 Last name\":\"" + AwayPlayer.LastName + "\",");
            }

            builder.Append("\"Games player 1\":\"" + HomeScore + "\",");
            builder.Append("\"Games player 2\":\"" + AwayScore + "\",");
            if (!(AwayWalkover || HomeWalkover))
            {
                builder.Append("\"Player 1: Game 1\":\"" + Scores[0].Player1Score + "\",");
                builder.Append("\"Player 2: Game 1\":\"" + Scores[0].Player2Score + "\",");
                builder.Append("\"Player 1: Game 2\":\"" + Scores[1].Player1Score + "\",");
                builder.Append("\"Player 2: Game 2\":\"" + Scores[1].Player2Score + "\",");
                builder.Append("\"Player 1: Game 3\":\"" + Scores[2].Player1Score + "\",");
                builder.Append("\"Player 2: Game 3\":\"" + Scores[2].Player2Score + "\",");
                builder.Append("\"Player 1: Game 4\":\"" + Scores[3].Player1Score + "\",");
                builder.Append("\"Player 2: Game 4\":\"" + Scores[3].Player2Score + "\",");
                builder.Append("\"Player 1: Game 5\":\"" + Scores[4].Player1Score + "\",");
                builder.Append("\"Player 2: Game 5\":\"" + Scores[4].Player2Score + "\",");
            }

            return builder.ToString();
        }

    }
}


text:
package org.portletbridge.portlet;

import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * @author jmccrindle
 */
public class ResourceUtil {

    private ResourceUtil() {
        super();
    }

    public static void copy(InputStream inputStream, OutputStream outputStream,
            int bufSize) throws IOException {
        InputStream in = inputStream;
        BufferedOutputStream out = new BufferedOutputStream(outputStream,
                bufSize);
        try {
            byte[] b = new byte[4096];
            int i = -1;
            while ((i = in.read(b)) != -1) {
                out.write(b, 0, i);
            }
            out.flush();
        } finally {
            in.close();
        }
    }

    public static String getString(InputStream in, String charSet) throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        copy(in, out, 4096);
        return new String(out.toByteArray(), charSet);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Partial Differential Equations</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

  PARTIAL
  DIFFERENTIAL EQUATIONS

First order partial
  differential equation and Hamilton-Jacobi equations; Cauchy problem and classification
  of second order equations, Holmgren’s uniqueness theorem; Laplace equation; Diffusion equation; Wave equation; Some methods of solutions, Variable separable
  method.

Books

Garabedian,
    P. R., Partial Differential Equations, John Wiley and Sons, 1964.

Prasad. P. and
    Ravindran, R., Partial Differential Equations, Wiley Eastern, 1985.

 Renardy, M.
    and Rogers, R. C., An Introduction to Partial Differential Equations, Springer-Verlag,
    1992.

Fritz John,
    Partial differential Equations, Springer (International Students Edition),
    1971.


text:
using ConsoleScraper.Models;
using OfficeOpenXml;
using System.Collections.Generic;

namespace ConsoleScraper.Logging.Interfaces
{
	public interface IExcelLogger
	{
		/// <summary>
		/// Adds an entry for a ground vehicle to a spreadsheet
		/// </summary>
		/// <param name="groundVehicle">The vehicle to pull the information from</param>
		/// <param name="worksheet">The worksheet to add the data to</param>
		void AddGroundVehicleRowToSpreadsheet(GroundVehicle groundVehicle, ExcelWorksheet worksheet);

		/// <summary>
		/// Creates the headers for the Ground Vehicles spreadsheet
		/// </summary>
		/// <param name="worksheet">The worksheet to create the headers in</param>
		void CreateGroundVehicleSpreadsheetHeaders(ExcelWorksheet worksheet);

		/// <summary>
		/// Creates a new excel file that holds all of the details extracted from
		/// the wiki in the location specified by the App.Config file
		/// </summary>
		void CreateExcelFile(Dictionary<string, GroundVehicle> vehicleDetails);
	}
}


text:
package org.seasar.doma.jdbc.query;

/**
 * @author taedium
 * @param <RESULT>
 *            結果
 */
public interface FunctionQuery<RESULT> extends ModuleQuery {

    RESULT getResult();
}


text:
package mesosphere.marathon
package core.base

import akka.Done
import mesosphere.marathon.core.async.ExecutionContexts

import scala.concurrent.Future

sealed trait CrashStrategy {
  def crash(): Future[Done]
}

case object JvmExitsCrashStrategy extends CrashStrategy {
  override def crash(): Future[Done] = {
    Runtime.getRuntime.asyncExit()(ExecutionContexts.global)
  }
}


text:
require('colors');

var stealthMode = false;

exports.setStealthMode = function(isStealthMode) {
    stealthMode = isStealthMode;
};

exports.log = function() {
    if (stealthMode) {
        return;
    }
    console.log(Array.prototype.slice.call(arguments).join(' '));
};


text:
<?xml version="1.0" encoding="UTF-8"?>
<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>

    <artifactId>share</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>io.github.pivopil</groupId>
        <artifactId>spring-boot-rest-rxjava</artifactId>
        <version>1.0.0</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>

        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>


text:
package com.mercari.sample.api;

import android.content.Context;

import com.mercari.sample.R;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Created by tomoaki on 6/3/16.
 */
public class FakeApi {

    Context context;
    public FakeApi(Context context) {
        this.context = context;
    }

    public JSONObject get(String ... request){
        //Sleep to show that the request is taking time
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        try {
            return new JSONObject(readTextFile(context.getResources().openRawResource(R.raw.experiments_response)));
        } catch (JSONException e) {
            return null;
        }
    }

    private String readTextFile(InputStream inputStream) {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

        byte buf[] = new byte[1024];
        int len;
        try {
            while ((len = inputStream.read(buf)) != -1) {
                outputStream.write(buf, 0, len);
            }
            outputStream.close();
            inputStream.close();
        } catch (IOException e) {

        }
        return outputStream.toString();
    }
}


text:
Implementation of Quartz job store using Hazelcast
=========

This project is now maintained here : https://github.com/FlavioF/quartz-scheduler-hazelcast-jobstore


text:
var EventEmitter = require('events').EventEmitter
var geoip = require('geoip-lite-with-city-data')

var maptail = exports = module.exports = new EventEmitter

maptail.config = {
  // maximum history items
  historyMax: 50

  // maximum markers to buffer
, bufferMax: 50

  // buffer time in milliseconds
, bufferTime: 1000

  // markers' initial time to live in seconds
, ttl: 100 // seconds

  // maximum dots to be displayed (this adjusts ttl automatically)
, maxDots: 200

  // report visitors up to that age
, maxAge: 240 // seconds

  // only emit ips with geo data
, onlyLookups: false

  // aging repaint in fps
, fps: 120
}

maptail.history = []
maptail.buffer = []

maptail.on('ip', function (ip, message) {
  var geo = ip && maptail.lookup(ip) || {}
  delete geo.range
  delete geo.region
  geo.ip = ip
  geo.date = Date.now()
  if (message) geo.message = message
  if (!maptail.config.onlyLookups || geo.ll) maptail.emit('geoip', geo)
})

maptail.lookup = function (ip) {
  return geoip.lookup(ip)
}

maptail.track = function () {
  return function (req, res, next) {
    // get real ip address
    var ip =
    req.headers['ip']
    || req.headers['x-forwarded-for']
    || req.headers['x-real-ip']
    || req.headers['x-ip']
    || req.connection.remoteAddress
    maptail.emit('ip', ip)
    next()
  }
}

maptail.static = function (opts) {
  var express = require('express')
  return express.static(__dirname + '/../public')
}

maptail.attach = function (app) {
  var users = {
    list: []
  , has: function (socket) {
      return !!~this.list.indexOf(socket)
    }
  , add: function (socket) {
      if (!this.has(socket)) this.list.push(socket)
    }
  , remove: function (socket) {
      var index = this.list.indexOf(socket)
      if (index > -1) this.list.splice(index, 1)
    }
  , forEach: function (fn) {
      this.list.forEach(fn)
    }
  }
  var simpl = require('simpl')
  var ws = simpl.createServer(app)
  ws.use(simpl.events())
  ws.use(simpl.json())
  ws.on('connection', function (socket) {
    socket.on('close', function () {
      users.remove(socket)
    })
    socket.remote
    .on('subscribe', function (what) {
      if (what === 'geoip') {
        users.add(socket)
        maptail.config.dateNow = Date.now()
        socket.remote.emit('config', maptail.config)
        socket.remote.emit('geoip', maptail.history)
      }
    })
    .on('unsubscribe', function (what) {
      if (what === 'geoip') users.remove(socket)
    })
  })
  var before = Date.now()
  maptail.on('geoip', function (geo) {
    maptail.history.push(geo)
    maptail.buffer.push(geo)
    if (maptail.history.length > maptail.config.historyMax) maptail.history.shift()
    if (Date.now() - before > maptail.config.bufferTime && maptail.buffer.length) {
      users.forEach(function (socket) {
        socket.remote.emit('geoip', maptail.buffer)
      })
      maptail.buffer = []
      before = Date.now()
    }
    else {
      if (maptail.buffer.length > maptail.config.bufferMax) maptail.buffer.shift()
    }
  })
}


text: package org.sellcom.core.util.function;


text:
title: React Tooltip component
components: Tooltip
githubLabel: 'component: Tooltip'
materialDesign: https://material.io/components/tooltips
waiAria: 'https://www.w3.org/TR/wai-aria-practices/#tooltip'
---

# Tooltip

Tooltips zeigen informativen Text an, wenn Benutzer auf ein Element zeigen, darauf fokussieren oder tippen.

Wenn aktiviert, zeigen [Tooltips](https://material.io/design/components/tooltips.html) eine Beschriftung an, die ein Element kennzeichnet, beispielsweise eine Beschreibung seiner Funktion.

{{"component": "modules/components/ComponentLinkHeader.js"}}

## Einfache Tooltips

{{"demo": "pages/components/tooltips/BasicTooltip.js"}}

## Positioned tooltips

The `Tooltip` has 12 **placements** choice. They don't have directional arrows; instead, they rely on motion emanating from the source to convey direction.

{{"demo": "pages/components/tooltips/PositionedTooltips.js"}}

## Benutzerdefinierte Tooltips

Hier einige Beispiele zum Anpassen der Komponente. Mehr dazu erfahren Sie auf der [Überschreibungsdokumentationsseite](/customization/how-to-customize/).

{{"demo": "pages/components/tooltips/CustomizedTooltips.js"}}

## Arrow tooltips

You can use the `arrow` prop to give your tooltip an arrow indicating which element it refers to.

{{"demo": "pages/components/tooltips/ArrowTooltips.js"}}

## Benutzerdefiniertes untergeordnetes Element

The tooltip needs to apply DOM event listeners to its child element. The tooltip needs to apply DOM event listeners to its child element.

```jsx
const MyComponent = React.forwardRef(function MyComponent(props, ref) {
  //  Spread the props to the underlying DOM element.
  return <div {...props} ref={ref}>Bin</div>
});

// ...

<Tooltip title="Löschen">
  <MyComponent>
</Tooltip>
```

Sie können ein ähnliches Konzept in der [Verpackungskomponenten](/guides/composition/#wrapping-components) Dokumentation finden.

## Auslöser

Sie können die Ereignistypen definieren, bei denen ein Tooltip angezeigt wird.

{{"demo": "pages/components/tooltips/TriggersTooltips.js"}}

## Controlled tooltips

Sie können die Eigenschaften `onOpen`, `onClose` und `open`, verwenden, um das Verhalten des Tooltips zu steuern.

{{"demo": "pages/components/tooltips/ControlledTooltips.js"}}

## Variable width

Der `Tooltip` umhüllt standardmäßig lange Texte, um diese lesbar zu machen.

{{"demo": "pages/components/tooltips/VariableWidth.js"}}

## Interaktive Liste

Tooltips are interactive by default (to pass [WCAG 2.1 success criterion 1.4.13](https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus)). It won't close when the user hovers over the tooltip before the `leaveDelay` is expired. It won't close when the user hovers over the tooltip before the `leaveDelay` is expired.

{{"demo": "pages/components/tooltips/NonInteractiveTooltips.js"}}

## Disabled elements

Standardmäßig lösen deaktivierte Elemente wie `<button>` keine Benutzerinteraktionen aus, sodass ein `Tooltip` bei normalen Ereignissen wie Hover nicht aktiviert wird. To accommodate disabled elements, add a simple wrapper element, such as a `span`.

> ⚠ In order to work with Safari, you need at least one display block or flex item below the tooltip wrapper.

{{"demo": "pages/components/tooltips/DisabledTooltips.js"}}

> If you're not wrapping a Material-UI component that inherits from `ButtonBase`, for instance, a native `<button>` element, you should also add the CSS property *pointer-events: none;* to your element when disabled:

```jsx
<Tooltip title="You don't have permission to do this">
  <span>
    <button disabled={disabled} style={disabled ? { pointerEvents: 'none' } : {}}>
      A disabled button
    </button>
  </span>
</Tooltip>
```

## Übergänge

Verwenden Sie einen anderen Übergang.

{{"demo": "pages/components/tooltips/TransitionsTooltips.js"}}

## Follow cursor

You can enable the tooltip to follow the cursor by setting `followCursor={true}`.

{{"demo": "pages/components/tooltips/FollowCursorTooltips.js"}}

## Virtual element

In the event you need to implement a custom placement, you can use the `anchorEl` prop: The value of the `anchorEl` prop can be a reference to a fake DOM element. You need to create an object shaped like the [`VirtualElement`](https://popper.js.org/docs/v2/virtual-elements/).

{{"demo": "pages/components/tooltips/AnchorElTooltips.js"}}

## Ein-und ausblenden

Der Tooltip wird normalerweise sofort angezeigt, wenn sich die Maus des Benutzers über dem Element befindet und sofort ausgeblendet wird, wenn die Maus des Benutzers verlassen wird. Eine Verzögerung beim Anzeigen oder Ausblenden des Tooltips kann über die Eigenschaften `enterDelay` und `leaveDelay` hinzugefügt werden, wie in der Demo zum kontrollierten Tooltip oben gezeigt.

On mobile, the tooltip is displayed when the user longpresses the element and hides after a delay of 1500ms. You can disable this feature with the `disableTouchListener` property.

{{"demo": "pages/components/tooltips/DelayTooltips.js"}}

## Barrierefreiheit

(WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#tooltip)

By default, the tooltip only labels its child element. This is notably different from `title` which can either label **or** describe its child depending on whether the child already has a label. For example, in:

```html
<button title="some more information">A button</button>
```

the `title` acts as an accessible description. If you want the tooltip to act as an accessible description you can pass `describeChild`. Note that you shouldn't use `describeChild` if the tooltip provides the only visual label. Otherwise, the child would have no accessible name and the tooltip would violate [success criterion 2.5.3 in WCAG 2.1](https://www.w3.org/WAI/WCAG21/Understanding/label-in-name.html).

{{"demo": "pages/components/tooltips/AccessibilityTooltips.js"}}


text:
var $ = require('jquery');
var _ = require('underscore');

var app   = require( './app'   );
var util  = require( './util'  );

var __ = {};

function ThriftForm(app, struct_name, metadata) {

  var name_parser = /^(?:([a-zA-Z0-9_]+)\.)?([a-zA-Z0-9_]+)$/,
      parsed, module, struct;

  metadata = metadata || {};

  if (typeof(struct_name) !== 'string') {
    throw 'invalid struct name: ' + struct_name;
  }
  var parsed = name_parser.exec(struct_name);
  if (!parsed) {
    throw 'could not parse struct name: ' + struct_name;
  }

  module = parsed[1];
  struct = parsed[2];

  if (!module) {
    throw 'module name must be specified for struct: ' + struct_name;
  }

  module = app.client.schema.modules[module];
  if (!module) {
    throw 'invalid thrift module: ' + struct_name;
  }

  struct = module.structs[struct];
  if (!struct) {
    throw 'invalid thrift struct: ' + struct_name;
  }

  Object.defineProperty(this, "app", {
    'value' : app,
    'enumerable' : true,
  });
  Object.defineProperty(this, "module", {
    'value' : module,
    'enumerable' : true,
  });
  Object.defineProperty(this, "struct", {
    'value' : struct,
    'enumerable' : true,
  });

  var _fieldInfo = null;
  Object.defineProperty(this, "fieldInfo", {
    'get' : function () {
      if (_fieldInfo == null) {
        _fieldInfo = __.build_field_info(this, metadata);
      }
      return _fieldInfo;
    },
    'enumerable' : true,
  });

};

function ThriftFormField(opts) {
  Object.defineProperty(this, 'name', {
    'value' : opts.name,
    'enumerable' : true
  });
  Object.defineProperty(this, 'fieldType', {
    'value' : opts.fieldType,
    'enumerable' : true
  });
  Object.defineProperty(this, 'dataType', {
    'value' : opts.dataType,
    'enumerable' : true
  });
  Object.defineProperty(this, 'constraint', {
    'value' : opts.constraint,
    'enumerable' : true
  });
  Object.defineProperty(this, 'multivalued', {
    'value' : opts.multivalued,
    'enumerable' : true
  });
  Object.defineProperty(this, 'metadata', {
    'value' : opts.metadata,
    'enumerable' : true
  });
};

Object.defineProperty(ThriftFormField.prototype, 'emitField', {
  'value' : function () {
    if (this.metadata.readonly) {
      return __.emit_readonly(this);
    }
    if (this.fieldType == 'text') {
      return __.emit_text_input(this);
    }
    if (this.fieldType == 'textarea') {
      return __.emit_textarea(this);
    }
    if (this.fieldType == 'checkbox') {
      return __.emit_checkbox(this);
    }
    if (this.dataType == 'set<string>') {
      return __.emit_tags(this);
    }
    return __.emit_readonly(this);
  },
  'enumerable' : false
});

__.emit_checkbox = function (field) {
  var result = $('<input type="checkbox" />');
  result.attr("name", field.name);
  result.data('field_info', field);
  return result;
};

__.emit_text_input = function (field) {
  var result = $('<input type="text" />');
  result.attr("name", field.name);
  if (field.constraint == 'decimal') {
    result.attr("type", "number");
    result.attr("min",  "0");
    result.attr("step", ".01");
  } else if (field.constraint == 'integer') {
    result.attr("type", "number");
    result.attr("min",  "0");
    result.attr("step", "1");
  }
  if (field.metadata && field.metadata.required === true) {
    result.attr("required", true);
  }
  result.data('field_info', field);
  return result;
};

__.emit_textarea = function (field) {
  var result = $('<textarea />');
  result.attr("name", field.name);
  result.data('field_info', field);
  return result;
};

__.emit_tags = function (field) {
  var result = $('<input type="text" class="tags">');
  result.attr("name", field.name);
  result.data("field_info", field);
  return result;
};

__.emit_readonly = function (field) {
  return __.emit_text_input(field).attr("disabled", true);
};

__.get_field_type = function get_field_type(name, type_obj, metadata) {
  var module_name = type_obj.moduleName;
  var type_name = type_obj.typeName;
  var result = {
    'name'    : name,
    'fieldType'   : null,
    'dataType'  : null,
    'constraint'  : false,
    'multivalued' : false,
    'metadata'  : metadata,
  };
  if (module_name) { // this means it is a Thrift struct
    result.fieldType = 'form';
    result.dataType  = type_obj;
  } else {
    result.dataType = type_name;
    switch (type_name) {
      case 'double' :
        result.fieldType = 'text';
        result.constraint = 'decimal';
        break;
      case 'i32' :
        result.fieldType = 'text';
        result.constraint = 'integer';
        break;
      case 'string' :
        result.fieldType = 'text';
        break;
      case 'bool' :
        result.fieldType = 'checkbox';
        break;
      default:
        console.log("unhandled type: " + type_name);
    }
  }
  return new ThriftFormField(result);
};

__.build_field = function build_field(form, metadata, name, index) {
  var field_type = form.struct.fields[name].type;
  var _metadata = metadata[name] || {};
  var _field = util.extend({
    'name'   : name,
    'type'   : __.get_field_type(name, field_type, _metadata),
    'meta'   : _metadata,
    'index'  : index,
    'module' : form.module.name,
    'struct' : form.struct.name,
  }, metadata[name] || {});
  return _field;
};

__.build_field_info = function build_field_info(form, metadata) {
  var _cols = {}, _meta = metadata, _i = 0;
  for (var _name in form.struct.fields) {
    _cols[_name] = __.build_field(form, metadata, _name, _i++);
  }
  return _cols;
};

module.exports = {
  ThriftForm : ThriftForm
};


text:
package com.adaptris.core.services.splitter;

import static org.apache.commons.lang3.StringUtils.isEmpty;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import com.adaptris.annotation.AdvancedConfig;
import com.adaptris.annotation.DisplayOrder;
import com.adaptris.core.AdaptrisMessage;
import com.adaptris.core.CoreException;
import com.adaptris.core.util.Args;
import com.adaptris.interlok.util.CloseableIterable;
import com.thoughtworks.xstream.annotations.XStreamAlias;

/**
 * Implementation of {@link MessageSplitter} which creates multiple instances of the same document based on a metadata key.
 *
 * <p>
 * The split messages will always contain the entire document, the metadata key containing the number of documents to generate.
 * </p>
 *
 * @config metadata-document-copier
 */
@XStreamAlias("metadata-document-copier")
@DisplayOrder(order = {"metadataKey", "copyMetadata", "copyObjectMetadata", "indexMetadataKey"})
public class MetadataDocumentCopier extends MessageCopier {

  @NotNull
  @NotBlank
  private String metadataKey = null;
  @AdvancedConfig
  private String indexMetadataKey;

  public MetadataDocumentCopier() {
  }

  public MetadataDocumentCopier(String key) {
    this(key, null);
  }

  public MetadataDocumentCopier(String key, String indexKey) {
    this();
    setMetadataKey(key);
    setIndexMetadataKey(indexKey);
  }

  @Override
  public CloseableIterable<AdaptrisMessage> splitMessage(AdaptrisMessage msg) throws CoreException {
    int size = toInteger(msg.getMetadataValue(getMetadataKey()));
    return new MessageCopierIterator(msg, size, (m, count) -> {
      if (!isEmpty(getIndexMetadataKey())) {
        m.addMetadata(getIndexMetadataKey(), String.valueOf(count));
      }
      return m;
    });
  }

  /**
   * Set the metadata key to use to for generating msgs.
   *
   * @param key the metadata key
   */
  public void setMetadataKey(String key) {
    metadataKey = Args.notEmpty(key, "metadata key");
  }

  public String getMetadataKey() {
    return metadataKey;
  }

  public String getIndexMetadataKey() {
    return indexMetadataKey;
  }

  /**
   * The metadata key storing the current index of the message from {@link #setMetadataKey(String)}
   * will be stored (zero based index).
   *
   * @param s the index metadata key to set
   */
  public void setIndexMetadataKey(String s) {
    indexMetadataKey = s;
  }
}


text:
<!doctype html>

    <meta charset="UTF-8">
    <title>Now Playing</title>
    <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css'>
    <link href="http://diegoddox.github.io/react-redux-toastr/4.4/react-redux-toastr.min.css" rel="stylesheet" type="text/css">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=yes">


text:
using Microsoft.Extensions.DependencyInjection;
using Orchard.Environment.Commands;
using System.IO;
using Xunit;

namespace Orchard.Tests.Commands
{
    public class CommandManagerTests
    {
        private ICommandManager _manager;

        public CommandManagerTests()
        {
            var services = new ServiceCollection();

            services.AddScoped<ICommandManager, DefaultCommandManager>();
            services.AddScoped<ICommandHandler, MyCommand>();

            _manager = services.BuildServiceProvider().GetService<ICommandManager>();
        }

        [Fact]
        public void ManagerCanRunACommand()
        {
            var context = new CommandParameters { Arguments = new string[] { "FooBar" }, Output = new StringWriter() };
            _manager.Execute(context);
            Assert.Equal("success!", context.Output.ToString());
        }

        [Fact]
        public void ManagerCanRunACompositeCommand()
        {
            var context = new CommandParameters { Arguments = ("Foo Bar Bleah").Split(' '), Output = new StringWriter() };
            _manager.Execute(context);
            Assert.Equal("Bleah", context.Output.ToString());
        }

        public class MyCommand : DefaultOrchardCommandHandler
        {
            public string FooBar()
            {
                return "success!";
            }

            public string Foo_Bar(string bleah)
            {
                return bleah;
            }
        }
    }
}


text:
"""Tests for interaction_operator.py."""
import unittest

import itertools

import numpy

from openfermion.ops.representations import InteractionOperator
from openfermion.ops.representations import get_active_space_integrals

class ActiveSpaceIntegralsTest(unittest.TestCase):

    def test_raises_error(self):
        with self.assertRaises(ValueError):
            _ = get_active_space_integrals(None, None, [], [])

class InteractionOperatorTest(unittest.TestCase):

    def setUp(self):
        self.n_qubits = 5
        self.constant = 0.
        self.one_body = numpy.zeros((self.n_qubits, self.n_qubits), float)
        self.two_body = numpy.zeros(
            (self.n_qubits, self.n_qubits, self.n_qubits, self.n_qubits), float)
        self.interaction_operator = InteractionOperator(self.constant,
                                                        self.one_body,
                                                        self.two_body)

    def test_four_point_iter(self):
        constant = 100.0
        one_body = numpy.zeros((self.n_qubits, self.n_qubits), float)
        two_body = numpy.zeros(
            (self.n_qubits, self.n_qubits, self.n_qubits, self.n_qubits), float)
        one_body[1, 1] = 10.0
        one_body[2, 3] = 11.0
        one_body[3, 2] = 11.0
        two_body[1, 2, 3, 4] = 12.0
        two_body[2, 1, 4, 3] = 12.0
        two_body[3, 4, 1, 2] = 12.0
        two_body[4, 3, 2, 1] = 12.0
        interaction_operator = InteractionOperator(constant, one_body, two_body)

        want_str = '100.0\n10.0\n11.0\n12.0\n'
        got_str = ''
        for key in interaction_operator.unique_iter(complex_valued=True):
            got_str += '{}\n'.format(interaction_operator[key])
        self.assertEqual(want_str, got_str)

    def test_eight_point_iter(self):
        constant = 100.0
        one_body = numpy.zeros((self.n_qubits, self.n_qubits), float)
        two_body = numpy.zeros(
            (self.n_qubits, self.n_qubits, self.n_qubits, self.n_qubits), float)
        one_body[1, 1] = 10.0
        one_body[2, 3] = 11.0
        one_body[3, 2] = 11.0
        two_body[1, 2, 3, 4] = 12.0
        two_body[2, 1, 4, 3] = 12.0
        two_body[3, 4, 1, 2] = 12.0
        two_body[4, 3, 2, 1] = 12.0
        two_body[1, 4, 3, 2] = 12.0
        two_body[2, 3, 4, 1] = 12.0
        two_body[3, 2, 1, 4] = 12.0
        two_body[4, 1, 2, 3] = 12.0
        interaction_operator = InteractionOperator(constant, one_body, two_body)

        want_str = '100.0\n10.0\n11.0\n12.0\n'
        got_str = ''
        for key in interaction_operator.unique_iter():
            got_str += '{}\n'.format(interaction_operator[key])
        self.assertEqual(want_str, got_str)

    def test_addition(self):
        interaction_op = InteractionOperator(0, numpy.ones((3, 3)),
                                             numpy.ones((3, 3, 3, 3)))
        summed_op = interaction_op + interaction_op
        self.assertTrue(
            numpy.array_equal(summed_op.one_body_tensor,
                              summed_op.n_body_tensors[(1, 0)]))
        self.assertTrue(
            numpy.array_equal(summed_op.two_body_tensor,
                              summed_op.n_body_tensors[(1, 1, 0, 0)]))

    def test_neg(self):
        interaction_op = InteractionOperator(0, numpy.ones((3, 3)),
                                             numpy.ones((3, 3, 3, 3)))
        neg_interaction_op = -interaction_op
        assert isinstance(neg_interaction_op, InteractionOperator)
        assert neg_interaction_op == InteractionOperator(
            0, -numpy.ones((3, 3)), -numpy.ones((3, 3, 3, 3)))

    def test_zero(self):
        interaction_op = InteractionOperator(0, numpy.ones((3, 3)),
                                             numpy.ones((3, 3, 3, 3)))
        assert InteractionOperator.zero(
            interaction_op.n_qubits) == interaction_op * 0

    def test_projected(self):
        interaction_op = InteractionOperator(1, numpy.ones((3, 3)),
                                             numpy.ones((3, 3, 3, 3)))
        projected_two_body_tensor = numpy.zeros_like(
            interaction_op.two_body_tensor)
        for i in range(3):
            projected_two_body_tensor[(i,) * 4] = 1
        projected_op = InteractionOperator(0, numpy.eye(3),
                                           projected_two_body_tensor)
        assert projected_op == interaction_op.projected(1, exact=True)
        projected_op.constant = 1
        assert projected_op == interaction_op.projected(1, exact=False)

        projected_op.one_body_tensor = numpy.zeros_like(
            interaction_op.one_body_tensor)
        for pq in itertools.product(range(2), repeat=2):
            projected_op.one_body_tensor[pq] = 1
        projected_op.two_body_tensor = numpy.zeros_like(
            interaction_op.two_body_tensor)
        for pqrs in itertools.product(range(2), repeat=4):
            projected_op.two_body_tensor[pqrs] = 1
        assert projected_op == interaction_op.projected((0, 1), exact=False)

        projected_op.constant = 0
        projected_op.one_body_tensor = numpy.zeros_like(
            interaction_op.one_body_tensor)
        projected_op.one_body_tensor[0, 1] = 1
        projected_op.one_body_tensor[1, 0] = 1
        projected_op.two_body_tensor = numpy.zeros_like(
            interaction_op.two_body_tensor)
        for pqrs in itertools.product(range(2), repeat=4):
            if len(set(pqrs)) > 1:
                projected_op.two_body_tensor[pqrs] = 1
        assert projected_op == interaction_op.projected((0, 1), exact=True)


text:
//  @flow

/**
 * @description An MVC-component's builder module.
 * @module core/component/request/schema
 * @license MIT
 * @author Aleksandr Yackovlev <aleksandryackovlev@yandex.ru>
 */

import type { SchemaInterface } from './schema.i';

/**
 * @description Interface for classes that represent an http-request schema.
 *
 * @interface
 */
export interface SchemaBuilderInterface {
    /**
     * @description Recursively builds a schema.
     * @returns {SchemaBuilderInterface} - Own instance for chaining.
     * @access public
     */
    build(): SchemaBuilderInterface;

    /**
     * @description Gets a builded schema.
     * @returns {SchemaInterface} - A builded schema.
     * @access public
     */
    getSchema(): SchemaInterface;
}

/**
 * @description Interface that represents an http-request schema's factory.
 *
 * @interface
 */
export type SchemaBuilderFactoryInterface = {
    /**
     * @description Recursively builds a schema.
     * @returns {SchemaInterface} - A builded schema.
     * @access public
     */
    createSchema(schema: {
        [key: string]: any,
    }): SchemaInterface;
}


text:
angular.module("template/modal/window.html", []).run(["$templateCache", function($templateCache) {
  $templateCache.put("template/modal/window.html",
    "
\n" +
    "

\n" +
    "
");
}]);


text:
package com.navercorp.pinpoint.profiler.instrument.classreading;

import com.navercorp.pinpoint.common.util.ClassLoaderUtils;
import com.navercorp.pinpoint.profiler.util.BytecodeUtils;
import com.navercorp.pinpoint.profiler.util.JavaAssistUtils;
import org.junit.Test;

import javax.annotation.Resource;
import java.io.ByteArrayInputStream;
import java.lang.annotation.Target;

import static org.junit.Assert.*;

/**
 * @author jaehong.kim
 */
public class ClassReaderWrapperTest {

    @Test
    public void base() throws Exception {
        final Class<?> clazz = String.class;
        final byte[] classBinary = BytecodeUtils.getClassFile(ClassLoaderUtils.getDefaultClassLoader(), clazz.getName());

        assertClassReader(new ClassReaderWrapper(classBinary));
        assertClassReader(new ClassReaderWrapper(ClassLoaderUtils.getDefaultClassLoader(), JavaAssistUtils.javaNameToJvmName(clazz.getName())));
    }

    @Test
    public void annotation() throws Exception {
        ClassReaderWrapper classReader = new ClassReaderWrapper(ClassLoaderUtils.getDefaultClassLoader(), JavaAssistUtils.javaNameToJvmName(AnnotationMock.class.getName()));
        classReader.getAnnotationInternalNames().contains("java/lang/Deprecated");
        classReader.getAnnotationInternalNames().contains("javax/annotation/Resource");
    }

    private void assertClassReader(ClassReaderWrapper classReader) {
        assertEquals("java/lang/String", classReader.getClassInternalName());
        assertEquals("java/lang/Object", classReader.getSuperClassInternalName());
        System.out.println(classReader.getInterfaceInternalNames());
        assertTrue(classReader.getInterfaceInternalNames().contains("java/lang/Comparable"));
        assertTrue(classReader.getInterfaceInternalNames().contains("java/io/Serializable"));
        classReader.getVersion();
        classReader.getAccess();
        assertNotNull(classReader.getClassBinary());
    }

    @Deprecated
    @Resource
    class AnnotationMock {
    }
}


text:
<?php

\Autoloader::add_core_namespace('Zipcode2address');

\Autoloader::add_classes(array(
	'Model_Zipcodedata' => APPPATH.'modules/zipcode2address/classes/model/zipcodedata.php',
));


text:
package fr.vergne.taskmanager.history;

public abstract class AbstractHistorizable<T> implements Historizable<T> {

	private final boolean isNullForbiden;

	public AbstractHistorizable(T initialValue, boolean forbidNull) {
		this(forbidNull);
		set(initialValue);
	}

	public AbstractHistorizable(T initialValue) {
		this(initialValue, false);
	}

	public AbstractHistorizable(boolean forbidNull) {
		isNullForbiden = forbidNull;
	}

	public AbstractHistorizable() {
		this(false);
	}

	public T get() {
		return history.getYoungestValue();
	}

	public void set(T value) {
		if (isNullForbiden && value == null) {
			throw new NullPointerException("Null values are forbidden.");
		} else {
			history.push(value);
		}
	}

	private final History<T> history = new History<T>() {
		@Override
		public String dataToString(T data) {
			return formatDataInString(data);
		};

		@Override
		public T stringToData(String string) {
			return formatStringInData(string);
		}
	};

	public abstract String formatDataInString(T data);

	public abstract T formatStringInData(String string);

	@Override
	public History<T> getHistory() {
		return history;
	}

	@Override
	public String toString() {
		return history.getYoungestValue().toString();
	}

	public boolean isNullForbiden() {
		return isNullForbiden;
	}
}


text:
/**
 * @fileoverview
 * @enhanceable
 * @public
 */
// GENERATED CODE -- DO NOT EDIT!

goog.provide('proto.google.protobuf.Timestamp');

goog.require('jspb.Message');

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 */
proto.google.protobuf.Timestamp = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.google.protobuf.Timestamp, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  proto.google.protobuf.Timestamp.displayName = 'proto.google.protobuf.Timestamp';
}

// Remainder elided


text:
module StackMaster
  module Commands
    class Validate
      include Command
      include Commander::UI

      def initialize(config, stack_definition, options = {})
        @config = config
        @stack_definition = stack_definition
      end

      def perform
        failed unless Validator.valid?(@stack_definition, @config)
      end
    end
  end
end


text:
package com.neocoretechs.relatrix;

import com.neocoretechs.relatrix.key.KeySet;

/**
* This class represents the morphisms stored in map,domain,range (codomain) order.
* The concept behind these permutations are to allow the Relatrix to go from Cat to Set.
* By storing these indexes with all their possible retrieval combinations for the morphisms,
* which turns out to be 6 indexes, we facilitate the retrieval of posets from our categories
* based on any number of possible operators and objects passed to the various 'findSet' permutations.
* @author Jonathan Groff (C) NeoCoreTechs 2014,2015,2021
*/
public class MapDomainRangeTransaction extends MorphismTransaction {
	private static final long serialVersionUID = -3223516008906545636L;
    public MapDomainRangeTransaction() {}

    public MapDomainRangeTransaction(String xid, Comparable d, Comparable m, Comparable r) {
       	super(xid,d,m,r);
    }
	public MapDomainRangeTransaction(String xid, Comparable<?> d, Comparable<?> m, Comparable<?> r, KeySet keys) {
		super(xid,d,m,r,keys);
	}
	public MapDomainRangeTransaction(String xid, Comparable<?> d, Comparable<?> m, Comparable<?> r, boolean template) {
		super(xid,d,m,r,template);
	}
	@SuppressWarnings("unchecked")
	@Override
	public int compareTo(Object dmrpk) {
		if(!this.getClass().equals(dmrpk.getClass()) && !dmrpk.getClass().isAssignableFrom(this.getClass()))
			return Morphism.partialCompareTo(this, (Comparable) dmrpk);
		MapDomainRangeTransaction dmr = (MapDomainRangeTransaction)dmrpk;
		int cmp = 0;
		if( dmr.getMap() == null )
			return 1;
		//cmp = map.compareTo(dmr.map);
		cmp = Morphism.fullCompareTo(getMap(), dmr.getMap());
		if( cmp != 0 ) return cmp;
		if( dmr.getDomain() == null )
			return 1;
		//cmp = domain.compareTo(dmr.domain);
		cmp = Morphism.fullCompareTo(getDomain(), dmr.getDomain());
		if( cmp != 0 ) return cmp;
		if( dmr.getRange() == null )
			return 1;
		//return range.compareTo(dmr.range);
		return Morphism.fullCompareTo(getRange(), dmr.getRange());

	}

	@Override
	public boolean equals(Object dmrpk) {
		if(!this.getClass().equals(dmrpk.getClass()) && !dmrpk.getClass().isAssignableFrom(this.getClass()))
			return Morphism.partialEquals(this, (Comparable) dmrpk);
		MapDomainRangeTransaction dmr = (MapDomainRangeTransaction)dmrpk;
		boolean cmp = false;
		if( dmr.getMap() == null )
			return false;
		//cmp = map.equals(dmr.map);
		cmp = Morphism.fullEquals(getMap(), dmr.getMap());
		if( !cmp ) return cmp;
		if( dmr.getDomain() == null )
			return false;
		//cmp = domain.equals(dmr.domain);
		cmp = Morphism.fullEquals(getDomain(), dmr.getDomain());
		if( !cmp ) return cmp;
		if( dmr.getRange() == null )
			return false;
		//return range.equals(dmr.range);
		return Morphism.fullEquals(getRange(), dmr.getRange());
	}

	@Override
	public int hashCode() {
		int result = 17;
		result = 37*result + (getDomain() == null ? 0 : getDomain().hashCode());
		result = 37*result + (getMap() == null ? 0 : getMap().hashCode());
		result = 37*result + (getRange() == null ? 0 : getRange().hashCode());
		return result;
	}

    /*
    public Comparable returnTupleOrder(int n) {
    	// default dmr
    	switch(n) {
    		case 1:
    			return map;
    		case 2:
    			return domain;
    		case 3:
    			return range;
    		default:
    			break;
    	}
    	throw new RuntimeException("returnTupleOrder invalid tuple "+n);
    }
    */
    @Override
    public Object clone() throws CloneNotSupportedException {
    	return new MapDomainRangeTransaction(transactionId, getDomain(), getMap(), getRange(), getKeys());
    }
}


text:
//
//  ORIGINAL_AUTHOR: Kim Hazelwood
//
//  This tool flushes the code cache after every five
//      threads are created. (Run it with threadWait.c)
//  Sample usage:
//    pin -mt -t mtFlush -- threadWait

#include <stdio.h>
#include "pin.H"

FILE * out;
PIN_LOCK lock;
int numThreads;
int numFlushesTriggered;
int numFlushesOccurred;

void InitializeMe()
{
    out = fopen("mtFlush.out", "w");
    numThreads = 1;
    numFlushesTriggered = 0;
    numFlushesOccurred = 0;
}

VOID ThreadBegin(UINT32 threadid, VOID * sp, int flags, VOID *v)
{
    GetLock(&lock, threadid+1);
    fprintf(out, "thread begin %d\n",threadid);
    numThreads++;
    if (threadid % 5 == 0)
    {
        numFlushesTriggered++;
        fprintf(out, "DUNK! (%d)\n",numFlushesTriggered);
        CODECACHE_FlushCache();
    }
    fflush(out);
    ReleaseLock(&lock);
}

VOID ThreadEnd(UINT32 threadid, INT32 code, VOID *v)
{
    GetLock(&lock, threadid+1);
    fprintf(out, "thread end %d code %d\n",threadid, code);
    fflush(out);
    ReleaseLock(&lock);
}

VOID FlushHappened()
{
    numFlushesOccurred++;
    fprintf(out, "SWOOSH! (%d)\n",numFlushesOccurred);
}

VOID Fini(INT32 code, VOID *v)
{
    fprintf(out, "Fini: code %d\n", code);
    fclose(out);
}

int main(INT32 argc, CHAR **argv)
{
    InitLock(&lock);

    InitializeMe();

    PIN_Init(argc, argv);

    PIN_AddThreadBeginFunction(ThreadBegin, 0);
    PIN_AddThreadEndFunction(ThreadEnd, 0);
    CODECACHE_AddCacheFlushedFunction(FlushHappened, 0);
    PIN_AddFiniFunction(Fini, 0);

    // Never returns
    PIN_StartProgram();

    return 0;
}


text:
<?php

namespace ThemeManager;

use PHPUnit_Framework_TestCase;

class ThemeCollectionTest extends PHPUnit_Framework_TestCase
{

    /**
     * @var ThemeCollection
     */
    protected $collection;

    /**
     * @var Theme
     */
    protected $theme;

    /**
     * @var array
     */
    protected $themeArray;

    public function setUp()
    {
        $this->theme = new Theme( themes_base_path() . '/demo' );
        $this->themeArray = [ $this->theme ];

        $this->collection = new ThemeCollection( $this->themeArray );
    }

    /**
     * @test
     * @group collection
     */
    public function testConstruct()
    {
        $this->assertTrue( $this->collection->first() instanceof Theme );
        $this->assertFalse( $this->collection->themeExists( 'demo' ) );
    }

    /**
     * @test
     * @group collection
     */
    public function testGetTheme()
    {
        $this->assertEquals( $this->theme, $this->collection->getTheme( 'demo-theme-yml' ) );
        $this->assertFalse( $this->collection->getTheme( 'demo' ) );
    }

    /**
     * @test
     * @group collection
     */
    public function testThemeExists()
    {
        $this->assertTrue( $this->collection->themeExists( 'demo-theme-yml' ) );
        $this->assertFalse( $this->collection->themeExists( 'demo' ) );
    }

    /**
     * @test
     * @group collection
     */
    public function testAllThemNames()
    {
        $allThemeNames = $this->collection->allThemeNames();
        $this->assertTrue( is_array( $allThemeNames ) && !empty( $allThemeNames ) );

        $this->assertEquals( 'demo-theme-yml', array_shift( $allThemeNames ) );
    }
}


text:
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="4dp"
    android:layout_marginRight="4dp"
    android:layout_marginTop="4dp"
    android:layout_marginBottom="4dp"
    android:clickable="true"
    android:focusable="true"
    app:cardElevation="2dp"
    app:cardPreventCornerOverlap="false"
    app:cardCornerRadius="2dp"
    app:cardUseCompatPadding="true"
    android:stateListAnimator="@anim/card_selector"
    android:foreground="?selectableItemBackground">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <!--suppress AndroidLintContentDescription -->
        <com.example.xyzreader.ui.DynamicHeightNetworkImageView
            android:id="@+id/thumbnail"
            android:layout_width="match_parent"
            android:layout_height="90dp"
            android:background="@color/photo_placeholder"
            android:layout_gravity="center" />

        <TextView
            android:id="@+id/article_title"
            style="@style/TextAppearance.AppCompat.Subhead"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="16dp"
            android:paddingTop="8dp"
            android:paddingRight="16dp"
            android:paddingBottom="4dp"
            android:ellipsize="end"
            android:maxLines="4"/>

        <TextView
            android:id="@+id/article_date"
            style="@style/TextAppearance.AppCompat.Body1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="16dp"
            android:textColor="@color/text_secondary"
            android:maxLines="2"
            android:ellipsize="end"
            android:paddingRight="16dp" />

        <TextView
            android:id="@+id/article_author"
            style="@style/TextAppearance.AppCompat.Body1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="16dp"
            android:paddingBottom="8dp"
            android:textColor="@color/text_secondary"
            android:maxLines="2"
            android:ellipsize="end"
            android:paddingRight="16dp" />
    </LinearLayout>

</android.support.v7.widget.CardView>


text:
Aria.tplScriptDefinition({
    $classpath : 'aria.tester.runner.view.links.LinksScript',
    $prototype : {
        getTopspotLinks : function () {
            return ([{
                        href : "http://topspot/index.php/Aria_Templates_Testing_Documentation",
                        title : "Topspot : Testing Documentation"
                    }, {
                        href : "http://topspot/index.php/Category:Aria_Templates_Testing",
                        title : "Topspot : Testing Category"
                    }, {
                        href : "http://topspot/index.php/Aria_Templates_Testing_Documentation_:_Assert",
                        title : "Topspot : List of Assert Methods"
                    }, {
                        href : "http://topspot/index.php/Aria_Templates_Testing_Documentation_:_First_Steps_Tutorial",
                        title : "Topspot : First Tutorial"
                    }, {
                        href : "http://topspot/index.php/Aria_Templates_Testing_Documentation_:_Test_Runner",
                        title : "Topspot : Tester User Guide"
                    }]);
        },
        getKeyboardShortcuts : function () {
            var shortcuts = [{
                        key : "F",
                        description : "fullscreen on/<b>off</b>",
                        callback : this.switchView
                    }, {
                        key : "R",
                        description : "Run/Reload the test",
                        callback : this.runTest
                    }, {
                        key : "E",
                        description : "Display End test report",
                        callback : this.navigateToReport
                    }];
            return shortcuts;
        },
        switchView : function () {
            this.moduleCtrl.switchView();
        },
        navigateToOptions : function () {
            this.flowCtrl.navigate(this.flowCtrl.STATES.OPTIONS);
        },
        navigateToReport : function () {
            this.flowCtrl.navigate(this.flowCtrl.STATES.REPORT);
        }
    }
});


text:
//
//  CEBaseAnimationController.h
//  ViewControllerTransitions
//
//  Created by Colin Eberhardt on 09/09/2013.
//  Copyright (c) 2013 Colin Eberhardt. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

/**
 A base class for animation controllers which provide reversible animations. A reversible animation is often used with navigation controllers where the reverse property is set based on whether this is a push or pop operation, or for modal view controllers where the reverse property is set based o whether this is a show / dismiss.
 */
@interface CEReversibleAnimationController : NSObject <UIViewControllerAnimatedTransitioning>

/**
 The direction of the animation.
 */
@property (nonatomic, assign) BOOL reverse;

/**
 The animation duration.
 */
@property (nonatomic, assign) NSTimeInterval duration;

- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext fromVC:(UIViewController *)fromVC toVC:(UIViewController *)toVC fromView:(UIView *)fromView toView:(UIView *)toView;

@end


text:
"""The Huisbaasje integration."""
from datetime import timedelta
import logging

import async_timeout
from huisbaasje import Huisbaasje, HuisbaasjeException

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed

from .const import (
    DATA_COORDINATOR,
    DOMAIN,
    FETCH_TIMEOUT,
    POLLING_INTERVAL,
    SENSOR_TYPE_RATE,
    SENSOR_TYPE_THIS_DAY,
    SENSOR_TYPE_THIS_MONTH,
    SENSOR_TYPE_THIS_WEEK,
    SENSOR_TYPE_THIS_YEAR,
    SOURCE_TYPES,
)

_LOGGER = logging.getLogger(__name__)

async def async_setup(hass: HomeAssistant, config: dict):
    """Set up the Huisbaasje component."""
    return True

async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry):
    """Set up Huisbaasje from a config entry."""
    # Create the Huisbaasje client
    huisbaasje = Huisbaasje(
        username=config_entry.data[CONF_USERNAME],
        password=config_entry.data[CONF_PASSWORD],
        source_types=SOURCE_TYPES,
        request_timeout=FETCH_TIMEOUT,
    )

    # Attempt authentication. If this fails, an exception is thrown
    try:
        await huisbaasje.authenticate()
    except HuisbaasjeException as exception:
        _LOGGER.error("Authentication failed: %s", str(exception))
        return False

    async def async_update_data():
        return await async_update_huisbaasje(huisbaasje)

    # Create a coordinator for polling updates
    coordinator = DataUpdateCoordinator(
        hass,
        _LOGGER,
        name="sensor",
        update_method=async_update_data,
        update_interval=timedelta(seconds=POLLING_INTERVAL),
    )

    await coordinator.async_refresh()

    if not coordinator.last_update_success:
        raise ConfigEntryNotReady

    # Load the client in the data of home assistant
    hass.data.setdefault(DOMAIN, {})[config_entry.entry_id] = {
        DATA_COORDINATOR: coordinator
    }

    # Offload the loading of entities to the platform
    hass.async_create_task(
        hass.config_entries.async_forward_entry_setup(config_entry, "sensor")
    )

    return True

async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry):
    """Unload a config entry."""
    # Forward the unloading of the entry to the platform
    unload_ok = await hass.config_entries.async_forward_entry_unload(
        config_entry, "sensor"
    )

    # If successful, unload the Huisbaasje client
    if unload_ok:
        hass.data[DOMAIN].pop(config_entry.entry_id)

    return unload_ok

async def async_update_huisbaasje(huisbaasje):
    """Update the data by performing a request to Huisbaasje."""
    try:
        # Note: asyncio.TimeoutError and aiohttp.ClientError are already
        # handled by the data update coordinator.
        async with async_timeout.timeout(FETCH_TIMEOUT):
            if not huisbaasje.is_authenticated():
                _LOGGER.warning("Huisbaasje is unauthenticated. Reauthenticating...")
                await huisbaasje.authenticate()

            current_measurements = await huisbaasje.current_measurements()

            return {
                source_type: {
                    SENSOR_TYPE_RATE: _get_measurement_rate(
                        current_measurements, source_type
                    ),
                    SENSOR_TYPE_THIS_DAY: _get_cumulative_value(
                        current_measurements, source_type, SENSOR_TYPE_THIS_DAY
                    ),
                    SENSOR_TYPE_THIS_WEEK: _get_cumulative_value(
                        current_measurements, source_type, SENSOR_TYPE_THIS_WEEK
                    ),
                    SENSOR_TYPE_THIS_MONTH: _get_cumulative_value(
                        current_measurements, source_type, SENSOR_TYPE_THIS_MONTH
                    ),
                    SENSOR_TYPE_THIS_YEAR: _get_cumulative_value(
                        current_measurements, source_type, SENSOR_TYPE_THIS_YEAR
                    ),
                }
                for source_type in SOURCE_TYPES
            }
    except HuisbaasjeException as exception:
        raise UpdateFailed(f"Error communicating with API: {exception}") from exception

def _get_cumulative_value(
    current_measurements: dict,
    source_type: str,
    period_type: str,
):
    """
    Get the cumulative energy consumption for a certain period.

    :param current_measurements: The result from the Huisbaasje client
    :param source_type: The source of energy (electricity or gas)
    :param period_type: The period for which cumulative value should be given.
    """
    if source_type in current_measurements.keys():
        if (
            period_type in current_measurements[source_type]
            and current_measurements[source_type][period_type] is not None
        ):
            return current_measurements[source_type][period_type]["value"]
    else:
        _LOGGER.error(
            "Source type %s not present in %s", source_type, current_measurements
        )
    return None

def _get_measurement_rate(current_measurements: dict, source_type: str):
    if source_type in current_measurements:
        if (
            "measurement" in current_measurements[source_type]
            and current_measurements[source_type]["measurement"] is not None
        ):
            return current_measurements[source_type]["measurement"]["rate"]
    else:
        _LOGGER.error(
            "Source type %s not present in %s", source_type, current_measurements
        )
    return None


text:
OSX_VERS=$(sw_vers -productVersion | awk -F "." '{print $2}')

Get Xcode CLI tools
https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/index-3905972D-B609-49CE-8D06-51ADC78E07BC.dvtdownloadableindex
TOOLS=clitools.dmg
if [ ! -f "$TOOLS" ]; then
if [ "$OSX_VERS" -eq 6 ]; then
elif [ "$OSX_VERS" -eq 7 ]; then
DMGURL=http://devimages.apple.com/downloads/xcode/command_line_tools_for_xcode_os_x_lion_april_2013.dmg
elif [ "$OSX_VERS" -eq 8 ]; then
DMGURL=http://devimages.apple.com/downloads/xcode/command_line_tools_for_xcode_os_x_mountain_lion_april_2013.dmg
elif [ "$OSX_VERS" -eq 9 ]; then
elif [ "$OSX_VERS" -eq 10 ]; then
DMGURL=http://adcdownload.apple.com/Developer_Tools/command_line_tools_os_x_mavericks_for_xcode__late_october_2013/command_line_tools_os_x_mavericks_for_xcode__late_october_2013.dmg
fi
curl "$DMGURL" -o "$TOOLS"
fi
TMPMOUNT=`/usr/bin/mktemp -d /tmp/clitools.XXXX`
hdiutil attach "$TOOLS" -mountpoint "$TMPMOUNT"
installer -pkg "$(find $TMPMOUNT -name '*.mpkg')" -target /
hdiutil detach "$TMPMOUNT"
rm -rf "$TMPMOUNT"
rm "$TOOLS"
exit

## test 10.9 clt

## https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_os_x_10.9_for_xcode__xcode_6.1.1/commandlinetoolsosx10.9forxcode6.1.1.dmg

## TEST 10.6

## http://adcdownload.apple.com/Developer_Tools/command_line_tools_for_xcode_4.4__late_march_2012/cltools_lion_latemarch12.dmg


text:
using System;

namespace CCExtractorTester
{
	/// <summary>
	/// ILogger, the interface for Logging classes.
	/// </summary>
	public interface ILogger
	{
		/// <summary>
		/// Logs a specific message on the Info level.
		/// </summary>
		/// <param name="message">A message to log.</param>
		void Info(string message);
		/// <summary>
		/// Logs a specific message on the Warn level.
		/// </summary>
		/// <param name="message">A message to log.</param>
		void Warn(string message);
		/// <summary>
		/// Logs a specific message on the Error level.
		/// </summary>
		/// <param name="message">A message to log.</param>
		void Error(string message);
		/// <summary>
		/// Logs a specific exception on the Error level.
		/// </summary>
		/// <param name="e">The exception to log</param>
		void Error(Exception e);
		/// <summary>
		/// Logs a specific message on the Debug level.
		/// </summary>
		/// <param name="message">A message to log.</param>
		void Debug(string message);
		/// <summary>
		/// Activates the debug mode. If it's not activated, no debug messages will be logged.
		/// </summary>
		void ActivateDebug();
	}
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.sql.planner.iterative.rule;

import com.facebook.presto.matching.Captures;
import com.facebook.presto.matching.Pattern;
import com.facebook.presto.spi.plan.AggregationNode;
import com.facebook.presto.spi.plan.AggregationNode.Aggregation;
import com.facebook.presto.spi.relation.RowExpression;
import com.facebook.presto.spi.relation.VariableReferenceExpression;
import com.facebook.presto.sql.planner.iterative.Rule;
import com.facebook.presto.sql.relational.OriginalExpressionUtils;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;

import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static com.facebook.presto.spi.plan.AggregationNode.Aggregation.removeDistinct;
import static com.facebook.presto.spi.plan.AggregationNode.Step.SINGLE;
import static com.facebook.presto.spi.plan.AggregationNode.singleGroupingSet;
import static com.facebook.presto.sql.planner.plan.Patterns.aggregation;
import static java.util.Collections.emptyList;

/**
 * Implements distinct aggregations with similar inputs by transforming plans of the following shape:
 *

 * - Aggregation
 *        GROUP BY (k)
 *        F1(DISTINCT s0, s1, ...),
 *        F2(DISTINCT s0, s1, ...),
 *     - X
 *

 * into
 *

 * - Aggregation
 *          GROUP BY (k)
 *          F1(x)
 *          F2(x)
 *      - Aggregation
 *             GROUP BY (k, s0, s1, ...)
 *          - X
 *

 *

 * Assumes s0, s1, ... are symbol references (i.e., complex expressions have been pre-projected)
 */
public class SingleDistinctAggregationToGroupBy
        implements Rule<AggregationNode>
{
    private static final Pattern<AggregationNode> PATTERN = aggregation()
            .matching(SingleDistinctAggregationToGroupBy::hasSingleDistinctInput)
            .matching(SingleDistinctAggregationToGroupBy::allDistinctAggregates)
            .matching(SingleDistinctAggregationToGroupBy::noFilters)
            .matching(SingleDistinctAggregationToGroupBy::noMasks);

    private static boolean hasSingleDistinctInput(AggregationNode aggregation)
    {
        return extractArgumentSets(aggregation)
                .count() == 1;
    }

    private static boolean allDistinctAggregates(AggregationNode aggregation)
    {
        return aggregation.getAggregations()
                .values().stream()
                .allMatch(Aggregation::isDistinct);
    }

    private static boolean noFilters(AggregationNode aggregation)
    {
        return aggregation.getAggregations()
                .values().stream()
                .noneMatch(instance -> instance.getFilter().isPresent());
    }

    private static boolean noMasks(AggregationNode aggregation)
    {
        return aggregation.getAggregations()
                .values().stream()
                .noneMatch(e -> e.getMask().isPresent());
    }

    private static Stream<Set<RowExpression>> extractArgumentSets(AggregationNode aggregation)
    {
        return aggregation.getAggregations()
                .values().stream()
                .filter(Aggregation::isDistinct)
                .map(Aggregation::getArguments)
                .<Set<RowExpression>>map(HashSet::new)
                .distinct();
    }

    @Override
    public Pattern<AggregationNode> getPattern()
    {
        return PATTERN;
    }

    @Override
    public Result apply(AggregationNode aggregation, Captures captures, Context context)
    {
        List<Set<RowExpression>> argumentSets = extractArgumentSets(aggregation)
                .collect(Collectors.toList());

        Set<VariableReferenceExpression> variables = Iterables.getOnlyElement(argumentSets).stream()
                .map(OriginalExpressionUtils::castToExpression)
                .map(context.getVariableAllocator()::toVariableReference)
                .collect(Collectors.toSet());

        return Result.ofPlanNode(
                new AggregationNode(
                        aggregation.getSourceLocation(),
                        aggregation.getId(),
                        new AggregationNode(
                                aggregation.getSourceLocation(),
                                context.getIdAllocator().getNextId(),
                                aggregation.getSource(),
                                ImmutableMap.of(),
                                singleGroupingSet(ImmutableList.<VariableReferenceExpression>builder()
                                        .addAll(aggregation.getGroupingKeys())
                                        .addAll(variables)
                                        .build()),
                                ImmutableList.of(),
                                SINGLE,
                                Optional.empty(),
                                Optional.empty()),
                        // remove DISTINCT flag from function calls
                        aggregation.getAggregations()
                                .entrySet().stream()
                                .collect(Collectors.toMap(
                                        Map.Entry::getKey,
                                        e -> removeDistinct(e.getValue()))),
                        aggregation.getGroupingSets(),
                        emptyList(),
                        aggregation.getStep(),
                        aggregation.getHashVariable(),
                        aggregation.getGroupIdVariable()));
    }
}


text:
FROM ruby:alpine

EXPOSE 5683/udp

COPY . /app
WORKDIR /app

RUN \
  apk update && \
  apk add build-base && \
  bundle install --without development test && \
  apk del build-base && \
  rm /var/cache/apk/*.gz

CMD rackup


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Oranikle.Studio.Controls
{
    public class CtrlDropdownHost : System.Windows.Forms.UserControl, Oranikle.Studio.Controls.IControlWithBorder, Oranikle.Studio.Controls.IEndEditToDataBinding, Oranikle.Studio.Controls.IResizeToPanel
    {

        protected delegate void EmptyDelegate();

        protected static readonly log4net.ILog log;

        private System.Drawing.Color _BorderColor;
        private System.Windows.Forms.BorderStyle _BorderStyle;
        private Oranikle.Studio.Controls.BorderDrawer borderDrawer;
        private System.ComponentModel.IContainer components;
        private bool dismissed;
        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        private Oranikle.Studio.Controls.IDropdownDisplayer displayer;
        [System.NonSerialized]
        [System.ComponentModel.Description("This is fired when the enter key is pressed.  It will later be translated into a tab key, so KeyDown will not be fired for enter.")]
        private Oranikle.Studio.Controls.WeakEvent<System.EventArgs> enterPressed;
        private Oranikle.Studio.Controls.WeakEvent<System.EventArgs> valueChanged;
        private Oranikle.Studio.Controls.WeakEvent<System.EventArgs> addNewClicked;
        private Oranikle.Studio.Controls.WeakEvent<System.EventArgs> editClicked;
        private Oranikle.Studio.Controls.WeakEvent<System.EventArgs> deleteClicked;
        private int horizontalOffset;
        private bool keepFocusOnTextbox;
        protected System.Windows.Forms.Panel pnlButton;
        private bool showDropdownOnEntry;
        private Oranikle.Studio.Controls.CtrlStyledSplitContainer splitContainer1;
        private Oranikle.Studio.Controls.CtrlDropDownForm subform;
        protected Oranikle.Studio.Controls.StyledTextBox textBox;
        protected object _value;
        private int verticalOffset;

        public System.Drawing.Color BorderColor
        {
            get
            {
                return _BorderColor;
            }
            set
            {
                _BorderColor = value;
                borderDrawer.BorderColor = value;
                Invalidate();
            }
        }

        [System.ComponentModel.DefaultValue(System.Windows.Forms.BorderStyle.FixedSingle)]
        public new System.Windows.Forms.BorderStyle BorderStyle
        {
            get
            {
                return _BorderStyle;
            }
            set
            {
                _BorderStyle = value;
                Invalidate();
            }
        }

        [System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        [System.ComponentModel.Browsable(false)]
        public bool Dismissed
        {
            get
            {
                return dismissed;
            }
            set
            {
                dismissed = value;
            }
        }

        protected Oranikle.Studio.Controls.IDropdownDisplayer Displayer
        {
            get
            {
                return displayer;
            }
            set
            {
                displayer = value;
            }
        }

        public Oranikle.Studio.Controls.WeakEvent<System.EventArgs> EnterPressed
        {
            get
            {
                return enterPressed;
            }
        }

        public int HorizontalOffset
        {
            get
            {
                return horizontalOffset;
            }
            set
            {
                horizontalOffset = value;
            }
        }

        [System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        [System.ComponentModel.Browsable(false)]
        public bool KeepFocusOnTextbox
        {
            get
            {
                return keepFocusOnTextbox;
            }
            set
            {
                keepFocusOnTextbox = value;
            }
        }

        public bool ShowDropdownOnEntry
        {
            get
            {
                return showDropdownOnEntry;
            }
            set
            {
                showDropdownOnEntry = value;
            }
        }

        public Font Font
        {
            get
            {
                return base.Font;
            }
            set
            {
                base.Font = value;
                textBox.Font = base.Font;

            }
        }

        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public Oranikle.Studio.Controls.CtrlDropDownForm Subform
        {
            get
            {
                return subform;
            }
            set
            {
                subform = value;
                subform.SuspendLayout();
                System.Drawing.Size size = subform.Size;
                System.Drawing.Point point = subform.Location;
                subform.Location = new System.Drawing.Point(9999, 9999);
                subform.Size = new System.Drawing.Size(1, 1);
                subform.ShowWindowWithoutFocus();
                subform.Hide();
                subform.Location = point;
                subform.Size = size;
                subform.ResumeLayout();
            }
        }

        public System.Drawing.Color TextColor
        {
            get
            {
                return textBox.ForeColor;
            }
            set
            {
                textBox.ForeColor = value;
            }
        }

        public System.Drawing.Font TextFont
        {
            get
            {
                return textBox.Font;
            }
            set
            {
                textBox.Font = value;
            }
        }

        public bool TextReadOnly
        {
            get { return textBox.ReadOnly; }
            set { textBox.ReadOnly = value; }
        }

        public int VerticalOffset
        {
            get
            {
                return verticalOffset;
            }
            set
            {
                verticalOffset = value;
            }
        }

        [System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Visible)]
        [System.ComponentModel.Browsable(true)]
        public sealed override string Text
        {
            get
            {
                return textBox.Text;
            }
            set
            {
                textBox.Text = value;
            }
        }

        public virtual object Value
        {
            get
            {
                return _value;
            }
            set
            {
                this._value = value;
                    string s = GetDisplayerValueOrNull(value);
                if (s != null)
                { textBox.Text = s; }
                //else
                    //textBox.Text = System.String.Empty;
            }
        }

        public CtrlDropdownHost()
        {
            borderDrawer = new Oranikle.Studio.Controls.BorderDrawer();
            horizontalOffset = 0;
            _BorderColor = System.Drawing.Color.LightGray;
            keepFocusOnTextbox = true;
            enterPressed = new Oranikle.Studio.Controls.WeakEvent<System.EventArgs>();
            valueChanged = new Oranikle.Studio.Controls.WeakEvent<System.EventArgs>();
            addNewClicked = new Oranikle.Studio.Controls.WeakEvent<System.EventArgs>();
            editClicked = new Oranikle.Studio.Controls.WeakEvent<System.EventArgs>();
            deleteClicked = new Oranikle.Studio.Controls.WeakEvent<System.EventArgs>();
            _BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            InitializeComponent();
            SetDefaultControlStyles();
            base.BorderStyle = System.Windows.Forms.BorderStyle.None;
            textBox.LostFocus += new System.EventHandler(ChildLostFocus);
            pnlButton.LostFocus += new System.EventHandler(ChildLostFocus);
            textBox.GotFocus += new System.EventHandler(ChildGotFocus);
            pnlButton.GotFocus += new System.EventHandler(ChildGotFocus);
            textBox.EnterPressed.AddHandler(new System.EventHandler(textBox_EnterPressed));
        }

        public void Host_deleteClicked(object sender, EventArgs e)
        {
            deleteClicked.Invoke(sender, e);
        }

        public void Host_editClicked(object sender, EventArgs e)
        {
            editClicked.Invoke(sender, e);
        }

        static CtrlDropdownHost()
        {
            Oranikle.Studio.Controls.CtrlDropdownHost.log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        }

        protected void ChildGotFocus(object sender, System.EventArgs e)
        {
            MaybeGotFocus();
        }

        protected void ChildLostFocus(object sender, System.EventArgs e)
        {
            MaybeLostFocus();
        }

        public void EndEditToDataBinding(System.Windows.Forms.ContainerControl mainControl)
        {
            foreach (System.Windows.Forms.Binding binding in DataBindings)
            {
                binding.WriteValue();
            }
        }

        //int Oranikle.Studio.Controls.IResizeToPanel.get_Width()
        //{
        //    return base.Width;
        //}

        private string GetDisplayerValue(object value)
        {
            if (value == null)
                return "";
            if (displayer == null)
                return value.ToString();
            return displayer.GetDisplay(value).ToString();
        }

        private string GetDisplayerValueOrNull(object value)
        {
            if (value == null)
                return null;
            if (displayer == null)
                return null;
            return displayer.GetDisplayOrNull(value).ToString();
        }

        private void InitializeComponent()
        {
            this.pnlButton = new System.Windows.Forms.Panel();
            this.splitContainer1 = new Oranikle.Studio.Controls.CtrlStyledSplitContainer();
            this.textBox = new Oranikle.Studio.Controls.StyledTextBox();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.SuspendLayout();
            //
            // pnlButton
            //
            this.pnlButton.BackColor = System.Drawing.SystemColors.ButtonFace;
            this.pnlButton.BackgroundImage = global::Oranikle.Studio.Controls.Properties.Resources.ComboBoxTransparent;
            this.pnlButton.Dock = System.Windows.Forms.DockStyle.Right;
            this.pnlButton.Location = new System.Drawing.Point(154, 1);
            this.pnlButton.Name = "pnlButton";
            this.pnlButton.Size = new System.Drawing.Size(16, 21);
            this.pnlButton.TabIndex = 1;
            this.pnlButton.Click += new System.EventHandler(this.pnlButton_Click);
            //
            // splitContainer1
            //
            this.splitContainer1.BackColor = System.Drawing.Color.White;
            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainer1.IsSplitterFixed = true;
            this.splitContainer1.Location = new System.Drawing.Point(1, 1);
            this.splitContainer1.Margin = new System.Windows.Forms.Padding(0);
            this.splitContainer1.Name = "splitContainer1";
            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
            this.splitContainer1.Panel1MinSize = 1;
            //
            // splitContainer1.Panel2
            //
            this.splitContainer1.Panel2.BackColor = System.Drawing.Color.Transparent;
            this.splitContainer1.Panel2.Controls.Add(this.textBox);
            this.splitContainer1.Panel2.Padding = new System.Windows.Forms.Padding(2, 0, 0, 0);
            this.splitContainer1.Panel2MinSize = 13;
            this.splitContainer1.Size = new System.Drawing.Size(153, 21);
            this.splitContainer1.SplitterDistance = 1;
            this.splitContainer1.SplitterWidth = 1;
            this.splitContainer1.TabIndex = 2;
            //
            // textBox
            //
            this.textBox.BackColor = System.Drawing.Color.White;
            this.textBox.BorderColor = System.Drawing.Color.LightGray;
            this.textBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.textBox.ConvertEnterToTab = true;
            this.textBox.ConvertEnterToTabForDialogs = false;
            this.textBox.Dock = System.Windows.Forms.DockStyle.Fill;
            this.textBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.textBox.Location = new System.Drawing.Point(2, 0);
            this.textBox.Margin = new System.Windows.Forms.Padding(0);
            this.textBox.Name = "textBox";
            this.textBox.Size = new System.Drawing.Size(151, 14);
            this.textBox.TabIndex = 0;
            this.textBox.TextChanged += new System.EventHandler(this.textBox_TextChanged);
            this.textBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox_KeyDown);
            this.textBox.BackColorChanged += new System.EventHandler(this.textBox_BackColorChanged);
            //
            // CtrlDropdownHost
            //
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
            this.Controls.Add(this.splitContainer1);
            this.Controls.Add(this.pnlButton);
            this.Margin = new System.Windows.Forms.Padding(1);
            this.Name = "CtrlDropdownHost";
            this.Padding = new System.Windows.Forms.Padding(1);
            this.Size = new System.Drawing.Size(171, 23);
            this.splitContainer1.Panel2.ResumeLayout(false);
            this.splitContainer1.Panel2.PerformLayout();
            this.splitContainer1.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        protected void MaybeGotFocus()
        {
            //if (Focused) goto label_0;
            //if (textBox.Focused) goto label_0;
            //if (pnlButton.Focused) goto label_0;
            //this.SelectAllText();
            if (Subform == null)
                return;
            if (!Subform.Visible)
                return;
            if (borderDrawer.BorderColor == Oranikle.Studio.Controls.BorderDrawer.BORDER_FOCUS_COLOR)
                return;
            borderDrawer.BorderColor = Oranikle.Studio.Controls.BorderDrawer.BORDER_FOCUS_COLOR;
            Invalidate();
        }

        protected void MaybeLostFocus()
        {
            if ((Subform != null) && !Subform.GetExpectedVisibility())
                Subform.UpdateVisibility();
            if (!Focused && !textBox.Focused && !pnlButton.Focused && (Subform != null) && !Subform.Visible && borderDrawer.BorderColor != Oranikle.Studio.Controls.BorderDrawer.BORDER_UNFOCUS_COLOR)
            {
                borderDrawer.BorderColor = Oranikle.Studio.Controls.BorderDrawer.BORDER_UNFOCUS_COLOR;
                Invalidate();
            }
        }

        private void ParentForm_Move(object sender, System.EventArgs e)
        {
            RepositionSubform();
        }

        private void pnlButton_Click(object sender, System.EventArgs e)
        {
            if ((Subform == null) || !Subform.Visible)
            {
                textBox.Focus();
                ShowSubform();
                return;
            }
            Subform.HideSubForm();
        }

        private void RepositionSubform()
        {
            if (subform != null)
                subform.Reposition(HorizontalOffset, VerticalOffset);
        }

        public void SelectAllText()
        {
            textBox.SelectAll();
        }

        public System.IntPtr SendMessageToMe(int msg, System.IntPtr wParam, System.IntPtr lParam)
        {
            return Oranikle.Studio.Controls.CtrlDropdownHost.SendMessage(new System.Runtime.InteropServices.HandleRef(Handle, Handle), msg, wParam, lParam);
        }

        //void Oranikle.Studio.Controls.IResizeToPanel.set_Width(object obj)
        //{
        //    base.Width = obj;
        //}

        private void SetDefaultControlStyles()
        {
            SetStyle(System.Windows.Forms.ControlStyles.ResizeRedraw, true);
            SetStyle(System.Windows.Forms.ControlStyles.UserMouse, true);
            SetStyle(System.Windows.Forms.ControlStyles.SupportsTransparentBackColor, true);
            SetStyle(System.Windows.Forms.ControlStyles.DoubleBuffer, true);
            SetStyle(System.Windows.Forms.ControlStyles.UserPaint, true);
            SetStyle(System.Windows.Forms.ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(System.Windows.Forms.ControlStyles.ContainerControl, true);
            UpdateStyles();
        }

        public void ShowSubform()
        {
            Dismissed = false;
            subform.SetHost(this, horizontalOffset, verticalOffset);
            subform.UpdateVisibility();
            if ((ParentForm != null) && !ParentForm.IsDisposed)
            {
                //ParentForm.TopMost = false;
                //ParentForm.BringToFront();
            }
            subform.TopMost = true;
            //subform.BringToFront();
            if (keepFocusOnTextbox)
            {
                textBox.Focus();
                return;
            }
            //subform.Activate();

        }

        private void textBox_BackColorChanged(object sender, System.EventArgs e)
        {
            if (splitContainer1.BackColor != textBox.BackColor)
                splitContainer1.BackColor = textBox.BackColor;
        }

        private void textBox_EnterPressed(object sender, System.EventArgs e)
        {
            OnEnterPressed();
        }

        private void textBox_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == System.Windows.Forms.Keys.Escape)
            {
                Dismissed = true;
                if (Subform != null)
                    Subform.UpdateVisibility();
            }
            OnKeyDown(e);
        }

        private void textBox_TextChanged(object sender, System.EventArgs e)
        {
            base.OnTextChanged(e);
            //OnValueChanged();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
                components.Dispose();
            base.Dispose(disposing);
        }

        protected virtual bool IsNullRepresentation(object newVal, object nullValue)
        {
            if ((newVal != null) && !newVal.Equals(nullValue) && !newVal.Equals(0))
                return newVal == System.DBNull.Value;
            return true;
        }

        protected override void OnEnabledChanged(System.EventArgs e)
        {
            base.OnEnabledChanged(e);
            if (Enabled)
            {
                splitContainer1.BackColor = System.Drawing.Color.White;
                textBox.BackColor = System.Drawing.Color.White;
                pnlButton.BackgroundImage = Oranikle.Studio.Controls.Properties.Resources.ComboBoxTransparent;
                pnlButton.BackColor = System.Drawing.Color.White;
            }
            else
            {
                splitContainer1.BackColor = System.Drawing.SystemColors.Control;
                textBox.BackColor = System.Drawing.SystemColors.Control;
                pnlButton.BackgroundImage = Oranikle.Studio.Controls.Properties.Resources.ComboBoxTransparentDisabled;
                pnlButton.BackColor = System.Drawing.SystemColors.Control;
            }
            Invalidate();
        }

        protected override void OnEnter(System.EventArgs e)
        {
            base.OnEnter(e);
            if (showDropdownOnEntry)
                ShowSubform();
        }

        public virtual void OnEnterPressed()
        {
            enterPressed.Invoke(this, System.EventArgs.Empty);
        }

        public virtual void OnValueChanged()
        {
            if (textBox.Text == string.Empty)
                this.Value = null;
            valueChanged.Invoke(this, System.EventArgs.Empty);
        }

        public virtual void OnAddNew_Clicked()
        {
            addNewClicked.Invoke(this, System.EventArgs.Empty);
        }

        public virtual void OnEdit_Clicked()
        {

            editClicked.Invoke(this, System.EventArgs.Empty);
        }

        public virtual void OnDelete_Clicked()
        {
            deleteClicked.Invoke(this, System.EventArgs.Empty);
        }

        public virtual void OnEnterPressedForceDatabinding()
        {
            foreach (System.Windows.Forms.Binding binding in DataBindings)
            {
                binding.WriteValue();
            }
            OnEnterPressed();
        }

        protected override void OnGotFocus(System.EventArgs e)
        {
            base.OnGotFocus(e);
            MaybeGotFocus();
        }

        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);
            if (!DesignMode && (ParentForm != null) && (ParentForm is System.Windows.Forms.Form))
                ((System.Windows.Forms.Form)ParentForm).Move += new EventHandler(ParentForm_Move); //.AddHandler(new System.EventHandler<System.EventArgs>(ParentForm_Move));

        }

        protected override void OnLostFocus(System.EventArgs e)
        {
            base.OnLostFocus(e);
            MaybeLostFocus();
        }

        protected override void OnParentChanged(System.EventArgs e)
        {
            base.OnParentChanged(e);
            if (!DesignMode && (ParentForm != null) && (ParentForm is System.Windows.Forms.Form))
                ((System.Windows.Forms.Form)ParentForm).Move += new EventHandler(ParentForm_Move);
        }

        protected override void OnResize(System.EventArgs e)
        {
            base.OnResize(e);
            if (subform != null)
                subform.Reposition(HorizontalOffset, VerticalOffset);
        }

        protected override void OnSizeChanged(System.EventArgs e)
        {
            base.OnSizeChanged(e);
            Invalidate();
        }

        protected override void OnTextChanged(System.EventArgs e)
        {
            base.OnTextChanged(e);

        }

        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
        {
            if (keyData == System.Windows.Forms.Keys.F2)
            {
                ShowSubform();
                return true;
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

        protected override bool ProcessKeyEventArgs(ref System.Windows.Forms.Message m)
        {
            if (m.Msg == 258)
            {
                textBox.SendMessageToMe(m.Msg, m.WParam, m.LParam);
                return true;
            }
            return base.ProcessKeyEventArgs(ref m);
        }

        protected virtual bool SwitchingBetweenNullRepresentations(object newVal, object nullValue)
        {
            if (IsNullRepresentation(Value, nullValue))
                return IsNullRepresentation(newVal, nullValue);
            return false;
        }

        protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            base.WndProc(ref m);
            borderDrawer.DrawBorder(ref m, base.Width, Height);
        }

        [System.Runtime.InteropServices.PreserveSig]
        [System.Runtime.InteropServices.DllImport("user32.dll", CallingConvention = System.Runtime.InteropServices.CallingConvention.Winapi, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
        public static extern System.IntPtr SendMessage(System.Runtime.InteropServices.HandleRef hWnd, int msg, System.IntPtr wParam, System.IntPtr lParam);

    }
}