text:
package org.apache.kafka.streams.scala

import org.apache.kafka.streams.KeyValue
import org.apache.kafka.streams.kstream._
import scala.collection.JavaConverters._
import java.lang.{Iterable => JIterable}

/**
 * Implicit classes that offer conversions of Scala function literals to
 * SAM (Single Abstract Method) objects in Java. These make the Scala APIs much
 * more expressive, with less boilerplate and more succinct.
 * <p>
 * For Scala 2.11, most of these conversions need to be invoked explicitly, as Scala 2.11 does not
 * have full support for SAM types.
 */
object FunctionConversions {

  implicit class PredicateFromFunction[K, V](val p: (K, V) => Boolean) extends AnyVal {
    def asPredicate: Predicate[K, V] = new Predicate[K, V] {
      override def test(key: K, value: V): Boolean = p(key, value)
    }
  }

  implicit class MapperFromFunction[T, U, VR](val f: (T, U) => VR) extends AnyVal {
    def asKeyValueMapper: KeyValueMapper[T, U, VR] = new KeyValueMapper[T, U, VR] {
      override def apply(key: T, value: U): VR = f(key, value)
    }
    def asValueJoiner: ValueJoiner[T, U, VR] = new ValueJoiner[T, U, VR] {
      override def apply(value1: T, value2: U): VR = f(value1, value2)
    }
  }

  implicit class KeyValueMapperFromFunction[K, V, KR, VR](val f: (K, V) => (KR, VR)) extends AnyVal {
    def asKeyValueMapper: KeyValueMapper[K, V, KeyValue[KR, VR]] = new KeyValueMapper[K, V, KeyValue[KR, VR]] {
      override def apply(key: K, value: V): KeyValue[KR, VR] = {
        val (kr, vr) = f(key, value)
        KeyValue.pair(kr, vr)
      }
    }
  }

  implicit class ValueMapperFromFunction[V, VR](val f: V => VR) extends AnyVal {
    def asValueMapper: ValueMapper[V, VR] = new ValueMapper[V, VR] {
      override def apply(value: V): VR = f(value)
    }
  }

  implicit class FlatValueMapperFromFunction[V, VR](val f: V => Iterable[VR]) extends AnyVal {
    def asValueMapper: ValueMapper[V, JIterable[VR]] = new ValueMapper[V, JIterable[VR]] {
      override def apply(value: V): JIterable[VR] = f(value).asJava
    }
  }

  implicit class ValueMapperWithKeyFromFunction[K, V, VR](val f: (K, V) => VR) extends AnyVal {
    def asValueMapperWithKey: ValueMapperWithKey[K, V, VR] = new ValueMapperWithKey[K, V, VR] {
      override def apply(readOnlyKey: K, value: V): VR = f(readOnlyKey, value)
    }
  }

  implicit class FlatValueMapperWithKeyFromFunction[K, V, VR](val f: (K, V) => Iterable[VR]) extends AnyVal {
    def asValueMapperWithKey: ValueMapperWithKey[K, V, JIterable[VR]] = new ValueMapperWithKey[K, V, JIterable[VR]] {
      override def apply(readOnlyKey: K, value: V): JIterable[VR] = f(readOnlyKey, value).asJava
    }
  }

  implicit class AggregatorFromFunction[K, V, VA](val f: (K, V, VA) => VA) extends AnyVal {
    def asAggregator: Aggregator[K, V, VA] = new Aggregator[K, V, VA] {
      override def apply(key: K, value: V, aggregate: VA): VA = f(key, value, aggregate)
    }
  }

  implicit class MergerFromFunction[K, VR](val f: (K, VR, VR) => VR) extends AnyVal {
    def asMerger: Merger[K, VR] = new Merger[K, VR] {
      override def apply(aggKey: K, aggOne: VR, aggTwo: VR): VR = f(aggKey, aggOne, aggTwo)
    }
  }

  implicit class ReducerFromFunction[V](val f: (V, V) => V) extends AnyVal {
    def asReducer: Reducer[V] = new Reducer[V] {
      override def apply(value1: V, value2: V): V = f(value1, value2)
    }
  }

  implicit class InitializerFromFunction[VA](val f: () => VA) extends AnyVal {
    def asInitializer: Initializer[VA] = new Initializer[VA] {
      override def apply(): VA = f()
    }
  }

  implicit class TransformerSupplierFromFunction[K, V, VO](val f: () => Transformer[K, V, VO]) extends AnyVal {
    def asTransformerSupplier: TransformerSupplier[K, V, VO] = new TransformerSupplier[K, V, VO] {
      override def get(): Transformer[K, V, VO] = f()
    }
  }
}


text:
rm -rf work
mkdir work
wget --http-user=jim --http-password=jimspassword --directory-prefix=work  --output-file=work/log.txt http://localhost:8080/camel/user
cat -n work/* | less

redpajama_set_name: RedPajamaGithub


text:
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));

var _jsxRuntime = require("react/jsx-runtime");

var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
  d: "M18 6H9V4H7v2H6l-4 4v9h20v-9l-4-4zM4 12h10v5H4v-5zm16 5h-4v-6.17l2-2 2 2V17z"
}), 'GiteOutlined');

exports.default = _default;


text:
package desktoppushbullet

import scala.swing.Frame
import akka.actor.Actor
import akka.actor.ActorSystem
import akka.actor.Props
import desktoppushbullet.dialogs.PushLinkDialog
import desktoppushbullet.dialogs.NoteDialog
import scala.swing.RichWindow
import akka.actor.PoisonPill
import scala.concurrent.duration._
import desktoppushbullet.systemtray.BulletSystemTray
import desktoppushbullet.systemtray.TrayWidget

import desktoppushbullet.remoteapi._

object PushBulletApp {

  val actorSupervisor = ActorSystem("MySystem")
  val mainloop = actorSupervisor.actorOf(Props[appLoop], name = "AppLoop")
  val pushapi  = actorSupervisor.actorOf(Props[PushAPI], name = "PushAPI")

  private var guiComponents = List[RichWindow]();

  def main(args: Array[String]): Unit = {
    mainloop ! StartAPP

  }

  def shutdown {
    actorSupervisor.stop(pushapi)
    actorSupervisor.stop(mainloop)

    guiComponents.foreach( g => g.dispose)
    sys.exit

  }

  def setupGUI {
      val pref = new PreferencesDialog(false)
      val dialogs = Set[RichWindow](new PushLinkDialog, new NoteDialog)

      def toMenuItemCmd(frame:RichWindow):MenuItemCmd = {
        (frame.title, (Unit) =>
          frame.visible match {
            case true => frame.visible = false
            case false => frame.visible = true
          })
      }

      val pushToDeviceName = Preferences.DefaultDeviceName
      val menuCmds = dialogs map toMenuItemCmd
      val quitCmd:MenuItemCmd = ("Quit",{(Unit) => PushBulletApp.mainloop ! Quit })
      val prefCmd = toMenuItemCmd(pref)

      new TrayWidget(pushToDeviceName, menuCmds, quitCmd, prefCmd)

      guiComponents = pref :: (dialogs.toList)
  }
}

abstract class Commands
object StartAPP extends Commands
object Quit extends Commands
case class QuitWithError(message:String) extends Commands
object API_KEY_Set extends Commands

class appLoop extends Actor {
  def receive = {
    case StartAPP if (Preferences.NeedtoConfigure) => new PreferencesDialog(true)
    case API_KEY_Set => PushBulletApp.pushapi ! GetDevices
    case StartAPP => PushBulletApp.setupGUI
    case Quit  => PushBulletApp.shutdown
    case QuitWithError(message) => PushBulletApp.shutdown //XXX add dialog with Message.

  }
}


text:
namespace beaker
{

Expr const* parse_expr(Parser&, Token_stream&);
Decl const* parse_decl(Parser&, Token_stream&);
Stmt const* parse_stmt(Parser&, Token_stream&);

namespace
{

// Consume through the next semicolon. This is typically used
// to advance the parse state after a fatal error in an
// expression statement.
//
// TODO: Move the generic form into lingo.
void
consume_through_semicolon(Token_stream& ts)
{
  while (next_token_is_not(ts, semicolon_tok))
    get_token(ts);
}

// Used to propagate diagnosed errors.

// Parse the empty statement.
//
//    empty-stmt ::= ';'
Stmt const*
parse_empty_stmt(Parser& p, Token_stream& ts)
{
  Token const* tok = require_token(ts, semicolon_tok);
  return p.on_empty_stmt(tok);
}

// Parse a sequence of statements.
//
//    statement-seq ::= stmt [',' stmt*]
Sequence_term<Stmt> const*
parse_statement_seq(Parser& p, Token_stream& ts)
{
  using Result = Sequence_term<Stmt>;
  Result result;
  while (!ts.eof()) {
    if (next_token_is(ts, rbrace_tok))
      break;

    if (Required<Stmt> term = parse_stmt(p, ts))
      result.push_back(*term);

    // Continue parsing even though we got an error, continue
    // parsing. This will allow us to diagnose as many errors
    // as possible in a block statement.
    else if (term.is_error())
      continue;

    // We should probably never have this state.
    else if (term.is_empty())
      continue;
  }
  return Result::make(std::move(result));
}

// Parse a block statement.
//
//    block-stmt ::= '{' stmt-seq '}'
//
// Each block defines a new local scope.
Stmt const*
parse_block_stmt(Parser& p, Token_stream& ts)
{
  Local_scope scope; // Enter a new local scope.

  using Term = Enclosed_term<Sequence_term<Stmt>>;
  if (Required<Term> enc = parse_brace_enclosed(p, ts, parse_statement_seq)) {
    // Note that enc->term() may be empty (null) if there are
    // no statements in the block.
    if (enc->term())
      return p.on_block_stmt(enc->open(), enc->close(), *enc->term());
    else
      return p.on_block_stmt(enc->open(), enc->close(), {});
  }
  else
    return make_error_node<Stmt>();
}

// Parse an declaration statement.
//
//    declaration-stmt ::= decl
Stmt const*
parse_declaration_stmt(Parser& p, Token_stream& ts)
{
  if (Required<Decl> d = parse_decl(p, ts))
    return p.on_declaration_stmt(*d);
  return make_error_node<Stmt>();
}

// Represents an expression wrapped in parens.
using Paren_expr = Enclosed_term<Expr>;

// Parse an if-then or if-else statement.
//
//    if-stmt ::= if '(' expr ')' stmt
//              | if '(' expr ')' stmt 'else' stmt
//
Stmt const*
parse_if_stmt(Parser& p, Token_stream& ts)
{
  Token const* tok1 = require_token(ts, if_kw);

  // Match the condition.
  Required<Paren_expr> test = parse_paren_enclosed(p, ts, parse_expr);
  if (!test)
    return make_error_node<Stmt>();
  Expr const* e = test->term();

  // Match the "then" clause.
  Required<Stmt> b1 = parse_expected(p, ts, parse_stmt);
  if (!b1)
    return make_error_node<Stmt>();

  // Match "else stmt".
  if (Token const* tok2 = match_token(ts, else_kw)) {
    Required<Stmt> b2 = parse_expected(p, ts, parse_stmt);
    if (!b2)
      return make_error_node<Stmt>();
    return p.on_if_else_stmt(tok1, tok2, e, *b1, *b2);
  } else {
    return p.on_if_then_stmt(tok1, e, *b1);
  }
}

// Parse a while statement.
//
//    while-stmt ::= 'while' '(' expr ')' stmt
//
// TODO: Factor out the 'while '(' expr ')' as a separate
// clause?
Stmt const*
parse_while_stmt(Parser& p, Token_stream& ts)
{
  error(ts.location(), "not implemented");
  return make_error_node<Stmt>();
}

// Parse a do statement.
//
//    do-stmt ::= 'do' stmt 'while' '(' expr ')' ';'
//
// TODO: See comments above.
Stmt const*
parse_do_stmt(Parser& p, Token_stream& ts)
{
  error(ts.location(), "not implemented");
  return make_error_node<Stmt>();
}

// Parse a return statement.
//
//    return-stmt ::= 'return' [expr] ';'
//
// Note that a return statement with no value is modeled as
// an "exit" statement.
Stmt const*
parse_return_stmt(Parser& p, Token_stream& ts)
{
  Token const* tok = require_token(ts, return_kw);

  // Match the "return;" case.
  if (Token const* semi = match_token(ts, semicolon_tok))
    return p.on_return_stmt(tok, semi);

  if (Required<Expr> expr = parse_expected(p, ts, parse_expr)) {
    // Require the semicolon token, but continue parsing if
    // it's missing.
    Token const* semi = expect_token(p, ts, semicolon_tok);
    if (semi)
      return p.on_return_stmt(tok, semi, *expr);
  }

  // Consume through the next semicolon so we can continue
  // parsing.
  consume_through_semicolon(ts);
  return make_error_node<Stmt>();
}

// Parse a expression statement.
//
//    expression-stmt ::= expr ';'
//                      | expr '=' expr ';'
//
// An assignment statement is grammatically considered
// to be a form of expression statement. However,
// assignment is not an expression.
Stmt const*
parse_expression_stmt(Parser& p, Token_stream& ts)
{
  Required<Expr> e1 = parse_expected(p, ts, parse_expr);
  if (!e1) {
    consume_through_semicolon(ts);
    return make_error_node<Stmt>();
  }

  // Match the optional assignment form.
  Required<Expr> e2;
  Token const* assign = match_token(ts, eq_tok);
  if (assign) {
    e2 = parse_expected(p, ts, parse_expr);
    if (!e2) {
      consume_through_semicolon(ts);
      return make_error_node<Stmt>();
    }
  }

  // Diagnose a missing semicolon, but continue processing.
  //
  // FIXME: I'm potentially passing a nullptr into the semantic
  // action. Maybe if we're missing the token, I should just
  // insert one at this point?
  //
  // See return-stmt for the same issue.
  Token const* semi = expect_token(p, ts, semicolon_tok);

  // Handle the result of the parse.
  if (assign)
    return p.on_assignment_stmt(assign, semi, *e1, *e2);
  else
    return p.on_expression_stmt(semi, *e1);
}

} // namespace

// Parse a statement.
//
//    statement ::= declaration-statement
//                | block-statement
//                | return-statement
//                | expression-statement
Stmt const*
parse_stmt(Parser& p, Token_stream& ts)
{
  switch (next_token_kind(ts)) {
    case semicolon_tok:
      return parse_empty_stmt(p, ts);

    case lbrace_tok:
      return parse_block_stmt(p, ts);

    case var_kw:
    case def_kw:
      return parse_declaration_stmt(p, ts);

    case if_kw:
      return parse_if_stmt(p, ts);

    case while_kw:
      return parse_while_stmt(p, ts);

    case do_kw:
      return parse_do_stmt(p, ts);

    case return_kw:
      return parse_return_stmt(p, ts);

    default:
      return parse_expression_stmt(p, ts);
  }
  lingo_unreachable();
}

} // namepace beaker


text:
package Paws::CognitoIdp::GetIdentityProviderByIdentifier;
  use Moose;
  has IdpIdentifier => (is => 'ro', isa => 'Str', required => 1);
  has UserPoolId => (is => 'ro', isa => 'Str', required => 1);

  use MooseX::ClassAttribute;

  class_has _api_call => (isa => 'Str', is => 'ro', default => 'GetIdentityProviderByIdentifier');
  class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::CognitoIdp::GetIdentityProviderByIdentifierResponse');
  class_has _result_key => (isa => 'Str', is => 'ro');
1;

### main pod documentation begin ###

=head1 NAME

Paws::CognitoIdp::GetIdentityProviderByIdentifier - Arguments for method GetIdentityProviderByIdentifier on Paws::CognitoIdp

=head1 DESCRIPTION

This class represents the parameters used for calling the method GetIdentityProviderByIdentifier on the
Amazon Cognito Identity Provider service. Use the attributes of this class
as arguments to method GetIdentityProviderByIdentifier.

You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to GetIdentityProviderByIdentifier.

As an example:

  $service_obj->GetIdentityProviderByIdentifier(Att1 => $value1, Att2 => $value2, ...);

Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object.

=head1 ATTRIBUTES

=head2 B<REQUIRED> IdpIdentifier => Str

The identity provider ID.

=head2 B<REQUIRED> UserPoolId => Str

The user pool ID.

=head1 SEE ALSO

This class forms part of L<Paws>, documenting arguments for method GetIdentityProviderByIdentifier in L<Paws::CognitoIdp>

=head1 BUGS and CONTRIBUTIONS

The source code is located here: https://github.com/pplu/aws-sdk-perl

Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues

=cut


text:
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;

[AddComponentMenu("NGUI/UI/NGUI Label"), ExecuteInEditMode]
public class UILabel : UIWidget
{
	public enum Effect
	{
		None,
		Shadow,
		Outline
	}

	public enum Overflow
	{
		ShrinkContent,
		ClampContent,
		ResizeFreely,
		ResizeHeight
	}

	public enum Crispness
	{
		Never,
		OnDesktop,
		Always
	}

	public delegate void CallLoadAsset(string strFileName, AssetCallBack callback);

	public delegate string OnQueryString(string strText);

	public UILabel.Crispness keepCrispWhenShrunk = UILabel.Crispness.OnDesktop;

	[HideInInspector, SerializeField]
	public Font mTrueTypeFont;

	[HideInInspector, SerializeField]
	private UIFont mFont;

	[HideInInspector, Multiline(6), SerializeField]
	private string mText = string.Empty;

	[HideInInspector, SerializeField]
	private int mFontSize = 16;

	[HideInInspector, SerializeField]
	private FontStyle mFontStyle;

	[HideInInspector, SerializeField]
	private NGUIText.Alignment mAlignment;

	[HideInInspector, SerializeField]
	private bool mEncoding = true;

	[HideInInspector, SerializeField]
	private int mMaxLineCount;

	[HideInInspector, SerializeField]
	private UILabel.Effect mEffectStyle;

	[HideInInspector, SerializeField]
	private Color mEffectColor = Color.black;

	[HideInInspector, SerializeField]
	private NGUIText.SymbolStyle mSymbols = NGUIText.SymbolStyle.Normal;

	[HideInInspector, SerializeField]
	private Vector2 mEffectDistance = Vector2.one;

	[HideInInspector, SerializeField]
	private UILabel.Overflow mOverflow;

	[HideInInspector, SerializeField]
	private Material mMaterial;

	[HideInInspector, SerializeField]
	private bool mApplyGradient;

	[HideInInspector, SerializeField]
	private Color mGradientTop = Color.white;

	[HideInInspector, SerializeField]
	private Color mGradientBottom = new Color(0.7f, 0.7f, 0.7f);

	[HideInInspector, SerializeField]
	private int mSpacingX;

	[HideInInspector, SerializeField]
	private int mSpacingY;

	[HideInInspector, SerializeField]
	private bool mShrinkToFit;

	[HideInInspector, SerializeField]
	private int mMaxLineWidth;

	[HideInInspector, SerializeField]
	private int mMaxLineHeight;

	[HideInInspector, SerializeField]
	private float mLineWidth;

	[HideInInspector, SerializeField]
	private bool mMultiline = true;

	[HideInInspector, SerializeField]
	private bool isChanged;

	[HideInInspector, SerializeField]
	public string mOriginalText = string.Empty;

	[HideInInspector, SerializeField]
	public bool mIntConvert;

	public bool needChangeWord = true;

	private Font mActiveTTF;

	private float mDensity = 1f;

	private bool mShouldBeProcessed = true;

	private string mProcessedText = string.Empty;

	private bool mPremultiply;

	private Vector2 mCalculatedSize = Vector2.zero;

	private float mScale = 1f;

	private int mPrintedSize;

	private int mLastWidth;

	private int mLastHeight;

	private static string[] separater = new string[]
	{
		"\\n"
	};

	private static StringBuilder sb = new StringBuilder();

	private static BetterList<UILabel> mList = new BetterList<UILabel>();

	private static Dictionary<Font, int> mFontUsage = new Dictionary<Font, int>();

	public static UILabel.CallLoadAsset monLoadAsset = null;

	private static StringBuilder mstrbuilder = new StringBuilder();

	public static UILabel.OnQueryString moQuery = null;

	public static UILabel.OnQueryString intConvertFunc = null;

	private static BetterList<Vector3> mTempVerts = new BetterList<Vector3>();

	private static BetterList<int> mTempIndices = new BetterList<int>();

	private Action m_symbolOffset;

	public string originalText
	{
		get
		{
			return this.mOriginalText;
		}
		set
		{
			if (this.mOriginalText == value)
			{
				return;
			}
			if (string.IsNullOrEmpty(value))
			{
				if (!string.IsNullOrEmpty(this.mOriginalText))
				{
					this.mOriginalText = string.Empty;
					this.shouldBeProcessed = true;
					this.ProcessAndRequest();
				}
			}
			else if (this.mOriginalText != value)
			{
				this.mOriginalText = value;
				this.shouldBeProcessed = true;
				this.ProcessAndRequest();
			}
		}
	}

	public bool wordIsChanged
	{
		get
		{
			return this.isChanged;
		}
		set
		{
			this.isChanged = value;
		}
	}

	private bool shouldBeProcessed
	{
		get
		{
			return this.mShouldBeProcessed;
		}
		set
		{
			if (value)
			{
				this.mChanged = true;
				this.mShouldBeProcessed = true;
			}
			else
			{
				this.mShouldBeProcessed = false;
			}
		}
	}

	public override bool isAnchoredHorizontally
	{
		get
		{
			return base.isAnchoredHorizontally || this.mOverflow == UILabel.Overflow.ResizeFreely;
		}
	}

	public override bool isAnchoredVertically
	{
		get
		{
			return base.isAnchoredVertically || this.mOverflow == UILabel.Overflow.ResizeFreely || this.mOverflow == UILabel.Overflow.ResizeHeight;
		}
	}

	public override Material material
	{
		get
		{
			if (this.mMaterial != null)
			{
				return this.mMaterial;
			}
			if (this.mFont != null)
			{
				return this.mFont.material;
			}
			if (this.mTrueTypeFont != null)
			{
				return this.mTrueTypeFont.material;
			}
			return null;
		}
		set
		{
			if (this.mMaterial != value)
			{
				this.MarkAsChanged();
				this.mMaterial = value;
				this.MarkAsChanged();
			}
		}
	}

	[Obsolete("Use UILabel.bitmapFont instead")]
	public UIFont font
	{
		get
		{
			return this.bitmapFont;
		}
		set
		{
			this.bitmapFont = value;
		}
	}

	public UIFont bitmapFont
	{
		get
		{
			return this.mFont;
		}
		set
		{
			if (this.mFont != value)
			{
				base.RemoveFromPanel();
				this.mFont = value;
				this.mTrueTypeFont = null;
				this.MarkAsChanged();
			}
		}
	}

	public Font trueTypeFont
	{
		get
		{
			if (this.mTrueTypeFont != null)
			{
				return this.mTrueTypeFont;
			}
			return (!(this.mFont != null)) ? null : this.mFont.dynamicFont;
		}
		set
		{
			if (this.mTrueTypeFont != value)
			{
				this.SetActiveFont(null);
				base.RemoveFromPanel();
				this.mTrueTypeFont = value;
				this.shouldBeProcessed = true;
				this.mFont = null;
				this.SetActiveFont(value);
				this.ProcessAndRequest();
				if (this.mActiveTTF != null)
				{
					base.MarkAsChanged();
				}
			}
		}
	}

	public UnityEngine.Object ambigiousFont
	{
		get
		{
			return (!(this.mFont != null)) ? this.mTrueTypeFont : this.mFont;
		}
		set
		{
			UIFont uIFont = value as UIFont;
			if (uIFont != null)
			{
				this.bitmapFont = uIFont;
			}
			else
			{
				this.trueTypeFont = (value as Font);
			}
		}
	}

	public string text
	{
		get
		{
			return this.mText;
		}
		set
		{
			if (this.mText == value)
			{
				return;
			}
			if (string.IsNullOrEmpty(value))
			{
				if (!string.IsNullOrEmpty(this.mText))
				{
					this.mText = string.Empty;
					this.shouldBeProcessed = true;
					this.ProcessAndRequest();
				}
			}
			else if (this.mText != value)
			{
				this.originalText = string.Empty;
				this.mText = value;
				this.shouldBeProcessed = true;
				this.ProcessAndRequest();
			}
			if (this.autoResizeBoxCollider)
			{
				base.ResizeCollider();
			}
		}
	}

	public int defaultFontSize
	{
		get
		{
			return (!(this.trueTypeFont != null)) ? ((!(this.mFont != null)) ? 16 : this.mFont.defaultSize) : this.mFontSize;
		}
	}

	public int fontSize
	{
		get
		{
			return this.mFontSize;
		}
		set
		{
			value = Mathf.Clamp(value, 0, 256);
			if (this.mFontSize != value)
			{
				this.mFontSize = value;
				this.shouldBeProcessed = true;
				this.ProcessAndRequest();
			}
		}
	}

	public FontStyle fontStyle
	{
		get
		{
			return this.mFontStyle;
		}
		set
		{
			if (this.mFontStyle != value)
			{
				this.mFontStyle = value;
				this.shouldBeProcessed = true;
				this.ProcessAndRequest();
			}
		}
	}

	public NGUIText.Alignment alignment
	{
		get
		{
			return this.mAlignment;
		}
		set
		{
			if (this.mAlignment != value)
			{
				this.mAlignment = value;
				this.shouldBeProcessed = true;
				this.ProcessAndRequest();
			}
		}
	}

	public bool applyGradient
	{
		get
		{
			return this.mApplyGradient;
		}
		set
		{
			if (this.mApplyGradient != value)
			{
				this.mApplyGradient = value;
				this.MarkAsChanged();
			}
		}
	}

	public Color gradientTop
	{
		get
		{
			return this.mGradientTop;
		}
		set
		{
			if (this.mGradientTop != value)
			{
				this.mGradientTop = value;
				if (this.mApplyGradient)
				{
					this.MarkAsChanged();
				}
			}
		}
	}

	public Color gradientBottom
	{
		get
		{
			return this.mGradientBottom;
		}
		set
		{
			if (this.mGradientBottom != value)
			{
				this.mGradientBottom = value;
				if (this.mApplyGradient)
				{
					this.MarkAsChanged();
				}
			}
		}
	}

	public int spacingX
	{
		get
		{
			return this.mSpacingX;
		}
		set
		{
			if (this.mSpacingX != value)
			{
				this.mSpacingX = value;
				this.MarkAsChanged();
			}
		}
	}

	public int spacingY
	{
		get
		{
			return this.mSpacingY;
		}
		set
		{
			if (this.mSpacingY != value)
			{
				this.mSpacingY = value;
				this.MarkAsChanged();
			}
		}
	}

	private bool keepCrisp
	{
		get
		{
			return this.trueTypeFont != null && this.keepCrispWhenShrunk != UILabel.Crispness.Never && this.keepCrispWhenShrunk == UILabel.Crispness.Always;
		}
	}

	public bool supportEncoding
	{
		get
		{
			return this.mEncoding;
		}
		set
		{
			if (this.mEncoding != value)
			{
				this.mEncoding = value;
				this.shouldBeProcessed = true;
			}
		}
	}

	public NGUIText.SymbolStyle symbolStyle
	{
		get
		{
			return this.mSymbols;
		}
		set
		{
			if (this.mSymbols != value)
			{
				this.mSymbols = value;
				this.shouldBeProcessed = true;
			}
		}
	}

	public UILabel.Overflow overflowMethod
	{
		get
		{
			return this.mOverflow;
		}
		set
		{
			if (this.mOverflow != value)
			{
				this.mOverflow = value;
				this.shouldBeProcessed = true;
			}
		}
	}

	[Obsolete("Use 'width' instead")]
	public int lineWidth
	{
		get
		{
			return base.width;
		}
		set
		{
			base.width = value;
		}
	}

	[Obsolete("Use 'height' instead")]
	public int lineHeight
	{
		get
		{
			return base.height;
		}
		set
		{
			base.height = value;
		}
	}

	public bool multiLine
	{
		get
		{
			return this.mMaxLineCount != 1;
		}
		set
		{
			if (this.mMaxLineCount != 1 != value)
			{
				this.mMaxLineCount = ((!value) ? 1 : 0);
				this.shouldBeProcessed = true;
			}
		}
	}

	public override Vector3[] localCorners
	{
		get
		{
			if (this.shouldBeProcessed)
			{
				this.ProcessText();
			}
			return base.localCorners;
		}
	}

	public override Vector3[] worldCorners
	{
		get
		{
			if (this.shouldBeProcessed)
			{
				this.ProcessText();
			}
			return base.worldCorners;
		}
	}

	public override Vector4 drawingDimensions
	{
		get
		{
			if (this.shouldBeProcessed)
			{
				this.ProcessText();
			}
			return base.drawingDimensions;
		}
	}

	public int maxLineCount
	{
		get
		{
			return this.mMaxLineCount;
		}
		set
		{
			if (this.mMaxLineCount != value)
			{
				this.mMaxLineCount = Mathf.Max(value, 0);
				this.shouldBeProcessed = true;
				if (this.overflowMethod == UILabel.Overflow.ShrinkContent)
				{
					this.MakePixelPerfect();
				}
			}
		}
	}

	public UILabel.Effect effectStyle
	{
		get
		{
			return this.mEffectStyle;
		}
		set
		{
			if (this.mEffectStyle != value)
			{
				this.mEffectStyle = value;
				this.shouldBeProcessed = true;
			}
		}
	}

	public Color effectColor
	{
		get
		{
			return this.mEffectColor;
		}
		set
		{
			if (this.mEffectColor != value)
			{
				this.mEffectColor = value;
				if (this.mEffectStyle != UILabel.Effect.None)
				{
					this.shouldBeProcessed = true;
				}
			}
		}
	}

	public Vector2 effectDistance
	{
		get
		{
			return this.mEffectDistance;
		}
		set
		{
			if (this.mEffectDistance != value)
			{
				this.mEffectDistance = value;
				this.shouldBeProcessed = true;
			}
		}
	}

	[Obsolete("Use 'overflowMethod == UILabel.Overflow.ShrinkContent' instead")]
	public bool shrinkToFit
	{
		get
		{
			return this.mOverflow == UILabel.Overflow.ShrinkContent;
		}
		set
		{
			if (value)
			{
				this.overflowMethod = UILabel.Overflow.ShrinkContent;
			}
		}
	}

	public string processedText
	{
		get
		{
			if (this.mLastWidth != this.mWidth || this.mLastHeight != this.mHeight)
			{
				this.mLastWidth = this.mWidth;
				this.mLastHeight = this.mHeight;
				this.mShouldBeProcessed = true;
			}
			if (this.shouldBeProcessed)
			{
				this.ProcessText();
			}
			return this.mProcessedText;
		}
	}

	public Vector2 printedSize
	{
		get
		{
			if (this.shouldBeProcessed)
			{
				this.ProcessText();
			}
			return this.mCalculatedSize;
		}
	}

	public override Vector2 localSize
	{
		get
		{
			if (this.shouldBeProcessed)
			{
				this.ProcessText();
			}
			return base.localSize;
		}
	}

	private bool isValid
	{
		get
		{
			return this.mFont != null || this.mTrueTypeFont != null;
		}
	}

	public void ChangeFont()
	{
		if (this.bitmapFont == null || Config.NGUIFont == null)
		{
			return;
		}
		if (this.bitmapFont == Config.NGUIFont)
		{
			this.bitmapFont = Config.SnailFont;
		}
	}

	public static string ForceBR(string strContext)
	{
		if (strContext == null)
		{
			return string.Empty;
		}
		string[] array = strContext.Split(UILabel.separater, StringSplitOptions.None);
		if (array != null)
		{
			UILabel.sb.Remove(0, UILabel.sb.Length);
			int num = array.Length;
			for (int i = 0; i < num - 1; i++)
			{
				UILabel.sb.Append(array[i]);
				UILabel.sb.Append("\n");
			}
			UILabel.sb.Append(array[num - 1]);
			return UILabel.sb.ToString();
		}
		return strContext;
	}

	protected override void OnInit()
	{
		base.OnInit();
		UILabel.mList.Add(this);
		this.SetActiveFont(this.trueTypeFont);
	}

	public override bool CheckLoadAtlas(OnUIWidgetAtlasLoaded onLoaded, UIWidget[] spList, OnUIWidgetAtlasAllLoaded onAllLoaded, GameObject oGo, params object[] args)
	{
		if (this.bitmapFont == null)
		{
			return false;
		}
		if (this.bitmapFont.atlas != null && this.bitmapFont.atlas.spriteMaterial == null)
		{
			this.monLoaded = onLoaded;
			this.mspList = spList;
			this.monAllLoaded = onAllLoaded;
			this.moGo = oGo;
			this.margs = args;
			this.LoadAtlas(this.bitmapFont.atlas.name);
			return true;
		}
		return false;
	}

	public override bool CheckWaitLoadingAtlas()
	{
		return !(this.bitmapFont == null) && this.bitmapFont.atlas != null && this.bitmapFont.atlas.spriteMaterial == null;
	}

	public static void SetLoadAssetCall(UILabel.CallLoadAsset call)
	{
		UILabel.monLoadAsset = call;
	}

	private void LoadAtlas(string strAtlasName)
	{
		if (Application.isPlaying)
		{
			string text = "Parts/Atlas/" + strAtlasName;
			if (UILabel.monLoadAsset != null)
			{
				UILabel.monLoadAsset(text, new AssetCallBack(this.OnFileLoaded));
			}
			else
			{
				UnityEngine.Object @object = Resources.Load(text);
				this.OnFileLoaded(new object[]
				{
					@object
				});
			}
		}
	}

	private void OnFileLoaded(params object[] args)
	{
		AtlasAsset atlasAsset = args[0] as AtlasAsset;
		if (atlasAsset == null)
		{
			if (this.monLoaded != null)
			{
				this.monLoaded(this.mspList, this.monAllLoaded, this.moGo, this.margs);
				this.mspList = null;
				this.moGo = null;
				this.monLoaded = null;
				this.monAllLoaded = null;
				this.margs = null;
			}
			return;
		}
		if (this.bitmapFont.atlas != null)
		{
			this.bitmapFont.atlas.spriteMaterial = atlasAsset.material;
			this.bitmapFont.atlas.MarkAsChanged();
		}
		if (this.monLoaded != null)
		{
			this.monLoaded(this.mspList, this.monAllLoaded, this.moGo, this.margs);
			this.mspList = null;
			this.moGo = null;
			this.monLoaded = null;
			this.monAllLoaded = null;
			this.margs = null;
		}
	}

	protected override void OnDisable()
	{
		this.SetActiveFont(null);
		UILabel.mList.Remove(this);
		base.OnDisable();
	}

	protected void SetActiveFont(Font fnt)
	{
		if (this.mActiveTTF != fnt)
		{
			if (this.mActiveTTF != null)
			{
				int num;
				if (UILabel.mFontUsage.TryGetValue(this.mActiveTTF, out num))
				{
					num = Mathf.Max(0, --num);
					if (num == 0)
					{
						Font.textureRebuilt -= new Action<Font>(UILabel.OnFontTextureChanged);
						UILabel.mFontUsage.Remove(this.mActiveTTF);
					}
					else
					{
						UILabel.mFontUsage[this.mActiveTTF] = num;
					}
				}
				else
				{
					Font.textureRebuilt -= new Action<Font>(UILabel.OnFontTextureChanged);
				}
			}
			this.mActiveTTF = fnt;
			if (this.mActiveTTF != null)
			{
				int num2 = 0;
				if (!UILabel.mFontUsage.TryGetValue(this.mActiveTTF, out num2))
				{
					Font.textureRebuilt += new Action<Font>(UILabel.OnFontTextureChanged);
				}
				num2 = (UILabel.mFontUsage[this.mActiveTTF] = num2 + 1);
			}
		}
	}

	private static void OnFontTextureChanged(Font font)
	{
		for (int i = 0; i < UILabel.mList.size; i++)
		{
			UILabel uILabel = UILabel.mList[i];
			if (uILabel != null)
			{
				Font trueTypeFont = uILabel.trueTypeFont;
				if (trueTypeFont == font)
				{
					trueTypeFont.RequestCharactersInTexture(uILabel.mText, uILabel.mPrintedSize, uILabel.mFontStyle);
					uILabel.MarkAsChanged();
				}
			}
		}
		for (int j = 0; j < UILabel.mList.size; j++)
		{
			UILabel uILabel2 = UILabel.mList[j];
			if (uILabel2 != null)
			{
				Font trueTypeFont2 = uILabel2.trueTypeFont;
				if (trueTypeFont2 == font)
				{
					uILabel2.RemoveFromPanel();
					uILabel2.CreatePanel();
				}
			}
		}
	}

	public override Vector3[] GetSides(Transform relativeTo)
	{
		if (this.shouldBeProcessed)
		{
			this.ProcessText();
		}
		return base.GetSides(relativeTo);
	}

	protected override void UpgradeFrom265()
	{
		this.ProcessText(true, true);
		if (this.mShrinkToFit)
		{
			this.overflowMethod = UILabel.Overflow.ShrinkContent;
			this.mMaxLineCount = 0;
		}
		if (this.mMaxLineWidth != 0)
		{
			base.width = this.mMaxLineWidth;
			this.overflowMethod = ((this.mMaxLineCount <= 0) ? UILabel.Overflow.ShrinkContent : UILabel.Overflow.ResizeHeight);
		}
		else
		{
			this.overflowMethod = UILabel.Overflow.ResizeFreely;
		}
		if (this.mMaxLineHeight != 0)
		{
			base.height = this.mMaxLineHeight;
		}
		if (this.mFont != null)
		{
			int defaultSize = this.mFont.defaultSize;
			if (base.height < defaultSize)
			{
				base.height = defaultSize;
			}
		}
		this.mMaxLineWidth = 0;
		this.mMaxLineHeight = 0;
		this.mShrinkToFit = false;
		if (base.GetComponent<BoxCollider>() != null)
		{
			NGUITools.AddWidgetCollider(base.gameObject, true);
		}
	}

	protected override void OnAnchor()
	{
		if (this.mOverflow == UILabel.Overflow.ResizeFreely)
		{
			if (base.isFullyAnchored)
			{
				this.mOverflow = UILabel.Overflow.ShrinkContent;
			}
		}
		else if (this.mOverflow == UILabel.Overflow.ResizeHeight && this.topAnchor.target != null && this.bottomAnchor.target != null)
		{
			this.mOverflow = UILabel.Overflow.ShrinkContent;
		}
		base.OnAnchor();
	}

	private void ProcessAndRequest()
	{
		if (this.ambigiousFont != null)
		{
			this.ProcessText();
		}
	}

	protected override void OnStart()
	{
		base.OnStart();
		this.shouldBeProcessed = true;
		if (this.mLineWidth > 0f)
		{
			this.mMaxLineWidth = Mathf.RoundToInt(this.mLineWidth);
			this.mLineWidth = 0f;
		}
		if (!this.mMultiline)
		{
			this.mMaxLineCount = 1;
			this.mMultiline = true;
		}
		this.mPremultiply = (this.material != null && this.material.shader != null && this.material.shader.name.Contains("Premultiplied"));
		this.ProcessAndRequest();
	}

	public override void MarkAsChanged()
	{
		this.shouldBeProcessed = true;
		base.MarkAsChanged();
	}

	private void ProcessText()
	{
		this.ProcessText(false, true);
	}

	private void ProcessText(bool legacyMode, bool full)
	{
		if (!this.isValid)
		{
			return;
		}
		this.mChanged = true;
		this.shouldBeProcessed = false;
		NGUIText.rectWidth = ((!legacyMode) ? base.width : ((this.mMaxLineWidth == 0) ? 1000000 : this.mMaxLineWidth));
		NGUIText.rectHeight = ((!legacyMode) ? base.height : ((this.mMaxLineHeight == 0) ? 1000000 : this.mMaxLineHeight));
		this.mPrintedSize = Mathf.Abs((!legacyMode) ? this.defaultFontSize : Mathf.RoundToInt(base.cachedTransform.localScale.x));
		this.mScale = 1f;
		if (NGUIText.rectWidth < 1 || NGUIText.rectHeight < 0)
		{
			this.mProcessedText = string.Empty;
			return;
		}
		bool flag = this.trueTypeFont != null;
		if (flag && this.keepCrisp)
		{
			UIRoot root = base.root;
			if (root != null)
			{
				this.mDensity = ((!(root != null)) ? 1f : root.pixelSizeAdjustment);
			}
		}
		else
		{
			this.mDensity = 1f;
		}
		if (full)
		{
			this.UpdateNGUIText();
		}
		if (this.mOverflow == UILabel.Overflow.ResizeFreely)
		{
			NGUIText.rectWidth = 1000000;
		}
		if (this.mOverflow == UILabel.Overflow.ResizeFreely || this.mOverflow == UILabel.Overflow.ResizeHeight)
		{
			NGUIText.rectHeight = 1000000;
		}
		if (this.mPrintedSize > 0)
		{
			bool keepCrisp = this.keepCrisp;
			for (int i = this.mPrintedSize; i > 0; i--)
			{
				if (keepCrisp)
				{
					this.mPrintedSize = i;
					NGUIText.fontSize = this.mPrintedSize;
				}
				else
				{
					this.mScale = (float)i / (float)this.mPrintedSize;
					NGUIText.fontScale = ((!flag) ? ((float)this.mFontSize / (float)this.mFont.defaultSize * this.mScale) : this.mScale);
				}
				NGUIText.Update(false);
				if (this.mOriginalText != string.Empty)
				{
					if (UILabel.moQuery != null)
					{
						this.mText = UILabel.moQuery(this.mOriginalText);
					}
					else
					{
						this.mText = this.mOriginalText;
					}
				}
				bool flag2;
				if (this.mIntConvert && UILabel.intConvertFunc != null)
				{
					if (string.IsNullOrEmpty(this.mText) || string.IsNullOrEmpty(this.mText.Trim()))
					{
						flag2 = NGUIText.CustomWrapText(this.mText, out this.mProcessedText);
					}
					else
					{
						flag2 = NGUIText.CustomWrapText(UILabel.intConvertFunc(this.mText), out this.mProcessedText);
					}
				}
				else
				{
					flag2 = NGUIText.CustomWrapText(this.mText, out this.mProcessedText);
				}
				if (this.mOverflow != UILabel.Overflow.ShrinkContent || flag2)
				{
					if (this.mOverflow == UILabel.Overflow.ResizeFreely)
					{
						this.mCalculatedSize = NGUIText.CalculatePrintedSize(this.mProcessedText);
						this.mWidth = Mathf.Max(this.minWidth, Mathf.RoundToInt(this.mCalculatedSize.x));
						this.mHeight = Mathf.Max(this.minHeight, Mathf.RoundToInt(this.mCalculatedSize.y));
						if ((this.mWidth & 1) == 1)
						{
							this.mWidth++;
						}
						if ((this.mHeight & 1) == 1)
						{
							this.mHeight++;
						}
					}
					else if (this.mOverflow == UILabel.Overflow.ResizeHeight)
					{
						this.mCalculatedSize = NGUIText.CalculatePrintedSize(this.mProcessedText);
						this.mHeight = Mathf.Max(this.minHeight, Mathf.RoundToInt(this.mCalculatedSize.y));
						if ((this.mHeight & 1) == 1)
						{
							this.mHeight++;
						}
					}
					else
					{
						this.mCalculatedSize = NGUIText.CalculatePrintedSize(this.mProcessedText);
					}
					if (legacyMode)
					{
						base.width = Mathf.RoundToInt(this.mCalculatedSize.x);
						base.height = Mathf.RoundToInt(this.mCalculatedSize.y);
						base.cachedTransform.localScale = Vector3.one;
					}
					break;
				}
				if (--i <= 1)
				{
					break;
				}
			}
		}
		else
		{
			base.cachedTransform.localScale = Vector3.one;
			this.mProcessedText = string.Empty;
			this.mScale = 1f;
		}
	}

	public static string ConvertNumber(long value)
	{
		long num = 100000000L;
		long num2 = 10000L;
		if (value >= num)
		{
			return UILabel.StringBuilder(new object[]
			{
				value / num,
				UILabel.GetUIString("UI230114")
			});
		}
		if (value >= num2)
		{
			return UILabel.StringBuilder(new object[]
			{
				value / num2 + UILabel.GetUIString("UI230113")
			});
		}
		return value.ToString();
	}

	public static string StringBuilder(params object[] args)
	{
		UILabel.mstrbuilder.Remove(0, UILabel.mstrbuilder.Length);
		if (args != null)
		{
			int num = args.Length;
			for (int i = 0; i < num; i++)
			{
				UILabel.mstrbuilder.Append(args[i]);
			}
		}
		return UILabel.mstrbuilder.ToString();
	}

	public static void SetQueryString(UILabel.OnQueryString onQueryString)
	{
		UILabel.moQuery = onQueryString;
	}

	public static string GetUIString(string strTxt)
	{
		if (UILabel.moQuery != null)
		{
			return UILabel.moQuery(strTxt);
		}
		return string.Empty;
	}

	public override void MakePixelPerfect()
	{
		if (this.ambigiousFont != null)
		{
			Vector3 localPosition = base.cachedTransform.localPosition;
			localPosition.x = (float)Mathf.RoundToInt(localPosition.x);
			localPosition.y = (float)Mathf.RoundToInt(localPosition.y);
			localPosition.z = (float)Mathf.RoundToInt(localPosition.z);
			base.cachedTransform.localPosition = localPosition;
			base.cachedTransform.localScale = Vector3.one;
			if (this.mOverflow == UILabel.Overflow.ResizeFreely)
			{
				this.AssumeNaturalSize();
			}
			else
			{
				int width = base.width;
				int height = base.height;
				UILabel.Overflow overflow = this.mOverflow;
				this.mOverflow = UILabel.Overflow.ShrinkContent;
				this.mWidth = 100000;
				this.mHeight = 100000;
				this.ProcessText(false, true);
				this.mOverflow = overflow;
				int num = Mathf.RoundToInt(this.mCalculatedSize.x);
				int num2 = Mathf.RoundToInt(this.mCalculatedSize.y);
				num = Mathf.Max(num, base.minWidth);
				num2 = Mathf.Max(num2, base.minHeight);
				this.mWidth = Mathf.Max(width, num);
				this.mHeight = Mathf.Max(height, num2);
				this.MarkAsChanged();
			}
		}
		else
		{
			base.MakePixelPerfect();
		}
	}

	public void AssumeNaturalSize()
	{
		if (this.ambigiousFont != null)
		{
			this.mWidth = 100000;
			this.mHeight = 100000;
			this.ProcessText(false, true);
			this.mWidth = Mathf.RoundToInt(this.mCalculatedSize.x);
			this.mHeight = Mathf.RoundToInt(this.mCalculatedSize.y);
			if ((this.mWidth & 1) == 1)
			{
				this.mWidth++;
			}
			if ((this.mHeight & 1) == 1)
			{
				this.mHeight++;
			}
			this.MarkAsChanged();
		}
	}

	[Obsolete("Use UILabel.GetCharacterAtPosition instead")]
	public int GetCharacterIndex(Vector3 worldPos)
	{
		return this.GetCharacterIndexAtPosition(worldPos);
	}

	[Obsolete("Use UILabel.GetCharacterAtPosition instead")]
	public int GetCharacterIndex(Vector2 localPos)
	{
		return this.GetCharacterIndexAtPosition(localPos);
	}

	public int GetCharacterIndexAtPosition(Vector3 worldPos)
	{
		Vector2 localPos = base.cachedTransform.InverseTransformPoint(worldPos);
		return this.GetCharacterIndexAtPosition(localPos);
	}

	public int GetCharacterIndexAtPosition(Vector2 localPos)
	{
		if (this.isValid)
		{
			string processedText = this.processedText;
			if (string.IsNullOrEmpty(processedText))
			{
				return 0;
			}
			this.UpdateNGUIText();
			NGUIText.PrintCharacterPositions(processedText, UILabel.mTempVerts, UILabel.mTempIndices);
			if (UILabel.mTempVerts.size > 0)
			{
				this.ApplyOffset(UILabel.mTempVerts, 0);
				int num = NGUIText.GetClosestCharacter(UILabel.mTempVerts, localPos);
				num = UILabel.mTempIndices[num];
				UILabel.mTempVerts.Clear();
				UILabel.mTempIndices.Clear();
				return num;
			}
		}
		return 0;
	}

	public string GetWordAtPosition(Vector3 worldPos)
	{
		return this.GetWordAtCharacterIndex(this.GetCharacterIndexAtPosition(worldPos));
	}

	public string GetWordAtPosition(Vector2 localPos)
	{
		return this.GetWordAtCharacterIndex(this.GetCharacterIndexAtPosition(localPos));
	}

	public string GetWordAtCharacterIndex(int characterIndex)
	{
		if (characterIndex != -1 && characterIndex < this.mText.Length)
		{
			int num = this.mText.LastIndexOf(' ', characterIndex) + 1;
			int num2 = this.mText.IndexOf(' ', characterIndex);
			if (num2 == -1)
			{
				num2 = this.mText.Length;
			}
			if (num != num2)
			{
				string text = this.mText.Substring(num, num2 - num);
				return NGUIText.StripSymbols(text);
			}
		}
		return null;
	}

	public string GetUrlAtPosition(Vector3 worldPos)
	{
		return this.GetUrlAtCharacterIndex(this.GetCharacterIndexAtPosition(worldPos));
	}

	public string GetUrlAtPosition(Vector2 localPos)
	{
		return this.GetUrlAtCharacterIndex(this.GetCharacterIndexAtPosition(localPos));
	}

	public string GetUrlAtCharacterIndex(int characterIndex)
	{
		if (characterIndex != -1 && characterIndex < this.mText.Length)
		{
			int num = this.mText.LastIndexOf("[url=", characterIndex);
			if (num != -1)
			{
				num += 5;
				int num2 = this.mText.IndexOf("]", num);
				if (num2 != -1)
				{
					int num3 = this.mText.IndexOf("[/url]", num2);
					if (num3 == -1 || num3 >= characterIndex)
					{
						return this.mText.Substring(num, num2 - num);
					}
				}
			}
		}
		return null;
	}

	public int GetCharacterIndex(int currentIndex, KeyCode key)
	{
		if (this.isValid)
		{
			string processedText = this.processedText;
			if (string.IsNullOrEmpty(processedText))
			{
				return 0;
			}
			int defaultFontSize = this.defaultFontSize;
			this.UpdateNGUIText();
			NGUIText.PrintCharacterPositions(processedText, UILabel.mTempVerts, UILabel.mTempIndices);
			if (UILabel.mTempVerts.size > 0)
			{
				this.ApplyOffset(UILabel.mTempVerts, 0);
				int i = 0;
				while (i < UILabel.mTempIndices.size)
				{
					if (UILabel.mTempIndices[i] == currentIndex)
					{
						Vector2 pos = UILabel.mTempVerts[i];
						if (key == KeyCode.UpArrow)
						{
							pos.y += (float)(defaultFontSize + this.spacingY);
						}
						else if (key == KeyCode.DownArrow)
						{
							pos.y -= (float)(defaultFontSize + this.spacingY);
						}
						else if (key == KeyCode.Home)
						{
							pos.x -= 1000f;
						}
						else if (key == KeyCode.End)
						{
							pos.x += 1000f;
						}
						int num = NGUIText.GetClosestCharacter(UILabel.mTempVerts, pos);
						num = UILabel.mTempIndices[num];
						if (num == currentIndex)
						{
							break;
						}
						UILabel.mTempVerts.Clear();
						UILabel.mTempIndices.Clear();
						return num;
					}
					else
					{
						i++;
					}
				}
				UILabel.mTempVerts.Clear();
				UILabel.mTempIndices.Clear();
			}
			if (key == KeyCode.UpArrow || key == KeyCode.Home)
			{
				return 0;
			}
			if (key == KeyCode.DownArrow || key == KeyCode.End)
			{
				return processedText.Length;
			}
		}
		return currentIndex;
	}

	public void PrintOverlay(int start, int end, UIGeometry caret, UIGeometry highlight, Color caretColor, Color highlightColor)
	{
		if (caret != null)
		{
			caret.Clear();
		}
		if (highlight != null)
		{
			highlight.Clear();
		}
		if (!this.isValid)
		{
			return;
		}
		string processedText = this.processedText;
		this.UpdateNGUIText();
		int size = caret.verts.size;
		Vector2 item;
		item.x = 0.5f;
		item.y = 0.5f;
		float finalAlpha = this.finalAlpha;
		if (highlight != null && start != end)
		{
			int size2 = highlight.verts.size;
			NGUIText.PrintCaretAndSelection(processedText, start, end, caret.verts, highlight.verts);
			if (highlight.verts.size > size2)
			{
				this.ApplyOffset(highlight.verts, size2);
				Color32 item2;
				item2.r = (byte)highlightColor.r;
				item2.g = (byte)highlightColor.g;
				item2.b = (byte)highlightColor.b;
				item2.a = (byte)(highlightColor.a * finalAlpha);
				for (int i = size2; i < highlight.verts.size; i++)
				{
					highlight.uvs.Add(item);
					highlight.cols.Add(item2);
				}
			}
		}
		else
		{
			NGUIText.PrintCaretAndSelection(processedText, start, end, caret.verts, null);
		}
		this.ApplyOffset(caret.verts, size);
		Color32 item3 = new Color(caretColor.r, caretColor.g, caretColor.b, caretColor.a * finalAlpha);
		item3.r = (byte)caretColor.r;
		item3.g = (byte)caretColor.g;
		item3.b = (byte)caretColor.b;
		item3.a = (byte)(caretColor.a * finalAlpha);
		for (int j = size; j < caret.verts.size; j++)
		{
			caret.uvs.Add(item);
			caret.cols.Add(item3);
		}
	}

	public override void OnFill(BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols)
	{
		if (!this.isValid)
		{
			return;
		}
		int start = verts.size;
		Color color = base.color;
		color.a = this.finalAlpha;
		if (this.mFont != null && this.mFont.premultipliedAlphaShader)
		{
			color = NGUITools.ApplyPMA(color);
		}
		string processedText = this.processedText;
		int size = verts.size;
		this.UpdateNGUIText();
		NGUIText.tint = color;
		NGUIText.Print(processedText, verts, uvs, cols);
		Vector2 vector = this.ApplyOffset(verts, size);
		if (this.mFont != null && this.mFont.packedFontShader)
		{
			return;
		}
		if (this.effectStyle != UILabel.Effect.None)
		{
			int size2 = verts.size;
			vector.x = this.mEffectDistance.x;
			vector.y = this.mEffectDistance.y;
			this.ApplyShadow(verts, uvs, cols, start, size2, vector.x, -vector.y);
			if (this.effectStyle == UILabel.Effect.Outline)
			{
				start = size2;
				size2 = verts.size;
				this.ApplyShadow(verts, uvs, cols, start, size2, -vector.x, vector.y);
				start = size2;
				size2 = verts.size;
				this.ApplyShadow(verts, uvs, cols, start, size2, vector.x, vector.y);
				start = size2;
				size2 = verts.size;
				this.ApplyShadow(verts, uvs, cols, start, size2, -vector.x, -vector.y);
			}
		}
		if (this.m_symbolOffset != null)
		{
			this.m_symbolOffset();
		}
	}

	public void SetSymbolOffset(Action call)
	{
		this.m_symbolOffset = call;
	}

	protected Vector2 ApplyOffset(BetterList<Vector3> verts, int start)
	{
		Vector2 pivotOffset = base.pivotOffset;
		float num = Mathf.Lerp(0f, (float)(-(float)this.mWidth), pivotOffset.x);
		float num2 = Mathf.Lerp((float)this.mHeight, 0f, pivotOffset.y) + Mathf.Lerp(this.mCalculatedSize.y - (float)this.mHeight, 0f, pivotOffset.y);
		num = Mathf.Round(num);
		num2 = Mathf.Round(num2);
		for (int i = start; i < verts.size; i++)
		{
			Vector3[] expr_80_cp_0 = verts.buffer;
			int expr_80_cp_1 = i;
			expr_80_cp_0[expr_80_cp_1].x = expr_80_cp_0[expr_80_cp_1].x + num;
			Vector3[] expr_99_cp_0 = verts.buffer;
			int expr_99_cp_1 = i;
			expr_99_cp_0[expr_99_cp_1].y = expr_99_cp_0[expr_99_cp_1].y + num2;
		}
		Vector2 zero = Vector2.zero;
		zero.x = num;
		zero.y = num2;
		return zero;
	}

	private void ApplyShadow(BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols, int start, int end, float x, float y)
	{
		Color color = this.mEffectColor;
		color.a *= this.finalAlpha;
		Color32 color2 = (!(this.bitmapFont != null) || !this.bitmapFont.premultipliedAlphaShader) ? color : NGUITools.ApplyPMA(color);
		for (int i = start; i < end; i++)
		{
			verts.Add(verts.buffer[i]);
			uvs.Add(uvs.buffer[i]);
			cols.Add(cols.buffer[i]);
			Vector3 vector = verts.buffer[i];
			vector.x += x;
			vector.y += y;
			verts.buffer[i] = vector;
			cols.buffer[i] = color2;
		}
	}

	public int CalculateOffsetToFit(string text)
	{
		this.UpdateNGUIText();
		NGUIText.encoding = false;
		NGUIText.symbolStyle = NGUIText.SymbolStyle.None;
		return NGUIText.CalculateOffsetToFit(text);
	}

	public void SetCurrentProgress()
	{
		if (UIProgressBar.current != null)
		{
			this.text = UIProgressBar.current.value.ToString("F");
		}
	}

	public void SetCurrentPercent()
	{
		if (UIProgressBar.current != null)
		{
			this.text = Mathf.RoundToInt(UIProgressBar.current.value * 100f) + "%";
		}
	}

	public void SetCustomProgress()
	{
		if (UIProgressBar.current != null)
		{
			float num = UIProgressBar.current.value;
			if (num <= 0.1f)
			{
				num = 0.1f;
			}
			else if ((double)num >= 0.9)
			{
				num = 0.9f;
			}
			this.text = Mathf.RoundToInt(num * 100f) + string.Empty;
		}
	}

	public void SetCustomVoiceProgress()
	{
		if (UIProgressBar.current != null)
		{
			float value = UIProgressBar.current.value;
			UIProgressBar.current.value = (float)Math.Round((double)value, 1);
			this.text = Math.Round((double)value, 1) * 100.0 + string.Empty;
		}
	}

	public void SetCustomScreenCount()
	{
		if (UIProgressBar.current != null)
		{
			float value = UIProgressBar.current.value;
			int num = Mathf.RoundToInt(value * 50f);
			if (num < 10)
			{
				num = 10;
			}
			else if (num > 50)
			{
				num = 50;
			}
			this.text = num + string.Empty;
		}
	}

	public void SetCurrentSelection()
	{
		if (UIPopupList.current != null)
		{
			this.text = ((!UIPopupList.current.isLocalized) ? UIPopupList.current.value : Localization.Get(UIPopupList.current.value));
		}
	}

	public bool Wrap(string text, out string final)
	{
		return this.Wrap(text, out final, 1000000);
	}

	public bool Wrap(string text, out string final, int height)
	{
		this.UpdateNGUIText();
		return NGUIText.WrapText(text, out final);
	}

	public void UpdateNGUIText()
	{
		Font trueTypeFont = this.trueTypeFont;
		bool flag = trueTypeFont != null;
		NGUIText.fontSize = this.mPrintedSize;
		NGUIText.fontStyle = this.mFontStyle;
		NGUIText.rectWidth = this.mWidth;
		NGUIText.rectHeight = this.mHeight;
		NGUIText.gradient = (this.mApplyGradient && (this.mFont == null || !this.mFont.packedFontShader));
		NGUIText.gradientTop = this.mGradientTop;
		NGUIText.gradientBottom = this.mGradientBottom;
		NGUIText.encoding = this.mEncoding;
		NGUIText.premultiply = this.mPremultiply;
		NGUIText.symbolStyle = this.mSymbols;
		NGUIText.maxLines = this.mMaxLineCount;
		NGUIText.spacingX = (float)this.mSpacingX;
		NGUIText.spacingY = (float)this.mSpacingY;
		NGUIText.fontScale = ((!flag) ? ((float)this.mFontSize / (float)this.mFont.defaultSize * this.mScale) : this.mScale);
		if (this.mFont != null)
		{
			NGUIText.bitmapFont = this.mFont;
			while (true)
			{
				UIFont replacement = NGUIText.bitmapFont.replacement;
				if (replacement == null)
				{
					break;
				}
				NGUIText.bitmapFont = replacement;
			}
			if (NGUIText.bitmapFont.isDynamic)
			{
				NGUIText.dynamicFont = NGUIText.bitmapFont.dynamicFont;
				NGUIText.bitmapFont = null;
			}
			else
			{
				NGUIText.dynamicFont = null;
			}
		}
		else
		{
			NGUIText.dynamicFont = trueTypeFont;
			NGUIText.bitmapFont = null;
		}
		if (flag && this.keepCrisp)
		{
			UIRoot root = base.root;
			if (root != null)
			{
				NGUIText.pixelDensity = ((!(root != null)) ? 1f : root.pixelSizeAdjustment);
			}
		}
		else
		{
			NGUIText.pixelDensity = 1f;
		}
		if (this.mDensity != NGUIText.pixelDensity)
		{
			this.ProcessText(false, false);
			NGUIText.rectWidth = this.mWidth;
			NGUIText.rectHeight = this.mHeight;
		}
		if (this.alignment == NGUIText.Alignment.Automatic)
		{
			UIWidget.Pivot pivot = base.pivot;
			if (pivot == UIWidget.Pivot.Left || pivot == UIWidget.Pivot.TopLeft || pivot == UIWidget.Pivot.BottomLeft)
			{
				NGUIText.alignment = NGUIText.Alignment.Left;
			}
			else if (pivot == UIWidget.Pivot.Right || pivot == UIWidget.Pivot.TopRight || pivot == UIWidget.Pivot.BottomRight)
			{
				NGUIText.alignment = NGUIText.Alignment.Right;
			}
			else
			{
				NGUIText.alignment = NGUIText.Alignment.Center;
			}
		}
		else
		{
			NGUIText.alignment = this.alignment;
		}
		NGUIText.Update();
	}
}


text:
package org.locationtech.geomesa.jobs.index

import cascading.tuple.Tuple
import com.twitter.scalding.{Args, Mode, Source}
import org.apache.accumulo.core.data.Mutation
import org.apache.hadoop.io.Text
import org.geotools.data.DataStoreFinder
import org.geotools.feature.DefaultFeatureCollection
import org.junit.runner.RunWith
import org.locationtech.geomesa.accumulo.data.AccumuloFeatureWriter.FeatureToWrite
import org.locationtech.geomesa.accumulo.data.tables.AttributeTable
import org.locationtech.geomesa.accumulo.data.{AccumuloDataStore, AccumuloFeatureStore}
import org.locationtech.geomesa.accumulo.index._
import org.locationtech.geomesa.features.{ScalaSimpleFeatureFactory, SimpleFeatureSerializers}
import org.locationtech.geomesa.jobs.index.AttributeIndexJob._
import org.locationtech.geomesa.jobs.scalding.{AccumuloSource, ConnectionParams, GeoMesaSource}
import org.locationtech.geomesa.utils.geotools.RichAttributeDescriptors.RichAttributeDescriptor
import org.locationtech.geomesa.utils.geotools.RichSimpleFeatureType.RichSimpleFeatureType
import org.locationtech.geomesa.utils.geotools.SimpleFeatureTypes
import org.locationtech.geomesa.utils.stats.IndexCoverage
import org.opengis.feature.simple.{SimpleFeature, SimpleFeatureType}
import org.specs2.mutable.Specification
import org.specs2.runner.JUnitRunner

import scala.collection.JavaConversions._
import scala.collection.mutable

@RunWith(classOf[JUnitRunner])
class AttributeIndexJobTest extends Specification {

  val tableName = "AttributeIndexJobTest"
  val params = Map(
    "instanceId"        -> "mycloud",
    "zookeepers"        -> "zoo1,zoo2,zoo3",
    "user"              -> "myuser",
    "password"          -> "mypassword",
    "auths"             -> "",
    "tableName"         -> tableName,
    "useMock"           -> "true")

  val ds = DataStoreFinder.getDataStore(params).asInstanceOf[AccumuloDataStore]

  def test(schema: SimpleFeatureType, feats: Seq[SimpleFeature]) = {
    ds.createSchema(schema)
    val sft = ds.getSchema(schema.getTypeName)
    ds.getFeatureSource(sft.getTypeName).asInstanceOf[AccumuloFeatureStore].addFeatures {
      val collection = new DefaultFeatureCollection(sft.getTypeName, sft)
      collection.addAll(feats)
      collection
    }

    val jobParams = Map(ATTRIBUTES_TO_INDEX -> List("name"),
                        INDEX_COVERAGE -> List("join"),
                        ConnectionParams.FEATURE_IN -> List(sft.getTypeName))
    val scaldingArgs = new Args(ConnectionParams.toInArgs(params) ++ jobParams)

    val input = feats.map(f => new Tuple(new Text(f.getID), f)).toBuffer
    val output = mutable.Buffer.empty[Tuple]
    val buffers: (Source) => Option[mutable.Buffer[Tuple]] = {
      case gs: GeoMesaSource  => Some(input)
      case as: AccumuloSource => Some(output)
    }
    val arguments = Mode.putMode(com.twitter.scalding.Test(buffers), scaldingArgs)

    // create the output table - in non-mock environments this happens in the output format
    ds.connector.tableOperations().create(AttributeTable.formatTableName(tableName, sft))

    // run the job
    val job = new AttributeIndexJob(arguments)
    job.run must beTrue

    val indexValueEncoder = IndexValueEncoder(sft)
    val encoder = SimpleFeatureSerializers(sft, ds.getFeatureEncoding(sft))

    sft.getDescriptor("name").setIndexCoverage(IndexCoverage.JOIN)
    val writer = AttributeTable.writer(sft)
    val expectedMutations = feats.flatMap { sf =>
      val toWrite = new FeatureToWrite(sf, ds.writeVisibilities, encoder, indexValueEncoder)
      writer(toWrite)
    }

    val jobMutations = output.map(_.getObject(1).asInstanceOf[Mutation])
    jobMutations must containTheSameElementsAs(expectedMutations)
  }

  val spec = "name:String,dtg:Date,*geom:Point:srid=4326"
  def getTestFeatures(sft: SimpleFeatureType) = {
    (0 until 10).map { i =>
      val name = s"name$i"
      val dtg = s"2014-01-0${i}T00:00:00.000Z"
      val geom = s"POINT(${40 + i} ${60 - i})"
      ScalaSimpleFeatureFactory.buildFeature(sft, Array(name, dtg, geom), s"fid-$i")
    } ++ (10 until 20).map { i =>
      val name = null
      val dtg = s"2014-01-${i}T00:00:00.000Z"
      val geom = s"POINT(${40 + i} ${60 - i})"
      ScalaSimpleFeatureFactory.buildFeature(sft, Array(name, dtg, geom), s"fid-$i")
    }
  }

  "AccumuloIndexJob" should {
    "create the correct mutation for a stand-alone feature" in {
      val sft = SimpleFeatureTypes.createType("1", spec)
      sft.setTableSharing(false)
      test(sft, getTestFeatures(sft))
    }

    "create the correct mutation for a shared-table feature" in {
      val sft = SimpleFeatureTypes.createType("2", spec)
      sft.setTableSharing(true)
      test(sft, getTestFeatures(sft))
    }
  }
}


text:
<?php
/**
 * Portable PHP password hashing framework.
 * @package phpass
 * @since 2.5
 * @version 0.1
 * @link http://www.openwall.com/phpass/
 */

#
# Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
# the public domain.
#
# There's absolutely no warranty.
#
# Please be sure to update the Version line if you edit this file in any way.
# It is suggested that you leave the main version number intact, but indicate
# your project name (after the slash) and add your own revision information.
#
# Please do not change the "private" password hashing method implemented in
# here, thereby making your hashes incompatible.  However, if you must, please
# change the hash type identifier (the "$P$") to something different.
#
# Obviously, since this code is in the public domain, the above are not
# requirements (there can be none), but merely suggestions.
#

/**
 * Portable PHP password hashing framework.
 *
 * @package phpass
 * @version 0.1 / genuine
 * @link http://www.openwall.com/phpass/
 * @since 2.5
 */
class PasswordHash {
	var $itoa64;
	var $iteration_count_log2;
	var $portable_hashes;
	var $random_state;

	function PasswordHash($iteration_count_log2, $portable_hashes)
	{
		$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

		if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
			$iteration_count_log2 = 8;
		$this->iteration_count_log2 = $iteration_count_log2;

		$this->portable_hashes = $portable_hashes;

		$this->random_state = microtime() . (function_exists('getmypid') ? getmypid() : '') . uniqid(rand(), TRUE);

	}

	function get_random_bytes($count)
	{
		$output = '';
		if (($fh = @fopen('/dev/urandom', 'rb'))) {
			$output = fread($fh, $count);
			fclose($fh);
		}

		if (strlen($output) < $count) {
			$output = '';
			for ($i = 0; $i < $count; $i += 16) {
				$this->random_state =
				    md5(microtime() . $this->random_state);
				$output .=
				    pack('H*', md5($this->random_state));
			}
			$output = substr($output, 0, $count);
		}

		return $output;
	}

	function encode64($input, $count)
	{
		$output = '';
		$i = 0;
		do {
			$value = ord($input[$i++]);
			$output .= $this->itoa64[$value & 0x3f];
			if ($i < $count)
				$value |= ord($input[$i]) << 8;
			$output .= $this->itoa64[($value >> 6) & 0x3f];
			if ($i++ >= $count)
				break;
			if ($i < $count)
				$value |= ord($input[$i]) << 16;
			$output .= $this->itoa64[($value >> 12) & 0x3f];
			if ($i++ >= $count)
				break;
			$output .= $this->itoa64[($value >> 18) & 0x3f];
		} while ($i < $count);

		return $output;
	}

	function gensalt_private($input)
	{
		$output = '$P$';
		$output .= $this->itoa64[min($this->iteration_count_log2 +
			((PHP_VERSION >= '5') ? 5 : 3), 30)];
		$output .= $this->encode64($input, 6);

		return $output;
	}

	function crypt_private($password, $setting)
	{
		$output = '*0';
		if (substr($setting, 0, 2) == $output)
			$output = '*1';

		if (substr($setting, 0, 3) != '$P$')
			return $output;

		$count_log2 = strpos($this->itoa64, $setting[3]);
		if ($count_log2 < 7 || $count_log2 > 30)
			return $output;

		$count = 1 << $count_log2;

		$salt = substr($setting, 4, 8);
		if (strlen($salt) != 8)
			return $output;

		# We're kind of forced to use MD5 here since it's the only
		# cryptographic primitive available in all versions of PHP
		# currently in use.  To implement our own low-level crypto
		# in PHP would result in much worse performance and
		# consequently in lower iteration counts and hashes that are
		# quicker to crack (by non-PHP code).
		if (PHP_VERSION >= '5') {
			$hash = md5($salt . $password, TRUE);
			do {
				$hash = md5($hash . $password, TRUE);
			} while (--$count);
		} else {
			$hash = pack('H*', md5($salt . $password));
			do {
				$hash = pack('H*', md5($hash . $password));
			} while (--$count);
		}

		$output = substr($setting, 0, 12);
		$output .= $this->encode64($hash, 16);

		return $output;
	}

	function gensalt_extended($input)
	{
		$count_log2 = min($this->iteration_count_log2 + 8, 24);
		# This should be odd to not reveal weak DES keys, and the
		# maximum valid value is (2**24 - 1) which is odd anyway.
		$count = (1 << $count_log2) - 1;

		$output = '_';
		$output .= $this->itoa64[$count & 0x3f];
		$output .= $this->itoa64[($count >> 6) & 0x3f];
		$output .= $this->itoa64[($count >> 12) & 0x3f];
		$output .= $this->itoa64[($count >> 18) & 0x3f];

		$output .= $this->encode64($input, 3);

		return $output;
	}

	function gensalt_blowfish($input)
	{
		# This one needs to use a different order of characters and a
		# different encoding scheme from the one in encode64() above.
		# We care because the last character in our encoded string will
		# only represent 2 bits.  While two known implementations of
		# bcrypt will happily accept and correct a salt string which
		# has the 4 unused bits set to non-zero, we do not want to take
		# chances and we also do not want to waste an additional byte
		# of entropy.
		$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';

		$output = '$2a$';
		$output .= chr(ord('0') + $this->iteration_count_log2 / 10);
		$output .= chr(ord('0') + $this->iteration_count_log2 % 10);
		$output .= '$';

		$i = 0;
		do {
			$c1 = ord($input[$i++]);
			$output .= $itoa64[$c1 >> 2];
			$c1 = ($c1 & 0x03) << 4;
			if ($i >= 16) {
				$output .= $itoa64[$c1];
				break;
			}

			$c2 = ord($input[$i++]);
			$c1 |= $c2 >> 4;
			$output .= $itoa64[$c1];
			$c1 = ($c2 & 0x0f) << 2;

			$c2 = ord($input[$i++]);
			$c1 |= $c2 >> 6;
			$output .= $itoa64[$c1];
			$output .= $itoa64[$c2 & 0x3f];
		} while (1);

		return $output;
	}

	function HashPassword($password)
	{
		$random = '';

		if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) {
			$random = $this->get_random_bytes(16);
			$hash =
			    crypt($password, $this->gensalt_blowfish($random));
			if (strlen($hash) == 60)
				return $hash;
		}

		if (CRYPT_EXT_DES == 1 && !$this->portable_hashes) {
			if (strlen($random) < 3)
				$random = $this->get_random_bytes(3);
			$hash =
			    crypt($password, $this->gensalt_extended($random));
			if (strlen($hash) == 20)
				return $hash;
		}

		if (strlen($random) < 6)
			$random = $this->get_random_bytes(6);
		$hash =
		    $this->crypt_private($password,
		    $this->gensalt_private($random));
		if (strlen($hash) == 34)
			return $hash;

		# Returning '*' on error is safe here, but would _not_ be safe
		# in a crypt(3)-like function used _both_ for generating new
		# hashes and for validating passwords against existing hashes.
		return '*';
	}

	function CheckPassword($password, $stored_hash)
	{
		$hash = $this->crypt_private($password, $stored_hash);
		if ($hash[0] == '*')
			$hash = crypt($password, $stored_hash);

		return $hash == $stored_hash;
	}
}

?>


text:
#region Licence

#endregion

#region Imports

using System.Collections;
using NUnit.Framework;
using Spring.Data.Common;
using SpringAir.Domain;

#endregion

namespace SpringAir.Data.Ado
{
    /// <summary>
    /// Integration tests for the ADO.NET-backed AirportDao class.
    /// </summary>
    /// <author>Rick Evans (.NET)</author>
    /// <version>$Id: AirportDaoTests.cs,v 1.4 2006/11/28 06:42:27 markpollack Exp $</version>
    [TestFixture]
    public sealed class AirportDaoTests
    {
        private AirportDao dao;

        [SetUp]
        public void SetUp()
        {
            IDbProvider dbProvider = DbProviderFactory.GetDbProvider("SqlServer-1.1");
            dbProvider.ConnectionString =
                "Server=(local);Integrated Security=no;User ID=springqa;PWD=springqa;initial catalog=SpringAir;";

            dao = new AirportDao();
            dao.DbProvider = dbProvider;
            /*
			ReflectiveDbConnectionFactory connectionfactory = new ReflectiveDbConnectionFactory();
			connectionfactory.ConnectionType = typeof (SqlConnection);
			connectionfactory.ConnectionString =
				"Server=(local)\\Spring;Integrated Security=no;User ID=sa;PWD=spring;initial catalog=SpringAir;";

            dao = new AirportDao();
            dao.CommandType = typeof (SqlCommand);
			dao.ConnectionFactory = connectionfactory;
            dao.AirportMapper = new AirportMapper();
             */
        }

        [Test]
        public void GetAllAirports()
        {
            IList airports = dao.GetAllAirports();
            Assert.IsNotNull(airports, "Must never return a null airport list.");
            Assert.AreEqual(4, airports.Count);
        }

        [Test]
        public void GetAirportById()
        {
            Airport airport = dao.GetAirport(0);
            Assert.IsNotNull(airport, "Failed to retrive an Airport that is definitely in the database.");
        }

        [Test]
        public void GetAirportByCode()
        {
            Airport airport = dao.GetAirport("SFO");
            Assert.IsNotNull(airport, "Failed to retrive an Airport that is definitely in the database.");
        }

        [Test]
        [ExpectedException(typeof(Spring.Dao.EmptyResultDataAccessException))]
        public void GetAirportByCodeNonExistent()
        {
            Airport airport = dao.GetAirport("FOO");
        }
    }
}


text:
public class Blort
{
    public boolean insBoolean;
    public byte insByte;
    public char insChar;
    public short insShort;
    public int insInt;
    public long insLong;
    public float insFloat;
    public double insDouble;
    public Object insObject;

    public Object test1() {
        int x = insByte + insChar + insShort + insInt +
            (int) insLong + (int) insFloat + (int) insDouble;

        if (insBoolean && (x > 0)) {;
            return insObject;
        } else {
            return null;
        }
    }

    public void test2(boolean b, int i, Object o) {
        insBoolean = b;
        insByte = (byte) i;
        insChar = (char) i;
        insShort = (short) i;
        insInt = i;
        insLong = i;
        insFloat = i;
        insDouble = i;
        insObject = o;
    }
}


text:
build:
	go build -a

install:
	go install -a


text:
using System;
using System.Data.Common;
using System.Data.SqlClient;
using System.Security.Cryptography;
using System.Text;
using System.Threading;

namespace PureCat.Demo
{
    public static class SQLDemo
    {
        private static readonly Random _rand = new Random();

        public static void Demo()
        {
            var sql = "select * from table";
            PureCatClient.DoTransaction("SQL", "SQLName", () =>
            {
                using (var conn = new SqlConnection("connString"))
                {
                    conn.Open();
                    LogEvent(conn, sql, null);

                    //do sql....
                    Thread.Sleep(_rand.Next(2000));
                }
            });

            //格式就是
            //T SQL,name
            //E SQL.Method
            //E SQL.Database
            //t SQL,name

        }

        private static void LogEvent(DbConnection conn, string sql, dynamic entity)
        {
            sql = sql.Trim();
            var method = sql.Substring(0, sql.IndexOf(' '));

            PureCatClient.LogEvent("SQL.Method", method);
            //以Mysql为例
            PureCatClient.LogEvent("SQL.Database", $"jdbc:mysql://{conn.DataSource}/{conn.Database}?useUnicode=true&autoReconnect=true");

            //可以记录完整带参数的sql
            var sqlFull = $"{sql}\r\n{GetNameAndValue(entity)}";

            //最好是对sql或者sqlFull进行hash
            var sqlHash = Md5(sql);
            PureCatClient.LogEvent("SQL", sqlHash, "0", sqlFull);
        }

        private static string Md5(string str)
        {
            return BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(Encoding.UTF8.GetBytes(str))).Replace("-", "").ToLower();
        }

        private static string GetNameAndValue<T>(T tValue)
        {
            var tStr = string.Empty;
            if (tValue == null)
            {
                return tStr;
            }
            var properties = tValue.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
            if (properties.Length <= 0)
            {
                return tStr;
            }
            foreach (var item in properties)
            {
                var name = item.Name; //名称
                var value = item.GetValue(tValue, null);  //值

                if (item.PropertyType.IsValueType || item.PropertyType.Name.StartsWith("String"))
                {
                    tStr += $"{name}:{value}\r\n";
                }
                else
                {
                    tStr += GetNameAndValue(value);
                }
            }
            return tStr;
        }

    }
}


text:
#ifndef _GEN_PV_LOCK_SLOWPATH

#include <linux/smp.h>
#include <linux/bug.h>
#include <linux/cpumask.h>
#include <linux/percpu.h>
#include <linux/hardirq.h>
#include <linux/mutex.h>
#include <asm/byteorder.h>
#include <asm/qspinlock.h>

/*
 * The basic principle of a queue-based spinlock can best be understood
 * by studying a classic queue-based spinlock implementation called the
 * MCS lock. The paper below provides a good description for this kind
 * of lock.
 *
 * http://www.cise.ufl.edu/tr/DOC/REP-1992-71.pdf
 *
 * This queued spinlock implementation is based on the MCS lock, however to make
 * it fit the 4 bytes we assume spinlock_t to be, and preserve its existing
 * API, we must modify it somehow.
 *
 * In particular; where the traditional MCS lock consists of a tail pointer
 * (8 bytes) and needs the next pointer (another 8 bytes) of its own node to
 * unlock the next pending (next->locked), we compress both these: {tail,
 * next->locked} into a single u32 value.
 *
 * Since a spinlock disables recursion of its own context and there is a limit
 * to the contexts that can nest; namely: task, softirq, hardirq, nmi. As there
 * are at most 4 nesting levels, it can be encoded by a 2-bit number. Now
 * we can encode the tail by combining the 2-bit nesting level with the cpu
 * number. With one byte for the lock value and 3 bytes for the tail, only a
 * 32-bit word is now needed. Even though we only need 1 bit for the lock,
 * we extend it to a full byte to achieve better performance for architectures
 * that support atomic byte write.
 *
 * We also change the first spinner to spin on the lock bit instead of its
 * node; whereby avoiding the need to carry a node from lock to unlock, and
 * preserving existing lock API. This also makes the unlock code simpler and
 * faster.
 *
 * N.B. The current implementation only supports architectures that allow
 *      atomic operations on smaller 8-bit and 16-bit data types.
 *
 */

#include "mcs_spinlock.h"

#ifdef CONFIG_PARAVIRT_SPINLOCKS
#define MAX_NODES	8
#else
#define MAX_NODES	4
#endif

/*
 * Per-CPU queue node structures; we can never have more than 4 nested
 * contexts: task, softirq, hardirq, nmi.
 *
 * Exactly fits one 64-byte cacheline on a 64-bit architecture.
 *
 * PV doubles the storage and uses the second cacheline for PV state.
 */
static DEFINE_PER_CPU_ALIGNED(struct mcs_spinlock, mcs_nodes[MAX_NODES]);

/*
 * We must be able to distinguish between no-tail and the tail at 0:0,
 * therefore increment the cpu number by one.
 */

static inline u32 encode_tail(int cpu, int idx)
{
	u32 tail;

#ifdef CONFIG_DEBUG_SPINLOCK
	BUG_ON(idx > 3);
#endif
	tail  = (cpu + 1) << _Q_TAIL_CPU_OFFSET;
	tail |= idx << _Q_TAIL_IDX_OFFSET; /* assume < 4 */

	return tail;
}

static inline struct mcs_spinlock *decode_tail(u32 tail)
{
	int cpu = (tail >> _Q_TAIL_CPU_OFFSET) - 1;
	int idx = (tail &  _Q_TAIL_IDX_MASK) >> _Q_TAIL_IDX_OFFSET;

	return per_cpu_ptr(&mcs_nodes[idx], cpu);
}

#define _Q_LOCKED_PENDING_MASK (_Q_LOCKED_MASK | _Q_PENDING_MASK)

/*
 * By using the whole 2nd least significant byte for the pending bit, we
 * can allow better optimization of the lock acquisition for the pending
 * bit holder.
 *
 * This internal structure is also used by the set_locked function which
 * is not restricted to _Q_PENDING_BITS == 8.
 */
struct __qspinlock {
	union {
		atomic_t val;
#ifdef __LITTLE_ENDIAN
		struct {
			u8	locked;
			u8	pending;
		};
		struct {
			u16	locked_pending;
			u16	tail;
		};
#else
		struct {
			u16	tail;
			u16	locked_pending;
		};
		struct {
			u8	reserved[2];
			u8	pending;
			u8	locked;
		};
#endif
	};
};

#if _Q_PENDING_BITS == 8
/**
 * clear_pending_set_locked - take ownership and clear the pending bit.
 * @lock: Pointer to queued spinlock structure
 *
 * *,1,0 -> *,0,1
 *
 * Lock stealing is not allowed if this function is used.
 */
static __always_inline void clear_pending_set_locked(struct qspinlock *lock)
{
	struct __qspinlock *l = (void *)lock;

	WRITE_ONCE(l->locked_pending, _Q_LOCKED_VAL);
}

/*
 * xchg_tail - Put in the new queue tail code word & retrieve previous one
 * @lock : Pointer to queued spinlock structure
 * @tail : The new queue tail code word
 * Return: The previous queue tail code word
 *
 * xchg(lock, tail)
 *
 * p,*,* -> n,*,* ; prev = xchg(lock, node)
 */
static __always_inline u32 xchg_tail(struct qspinlock *lock, u32 tail)
{
	struct __qspinlock *l = (void *)lock;

	/*
	 * Use release semantics to make sure that the MCS node is properly
	 * initialized before changing the tail code.
	 */
	return (u32)xchg_release(&l->tail,
				 tail >> _Q_TAIL_OFFSET) << _Q_TAIL_OFFSET;
}

#else /* _Q_PENDING_BITS == 8 */

/**
 * clear_pending_set_locked - take ownership and clear the pending bit.
 * @lock: Pointer to queued spinlock structure
 *
 * *,1,0 -> *,0,1
 */
static __always_inline void clear_pending_set_locked(struct qspinlock *lock)
{
	atomic_add(-_Q_PENDING_VAL + _Q_LOCKED_VAL, &lock->val);
}

/**
 * xchg_tail - Put in the new queue tail code word & retrieve previous one
 * @lock : Pointer to queued spinlock structure
 * @tail : The new queue tail code word
 * Return: The previous queue tail code word
 *
 * xchg(lock, tail)
 *
 * p,*,* -> n,*,* ; prev = xchg(lock, node)
 */
static __always_inline u32 xchg_tail(struct qspinlock *lock, u32 tail)
{
	u32 old, new, val = atomic_read(&lock->val);

	for (;;) {
		new = (val & _Q_LOCKED_PENDING_MASK) | tail;
		/*
		 * Use release semantics to make sure that the MCS node is
		 * properly initialized before changing the tail code.
		 */
		old = atomic_cmpxchg_release(&lock->val, val, new);
		if (old == val)
			break;

		val = old;
	}
	return old;
}
#endif /* _Q_PENDING_BITS == 8 */

/**
 * set_locked - Set the lock bit and own the lock
 * @lock: Pointer to queued spinlock structure
 *
 * *,*,0 -> *,0,1
 */
static __always_inline void set_locked(struct qspinlock *lock)
{
	struct __qspinlock *l = (void *)lock;

	WRITE_ONCE(l->locked, _Q_LOCKED_VAL);
}

/*
 * Generate the native code for queued_spin_unlock_slowpath(); provide NOPs for
 * all the PV callbacks.
 */

static __always_inline void __pv_init_node(struct mcs_spinlock *node) { }
static __always_inline void __pv_wait_node(struct mcs_spinlock *node,
					   struct mcs_spinlock *prev) { }
static __always_inline void __pv_kick_node(struct qspinlock *lock,
					   struct mcs_spinlock *node) { }
static __always_inline u32  __pv_wait_head_or_lock(struct qspinlock *lock,
						   struct mcs_spinlock *node)
						   { return 0; }

#define pv_enabled()		false

#define pv_init_node		__pv_init_node
#define pv_wait_node		__pv_wait_node
#define pv_kick_node		__pv_kick_node
#define pv_wait_head_or_lock	__pv_wait_head_or_lock

#ifdef CONFIG_PARAVIRT_SPINLOCKS
#define queued_spin_lock_slowpath	native_queued_spin_lock_slowpath
#endif

/*
 * queued_spin_lock_slowpath() can (load-)ACQUIRE the lock before
 * issuing an _unordered_ store to set _Q_LOCKED_VAL.
 *
 * This means that the store can be delayed, but no later than the
 * store-release from the unlock. This means that simply observing
 * _Q_LOCKED_VAL is not sufficient to determine if the lock is acquired.
 *
 * There are two paths that can issue the unordered store:
 *
 *  (1) clear_pending_set_locked():	*,1,0 -> *,0,1
 *
 *  (2) set_locked():			t,0,0 -> t,0,1 ; t != 0
 *      atomic_cmpxchg_relaxed():	t,0,0 -> 0,0,1
 *
 * However, in both cases we have other !0 state we've set before to queue
 * ourseves:
 *
 * For (1) we have the atomic_cmpxchg_acquire() that set _Q_PENDING_VAL, our
 * load is constrained by that ACQUIRE to not pass before that, and thus must
 * observe the store.
 *
 * For (2) we have a more intersting scenario. We enqueue ourselves using
 * xchg_tail(), which ends up being a RELEASE. This in itself is not
 * sufficient, however that is followed by an smp_cond_acquire() on the same
 * word, giving a RELEASE->ACQUIRE ordering. This again constrains our load and
 * guarantees we must observe that store.
 *
 * Therefore both cases have other !0 state that is observable before the
 * unordered locked byte store comes through. This means we can use that to
 * wait for the lock store, and then wait for an unlock.
 */
#ifndef queued_spin_unlock_wait
void queued_spin_unlock_wait(struct qspinlock *lock)
{
	u32 val;

	for (;;) {
		val = atomic_read(&lock->val);

		if (!val) /* not locked, we're done */
			goto done;

		if (val & _Q_LOCKED_MASK) /* locked, go wait for unlock */
			break;

		/* not locked, but pending, wait until we observe the lock */
		cpu_relax();
	}

	/* any unlock is good */
	while (atomic_read(&lock->val) & _Q_LOCKED_MASK)
		cpu_relax();

done:
	smp_rmb(); /* CTRL + RMB -> ACQUIRE */
}
EXPORT_SYMBOL(queued_spin_unlock_wait);
#endif

#endif /* _GEN_PV_LOCK_SLOWPATH */

/**
 * queued_spin_lock_slowpath - acquire the queued spinlock
 * @lock: Pointer to queued spinlock structure
 * @val: Current value of the queued spinlock 32-bit word
 *
 * (queue tail, pending bit, lock value)
 *
 *              fast     :    slow                                  :    unlock
 *                       :                                          :
 * uncontended  (0,0,0) -:--> (0,0,1) ------------------------------:--> (*,*,0)
 *                       :       | ^--------.------.             /  :
 *                       :       v           \      \            |  :
 * pending               :    (0,1,1) +--> (0,1,0)   \           |  :
 *                       :       | ^--'              |           |  :
 *                       :       v                   |           |  :
 * uncontended           :    (n,x,y) +--> (n,0,0) --'           |  :
 *   queue               :       | ^--'                          |  :
 *                       :       v                               |  :
 * contended             :    (*,x,y) +--> (*,0,0) ---> (*,0,1) -'  :
 *   queue               :         ^--'                             :
 */
void queued_spin_lock_slowpath(struct qspinlock *lock, u32 val)
{
	struct mcs_spinlock *prev, *next, *node;
	u32 new, old, tail;
	int idx;

	BUILD_BUG_ON(CONFIG_NR_CPUS >= (1U << _Q_TAIL_CPU_BITS));

	if (pv_enabled())
		goto queue;

	if (virt_spin_lock(lock))
		return;

	/*
	 * wait for in-progress pending->locked hand-overs
	 *
	 * 0,1,0 -> 0,0,1
	 */
	if (val == _Q_PENDING_VAL) {
		while ((val = atomic_read(&lock->val)) == _Q_PENDING_VAL)
			cpu_relax();
	}

	/*
	 * trylock || pending
	 *
	 * 0,0,0 -> 0,0,1 ; trylock
	 * 0,0,1 -> 0,1,1 ; pending
	 */
	for (;;) {
		/*
		 * If we observe any contention; queue.
		 */
		if (val & ~_Q_LOCKED_MASK)
			goto queue;

		new = _Q_LOCKED_VAL;
		if (val == new)
			new |= _Q_PENDING_VAL;

		/*
		 * Acquire semantic is required here as the function may
		 * return immediately if the lock was free.
		 */
		old = atomic_cmpxchg_acquire(&lock->val, val, new);
		if (old == val)
			break;

		val = old;
	}

	/*
	 * we won the trylock
	 */
	if (new == _Q_LOCKED_VAL)
		return;

	/*
	 * we're pending, wait for the owner to go away.
	 *
	 * *,1,1 -> *,1,0
	 *
	 * this wait loop must be a load-acquire such that we match the
	 * store-release that clears the locked bit and create lock
	 * sequentiality; this is because not all clear_pending_set_locked()
	 * implementations imply full barriers.
	 */
	smp_cond_acquire(!(atomic_read(&lock->val) & _Q_LOCKED_MASK));

	/*
	 * take ownership and clear the pending bit.
	 *
	 * *,1,0 -> *,0,1
	 */
	clear_pending_set_locked(lock);
	return;

	/*
	 * End of pending bit optimistic spinning and beginning of MCS
	 * queuing.
	 */
queue:
	node = this_cpu_ptr(&mcs_nodes[0]);
	idx = node->count++;
	tail = encode_tail(smp_processor_id(), idx);

	node += idx;
	node->locked = 0;
	node->next = NULL;
	pv_init_node(node);

	/*
	 * We touched a (possibly) cold cacheline in the per-cpu queue node;
	 * attempt the trylock once more in the hope someone let go while we
	 * weren't watching.
	 */
	if (queued_spin_trylock(lock))
		goto release;

	/*
	 * We have already touched the queueing cacheline; don't bother with
	 * pending stuff.
	 *
	 * p,*,* -> n,*,*
	 */
	old = xchg_tail(lock, tail);
	next = NULL;

	/*
	 * if there was a previous node; link it and wait until reaching the
	 * head of the waitqueue.
	 */
	if (old & _Q_TAIL_MASK) {
		prev = decode_tail(old);
		WRITE_ONCE(prev->next, node);

		pv_wait_node(node, prev);
		arch_mcs_spin_lock_contended(&node->locked);

		/*
		 * While waiting for the MCS lock, the next pointer may have
		 * been set by another lock waiter. We optimistically load
		 * the next pointer & prefetch the cacheline for writing
		 * to reduce latency in the upcoming MCS unlock operation.
		 */
		next = READ_ONCE(node->next);
		if (next)
			prefetchw(next);
	}

	/*
	 * we're at the head of the waitqueue, wait for the owner & pending to
	 * go away.
	 *
	 * *,x,y -> *,0,0
	 *
	 * this wait loop must use a load-acquire such that we match the
	 * store-release that clears the locked bit and create lock
	 * sequentiality; this is because the set_locked() function below
	 * does not imply a full barrier.
	 *
	 * The PV pv_wait_head_or_lock function, if active, will acquire
	 * the lock and return a non-zero value. So we have to skip the
	 * smp_cond_acquire() call. As the next PV queue head hasn't been
	 * designated yet, there is no way for the locked value to become
	 * _Q_SLOW_VAL. So both the set_locked() and the
	 * atomic_cmpxchg_relaxed() calls will be safe.
	 *
	 * If PV isn't active, 0 will be returned instead.
	 *
	 */
	if ((val = pv_wait_head_or_lock(lock, node)))
		goto locked;

	smp_cond_acquire(!((val = atomic_read(&lock->val)) & _Q_LOCKED_PENDING_MASK));

locked:
	/*
	 * claim the lock:
	 *
	 * n,0,0 -> 0,0,1 : lock, uncontended
	 * *,0,0 -> *,0,1 : lock, contended
	 *
	 * If the queue head is the only one in the queue (lock value == tail),
	 * clear the tail code and grab the lock. Otherwise, we only need
	 * to grab the lock.
	 */
	for (;;) {
		/* In the PV case we might already have _Q_LOCKED_VAL set */
		if ((val & _Q_TAIL_MASK) != tail) {
			set_locked(lock);
			break;
		}
		/*
		 * The smp_cond_acquire() call above has provided the necessary
		 * acquire semantics required for locking. At most two
		 * iterations of this loop may be ran.
		 */
		old = atomic_cmpxchg_relaxed(&lock->val, val, _Q_LOCKED_VAL);
		if (old == val)
			goto release;	/* No contention */

		val = old;
	}

	/*
	 * contended path; wait for next if not observed yet, release.
	 */
	if (!next) {
		while (!(next = READ_ONCE(node->next)))
			cpu_relax();
	}

	arch_mcs_spin_unlock_contended(&next->locked);
	pv_kick_node(lock, next);

release:
	/*
	 * release the node
	 */
	this_cpu_dec(mcs_nodes[0].count);
}
EXPORT_SYMBOL(queued_spin_lock_slowpath);

/*
 * Generate the paravirt code for queued_spin_unlock_slowpath().
 */
#if !defined(_GEN_PV_LOCK_SLOWPATH) && defined(CONFIG_PARAVIRT_SPINLOCKS)
#define _GEN_PV_LOCK_SLOWPATH

#undef  pv_enabled
#define pv_enabled()	true

#undef pv_init_node
#undef pv_wait_node
#undef pv_kick_node
#undef pv_wait_head_or_lock

#undef  queued_spin_lock_slowpath
#define queued_spin_lock_slowpath	__pv_queued_spin_lock_slowpath

#include "qspinlock_paravirt.h"
#include "qspinlock.c"

#endif


text:
document.title = 'page cycler';

document.cookie = '__pc_done=0; path=/';
document.cookie = '__pc_timings=; path=/';

var options = location.search.substring(1).split('&');

function getOption(name) {
  var r = new RegExp('^' + name + '=');
  for (var i = 0; i < options.length; i++) {
    if (options[i].match(r)) {
      return options[i].substring(name.length + 1);
    }
  }
  return null;
}

function start() {
  var iterations = document.getElementById('iterations').value;
  window.resizeTo(800, 800);
  var url = 'index.html?n=' + iterations + '&i=0&td=0';
  window.location = url;
}

function renderForm() {
  var form = document.createElement('form');
  form.onsubmit = function(e) {
    start();
    e.preventDefault();
  };

  var label = document.createTextNode('Iterations: ');
  form.appendChild(label);

  var input = document.createElement('input');
  input.id = 'iterations';
  input.type = 'number';
  var iterations = getOption('iterations');
  input.value = iterations ? iterations : '5';
  form.appendChild(input);

  input = document.createElement('input');
  input.type = 'submit';
  input.value = 'Start';
  form.appendChild(input);

  document.body.appendChild(form);
}

renderForm();

// should we start automatically?
if (location.search.match('auto=1'))
  start();


text:
import './style/index.less'
import Message from './message'

let defaultDuration = 3
let defaultTop = 24
let key = 1

let messageInstance

function getMessageInstance() {
  messageInstance = messageInstance || Message.getInstance({
    top: defaultTop
  })

  return messageInstance
}

function notice(content, duration = defaultDuration, onClose = $.noop, type = 'success') {
  const instance = getMessageInstance()
  instance.notice({
    key,
    duration,
    content,
    type,
    onClose
  })

  return (function () {
    key += 1
    const target = key
    return function () {
      instance.removeNotice(target)
    }
  }())
}

export default {
  info(content, duration, onClose) {
    return notice(content, duration, onClose, 'info')
  },
  success(content, duration, onClose) {
    return notice(content, duration, onClose, 'success')
  },
  warning(content, duration, onClose) {
    return notice(content, duration, onClose, 'warning')
  },
  error(content, duration, onClose) {
    return notice(content, duration, onClose, 'error')
  },
  loading(content, duration, onClose) {
    return notice(content, duration, onClose, 'loading')
  },
  config(options) {
    if (options.top) {
      defaultTop = options.top
      // delete messageInstance for new defaultTop
      messageInstance = null
    }
    if (options.duration) {
      defaultDuration = options.duration
    }
  },
  destroy() {
    if (messageInstance) {
      messageInstance.destroy()
      messageInstance = null
    }
  }
}


text:
\section{Controlling flow}\label{sec:flow_control}
In this section we run through the flow control statements available in JavaScript. The controlling statments are similar to the once we know and love from other procedural OOP languages.

\subsection{if-else}
If and else are similar as in C or Java and have the following form.
\begin{lstlisting}
if (b1) {
    // code
} else if(b2) {
    // code
} else {
}
\end{lstlisting}

The else-if and else are optional, as in the above mentioned languages. The statements \texttt{b1} and \texttt{b2} are evaluted to boolean value and the blocks are executed with respect to the output of that evaluation.

The check can be other objects than boolean values and we say that the evaluation calculates Truthy and Falsy of the statements. The following list shows how different objects are evaluated to \texttt{true} in JavaScript.

\begin{itemize}
\item \texttt{if (true)}
\item \texttt{if ({})}
\item \texttt{if ([])}
\item \texttt{if (42)}
\item \texttt{if ("foo")}
\item \texttt{if (new Date())}
\end{itemize}

The following list shows statements which will evaluate to false

\begin{itemize}
\item \texttt{if (false)}
\item \texttt{if (null)}
\item \texttt{if (undefined)}
\item \texttt{if (0)}
\item \texttt{if (NaN)}
\item \texttt{if ('')}
\end{itemize}

\subsection{Switch}
\url{https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/switch}

\subsection{Exception handling}
\url{https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch}

\subsection{Loops and iterations}
\url{https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration}


text:
#ifndef EXCEPTIONS_H_
#define EXCEPTIONS_H_

#include <Poco/Exception.h>

namespace Myriad {
/**
 * @addtogroup core
 * @{*/

/**
 * An exception thrown when an error in the application configuraiton is
 * detected.
 *
 * @author: Alexander Alexandrov <alexander.alexandrov@tu-berlin.de>
 */
POCO_DECLARE_EXCEPTION(, ConfigException, Poco::Exception)

/**
 * An exception thrown when an integer overflow is detected by the application.
 *
 * @author: Alexander Alexandrov <alexander.alexandrov@tu-berlin.de>
 */
POCO_DECLARE_EXCEPTION(, IntegerOverflowException, Poco::LogicException)

/** @}*/// add to core group
}  // namespace Myriad

#endif /* EXCEPTIONS_H_ */


text:
<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->

![Vespa logo](https://vespa.ai/assets/vespa-logo-color.png)

# Vespa client
This app contains the **Query Builder** and the **Trace Visualizer**.

Install and start:

    $ nvm install --lts node  # in case the installed node.js is too old
    $ yarn install
    $ yarn dev                # then open link, like http://127.0.0.1:3000/

Alternatively, use Docker to start it without installing node:

    $ docker run -v `pwd`:/w -w /w --publish 3000:3000 node:16 sh -c 'yarn install && yarn dev --host'

When started, open [http://127.0.0.1:3000/](http://127.0.0.1:3000/).

*Troubleshooting:* Remove the generated `node_modules` directory and try again.
This is also relevant when switching between running local and in the container.

## Query Builder
The Query Builder is a tool for creating Vespa queries to send to a local Vespa application.
The tool provides all of the options for query parameters from dropdowns.
The input fields provide hints to what is the expected type of value.

![Query Builder](img/querybuilder.png)

To access a Vespa endpoint from the Query Builder,
deploy with [CORS filters](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).
To the query-serving container, add an `http` element in _services.xml_ like:
```
    <container id="default" version="1.0">

        <http>
            <filtering strict-mode="false">
                <request-chain id="request-chain">
                    <filter id="com.yahoo.jdisc.http.filter.security.cors.CorsPreflightRequestFilter"
                            bundle="jdisc-security-filters">
                        <config name="jdisc.http.filter.security.cors.cors-filter">
                            <allowedUrls>
                                <item>*</item>
                            </allowedUrls>
                        </config>
                    </filter>
                    <binding>http://*/search/</binding>
                </request-chain>

                <response-chain id="response-chain">
                    <filter id="com.yahoo.jdisc.http.filter.security.cors.CorsResponseFilter"
                            bundle="jdisc-security-filters">
                        <config name="jdisc.http.filter.security.cors.cors-filter">
                            <allowedUrls>
                                <item>*</item>
                            </allowedUrls>
                        </config>
                    </filter>
                    <binding>http://*/search/</binding>
                </response-chain>
            </filtering>

            <server port="8080" id="default"/>
        </http>
```

Deploy again, and (possibly) restart Vespa (internal port changes can be triggered by this).

## Trace Visualizer
The Trace Visualizer is a tool for converting and visualizing traces from Vespa in a flame graph.
To use the visualizer, a [Jaeger](https://www.jaegertracing.io/) instance must be run locally with Docker:

    docker run -d --rm \
      -p 16685:16685 \
      -p 16686:16686 \
      -p 16687:16687 \
      -e SPAN_STORAGE_TYPE=memory \
      jaegertracing/jaeger-query:latest

The Jaeger UI can then be reached at **localhost:16686/search**

To use the visualizer,
paste the Vespa trace into the text box
and press the button to convert the trace to a format supported by Jaeger and download it.
Only traces using _trace.timestamps=true_ **and** _traceLevel_ between 3 and 5 (inclusive) will work correctly -
see [query tracing](https://docs.vespa.ai/en/query-api.html#query-tracing):

![Trace Converter](img/TraceConverter.png)

After downloading the converted trace, it can be used with the Jaeger UI.
Press the _JSON File_ button as shown in the image, and drag and drop the trace you just downloaded:

![Jaeger Image](img/JaegerExample.png)

Then click on the newly added trace and see it displayed as a flame graph:

![Example Image](img/result.png)


text:
package org.apache.hadoop.hbase.mapreduce;

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

import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.util.StringUtils;

/**
 * Emits sorted Puts.
 * Reads in all Puts from passed Iterator, sorts them, then emits
 * Puts in sorted order.  If lots of columns per row, it will use lots of
 * memory sorting.
 * @see HFileOutputFormat
 * @see KeyValueSortReducer
 */
@InterfaceAudience.Public
@InterfaceStability.Stable
public class PutSortReducer extends
    Reducer<ImmutableBytesWritable, Put, ImmutableBytesWritable, KeyValue> {

  @Override
  protected void reduce(
      ImmutableBytesWritable row,
      java.lang.Iterable<Put> puts,
      Reducer<ImmutableBytesWritable, Put,
              ImmutableBytesWritable, KeyValue>.Context context)
      throws java.io.IOException, InterruptedException
  {
    // although reduce() is called per-row, handle pathological case
    long threshold = context.getConfiguration().getLong(
        "putsortreducer.row.threshold", 2L * (1<<30));
    Iterator<Put> iter = puts.iterator();
    while (iter.hasNext()) {
      TreeSet<KeyValue> map = new TreeSet<KeyValue>(KeyValue.COMPARATOR);
      long curSize = 0;
      // stop at the end or the RAM threshold
      while (iter.hasNext() && curSize < threshold) {
        Put p = iter.next();
        for (List<? extends Cell> cells: p.getFamilyMap().values()) {
          for (Cell cell: cells) {
            KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
            map.add(kv);
            curSize += kv.getLength();
          }
        }
      }
      context.setStatus("Read " + map.size() + " entries of " + map.getClass()
          + "(" + StringUtils.humanReadableInt(curSize) + ")");
      int index = 0;
      for (KeyValue kv : map) {
        context.write(row, kv);
        if (index > 0 && index % 100 == 0)
          context.setStatus("Wrote " + index);
      }

      // if we have more entries to process
      if (iter.hasNext()) {
        // force flush because we cannot guarantee intra-row sorted order
        context.write(null, null);
      }
    }
  }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1,initial-scale=1,user-scalable=no" />
  <meta name="format-detection" content="telephone=no" />
  <title>tabs-css-frame</title>

  <link rel="stylesheet" type="text/css" href="../../default.css">

    编号
    分类
    内容

      1. 一道看似非常难的面试算法题

      6. Vue.js 系列教程

      10. 研究思考