text:
关键代码如下:
```
handler = new Handler() {
	@Override
	public void handleMessage(Message msg) {
		switch (msg.what) {
		case INFO_ID:
			String str = msg.obj.toString();
			textView.append("\n" + str);
			break;
		default:
			break;
		}
		super.handleMessage(msg);
	}
};
Thread thread = new Thread() {
	@Override
	public void run() {
		int flag = 0;
		try {
			while (isRuning) {
				Thread.sleep(1000);
				flag++;
				String str = editText.getText().toString() + "第" + flag
						+ "条";
				Message message = new Message();
				message.what = INFO_ID;
				message.obj = str;
				handler.sendMessage(message);
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
};
thread.start();
```
--------------------------------------------------
Java完整代码如下:HandlerMessageActivity .java
--------------------------------------------------
```
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class HandlerMessageActivity extends Activity {
	TextView textView;
	EditText editText;
	Button button;
	public static final int INFO_ID = 23434;
	private boolean isRuning = true;
	Handler handler;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.handler_layout_main);
		textView = (TextView) this.findViewById(R.id.handler_textview_send);
		editText = (EditText) this.findViewById(R.id.handler_edittext_send);
		button = (Button) this.findViewById(R.id.handler_button_send);
		handler = new Handler() {
			@Override
			public void handleMessage(Message msg) {
				switch (msg.what) {
				case INFO_ID:
					String str = msg.obj.toString();
					textView.append("\n" + str);
					break;

				default:
					break;
				}
				super.handleMessage(msg);
			}
		};
		Thread thread = new Thread() {
			@Override
			public void run() {
				int flag = 0;
				try {
					while (isRuning) {
						Thread.sleep(1000);
						flag++;
						String str = editText.getText().toString() + "第" + flag
								+ "条";
						Message message = new Message();
						message.what = INFO_ID;
						message.obj = str;
						handler.sendMessage(message);
					}
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		};
		thread.start();
	}
	@Override
	protected void onPause() {
		isRuning = false;
		super.onPause();
	}
	@Override
	protected void onResume() {
		isRuning = true;
		super.onResume();
	}
}
```
------------------------------------------
XML布局文件如下:handler_layout_main.xml
------------------------------------------
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <EditText
        android:id="@+id/handler_edittext_send"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    <Button
        android:id="@+id/handler_button_send"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="200dp"
        android:text="发送数据" />
    <ScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
        <TextView
            android:id="@+id/handler_textview_send"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="本activity用于测试handler中message传输" />
    </ScrollView>
</LinearLayout>
```


text:
package org.apache.sis.io.wkt;

import java.util.Arrays;
import java.util.Locale;
import java.io.Serializable;
import java.text.NumberFormat;
import org.apache.sis.util.Localized;
import org.apache.sis.util.Workaround;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.resources.Errors;

import static org.apache.sis.util.ArgumentChecks.*;

/**
 * The set of symbols to use for Well Known Text (WKT) parsing and formatting.
 * The two constants defined in this class, namely {@link #SQUARE_BRACKETS} and {@link #CURLY_BRACKETS},
 * define the symbols for ISO 19162 compliant WKT formatting. Their properties are:
 *
 *

 *

 *     Locale for number format:
 *     {@link Locale#ROOT}
 *
 *

 *

 *     Bracket symbols:
 *     {@code [}…{@code ]} or {@code (}…{@code )}
 *     Note: the {@code […]} brackets are common in referencing WKT,
 *         while the {@code (…)} brackets are common in geometry WKT.
 *

 *

 *     Quote symbols:
 *     {@code "}…{@code "}
 *     Note: Apache SIS accepts also {@code "…"} quotes
 *         for more readable {@code String} literals in Java code, but this is non-standard.
 *

 *

 *     Sequence symbols:
 *     {…}
 *
 *

 *

 *     Separator:
 *     {@code ,}
 *
 *

 *

 *
 * Users can create their own {@code Symbols} instance for parsing or formatting a WKT with different symbols.
 *
 * @author  Martin Desruisseaux (IRD, Geomatys)
 * @since   0.4
 * @version 0.6
 * @module
 *
 * @see WKTFormat#getSymbols()
 * @see WKTFormat#setSymbols(Symbols)
 */
public class Symbols implements Localized, Cloneable, Serializable {
    /**
     * For cross-version compatibility.
     */
    private static final long serialVersionUID = -1730166945430878916L;

    /**
     * Set to {@code true} if parsing and formatting of number in scientific notation is allowed.
     * The way to achieve that is currently a hack, because {@link NumberFormat} has no API for
     * managing that as of JDK 1.8.
     *
     * @todo See if a future version of JDK allows us to get ride of this ugly hack.
     */
    @Workaround(library = "JDK", version = "1.8")
    static final boolean SCIENTIFIC_NOTATION = true;

    /**
     * The prefix character for the value of a WKT fragment.
     */
    static final char FRAGMENT_VALUE = '$';

    /**
     * A set of symbols with values between square brackets, like {@code DATUM["WGS84"]}.
     * This instance defines:
     *
     *

     *
{@link Locale#ROOT} for {@linkplain java.text.DecimalFormatSymbols decimal format symbols}.

     *
Square brackets by default, as in {@code DATUM["WGS84"]}, but accepting also curly brackets as in
     *       {@code DATUM("WGS84")}. Both are legal WKT.

     *
English quotation mark ({@code '"'}) by default, but accepting also "…" quotes
     *       for more readable {@link String} constants in Java code.

     *
Coma separator followed by a space ({@code ", "}).

     *

     *
     * This is the most frequently used WKT format for referencing objects.
     */
    public static final Symbols SQUARE_BRACKETS = new Symbols(
            new int[] {'[', ']', '(', ')'}, new int[] {'"', '"', '"', '"'});

    /**
     * A set of symbols with values between parentheses, like {@code DATUM("WGS84")}.
     * This instance is identical to {@link #SQUARE_BRACKETS} except that the default
     * brackets are the curly ones instead than the square ones (but both are still
     * accepted at parsing time).
     *
     *
This format is rare with referencing objects but common with geometry objects.

     */
    public static final Symbols CURLY_BRACKETS = new Symbols(
            new int[] {'(', ')', '[', ']'}, SQUARE_BRACKETS.quotes);

    /**
     * The locale of {@linkplain java.text.DecimalFormatSymbols decimal format symbols} or other symbols.
     *
     * @see #getLocale()
     */
    private Locale locale;

    /**
     * List of characters (as Unicode code points) acceptable as opening or closing brackets.
     * The array shall comply to the following restrictions:
     *
     *

     *
The characters at index 0 and 1 are the preferred opening and closing brackets respectively.

     *
For each even index <var>i</var>, {@code brackets[i+1]} is the closing bracket matching {@code brackets[i]}.

     *

     *
     * @see #getOpeningBracket(int)
     * @see #getClosingBracket(int)
     */
    private int[] brackets;

    /**
     * List of characters (as Unicode code point) used for opening or closing a quoted text.
     * The array shall comply to the following restrictions:
     *
     *

     *
The characters at index 0 and 1 are the preferred opening and closing quotes respectively.

     *
For each even index <var>i</var>, {@code quotes[i+1]} is the closing quote matching {@code quotes[i]}.

     *

     *
     * Both opening and closing quotes are usually {@code '"'}.
     */
    private int[] quotes;

    /**
     * The preferred closing quote character ({@code quotes[1]}) as a string.
     * We use the closing quote because this is the character that the parser
     * will look for determining the text end.
     *
     * @see #getQuote()
     * @see #readResolve()
     */
    private transient String quote;

    /**
     * The character (as Unicode code point) used for opening ({@code openSequence})
     * or closing ({@code closeSequence}) an array or enumeration.
     */
    private int openSequence, closeSequence;

    /**
     * The string used as a separator in a list of values. This is usually {@code ", "},
     * but may be different if a non-English locale is used for formatting numbers.
     */
    private String separator;

    /**
     * Same value than {@link #separator} but without leading and trailing spaces.
     */
    private transient String trimmedSeparator;

    /**
     * {@code true} if this instance shall be considered as immutable.
     */
    private boolean isImmutable;

    /**
     * Creates a new set of WKT symbols initialized to a copy of the given symbols.
     *
     * @param symbols The symbols to copy.
     */
    public Symbols(final Symbols symbols) {
        ensureNonNull("symbols", symbols);
        locale           = symbols.locale;
        brackets         = symbols.brackets;
        quotes           = symbols.quotes;
        quote            = symbols.quote;
        openSequence     = symbols.openSequence;
        closeSequence    = symbols.closeSequence;
        separator        = symbols.separator;
        trimmedSeparator = symbols.trimmedSeparator;
    }

    /**
     * Constructor reserved to {@link #SQUARE_BRACKETS} and {@link #CURLY_BRACKETS} constants.
     * The given array is stored by reference - it is not cloned.
     */
    private Symbols(final int[] brackets, final int[] quotes) {
        this.locale           = Locale.ROOT;
        this.brackets         = brackets;
        this.quotes           = quotes;
        this.quote            = "\"";
        this.openSequence     = '{';
        this.closeSequence    = '}';
        this.separator        = ", ";
        this.trimmedSeparator = ",";
        this.isImmutable      = true;
    }

    /**
     * Throws an exception if this set of symbols is immutable.
     */
    final void checkWritePermission() throws UnsupportedOperationException {
        if (isImmutable) {
            throw new UnsupportedOperationException(Errors.format(Errors.Keys.UnmodifiableObject_1, "Symbols"));
        }
    }

    /**
     * Returns the default set of symbols.
     * This is currently set to {@link #SQUARE_BRACKETS}.
     *
     * @return The default set of symbols.
     */
    public static Symbols getDefault() {
        return SQUARE_BRACKETS;
    }

    /**
     * Returns the locale for formatting dates and numbers.
     * The default value is {@link Locale#ROOT}.
     *
     *
Relationship between {@code Symbols} locale and {@code WKTFormat} locale

     * The {@code WKTFormat.getLocale(Locale.DISPLAY)} property specifies the language to use when
     * formatting {@link org.opengis.util.InternationalString} instances and can be set to any value.
     * On the contrary, the {@code Locale} property of this {@code Symbols} class controls
     * the decimal format symbols and is very rarely set to an other locale than {@code Locale.ROOT}.
     *
     * @return The locale for dates and numbers.
     *
     * @see WKTFormat#getLocale(Locale.Category)
     */
    @Override
    public final Locale getLocale() {
        return locale;
    }

    /**
     * Sets the locale of decimal format symbols or other symbols.
     * Note that any non-English locale is likely to produce WKT that do not conform to ISO 19162.
     * Such WKT can be used for human reading, but not for data export.
     *
     * @param locale The new symbols locale.
     */
    public void setLocale(final Locale locale) {
        checkWritePermission();
        ensureNonNull("locale", locale);
        this.locale = locale;
    }

    /**
     * Implementation of {@link #matchingBracket(int)} and {@link #matchingQuote(int)}.
     */
    private static int matching(final int[] chars, final int c) {
        for (int i = 0; i < chars.length; i += 2) {
            if (chars[i] == c) {
                return chars[i + 1];
            }
        }
        return -1;
    }

    /**
     * If the given character is an opening bracket, returns the matching closing bracket.
     * Otherwise returns -1.
     */
    final int matchingBracket(final int c) {
        return matching(brackets, c);
    }

    /**
     * Returns the number of paired brackets. For example if the WKT parser accepts both the
     * {@code […]} and {@code (…)} bracket pairs, then this method returns 2.
     *
     * @return The number of bracket pairs.
     *
     * @see #getOpeningBracket(int)
     * @see #getClosingBracket(int)
     */
    public final int getNumPairedBrackets() {
        return brackets.length >>> 1;
    }

    /**
     * Returns the opening bracket character at the given index.
     * Index 0 stands for the default bracket used at formatting time.
     * All other index are for optional brackets accepted at parsing time.
     *
     * @param  index Index of the opening bracket to get, from 0 to {@link #getNumPairedBrackets()} exclusive.
     * @return The opening bracket at the given index, as a Unicode code point.
     * @throws IndexOutOfBoundsException if the given index is out of bounds.
     */
    public final int getOpeningBracket(final int index) {
        return brackets[index << 1];
    }

    /**
     * Returns the closing bracket character at the given index.
     * Index 0 stands for the default bracket used at formatting time.
     * All other index are for optional brackets accepted at parsing time.
     *
     * @param  index Index of the closing bracket to get, from 0 to {@link #getNumPairedBrackets()} exclusive.
     * @return The closing bracket at the given index, as a Unicode code point.
     * @throws IndexOutOfBoundsException if the given index is out of bounds.
     */
    public final int getClosingBracket(final int index) {
        return brackets[(index << 1) | 1];
    }

    /**
     * Sets the opening and closing brackets to the given pairs.
     * Each string shall contain exactly two code points (usually two characters).
     * The first code point is taken as the opening bracket, and the second code point as the closing bracket.
     *
     *
Example:
     * The following code will instruct the WKT formatter to use the (…) pair of brackets at formatting time,
     * but still accept the more common […] pair of brackets at parsing time:
     *
     * {@preformat java
     *   symbols.setPairedBrackets("()", "[]");
     * }

     *
     * @param preferred The preferred pair of opening and closing quotes, used at formatting time.
     * @param alternatives Alternative pairs of opening and closing quotes accepted at parsing time.
     */
    public void setPairedBrackets(final String preferred, final String... alternatives) {
        checkWritePermission();
        brackets = toCodePoints(preferred, alternatives);
    }

    /**
     * If the given character is an opening quote, returns the matching closing quote.
     * Otherwise returns -1.
     */
    final int matchingQuote(final int c) {
        return matching(quotes, c);
    }

    /**
     * Returns the number of paired quotes. For example if the WKT parser accepts both the
     * {@code "…"} and {@code "…"} quote pairs, then this method returns 2.
     *
     * @return The number of quote pairs.
     *
     * @see #getOpeningQuote(int)
     * @see #getClosingQuote(int)
     */
    public final int getNumPairedQuotes() {
        return quotes.length >>> 1;
    }

    /**
     * Returns the opening quote character at the given index.
     * Index 0 stands for the default quote used at formatting time, which is usually {@code '"'}.
     * All other index are for optional quotes accepted at parsing time.
     *
     * @param  index Index of the opening quote to get, from 0 to {@link #getNumPairedQuotes()} exclusive.
     * @return The opening quote at the given index, as a Unicode code point.
     * @throws IndexOutOfBoundsException if the given index is out of bounds.
     */
    public final int getOpeningQuote(final int index) {
        return quotes[index << 1];
    }

    /**
     * Returns the closing quote character at the given index.
     * Index 0 stands for the default quote used at formatting time, which is usually {@code '"'}.
     * All other index are for optional quotes accepted at parsing time.
     *
     * @param  index Index of the closing quote to get, from 0 to {@link #getNumPairedQuotes()} exclusive.
     * @return The closing quote at the given index, as a Unicode code point.
     * @throws IndexOutOfBoundsException if the given index is out of bounds.
     */
    public final int getClosingQuote(final int index) {
        return quotes[(index << 1) | 1];
    }

    /**
     * Returns the preferred closing quote character as a string. This is the quote to double if it
     * appears in a Unicode string to format. We check for the closing quote because this is the one
     * that the parser will look for determining the text end.
     */
    final String getQuote() {
        return quote;
    }

    /**
     * Sets the opening and closing quotes to the given pairs.
     * Each string shall contain exactly two code points (usually two characters).
     * The first code point is taken as the opening quote, and the second code point as the closing quote.
     *
     *
Example:
     * The following code will instruct the WKT formatter to use the prettier "…" quotation marks at formatting time
     * (especially useful for {@code String} constants in Java code), but still accept the standard "…" quotation marks
     * at parsing time:
     *
     * {@preformat java
     *   symbols.setPairedQuotes("""", "\"\"");
     * }

     *
     * @param preferred The preferred pair of opening and closing quotes, used at formatting time.
     * @param alternatives Alternative pairs of opening and closing quotes accepted at parsing time.
     */
    public void setPairedQuotes(final String preferred, final String... alternatives) {
        checkWritePermission();
        quotes = toCodePoints(preferred, alternatives);
        quote = preferred.substring(Character.charCount(quotes[0])).trim();
    }

    /**
     * Packs the given pairs of bracket or quotes in a single array of code points.
     * This method also verifies arguments validity.
     */
    private static int[] toCodePoints(final String preferred, final String[] alternatives) {
        ensureNonEmpty("preferred", preferred);
        final int n = (alternatives != null) ? alternatives.length : 0;
        final int[] array = new int[(n+1) * 2];
        String name = "preferred";
        String pair = preferred;
        int i=0, j=0;
        while (true) {
            if (pair.codePointCount(0, pair.length()) != 2) {
                throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentValue_2, name, pair));
            }
            final int c = pair.codePointAt(0);
            ensureValidQuoteOrBracket(name, array[j++] = c);
            ensureValidQuoteOrBracket(name, array[j++] = pair.codePointAt(Character.charCount(c)));
            if (i >= n) {
                break;
            }
            ensureNonNullElement(name = "alternatives", i, pair = alternatives[i++]);
        }
        return array;
    }

    /**
     * Ensures that the given code point is a valid Unicode code point but not a Unicode identifier part.
     */
    private static void ensureValidQuoteOrBracket(final String name, final int code) {
        ensureValidUnicodeCodePoint(name, code);
        if (Character.isUnicodeIdentifierPart(code) || Character.isSpaceChar(code) || code == FRAGMENT_VALUE) {
            throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalCharacter_2,
                    name, String.valueOf(Character.toChars(code))));
        }
    }

    /**
     * Returns the character used for opening a sequence of values.
     * This is usually '{'.
     *
     * @return The character used for opening a sequence of values, as a Unicode code point.
     */
    public final int getOpenSequence() {
        return openSequence;
    }

    /**
     * Returns the character used for closing a sequence of values.
     * This is usually '}'.
     *
     * @return The character used for closing a sequence of values, as a Unicode code point.
     */
    public final int getCloseSequence() {
        return closeSequence;
    }

    /**
     * Sets the characters used for opening and closing a sequence of values.
     *
     * @param openSequence  The character for opening a sequence of values, as a Unicode code point.
     * @param closeSequence The character for closing a sequence of values, as a Unicode code point.
     */
    public void setSequenceBrackets(final int openSequence, final int closeSequence) {
        checkWritePermission();
        ensureValidQuoteOrBracket("openSequence",  openSequence);
        ensureValidQuoteOrBracket("closeSequence", closeSequence);
        this.openSequence  = openSequence;
        this.closeSequence = closeSequence;
    }

    /**
     * Returns the string used as a separator in a list of values. This is usually {@code ", "},
     * but may be different if a non-English locale is used for formatting numbers.
     *
     * @return The string used as a separator in a list of values.
     */
    public final String getSeparator() {
        return separator;
    }

    /**
     * Sets the string to use as a separator in a list of values.
     * The given string will be used "as-is" at formatting time,
     * but leading and trailing spaces will be ignored at parsing time.
     *
     * @param separator The new string to use as a separator in a list of values.
     */
    public void setSeparator(final String separator) {
        checkWritePermission();
        final String s = CharSequences.trimWhitespaces(separator.trim());
        ensureNonEmpty("separator", s);
        this.separator = separator;
        trimmedSeparator = s;
    }

    /**
     * Returns the separator without trailing spaces.
     */
    final String trimmedSeparator() {
        return trimmedSeparator;
    }

    /**
     * Returns the value of {@link #getSeparator()} without trailing spaces,
     * followed by the system line separator.
     */
    final String lineSeparator() {
        final String separator = getSeparator();
        return separator.substring(0, CharSequences.skipTrailingWhitespaces(separator, 0, separator.length()))
                .concat(System.lineSeparator());
    }

    /**
     * Creates a new number format to use for parsing and formatting. Each {@link WKTFormat} will
     * create its own instance, since {@link NumberFormat}s are not guaranteed to be thread-safe.
     *
     *
Scientific notation

     * The {@link NumberFormat} created here does not use scientific notation. This is okay for many
     * WKT formatting purpose since Earth ellipsoid axis lengths in metres are large enough for trigging
     * scientific notation, while we want to express them as normal numbers with centimetre precision.
     * However this is problematic for small numbers like 1E-5. Callers may need to adjust the precision
     * depending on the kind of numbers (length or angle) to format.
     */
    final NumberFormat createNumberFormat() {
        final NumberFormat format = NumberFormat.getNumberInstance(locale);
        format.setGroupingUsed(false);
        return format;
    }

    /**
     * Returns {@code true} if the given WKT contains at least one instance of the given element.
     * Invoking this method is equivalent to invoking {@link String#contains(CharSequence)} except
     * for the following:
     *
     *

     *
The search is case-insensitive.

     *
Characters between {@linkplain #getOpeningQuote(int) opening quotes} and
     *       {@linkplain #getClosingQuote(int) closing quotes} are ignored.

     *
The element found in the given WKT can not be preceded by other
     *       {@linkplain Character#isUnicodeIdentifierPart(int) Unicode identifier characters}.

     *
The element found in the given WKT must be followed, ignoring space, by an
     *       {@linkplain #getOpeningBracket(int) opening bracket}.

     *

     *
     * The purpose of this method is to guess some characteristics about the encoded object without
     * the cost of a full WKT parsing.
     *
     * @param  wkt The WKT to inspect.
     * @param  element The element to search for.
     * @return {@code true} if the given WKT contains at least one instance of the given element.
     */
    public boolean containsElement(final CharSequence wkt, final String element) {
        ensureNonNull("wkt", wkt);
        ensureNonEmpty("element", element);
        if (!CharSequences.isUnicodeIdentifier(element)) {
            throw new IllegalArgumentException(Errors.format(Errors.Keys.NotAUnicodeIdentifier_1, element));
        }
        return containsElement(wkt, element, 0);
    }

    /**
     * Returns {@code true} if the given WKT contains at least one instance of the {@code AXIS[…]} element.
     * Invoking this method is equivalent to invoking
     * {@linkplain #containsElement(CharSequence, String) containsElement}(wkt, "AXIS").
     *
     *
Use case

     * The check for axis elements is of particular interest because the axis order is a frequent cause
     * of confusion when processing geographic data. Some applications just ignore any declared axis order
     * in favor of their own hard-coded (<var>longitude</var>, <var>latitude</var>) axis order.
     * Consequently, the presence of {@code AXIS[…]} elements in a WKT is an indication that the encoded
     * object may not be understood as intended by some external softwares.
     *
     * @param  wkt The WKT to inspect.
     * @return {@code true} if the given WKT contains at least one instance of the {@code AXIS[…]} element.
     */
    public boolean containsAxis(final CharSequence wkt) {
        ensureNonNull("wkt", wkt);
        return containsElement(wkt, "AXIS", 0);
    }

    /**
     * Implementation of {@link #containsElement(CharSequence, String)} without verification of argument validity.
     *
     * @param  wkt     The WKT to inspect.
     * @param  element The element to search. Must contains only uppercase letters.
     * @param  offset  The index to start the search from.
     */
    private boolean containsElement(final CharSequence wkt, final String element, int offset) {
        final int[] quotes = this.quotes;
        final int length = wkt.length();
        boolean isQuoting = false;
        int closeQuote = 0;
        while (offset < length) {
            int c = Character.codePointAt(wkt, offset);
            if (closeQuote != 0) {
                if (c == closeQuote) {
                    isQuoting = false;
                }
            } else for (int i=0; i<quotes.length; i+=2) {
                if (c == quotes[i]) {
                    closeQuote = quotes[i | 1];
                    isQuoting = true;
                    break;
                }
            }
            if (!isQuoting && Character.isUnicodeIdentifierStart(c)) {
                /*
                 * Found the beginning of a Unicode identifier.
                 * Check if this is the identifier we were looking for.
                 */
                if (CharSequences.regionMatches(wkt, offset, element, true)) {
                    offset = CharSequences.skipLeadingWhitespaces(wkt, offset + element.length(), length);
                    if (offset >= length) {
                        break;
                    }
                    c = Character.codePointAt(wkt, offset);
                    if (matchingBracket(c) >= 0) {
                        return true;
                    }
                } else {
                    /*
                     * Not the identifier we were looking for. Skip the whole identifier.
                     */
                    do {
                        offset += Character.charCount(c);
                        if (offset >= length) {
                            return false;
                        }
                        c = Character.codePointAt(wkt, offset);
                    } while (Character.isUnicodeIdentifierPart(c));
                }
            }
            offset += Character.charCount(c);
        }
        return false;
    }

    /**
     * Returns an immutable copy of this set of symbols, or {@code this} if this instance is already immutable.
     */
    final Symbols immutable() {
        if (isImmutable) {
            return this;
        }
        final Symbols clone = clone();
        clone.isImmutable = true;
        return clone;
    }

    /**
     * Returns a clone of this {@code Symbols}.
     *
     * @return A clone of this {@code Symbols}.
     */
    @Override
    public Symbols clone() {
        final Symbols clone;
        try {
            clone = (Symbols) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new AssertionError(e);
        }
        /*
         * No needs to copy the arrays, because their content are never modified.
         * Instead, the setter methods create new arrays.
         */
        clone.isImmutable = false;
        return clone;
    }

    /**
     * Compares this {@code Symbols} with the given object for equality.
     *
     * @param  other The object to compare with this {@code Symbols}.
     * @return {@code true} if both objects are equal.
     */
    @Override
    public boolean equals(final Object other) {
        if (other instanceof Symbols) {
            final Symbols that = (Symbols) other;
            return Arrays.equals(brackets, that.brackets) &&
                   Arrays.equals(quotes, that.quotes) &&
                   // no need to compare 'quote' because it is computed from 'quotes'.
                   openSequence  == that.openSequence &&
                   closeSequence == that.closeSequence &&
                   separator.equals(that.separator) &&
                   locale.equals(that.locale);
        }
        return false;
    }

    /**
     * Returns a hash code value for this object.
     *
     * @return A hash code value.
     */
    @Override
    public int hashCode() {
        return Arrays.deepHashCode(new Object[] {brackets, quotes, openSequence, closeSequence, separator, locale});
    }

    /**
     * Invoked on deserialization for replacing the deserialized instance by the constant instance.
     * This method also opportunistically recompute the {@link #quote} field if no replacement is done.
     *
     * @return The object to use after deserialization.
     */
    final Object readResolve() {
        if (isImmutable) {
            if (equals(SQUARE_BRACKETS)) return SQUARE_BRACKETS;
            if (equals(CURLY_BRACKETS))  return CURLY_BRACKETS;
        }
        quote = String.valueOf(Character.toChars(quotes[1]));
        trimmedSeparator = CharSequences.trimWhitespaces(separator.trim());
        return this;
    }
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="../build/d3-gridding.js"></script>
<script>

var width = 400,
    height = 300;

var gridding = d3.gridding()
  .size([width, height])
  .mode("grid");

// var abc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");

var data =  d3.range(250).map(function(d, i) {
  return {x: d, y: i, r: Math.random(), index: i, value: String.fromCharCode(i)};
});

console.log(gridding(data))

</script>


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">

        <title>Eole Project</title>

        <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Montserrat:400,700" type="text/css">
        <link rel="stylesheet" href="bower_components/components-font-awesome/css/font-awesome.min.css" type="text/css">
        <link rel="stylesheet" href="bower_components/tether/dist/css/tether.min.css">
        <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
        <link rel="stylesheet" href="css/all.css">

Eole

What is Eole ?

                    Eole is an online board games website
                    for people who want to play
                    to their favorite board game, but don't find
                    an online version of the game.

                        Demo application

                    It is an open-source project, and a free web application.

                    It aims to be an oasis for both board game players and developers.

Project News

Sandstone release

                                <time pubdate="pubdate" datetime="2016-06-17" class="text-muted">17th June, 2016</time>

                                    Eole Api uses an extended version of Silex which nicely handle websocket topics,
                                    push server based on ZMQ... So I decided to "extract" this component
                                    as a standalone library. I named it Sandstone, it is open-source,
                                    and it is on Github.

                                        Eole/Sandstone

Architecture

                    As is, Eole is just a game platform,
                    and provides (or will provides in futur)
                    features like:

creating a game,

waiting for people to join your game,

real-time playing,

creating an account,

chat room,

organizing tournaments,

poker chips for bet games,

ranking system with Elo, win/loss/draw...

                    The project consists on a PHP Rest Api, working together with a websocket server for real-time notifications,
                    and a front-side AngularJS application.

                                Eole Api

                                    The Api provides a Rest Api
                                    and a websocket server for real-time notification
                                    (i.e a player made a move).

                                    It is built with following technologies/libraries:

PHP 5.5

Symfony

Silex 2, Sandstone

ReactPHP

WAMP v1 protocol

php-zmq extension

ZMQ

                                        See project on Github

                                License GNU GPL-v3

                                Eole Angular

                                    The AngularJS project provides a front-side application.

                                    It is built with following technologies/libraries:

Javascript

AngularJS 1

Bootstrap 3

Autobahn 0.8

                                        See project on Github

                                License GNU GPL-v3

Extendability

                    Eole architecture allows to be extended easily by adding:

more endpoints for RestApi,

more topics for websocket server

and more AngularJS modules for web application.

                    So games can be developed independently of Eole domain and components,
                    and then just create a layer/bridge to extend Eole with your game endpoints, topics...

And then the footer...

                        Eole Github organization


text:
<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Admin\Sociallink;
use Illuminate\Support\Facades\Storage;

class SociallinkController extends Controller
{
    public function index()
    {
        $sociallinks = Sociallink::OrderBy('name', 'asc')->paginate(1);
        return view('admin.socailLink.socaillink-list', compact('sociallinks'));
    }

    public function addEdit($id = null)
    {
        if ($id) {
            $sociallink = Sociallink::findOrFail($id);
        }
        return view('admin.socailLink.add-edit-socaillink', compact('sociallink'));
    }

    public function store(Request $request)
    {
        if ($request->id) {
            $this->validate($request, [
                'name' => 'required|max:190'
            ]);
        } else {
            $this->validate($request, [
                'name' => 'required|max:190',
                'icon' => 'required|image'
            ]);
        }

        $image_url = '';
        $new_icon = '';
        if ($request->hasFile('icon')) {
            $image_name = str_replace(' ', '-', 'icon-' . microtime() . '-' . '.' . $request->file('icon')->getClientOriginalExtension());
            $new_icon = $request->file('icon')->storePubliclyAs('socialIcon', $image_name, 'public');
        }

        if ($new_icon == '') {
            $image_url = @$request->old_image;
        } else {
            $image_url = $new_icon;
        }

        $social = $request->user()->socialLinks()->UpdateOrCreate(['id' => @$request->id], ['name' => $request->name, 'icon' => $image_url]);

        if ($request->id) {
            if ($new_icon != '') {
                $old_icon = $request->old_image;
                Storage::disk('public')->delete($old_icon);
            }
            return redirect()->route('social-link.index')->with('success', 'Data successfully updated!!');
        }
        return redirect()->route('social-link.index')->with('success', 'Data successfully added!!');
    }

    public function delete($id)
    {
        $sociallink = Sociallink::findOrFail($id);
        $sociallink->delete();
        return redirect()->back()->with('success', 'Data successfully deleted!!');
    }

}


text:
<?php
/**
 * This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
 * See [README.md](README.md#generating-data) for more information.
 *
 * Pull requests changing data in these files will not be accepted. See the
 * [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
 * metadata changes.
 *
 * Do not modify this file directly!
 */

return array (
  21670 => 'Ben Arous',
  21671 => 'Ariana/Ben Arous/Carthage/Tunis',
  21672 => 'Bizerte/Nabeul/Zaghouan',
  21673 => 'Chebba/Hamman-Sousse/Khenis/Mahdia/Monastir/Sousse',
  21674 => 'Agareb/Sfax',
  21675 => 'Gabes/Kebili/Medenine/Tataouine',
  21676 => 'Gafsa/Sidi Bouzid/Tozeur',
  21677 => 'Haffouz/Kairouan/Kasserine',
  21678 => 'Beja/Jendouba/Kef/La Kef/Siliana/Tabarka',
);


text:
Ajax-uploader
=============

...but it's not ajax really. Naming things is hard .(

Files uploader
==============

It's javascript class for dynamic uploading of files via iframe.
* create hidden iframe and use it as the target for form
* form is proceeded on background, then reseted and can be reused
* upload's response can contain data to be displayed in no time

Basic uploader
--------------

* ...just upload data and that's all
* *selInputWrapper have to be inside form or to be form itself (always)*

```html
<script>
	new AjaxUploader({
		selInputWrapper: ".input_wrapper"
	});
</script>
<form action="/image/upload/" method="post" enctype="multipart/form-data">
    <div class="input_wrapper">
		<input type="file" name="image"/>
	</div>
</form>
```

Uploader with status messages
-----------------------------

* display messages while upload

```html
<script>
	new AjaxUploader({
		selInputWrapper: ".input_wrapper",
		selMessages: ".upload_messages"
	});
</script>
<form action="/image/upload/" method="post" enctype="multipart/form-data">
    <div class="input_wrapper">
		<input type="file" name="image"/>
	</div>
</form>
<div class="upload_messages">
	<div class="alert">Shows sucess/progress/alert informations</div>
	<div class="progress">Progress bar while uploading</div>
</div>
```

Uploader with response canvas
-----------------------------

* provides canvas to display data from response

```html
<script>
	new AjaxUploader({
		selInputWrapper: ".input_wrapper",
		selThumbnails: ".canvas"
	});
</script>
<form action="/image/upload/" method="post" enctype="multipart/form-data">
    <div class="input_wrapper">
		<input type="file" name="image"/>
	</div>
</form>
<div class="canvas">
	<!--
	this node will contains html from response if response contains
	following json structure:

	[{
		file: {
			html: "<p>result to display in this node</p>"
		}
	}]

	-->
</div>
```

Object options
==============

msgUploading
message displayed while uploading

msgUploadError
message for upload error

msgUploadSuccess
message for complete upload

msgDeleteConfirm
message for delete confirmation

selInputWrapper
selector for close wrapper of file input

selMessages
selector for close messages' wrapper

selThumbnails
selector for (response's) thumbnails wrapper

selThumbnailWrapper
selector for existing thumbnail (used while deleting to remove given DOM node)

selFormMirror
selector for mirror form

- when there's a need to have input in different form which has mismatching params (target/enctype/method) then you can use another (hidden) form to submit your input. File input is copied in there and given form is submitted instead of input's parent form.

djangoCsrf
if you use Django, csrf token is added. Set to false otherwise

onUpload
your custom action to run after success upload

beforeUpload
your custom action to run before upload


text:
package uk.ac.shef.wit.simmetrics.math;

/**
 * Package: uk.ac.shef.wit.simmetrics.math
 * Description: MathFuncs implements a number of handy maths functions.
 * Date: 24-Mar-2004
 * Time: 14:15:30
 * @author Sam Chapman Website, Email.
 * @version 1.1
 */
final public class MathFuncs {

    /**
     * returns the max of three numbers.
     *
     * @param x
     * @param y
     * @param z
     * @return the max of three numbers
     */
    public static float max3(final float x, final float y, final float z) {
        return Math.max(x, Math.max(y, z) );
    }

    /**
     * returns the max of four numbers.
     *
     * @param w
     * @param x
     * @param y
     * @param z
     * @return the max of four numbers
     */
    public static float max4(final float w, final float x, final float y, final float z) {
        return Math.max(Math.max(w, x), Math.max(y, z));
    }

    /**
     * returns the min of three numbers.
     *
     * @param x
     * @param y
     * @param z
     * @return the min of three numbers
     */
    public static float min3(final float x, final float y, final float z) {
        return Math.min(x, Math.min(y, z));
    }

    /**
     * returns the min of three numbers.
     *
     * @param x
     * @param y
     * @param z
     * @return the min of three numbers
     */
    public static int min3(final int x, final int y, final int z) {
        return Math.min(x, Math.min(y, z));
    }

    /**
     * returns the max of three numbers.
     *
     * @param x
     * @param y
     * @param z
     * @return the max of three numbers
     */
    public static int max3(final int x, final int y, final int z) {
        return Math.max(x, Math.max(y, z));
    }
}


text:
using namespace ci;
using namespace ci::app;
using namespace components;

void VrInterface::cfg(cms::cfg::Cfg& cfg) {
  cfg
  .connectAttr<void()>("setupOn", [this](){ this->setup();})
  .connectAttr<void()>("updateOn", [this](){ this->update();})
  .connectAttr<void()>("drawOn", [this](){ this->draw();})

  .withSignalByAttr<void()>("drawSceneEmit", [this](::ctree::Signal<void()>& sig){
    this->renderSceneSignal.connect([&sig](){ sig.emit(); });
  })
  .withSignalByAttr<void()>("drawNoVR", [this](::ctree::Signal<void()>& sig){
    this->renderNoVrSignal.connect([&sig](){ sig.emit(); });
  })
  .withSignalByAttr<void()>("drawVR", [this](::ctree::Signal<void()>& sig){
    this->renderVrSignal.connect([&sig](){ sig.emit(); });
  });

  if (cfg.reader()->getBool("autoSetup", true)) {
    this->setup();
  }

  if (cfg.reader()->getBool("windowMouseEvents", true)) {
    app::App::get()->getWindow()->getSignalMouseDown().connect([this](app::MouseEvent &event){
      this->mouseDown(event);
    });

    app::App::get()->getWindow()->getSignalMouseDrag().connect([this](app::MouseEvent &event){
      this->mouseDrag(event);
    });
  }

  if (cfg.reader()->getBool("windowKeyEvents", false)) {
    app::App::get()->getWindow()->getSignalKeyDown().connect([this](app::KeyEvent &event){
      this->keyDown(event);
    });
  }
}

void VrInterface::setup(){
  if (bSetupDone) return;

  #ifdef VR_ENABLED
    CI_LOG_I("Setting up VR...");

    try {
      ci::vr::initialize();
    } catch (const std::exception& e) {
      CI_LOG_E("VR failed: " << e.what());
    }

    try {
      mVrContext = ci::vr::beginSession(
        ci::vr::SessionOptions()
        .setOriginOffset(vec3(0, 0, 0)) // vec3(0, 0, -3)
        // .setControllerConnected([this](const ci::vr::Controller* controller) {
        //   CI_LOG_I("VR controller connected");
        //   this->pController = controller;
        // })
        // .setControllerDisconnected([this](const ci::vr::Controller* controller) {
        //   CI_LOG_I("VR controller DISconnected");
        //   this->pController = NULL;
        // })
      );
    }
    catch (const std::exception& e) {
      CI_LOG_E("VR Session failed: " << e.what());
    }

    if (mVrContext) {
      try {
        mHmd = mVrContext->getHmd();
        //mHmd->setMirrorMode(ci::vr::Hmd::MirrorMode::MIRROR_MODE_STEREO);
        mHmd->setMirrorMode(ci::vr::Hmd::MirrorMode::MIRROR_MODE_UNDISTORTED_STEREO);
      }
      catch (const std::exception& e) {
        CI_LOG_E("VR Hmd failed: " << e.what());
      }
    }

    setMirroredMode(0);

  #endif

  #ifdef VR_PLACEHOLDER
    mCam.setWorldUp(vec3(0, 1, 0));
    mCam.lookAt(vec3(0), vec3(0, 0, 1));
    mCam.setPerspective( 45.0f, getWindowAspectRatio(), 0.1, 10000 );

    CI_LOG_I("Setting up VR-replacement camera...");
    mCamUi = CameraUi( &mCam, app::App::get()->getWindow() );
  #endif

  this->bSetupDone = true;
}

void VrInterface::update(){
  #ifdef VR_ENABLED
    // Vive sometimes returns the wrong pose data initially so reinitialize the origin matrix after the first 60 frames.
    if (mHmd && (ci::vr::API_OPENVR == mVrContext->getApi()) && (!mRecalcOrigin) && (mHmd->getElapsedFrames() > 60)) {
      mHmd->calculateOriginMatrix();
      mRecalcOrigin = true;
    }
  #endif
}

void VrInterface::draw(){
  #ifdef VR_ENABLED
    // render for VR glasses?
    if(mHmd){

      // render for individual eyes
      mHmd->bind();
      {
        for (auto eye : mHmd->getEyes()) {
          mHmd->enableEye(eye);
          this->renderSceneSignal.emit();
          this->renderVrSignal.emit();
          mHmd->drawControllers(eye);
        }
      }
      mHmd->unbind();

      // also draw to monitor?
      if (drawMirrored) {
        mHmd->submitFrame();

        gl::viewport( getWindowWidth() / 2, 0.0f, getWindowWidth() / 2, getWindowHeight() );
        //        gl::viewport(getWindowSize());
        mHmd->enableEye(ci::vr::EYE_HMD);
        this->renderSceneSignal.emit();
        this->renderVrSignal.emit();
      } else {
        gl::viewport( getWindowWidth() / 2, 0.0f, getWindowWidth() / 2, getWindowHeight() );
//        gl::viewport(getWindowSize());
        gl::setMatricesWindow(getWindowSize());
        mHmd->drawMirrored(getWindowBounds(), true);
      }

      // done
      return;
    }
  #endif

  // draw "normal" (no VR)
  gl::viewport( getWindowWidth() / 2, 0.0f, getWindowWidth() / 2, getWindowHeight() );
  //gl::viewport(getWindowSize());
  gl::setMatrices(mCam);
  this->renderSceneSignal.emit();
  this->renderNoVrSignal.emit();
}

void VrInterface::mouseDown( MouseEvent& event ){
  #ifdef VR_PLACEHOLDER
    if (event.isMetaDown())
      mCamUi.mouseDown(event);
  #endif
}

void VrInterface::mouseDrag(MouseEvent& event){
  #ifdef VR_PLACEHOLDER
    if (event.isMetaDown())
      mCamUi.mouseDrag(event);
  #endif
}

void VrInterface::keyDown(KeyEvent& event){
  #ifdef VR_ENABLED
    if(event.isMetaDown()){
      switch (event.getChar()) {
        case DEFAULT_MIRRORMODE1_KEY: { setMirroredMode(0); return; }
        case DEFAULT_MIRRORMODE2_KEY: { setMirroredMode(1); return; }
        case DEFAULT_MIRRORMODE3_KEY: { setMirroredMode(2); return; }
        case DEFAULT_MIRRORMODE4_KEY: { setMirroredMode(3); return; }
        case DEFAULT_MIRRORMODE5_KEY: { setMirroredMode(4); return; }
        case DEFAULT_NO_MIRRORMODE_KEY: { drawMirrored = !drawMirrored; return; }
      }
    }
  #endif

  #ifdef VR_PLACEHOLDER
    if(event.getChar() == DEFAULT_TOGGLE_UICAM_KEY) {
      this->mCamUi.enable(!this->mCamUi.isEnabled());
    }
  #endif
}


text:
package com.example.android.autofill.app.view.autofillable;

import android.app.DatePickerDialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.AppCompatEditText;
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.autofill.AutofillValue;
import android.widget.DatePicker;

import com.example.android.autofill.app.R;

import java.util.Calendar;
import java.util.Date;

import static com.example.android.autofill.app.Util.DEBUG;
import static com.example.android.autofill.app.Util.TAG;

/**
 * A custom view that represents a {@link View#AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE} using
 * a non-editable {@link EditText} that triggers a {@link DatePickerDialog} to represent the
 * credit card expiration month and year.
 */
public class CreditCardExpirationDatePickerView extends AppCompatEditText {

    private static final int CC_EXP_YEARS_COUNT = 5;

    /**
     * Calendar instance used for month / year calculations. Should be reset before each use.
     */
    private final Calendar mTempCalendar;

    private int mMonth;
    private int mYear;

    public CreditCardExpirationDatePickerView(@NonNull Context context) {
        this(context, null);
    }

    public CreditCardExpirationDatePickerView(@NonNull Context context,
            @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public CreditCardExpirationDatePickerView(@NonNull Context context,
            @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        // Use the current date as the initial date in the picker.
        mTempCalendar = Calendar.getInstance();
        mYear = mTempCalendar.get(Calendar.YEAR);
        mMonth = mTempCalendar.get(Calendar.MONTH);
    }

    /**
     * Gets a temporary calendar set with the View's year and month.
     */
    private Calendar getCalendar() {
        mTempCalendar.clear();
        mTempCalendar.set(Calendar.YEAR, mYear);
        mTempCalendar.set(Calendar.MONTH, mMonth);
        mTempCalendar.set(Calendar.DATE, 1);
        return mTempCalendar;
    }

    @Override
    public AutofillValue getAutofillValue() {
        Calendar c = getCalendar();
        AutofillValue value = AutofillValue.forDate(c.getTimeInMillis());
        if (DEBUG) Log.d(TAG, "getAutofillValue(): " + value);
        return value;
    }

    @Override
    public void autofill(AutofillValue value) {
        if (value == null || !value.isDate()) {
            Log.w(TAG, "autofill(): invalid value " + value);
            return;
        }
        long time = value.getDateValue();
        mTempCalendar.setTimeInMillis(time);
        int year = mTempCalendar.get(Calendar.YEAR);
        int month = mTempCalendar.get(Calendar.MONTH);
        if (DEBUG) Log.d(TAG, "autofill(" + value + "): " + month + "/" + year);
        setDate(year, month);
    }

    private void setDate(int year, int month) {
        mYear = year;
        mMonth = month;
        Date selectedDate = new Date(getCalendar().getTimeInMillis());
        String dateString = DateFormat.getDateFormat(getContext()).format(selectedDate);
        setText(dateString);
    }

    @Override
    public int getAutofillType() {
        return AUTOFILL_TYPE_DATE;
    }

    public void reset() {
        mTempCalendar.setTimeInMillis(System.currentTimeMillis());
        setDate(mTempCalendar.get(Calendar.YEAR), mTempCalendar.get(Calendar.MONTH));
    }

    public void showDatePickerDialog(FragmentManager fragmentManager) {
        DatePickerFragment newFragment = new DatePickerFragment();
        newFragment.mParent = this;
        newFragment.show(fragmentManager, "datePicker");
    }

    public static class DatePickerFragment extends DialogFragment
            implements DatePickerDialog.OnDateSetListener {

        private CreditCardExpirationDatePickerView mParent;

        @Override
        public Dialog onCreateDialog(Bundle savedInstanceState) {
            DatePickerDialog dialog = new DatePickerDialog(getActivity(),
                    R.style.CustomDatePickerDialogTheme, this, mParent.mYear, mParent.mMonth, 1);

            DatePicker datePicker = dialog.getDatePicker();

            // Limit range.
            Calendar c = mParent.getCalendar();
            datePicker.setMinDate(c.getTimeInMillis());
            c.set(Calendar.YEAR, mParent.mYear + CC_EXP_YEARS_COUNT - 1);
            datePicker.setMaxDate(c.getTimeInMillis());

            // Remove day.
            datePicker.findViewById(getResources().getIdentifier("day", "id", "android"))
                    .setVisibility(View.GONE);
            return dialog;
        }

        @Override
        public void onDateSet(DatePicker view, int year, int month, int day) {
            mParent.setDate(year, month);
        }
    }
}


text:
default: build

lint:
	(go list ./... | grep -v '/vendor/' )| while read -r line; do fgt golint "$$line" || exit 1; done

test: lint
	GO15VENDOREXPERIMENT=1 go test $$(go list ./... | grep -v '/vendor/')

build:
	GO15VENDOREXPERIMENT=1 go build

changelog:
	git log --first-parent --pretty="format:* %b" v`./banshee -v`..

static:
	make -C static deps
	make -C static build

.PHONY: changelog static


text:
'use strict';

var colorContainer = document.getElementById('colorContainer');
var ballContainer = document.getElementsByClassName('ball')[0];

function selectColor(event) {
  console.log(event.target.id);
  ballContainer.id = event.target.id;
  localStorage.userColor = JSON.stringify(event.target.id);
}
colorContainer.addEventListener('click', selectColor);
ballContainer.id = 'black';
localStorage.userColor = JSON.stringify(ballContainer.id);


text:
<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
 <status>OK</status>
 <result>
  <type>locality</type>
  <type>political</type>
  <formatted_address>Ertl, Austria</formatted_address>
  <address_component>
   <long_name>Ertl</long_name>
   <short_name>Ertl</short_name>
   <type>locality</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Ertl</long_name>
   <short_name>Ertl</short_name>
   <type>administrative_area_level_3</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Amstetten District</long_name>
   <short_name>Amstetten District</short_name>
   <type>administrative_area_level_2</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Lower Austria</long_name>
   <short_name>Lower Austria</short_name>
   <type>administrative_area_level_1</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Austria</long_name>
   <short_name>AT</short_name>
   <type>country</type>
   <type>political</type>
  </address_component>
  <geometry>
   <location>
    <lat>47.9764508</lat>
    <lng>14.6318017</lng>
   </location>
   <location_type>APPROXIMATE</location_type>
   <viewport>
    <southwest>
     <lat>47.9414500</lat>
     <lng>14.6028200</lng>
    </southwest>
    <northeast>
     <lat>47.9977900</lat>
     <lng>14.6702300</lng>
    </northeast>
   </viewport>
   <bounds>
    <southwest>
     <lat>47.9414500</lat>
     <lng>14.6028200</lng>
    </southwest>
    <northeast>
     <lat>47.9977900</lat>
     <lng>14.6702300</lng>
    </northeast>
   </bounds>
  </geometry>
  <place_id>ChIJbSxxEtwyckcR_doRBMUUBxA</place_id>
 </result>
</GeocodeResponse>


text:
package org.onosproject.openstacknetworking;

import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip4Prefix;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;

/**
 * Provides constants used in OpenStackSwitching.
 */
public final class Constants {

    private Constants() {
    }

    public static final String APP_ID = "org.onosproject.openstackswitching";

    public static final String PORTNAME_PREFIX_VM = "tap";
    public static final String PORTNAME_PREFIX_ROUTER = "qr-";
    public static final String PORTNAME_PREFIX_TUNNEL = "vxlan";

    public static final MacAddress GATEWAY_MAC = MacAddress.valueOf("1f:1f:1f:1f:1f:1f");

    // TODO: Please change these valuses following the way vrouter is implemented
    public static final MacAddress GW_EXT_INT_MAC = MacAddress.valueOf("56:e6:30:a6:8c:e5");
    public static final MacAddress PHY_ROUTER_MAC = MacAddress.valueOf("00:00:00:00:01:01");

    public static final Ip4Address DNS_SERVER_IP = Ip4Address.valueOf("8.8.8.8");
    public static final IpPrefix IP_PREFIX_ANY = Ip4Prefix.valueOf("0.0.0.0/0");
    public static final int DHCP_INFINITE_LEASE = -1;

    public static final String NETWORK_ID = "networkId";
    public static final String PORT_ID = "portId";
    public static final String VXLAN_ID = "vxlanId";
    public static final String TENANT_ID = "tenantId";
    public static final String GATEWAY_IP = "gatewayIp";
    public static final String CREATE_TIME = "createTime";

    public static final int SWITCHING_RULE_PRIORITY = 30000;
    public static final int TUNNELTAG_RULE_PRIORITY = 30000;
    public static final int ACL_RULE_PRIORITY = 30000;

}


text:
<?php
namespace Aspose\Slides\Models;
/**
 * $model.description$
 *
 * NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
 *
 */
class PresentationsMergeRequest {
	static $swaggerTypes = array(
		'PresentationPaths' => 'array[string]'

	);

	public $PresentationPaths; // array[string]
	}


text:
'use strict';

import Hash from './helpers/hash';
import Logger from '../services/logger';
import path from 'path';
import fs from 'fs-extra';
import Downloader from './helpers/downloader';
import {remote} from 'electron';
import mkdirp from 'mkdirp';

let ipcRenderer = require('electron').ipcRenderer;

class InstallableItem {
  constructor(keyName, downloadUrl, fileName, targetFolderName, installerDataSvc, authRequired) {
    this.keyName = keyName;
    if (downloadUrl == null || downloadUrl == '') {
      throw(new Error(`No download URL set for ${keyName} Installer`));
    }
    this.downloadUrl = downloadUrl;
    this.fileName = fileName;
    this.targetFolderName = targetFolderName;
    this.installerDataSvc = installerDataSvc;
    this.authRequired = authRequired;

    let requirement = installerDataSvc.getRequirementByName(keyName);
    this.productName = requirement.name;
    this.productVersion = requirement.version;
    this.productDesc = requirement.description;
    this.isInstallable = requirement.installable;
    this.messages = requirement.messages;
    this.useDownload = requirement.useDownload == undefined ? true : requirement.useDownload;
    this.size = requirement.size;
    this.installSize = requirement.installSize;
    this.version = requirement.version;
    this.channel = requirement.channel;

    this.downloaded = false;
    this.installed = false;

    this.bundleFolder = remote && remote.getCurrentWindow().bundleTempFolder ? remote.getCurrentWindow().bundleTempFolder : path.normalize(path.join(__dirname, '../../../..'));
    this.userAgentString = remote && remote.getCurrentWindow().webContents.session.getUserAgent();
    if (process.env.DSI_TEST_AGENT && this.userAgentString) {
      this.userAgentString = this.userAgentString.replace("Installer", "TestInstaller");
    }

    this.bundledFile = path.join(this.bundleFolder, fileName);

    this.isCollapsed = true;
    this.option = new Set();
    this.selectedOption = requirement.defaultOption ? requirement.defaultOption : 'install';

    this.downloader = null;
    this.downloadFolder = path.join(this.installerDataSvc.localAppData(), 'cache');
    if(!fs.existsSync(this.downloadFolder)) {
      mkdirp.sync(this.downloadFolder);
    }
    this.downloadedFile = path.join(this.downloadFolder, fileName);

    if (requirement.file) {
      this.files = requirement.file;
    } else {
      this.files = {};
      if(requirement.fileName){
        this.files[this.keyName] = {
          dmUrl: downloadUrl,
          fileName: path.basename(fileName),
          sha256sum: requirement.sha256sum,
          size: this.size
        };
      }
    }

    this.downloaded = true;
    if(this.useDownload) {
      for (let file in this.files) {
        if (!fs.existsSync(path.join(this.bundleFolder, this.files[file].fileName))) {
          if (fs.existsSync(path.join(this.downloadFolder, this.files[file].fileName))) {
            try {
              let stat = fs.statSync(path.join(this.downloadFolder, this.files[file].fileName));
              this.files[file].downloaded = stat && stat.size == this.files[file].size;
              this.downloaded = this.downloaded && this.files[file].downloaded;
            } catch (error) {
              this.downloaded = false;
              Logger.info(`${this.keyName} - fstat function failure ${error}`);
            }
          } else {
            this.downloaded = false;
          }
        } else {
          this.files[file].downloaded = true;
          this.downloadedFile = path.join(this.bundleFolder, this.files[file].fileName);
        }
      }
    }
    this.installAfter = undefined;
    this.ipcRenderer = ipcRenderer;
    this.references = 0;

    this.totalDownloads = Object.keys(this.files).length;
  }

  getProductName() {
    return this.productName;
  }

  getProductVersion() {
    if(this.isDetected()) {
      return this.option[this.selectedOption].version;
    }
    return this.productVersion;
  }

  getProductDesc() {
    return this.productDesc;
  }

  getTargetLocation () {
    return path.join(this.installerDataSvc.installRoot, this.targetFolderName);
  }

  getDownloadUrl() {
    return this.downloadUrl;
  }

  isDownloaded() {
    return this.downloaded;
  }

  isInstalled() {
    return this.installed;
  }

  isDownloadRequired() {
    return this.useDownload && !this.downloaded;
  }

  setDownloadComplete() {
    this.downloaded = true;
  }

  getDownloadStatus() {
    let status = 'No download required';
    if (this.size && this.size >= 0) {
      status = this.downloaded ? 'Previously downloaded' : 'Selected to download';
    }
    return status;
  }

  setInstallComplete() {
    this.installed = true;
  }

  detectExistingInstall () {
    return Promise.resolve();
  }

  checkForExistingInstall() {
    // To be overridden
  }

  validateVersion() {
    //to be overriden
  }

  downloadInstaller(progress, success, failure, downloader) {
    this.downloader = downloader ? downloader : new Downloader(progress, success, failure, this.totalDownloads, this.userAgentString);
    for (let file in this.files) {
      if (this.files[file].downloaded) {
        continue;
      }

      if (fs.existsSync(path.join(this.bundleFolder, this.files[file].fileName))) {
        this.files[file].downloadedFile = path.join(this.bundleFolder, this.files[file].fileName);
        this.downloader.closeHandler();
      } else {
        this.startDownload(
          path.join(this.downloadFolder, this.files[file].fileName),
          this.files[file].dmUrl,
          this.files[file].sha256sum,
          this.authRequired ? this.installerDataSvc.getUsername() : undefined,
          this.authRequired ? this.installerDataSvc.getPassword() : undefined,
          progress
        );
      }
    }
  }

  checkFiles() {
    let promise = Promise.resolve();
    for (let file in this.files) {
      if (fs.existsSync(path.join(this.downloadFolder, this.files[file].fileName))) {
        let h = new Hash();
        promise = promise.then(() => {
          return h.SHA256(path.join(this.downloadFolder, this.files[file].fileName));
        }).then((dlSha) => {
          if(this.files[file].sha256sum === dlSha) {
            Logger.info(`Using previously downloaded file='${this.files[file].fileName}' sha256='${dlSha}'`);
            this.files[file].downloaded = true;
          } else {
            this.downloaded = false;
            this.files[file].downloaded = false;
          }
        });
      } else {
        this.downloaded = false;
        this.files[file].downloaded = false;
      }
    }
    return promise;
  }

  startDownload(downloadedFile, url, sha, user, pass) {
    if(user === undefined && pass === undefined ) {
      this.downloader.download(url, downloadedFile, sha, this);
    } else {
      this.downloader.downloadAuth(url, user, pass, downloadedFile, sha, this);
    }
  }

  install(progress, success, failure) {
    if( !this.getInstallAfter() || this.getInstallAfter().isInstalled() ) {
      progress.productName = this.productName;
      progress.productVersion = this.productVersion;
      progress.$timeout();
      this.installAfterRequirements(progress, success, failure);
    } else {
      this.ipcRenderer.on('installComplete', (event, arg) => {
        if (!this.isInstalled() && arg === this.getInstallAfter().keyName) {
          progress.productName = this.productName;
          progress.productVersion = this.productVersion;
          progress.$timeout();
          this.installAfterRequirements(progress, success, failure);
        }
      });
    }
  }

  installAfterRequirements(progress, success) {
    progress.setStatus('Installing');
    success && success(true);
  }

  changeIsCollapsed() {
    this.isCollapsed = !this.isCollapsed;
  }

  hasOption(name) {
    return this.option[name]!=undefined;
  }

  addOption(name, version, location, valid) {
    this.option[name] = {
      'version'  : version,
      'location' : location,
      'valid'    : valid,
      'error'    : '',
      'warning'  : ''
    };
  }

  setOptionLocation(name, location) {
    if(this.option[name]) {
      this.option[name].location = location;
    }
  }

  // Override parent "true" and check if we have something setup
  isConfigured() {
    let t =
      this.selectedOption == 'install'
        || this.selectedOption == 'detected' && this.hasOption('detected') && this.option['detected'].valid
        || this.selectedOption == 'detected' && !this.hasOption('detected');
    return t;
  }

  isDetected() {
    return this.selectedOption == 'detected' && this.hasOption('detected');
  }

  isValidVersionDetected() {
    return this.hasOption('detected') && this.option['detected'].valid;
  }

  isInvalidVersionDetected() {
    return this.hasOption('detected') && !this.option['detected'].valid;
  }

  isNotDetected() {
    return !this.hasOption('detected');
  }

  isSkipped() {
    return this.selectedOption == 'detected';
  }

  isSelected() {
    return this.selectedOption == 'install';
  }

  getLocation() {
    return this.isDetected()
      ? this.option.detected.location
      : this.option.install.location;
  }

  restartDownload() {
    this.downloader.restartDownload();
  }

  getInstallAfter() {
    let installable = this.installAfter;
    while ( installable !== undefined && installable.isSkipped()) {
      installable = installable.installAfter;
    }
    return installable;
  }

  thenInstall(installer) {
    installer.installAfter = this;
    return installer;
  }

  setup(progress, success ) {
    progress.setStatus('Setting up');
    progress.setComplete();
    success();
  }

  isDisabled() {
    return this.references > 0;
  }

  isConfigurationValid() {
    return true;
  }
}

function fromJson({keyName, installerDataSvc, downloadUrl, fileName, authRequired}) {
  return new InstallableItem(keyName, downloadUrl, fileName, '', installerDataSvc, authRequired);
}

InstallableItem.convertor = {fromJson};

export default InstallableItem;