text:
<tool id="refseq_masher_contains" name="RefSeq Masher Contains" version="0.1.2">
  <description>
    Find NCBI RefSeq Genomes contained in your sequences
  </description>
  <requirements>
    <requirement type="package" version="0.1.2">refseq_masher</requirement>
  </requirements>
  <command detect_errors="exit_code">
<![CDATA[

#import re
#import os

#if $input.type == 'fasta'
#set $input_files = '"{}.fasta"'.format(os.path.splitext($input.fasta.name)[0])
  ln -s "$input.fasta" $input_files &&
#elif $input.type == 'paired'
#set $_forward_ext = '.fastq.gz' if $re.match(r'.*\.gz$', $input.forward.name) else '.fastq'
#set $_forward = '"{}_1{}"'.format($re.sub(r'_[12]\..+$', '', $input.forward.name), $_forward_ext)
#set $_reverse_ext = '.fastq.gz' if $re.match(r'.*\.gz$', $input.reverse.name) else '.fastq'
#set $_reverse = '"{}_2{}"'.format($re.sub(r'_[12]\..+$', '', $input.reverse.name), $_reverse_ext)
#set $input_files = '{} {}'.format($_forward, $_reverse)
  ln -s "$input.forward" $_forward &&
  ln -s "$input.reverse" $_reverse &&
#elif $input.type == 'single'
#set $input_files = '"{}"'.format($input.single.name)
  ln -s "$input.single" $input_files &&
#elif $input.type == 'paired_collection'
#set $_forward_ext = '.fastq.gz' if $re.match(r'.*\.gz$', str($input.paired_collection.forward)) else '.fastq'
#set $_forward = '"{}_1{}"'.format($input.paired_collection.name, $_forward_ext)
#set $_reverse_ext = '.fastq.gz' if $re.match(r'.*\.gz$', str($input.paired_collection.reverse)) else '.fastq'
#set $_reverse = '"{}_2{}"'.format($input.paired_collection.name, $_reverse_ext)
#set $input_files = '{} {}'.format($_forward, $_reverse)
  ln -s "$input.paired_collection.forward" $_forward &&
  ln -s "$input.paired_collection.reverse" $_reverse &&
#end if

refseq_masher
  $adv.verbosity
  contains
  --output refseq_masher-contains.${adv.output_type}
  --output-type $adv.output_type
  --top-n-results $adv.top_n_results
  --parallelism "\${GALAXY_SLOTS:-1}"
  --min-identity $adv.min_identity
  --max-pvalue $adv.max_pvalue
  $input_files

]]>
  </command>
  <inputs>
    <conditional name="input">
      <param name="type" type="select" label="Sequence input type">
        <option value="fasta">FASTA</option>
        <option value="paired">Paired-end FASTQs</option>
        <option value="single">Single-end FASTQ</option>
        <option value="paired_collection">Paired-end FASTQ collection</option>
      </param>
      <when value="fasta">
        <param name="fasta"
          type="data" format="fasta"
          optional="false"
          label="FASTA file"
          />
      </when>
      <when value="paired">
        <param name="forward"
          type="data" format="fastq,fastqsanger,fastqillumina,fastqsolexa"
          optional="false"
          label="Forward FASTQ file"
          help="Must have ASCII encoded quality scores"
          />
        <param name="reverse"
          type="data" format="fastq,fastqsanger,fastqillumina,fastqsolexa"
          optional="false"
          label="Reverse FASTQ file"
          help="File format must match the Forward FASTQ file"
          />
      </when>
      <when value="single">
        <param name="single"
          type="data" format="fastq,fastqsanger,fastqillumina,fastqsolexa"
          optional="false"
          label="Single-end FASTQ file"
          />
      </when>
      <when value="paired_collection">
        <param name="paired_collection"
          type="data_collection" format="fastq,fastqsanger,fastqillumina,fastqsolexa,fastq.gz,txt"
          collection_type="paired"
          optional="false"
          label="Paired-end FASTQ collection"
          help=""
          />
      </when>
    </conditional>

      <param name="top_n_results"
        type="integer"
        label="Top N matches to report (0 to report all)"
        min="0"
        value="0"
        optional="true"
        />
      <param name="min_identity"
        type="float" value="0.9" min="0.0" max="1.0"
        label="Mash dist min. identity to report"
        optional="true"
        />
      <param name="max_pvalue"
        type="float" value="0.01" min="0.0" max="1.0"
        label="Mash screen max. p-value to report"
        optional="true"
        />
      <param name="output_type"
        type="select"
        label="Output type"
        multiple="false">
        <option value="tab" selected="true">Tabular (tab-delimited values)</option>
        <option value="csv">CSV (Comma Separated Values)</option>
      </param>
      <param name="verbosity"
        type="select"
        label="Logging verbosity">
        <option value="">Error messages only</option>
        <option value="-v">Show warning messages</option>
        <option value="-vv" selected="true">Show info messages</option>
        <option value="-vvv">Show debug messages</option>
      </param>

  </inputs>
  <outputs>
    <data
      name="output_path_csv"
      format="csv"
      label="RefSeq Masher contains table"
      from_work_dir="refseq_masher-contains.csv">
      <filter>adv['output_type'] == 'csv'</filter>
    </data>
    <data
      name="output_path_tab"
      format="tabular"
      label="RefSeq Masher contains table"
      from_work_dir="refseq_masher-contains.tab">
      <filter>adv['output_type'] == 'tab'</filter>
    </data>
  </outputs>
  <tests>
    <test>
      <conditional name="input">
        <param name="type" value="single"/>
        <param name="single" value="SRR1203042_1-head4000.fastq"/>
      </conditional>

        <param name="top_n_results" value="5"/>
        <param name="output_type" value="tab"/>
        <param name="min_identity" value="0.9"/>
        <param name="max_pvalue" value="0.01"/>

      <output name="output_path_tab" ftype="tabular">
        <assert_contents>
          <has_n_columns n="24" />
          <has_n_lines n="6" />
        </assert_contents>
      </output>
    </test>
  </tests>
  <help>
<![CDATA[
RefSeq Masher - Containment
===========================

Find what NCBI RefSeq genomes are contained within your sequence data using Mash_ with a Mash sketch database of 54,925 NCBI RefSeq Genomes.

Source code available on Github at github.com/phac-nml/refseq_masher

`contains` - find what NCBI RefSeq Genomes are contained in your input sequences
--------------------------------------------------------------------------------

If you have a metagenomic sample or maybe a sample with some contamination, you may be interested in seeing what's in your sample. You can do this with `refseq_masher contains <INPUT>`.::

    Usage: refseq_masher contains [OPTIONS] INPUT...

      Find the NCBI RefSeq genomes contained in your sequence files using Mash
      Screen

      Input is expected to be one or more FASTA/FASTQ files or one or more
      directories containing FASTA/FASTQ files. Files can be Gzipped.

    Options:
      --mash-bin TEXT              Mash binary path (default="mash")
      -o, --output PATH            Output file path (default="-"/stdout)
      --output-type [tab|csv]      Output file type (tab|csv)
      -n, --top-n-results INTEGER  Output top N results sorted by identity in
                                   ascending order (default=0/all)
      -i, --min-identity FLOAT     Mash screen min identity to report
                                   (default=0.9)
      -v, --max-pvalue FLOAT       Mash screen max p-value to report
                                   (default=0.01)
      -p, --parallelism INTEGER    Mash screen parallelism; number of threads to
                                   spawn (default=1)
      -h, --help                   Show this message and exit.

Example - metagenomic a sample SAMEA1877340_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For this example, we're going to see what RefSeq genomes are contained within sample SAMEA1877340_ from BioProject PRJEB1775_.

Description from BioProject PRJEB1775_:

.. epigraph::

    Design, Setting and Patients Forty-five samples were selected from a set of fecal specimens obtained from patients with diarrhea during the 2011 outbreak of STEC O104:H4 in Germany. Samples were chosen to represent STEC-positive patients with a range of clinical conditions and colony counts together with a small number of patients with other infections (Campylobacter jejnuni, Clostridium difficile and Salmonella enterica). Samples were subjected to high-throughput sequencing on the Illumina MiSeq and HiSeq 2500, followed by bioinformatics analysis.

We're going to download the FASTQ files for ERR260489_::

    wget ftp.sra.ebi.ac.uk/vol1/fastq/ERR260/ERR260489/ERR260489_1.fastq.gz
    wget ftp.sra.ebi.ac.uk/vol1/fastq/ERR260/ERR260489/ERR260489_2.fastq.gz

We're going to run `refseq_masher` against these FASTQ files::

    refseq_masher -vv contains --top-n-results 50 -p 12 -o containment-ERR260489.tab ERR260489_1.fastq.gz ERR260489_2.fastq.gz

**Log**::

    2018-01-29 10:59:25,849 INFO: Grouped 2 fastqs into 1 groups [in ...refseq_masher/refseq_masher/utils.py:174]
    2018-01-29 10:59:25,849 INFO: Collected 0 FASTA inputs and 1 read sets [in ...refseq_masher/refseq_masher/utils.py:185]
    2018-01-29 10:59:25,849 INFO: Running Mash Screen with NCBI RefSeq sketch database against sample "ERR260489" with inputs: ['../ERR260489_1.fastq.gz', '../ERR260489_2.fastq.gz'] [in ...refseq_masher/refseq_masher/mash/screen.py:44]
    Loading ...refseq_masher/refseq_masher/data/RefSeqSketches.msh...
       4669418 distinct hashes.
    Streaming from 2 inputs...
       Estimated distinct k-mers in pool: 206836855
    Summing shared...
    Computing coverage medians...
    Writing output...
    2018-01-29 11:00:19,665 INFO: Ran Mash Screen on all input. Merging NCBI taxonomic information into results output. [in ...refseq_masher/refseq_masher/cli.py:134]
    2018-01-29 11:00:19,666 INFO: Fetching all taxonomy info for 23 unique NCBI Taxonomy UIDs [in ...refseq_masher/refseq_masher/taxonomy.py:35]
    2018-01-29 11:00:19,669 INFO: Dropping columns with all NA values (ncol=32) [in ...refseq_masher/refseq_masher/taxonomy.py:38]
    2018-01-29 11:00:19,671 INFO: Columns with all NA values dropped (ncol=12) [in ...refseq_masher/refseq_masher/taxonomy.py:40]
    2018-01-29 11:00:19,671 INFO: Merging Mash results with relevant taxonomic information [in ...refseq_masher/refseq_masher/taxonomy.py:41]
    2018-01-29 11:00:19,674 INFO: Merged Mash results with taxonomy info [in ...refseq_masher/refseq_masher/taxonomy.py:43]
    2018-01-29 11:00:19,674 INFO: Merged taxonomic information into results output [in ...refseq_masher/refseq_masher/cli.py:136]
    2018-01-29 11:00:19,674 INFO: Reordering output columns [in ...refseq_masher/refseq_masher/cli.py:137]
    2018-01-29 11:00:19,677 INFO: Wrote output to "containment-ERR260489.tab" [in ...refseq_masher/refseq_masher/writers.py:20]

**Output**

+-----------+--------------------------------------+----------+----------------+----------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+------------------------------+------------------+--------------------+------------------+---------------------+-------------------+-------------------------+------------+---------+----------+------------+-----------+---------+---------------------+----------------------------------------------------------------------------------------------+--------------------------+----------------+
|  sample   | top_taxonomy_name                    | identity | shared_hashes  | median_multiplicity  | pvalue | full_taxonomy                                                                                | taxonomic_subspecies  | taxonomic_species            | taxonomic_genus  | taxonomic_family   | taxonomic_order  | taxonomic_class     | taxonomic_phylum  | taxonomic_superkingdom  | subspecies | serovar | plasmid  | bioproject | biosample | taxid   | assembly_accession  | match_id                                                                                | taxonomic_species group  | match_comment  |
+===========+======================================+==========+================+======================+========+==================================================================================================================================================+=======================+==============================+==================+====================+==================+=====================+===================+=========================+============+=========+==========+============+===========+=========+=====================+==============================================================================================+==========================+================+
| ERR260489 | Bacteroides fragilis                 | 1.0      | 400/400        | 786                  | 0.0    | Bacteria; FCB group; Bacteroidetes/Chlorobi group; Bacteroidetes; Bacteroidia; Bacteroidales; Bacteroidaceae; Bacteroides; fragilis              |                       | Bacteroides fragilis         | Bacteroides      | Bacteroidaceae     | Bacteroidales    | Bacteroidia         | Bacteroidetes     | Bacteria                |            |         | pLV22a   |            |           | 817     |                     | ./rcn/refseq-NG-817-.-.-.-pLV22a-Bacteroides_fragilis.fna                                    |                          |                |
+-----------+--------------------------------------+----------+----------------+----------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+------------------------------+------------------+--------------------+------------------+---------------------+-------------------+-------------------------+------------+---------+----------+------------+-----------+---------+---------------------+----------------------------------------------------------------------------------------------+--------------------------+----------------+
| [1 row]   |                                      |          |                |                      |        |                                                                                |                       |                              |                  |                    |                  |                     |                   |                         |            |         |          |            |           |         |                     |                                                                                |                          |                |
+-----------+--------------------------------------+----------+----------------+----------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+------------------------------+------------------+--------------------+------------------+---------------------+-------------------+-------------------------+------------+---------+----------+------------+-----------+---------+---------------------+----------------------------------------------------------------------------------------------+--------------------------+----------------+
| ERR260489 | Escherichia coli O104:H4 str. E92/11 | 1.0      | 400/400        | 48                   | 0.0    | Bacteria; Proteobacteria; Gammaproteobacteria; Enterobacterales; Enterobacteriaceae; Escherichia; coli; O104:H4; str. E92/11                     |                       | Escherichia coli             | Escherichia      | Enterobacteriaceae | Enterobacterales | Gammaproteobacteria | Proteobacteria    | Bacteria                |            |         | pE9211p3 |            |           | 1090927 | NZ_AHAU             | ./rcn/refseq-NZ-1090927-.-.-NZ_AHAU-pE9211p3-Escherichia_coli_O104_H4_str._E92_11.fna        |                          |                |
+-----------+--------------------------------------+----------+----------------+----------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+------------------------------+------------------+--------------------+------------------+---------------------+-------------------+-------------------------+------------+---------+----------+------------+-----------+---------+---------------------+----------------------------------------------------------------------------------------------+--------------------------+----------------+
| [3 rows]  |                                      |          |                |                      |        |                                                                                |                       |                              |                  |                    |                  |                     |                   |                         |            |         |          |            |           |         |                     |                                                                                |                          |                |
+-----------+--------------------------------------+----------+----------------+----------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+------------------------------+------------------+--------------------+------------------+---------------------+-------------------+-------------------------+------------+---------+----------+------------+-----------+---------+---------------------+----------------------------------------------------------------------------------------------+--------------------------+----------------+
| ERR260489 | Kingella kingae KKC2005004457        | 1.0      | 400/400        | 5                    | 0.0    | Bacteria; Proteobacteria; Betaproteobacteria; Neisseriales; Neisseriaceae; Kingella; kingae; KKC2005004457                                       |                       | Kingella kingae              | Kingella         | Neisseriaceae      | Neisseriales     | Betaproteobacteria  | Proteobacteria    | Bacteria                |            |         | unnamed  |            |           | 1229911 |                     | ./rcn/refseq-NG-1229911-.-.-.-unnamed-Kingella_kingae_KKC2005004457.fna                      |                          |                |
+-----------+--------------------------------------+----------+----------------+----------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+------------------------------+------------------+--------------------+------------------+---------------------+-------------------+-------------------------+------------+---------+----------+------------+-----------+---------+---------------------+----------------------------------------------------------------------------------------------+--------------------------+----------------+
| ERR260489 | Bacteroides cellulosilyticus WH2     | 0.99984  | 399/400        | 772                  | 0.0    | Bacteria; FCB group; Bacteroidetes/Chlorobi group; Bacteroidetes; Bacteroidia; Bacteroidales; Bacteroidaceae; Bacteroides; cellulosilyticus; WH2 |                       | Bacteroides cellulosilyticus | Bacteroides      | Bacteroidaceae     | Bacteroidales    | Bacteroidia         | Bacteroidetes     | Bacteria                |            |         | pBWH2B   |            |           | 1268240 | NZ_ATFI             | ./rcn/refseq-NZ-1268240-.-.-NZ_ATFI-pBWH2B-Bacteroides_cellulosilyticus_WH2.fna              |                          |                |
+-----------+--------------------------------------+----------+----------------+----------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+------------------------------+------------------+--------------------+------------------+---------------------+-------------------+-------------------------+------------+---------+----------+------------+-----------+---------+---------------------+----------------------------------------------------------------------------------------------+--------------------------+----------------+
| [1 row]   |                                      |          |                |                      |        |                                                                                |                       |                              |                  |                    |                  |                     |                   |                         |            |         |          |            |           |         |                     |                                                                                |                          |                |
+-----------+--------------------------------------+----------+----------------+----------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+------------------------------+------------------+--------------------+------------------+---------------------+-------------------+-------------------------+------------+---------+----------+------------+-----------+---------+---------------------+----------------------------------------------------------------------------------------------+--------------------------+----------------+
| ERR260489 | Klebsiella pneumoniae                | 0.99984  | 399/400        | 4                    | 0.0    | Bacteria; Proteobacteria; Gammaproteobacteria; Enterobacterales; Enterobacteriaceae; Klebsiella; pneumoniae                                      |                       | Klebsiella pneumoniae        | Klebsiella       | Enterobacteriaceae | Enterobacterales | Gammaproteobacteria | Proteobacteria    | Bacteria                |            |         | pMRC151  |            |           | 573     |                     | ./rcn/refseq-NG-573-.-.-.-pMRC151-Klebsiella_pneumoniae.fna                                  |                          |                |
+-----------+--------------------------------------+----------+----------------+----------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+------------------------------+------------------+--------------------+------------------+---------------------+-------------------+-------------------------+------------+---------+----------+------------+-----------+---------+---------------------+----------------------------------------------------------------------------------------------+--------------------------+----------------+
| [37 rows] |                                      |          |                |                      |        |                                                                                |                       |                              |                  |                    |                  |                     |                   |                         |            |         |          |            |           |         |                     |                                                                                |                          |                |
+-----------+--------------------------------------+----------+----------------+----------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+------------------------------+------------------+--------------------+------------------+---------------------+-------------------+-------------------------+------------+---------+----------+------------+-----------+---------+---------------------+----------------------------------------------------------------------------------------------+--------------------------+----------------+

Some of the top genomes contained in this sample are sorted by identity and median multiplicity are:

- *Bacteroides fragilis* - fully contained (400/400) and high multiplicity (768)
- *Escherichia coli* O104:H4 - fully contained (400/400) and median multiplicity of 48
- *Kingella kingae* - fully contained (400/400) and median multiplicity of 5
- *Klebsiella pneumoniae* - 399/400 sketches contained with median multiplicity of 4

So with Mash we are able to find that the sample contained the expected genomic data (especially *E. coli* O104:H4).

Legal
-----

Copyright Government of Canada 2017

Written by: National Microbiology Laboratory, Public Health Agency of Canada

Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this work except in compliance with the License. You may obtain a copy of the
License at:

www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.

Contact
-------

**Gary van Domselaar**: gary.vandomselaar@phac-aspc.gc.ca

.. _Mash: genomebiology.biomedcentral.com/articles/10.1186/s13059-016-0997-x
.. _SAMEA1877340: www.ebi.ac.uk/ena/data/view/SAMEA1877340
.. _PRJEB1775: www.ebi.ac.uk/ena/data/view/PRJEB1775
.. _ERR260489: www.ebi.ac.uk/ena/data/view/ERR260489&display=html

]]>
  </help>
  <citations>

    <citation type="doi">10.1186/s13059-016-0997-x</citation>
  </citations>
</tool>


text:
package com.drew.imaging.gif;

import com.drew.lang.StreamReader;
import com.drew.lang.annotations.NotNull;
import com.drew.metadata.Metadata;
import com.drew.metadata.file.FileMetadataReader;
import com.drew.metadata.gif.GifReader;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Obtains metadata from GIF files.
 *
 * @author Drew Noakes https://drewnoakes.com
 */
public class GifMetadataReader
{
    @NotNull
    public static Metadata readMetadata(@NotNull File file) throws IOException
    {
        InputStream inputStream = new FileInputStream(file);
        Metadata metadata;
        try {
            metadata = readMetadata(inputStream);
        } finally {
            inputStream.close();
        }
        new FileMetadataReader().read(file, metadata);
        return metadata;
    }

    @NotNull
    public static Metadata readMetadata(@NotNull InputStream inputStream)
    {
        Metadata metadata = new Metadata();
        new GifReader().extract(new StreamReader(inputStream), metadata);
        return metadata;
    }
}

redpajama_set_name: RedPajamaGithub


text:
name:
scenario-context: During Review
scenario: [review]
customer: [coaches, parents, players]
---


text:
// =================================================================================================
// ADOBE SYSTEMS INCORPORATED
// Copyright 2006 Adobe Systems Incorporated
// All Rights Reserved
//
// NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the terms
// of the Adobe license agreement accompanying it.
// =================================================================================================

package com.adobe.xmp.impl;

import java.io.UnsupportedEncodingException;

/**
 * @since   12.10.2006
 */
public class Latin1Converter
{
	/** */
	private static final int STATE_START = 0;
	/** */
	private static final int STATE_UTF8CHAR = 11;

	/**
	 * Private constructor
	 */
	private Latin1Converter()
	{
		// EMPTY
	}

	/**
	 * A converter that processes a byte buffer containing a mix of UTF8 and Latin-1/Cp1252 chars.
	 * The result is a buffer where those chars have been converted to UTF-8;
	 * that means it contains only valid UTF-8 chars.
	 *

	 * Explanation of the processing: First the encoding of the buffer is detected looking
	 * at the first four bytes (that works only if the buffer starts with an ASCII-char,
	 * like xmls '<'). UTF-16/32 flavours do not require further proccessing.
	 *

	 * In the case, UTF-8 is detected, it assumes wrong UTF8 chars to be a sequence of
	 * Latin-1/Cp1252 encoded bytes and converts the chars to their corresponding UTF-8 byte
	 * sequence.
	 *

	 * The 0x80..0x9F range is undefined in Latin-1, but is defined in Windows code
	 * page 1252. The bytes 0x81, 0x8D, 0x8F, 0x90, and 0x9D are formally undefined
	 * by Windows 1252. These are in XML's RestrictedChar set, so we map them to a
	 * space.
	 *

	 * The official Latin-1 characters in the range 0xA0..0xFF are converted into
	 * the Unicode Latin Supplement range U+00A0 - U+00FF.
	 *

	 * Example: If an Euro-symbol (€) appears in the byte buffer (0xE2, 0x82, 0xAC),
	 * it will be left as is. But if only the first two bytes are appearing,
	 * followed by an ASCII char a (0xE2 - 0x82 - 0x41), it will be converted to
	 * 0xC3, 0xA2 (â) - 0xE2, 0x80, 0x9A (') - 0x41 (a).
	 *
	 * @param buffer a byte buffer contain
	 * @return Returns a new buffer containing valid UTF-8
	 */
	public static ByteBuffer convert(ByteBuffer buffer)
	{
		if ("UTF-8".equals(buffer.getEncoding()))
		{
			// the buffer containing one UTF-8 char (up to 8 bytes)
			byte[] readAheadBuffer = new byte[8];
			// the number of bytes read ahead.
			int readAhead  = 0;
			// expected UTF8 bytesto come
			int expectedBytes = 0;
			// output buffer with estimated length
			ByteBuffer out = new ByteBuffer(buffer.length() * 4 / 3);

			int state = STATE_START;
			for (int i = 0; i < buffer.length(); i++)
			{
				int b = buffer.charAt(i);

				switch (state)
				{
					default:
					case STATE_START:
						if (b < 0x7F)
						{
							out.append((byte) b);
						}
						else if (b >= 0xC0)
						{
							// start of UTF8 sequence
							expectedBytes = -1;
							int test = b;
							for (; expectedBytes < 8  &&  (test & 0x80) == 0x80; test = test << 1)
							{
								expectedBytes++;
							}
							readAheadBuffer[readAhead++] = (byte) b;
							state = STATE_UTF8CHAR;
						}
						else //  implicitly:  b >= 0x80  &&  b < 0xC0
						{
							// invalid UTF8 start char, assume to be Latin-1
							byte[] utf8 = convertToUTF8((byte) b);
							out.append(utf8);
						}
						break;

					case STATE_UTF8CHAR:
						if (expectedBytes > 0  &&  (b & 0xC0) == 0x80)
						{
							// valid UTF8 char, add to readAheadBuffer
							readAheadBuffer[readAhead++] = (byte) b;
							expectedBytes--;

							if (expectedBytes == 0)
							{
								out.append(readAheadBuffer, 0, readAhead);
								readAhead = 0;

								state = STATE_START;
							}
						}
						else
						{
							// invalid UTF8 char:
							// 1. convert first of seq to UTF8
							byte[] utf8 = convertToUTF8(readAheadBuffer[0]);
							out.append(utf8);

							// 2. continue processing at second byte of sequence
							i = i - readAhead;
							readAhead = 0;

							state = STATE_START;
						}
						break;
				}
			}

			// loop ends with "half" Utf8 char --> assume that the bytes are Latin-1
			if (state == STATE_UTF8CHAR)
			{
				for (int j = 0; j < readAhead; j++)
				{
					byte b = readAheadBuffer[j];
					byte[] utf8 = convertToUTF8(b);
					out.append(utf8);
				}
			}

			return out;
		}
		else
		{
			// Latin-1 fixing applies only to UTF-8
			return buffer;
		}
	}

	/**
	 * Converts a Cp1252 char (contains all Latin-1 chars above 0x80) into a
	 * UTF-8 byte sequence. The bytes 0x81, 0x8D, 0x8F, 0x90, and 0x9D are
	 * formally undefined by Windows 1252 and therefore replaced by a space
	 * (0x20).
	 *
	 * @param ch
	 *            an Cp1252 / Latin-1 byte
	 * @return Returns a byte array containing a UTF-8 byte sequence.
	 */
	private static byte[] convertToUTF8(byte ch)
	{
		int c = ch & 0xFF;
		try
		{
			if (c >= 0x80)
			{
				if (c == 0x81  ||  c == 0x8D  ||  c == 0x8F  ||  c == 0x90  ||  c == 0x9D)
				{
					return new byte[] { 0x20 }; // space for undefined
				}

				// interpret byte as Windows Cp1252 char
				return new String(new byte[] { ch }, "cp1252").getBytes("UTF-8");
			}
		}
		catch (UnsupportedEncodingException e)
		{
			// EMPTY
		}
		return new byte[] { ch };
	}
}


text:
demo_app
========

Ruby demo app


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

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.sql.SQLException;

import org.apache.commons.lang3.StringUtils;

import com.atlassian.bitbucket.nav.NavBuilder;
import com.atlassian.bitbucket.pull.PullRequest;
import com.atlassian.bitbucket.repository.Repository;
import com.atlassian.bitbucket.repository.RepositoryCloneLinksRequest;
import com.atlassian.bitbucket.repository.RepositoryService;
import com.palantir.stash.stashbot.config.ConfigurationPersistenceService;
import com.palantir.stash.stashbot.jobtemplate.JobType;
import com.palantir.stash.stashbot.persistence.JenkinsServerConfiguration;
import com.palantir.stash.stashbot.persistence.JobTemplate;
import com.palantir.stash.stashbot.persistence.RepositoryConfiguration;

public class StashbotUrlBuilder {

    private final ConfigurationPersistenceService cps;
    private final NavBuilder nb;
    private final RepositoryService rs;

    public StashbotUrlBuilder(ConfigurationPersistenceService cps, NavBuilder nb, RepositoryService rs) {
        this.cps = cps;
        this.nb = nb;
        this.rs = rs;
    }

    public String getJenkinsTriggerUrl(Repository repo, JobType jt,
        String buildHead, PullRequest pullRequest) throws SQLException {
        StringBuffer urlB = new StringBuffer(nb.buildAbsolute());
        urlB.append("/plugins/servlet/stashbot/build-trigger/");
        urlB.append(repo.getId()).append("/");
        urlB.append(jt.toString()).append("/");
        urlB.append(buildHead);
        if (pullRequest != null) {
            urlB.append("/");
            urlB.append(pullRequest.getToRef().getLatestCommit());
            urlB.append("/");
            urlB.append(pullRequest.getId());
        }
        return urlB.toString();
    }

    public String buildReportingUrl(Repository repo, JobType jobType,
        JenkinsServerConfiguration jsc, String status) {
        // Look at the BuildSuccessReportinServlet if you change this:
        // "BASE_URL/REPO_ID/JOB_NAME/STATE/BUILD_NUMBER/BUILD_HEAD[/MERGE_HEAD/PULLREQUEST_ID]";
        // SEE ALSO:
        // https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables
        // TODO: Remove $repoId, hardcode ID?
        String url = nb
            .buildAbsolute()
            .concat("/plugins/servlet/stashbot/build-reporting/$repoId/"
                + jobType.toString() + "/" + status
                + "/$BUILD_NUMBER/$buildHead/$mergeHead/$pullRequestId");
        return url;
    }

    public String buildCloneUrl(Repository repo, JenkinsServerConfiguration jsc) {
        RepositoryCloneLinksRequest rclr =
            new RepositoryCloneLinksRequest.Builder().repository(repo).protocol("http").user(null).build();
        String url = rs.getCloneLinks(rclr).iterator().next().getHref();
        // we build without username because we insert username AND password, and need both, in the case where we are using USERNAME_AND_PASSWORD.
        switch (jsc.getAuthenticationMode()) {
        case USERNAME_AND_PASSWORD:
            url = url.replace("://",
                "://" + mask(jsc.getStashUsername()) + ":" + mask(jsc.getStashPassword())
                    + "@");
            break;
        case CREDENTIAL_AUTOMATIC_SSH_KEY:
            RepositoryCloneLinksRequest rclrssh =
                new RepositoryCloneLinksRequest.Builder().repository(repo).protocol("ssh").build();
            url = rs.getCloneLinks(rclrssh).iterator().next().getHref();
            break;
        case CREDENTIAL_MANUALLY_CONFIGURED:
            // do nothing
            // XXX: do we need to get the git/ssh link instead of the http link here?  maybe that's a new mode?
            break;
        default:
            throw new IllegalStateException("Invalid value - update this code after adding an authentication mode");
        }
        return url;
    }

    public String buildStashCommitUrl(Repository repo, String commit) {
        return nb.repo(repo).commit(commit).buildAbsolute();
    }

    private String mask(String str) {
        try {
            return URLEncoder.encode(str, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            return str;
        }
    }

    /* NOTE: elsewhere in JenkinsManager, we generate this URL (when folders are enabled) by fetching the entire folder chain from jenkins.
     * But in places where we are generating the links only, we don't want to have several server round-trips so we will instead assume it
     * exists and just create the URL.
     */
    public String getJenkinsJobUrl(Repository repo, JobTemplate jt) throws SQLException {
        RepositoryConfiguration rc = cps.getRepositoryConfigurationForRepository(repo);
        JenkinsServerConfiguration jsc = cps.getJenkinsServerConfiguration(rc.getJenkinsServerName());
        String baseUrl = jsc.getUrl();
        String prefix = "";
        if (jsc.getFolderSupportEnabled()) {
            prefix = prefix + jsc.getFolderPrefix();
        }
        if (jsc.getUseSubFolders()) {
            if (!prefix.isEmpty()) {
                prefix = prefix + "/" + jt.getPathFor(repo);
            } else {
                prefix = jt.getPathFor(repo);
            }
        }
        String url = baseUrl;
        if (!prefix.isEmpty()) {
            url = url + "/job/" + StringUtils.join(prefix.split("/"), "/job/");
        }
        url = url + "/job/" + jt.getBuildNameFor(repo);
        return url;
    }

    public String getJenkinsBuildUrl(Repository repo, JobTemplate jt, long buildNumber) throws SQLException {
        return getJenkinsJobUrl(repo, jt) + "/" + Long.toString(buildNumber);
    }
}


text:
#include "vice.h"

#include <stdio.h>
#include <string.h>
#include <tchar.h>
#include <windows.h>

#include "intl.h"
#include "lib.h"
#include "machine.h"
#include "res.h"
#include "resources.h"
#include "system.h"
#include "translate.h"
#include "ui.h"
#include "uic128.h"
#include "uilib.h"
#include "winmain.h"

static const int ui_machine[] = {
    IDS_INTERNATIONAL,
    IDS_FINNISH,
    IDS_FRENCH,
    IDS_GERMAN,
    IDS_ITALIAN,
    IDS_NORWEGIAN,
    IDS_SWEDISH,
    0
};

static void enable_machine_controls(HWND hwnd)
{
}

static void enable_functionrom_controls(HWND hwnd)
{
    int is_enabled;

    EnableWindow(GetDlgItem(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_NAME), 1);
    EnableWindow(GetDlgItem(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_BROWSE), 1);

    is_enabled = (IsDlgButtonChecked(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL) == BST_CHECKED) ? 1 : 0;

    EnableWindow(GetDlgItem(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_NAME), is_enabled);
    EnableWindow(GetDlgItem(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_BROWSE), is_enabled);
}

static uilib_localize_dialog_param machine_dialog_trans[] = {
    { IDC_MACHINE_TYPE, IDS_MACHINE_TYPE, 0 },
    { 0, 0, 0 }
};

static void init_machine_dialog(HWND hwnd)
{
    HWND machine_hwnd;
    int res_value;
    int res_value_loop;
    int xpos;

    /* translate all dialog items */
    uilib_localize_dialog(hwnd, machine_dialog_trans);

    /* adjust the size of the  machine type element */
    uilib_adjust_element_width(hwnd, IDC_MACHINE_TYPE);

    /* get the max x of the machine type element */
    uilib_get_element_max_x(hwnd, IDC_MACHINE_TYPE, &xpos);

    /* move the machine type indicator element */
    uilib_move_element(hwnd, IDC_C128_MACHINE_TYPE, xpos + 10);

    resources_get_int("MachineType", &res_value);
    machine_hwnd = GetDlgItem(hwnd, IDC_C128_MACHINE_TYPE);
    for (res_value_loop = 0; ui_machine[res_value_loop] != 0; res_value_loop++) {
        SendMessage(machine_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(ui_machine[res_value_loop]));
    }
    SendMessage(machine_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0);

    enable_machine_controls(hwnd);
}

static uilib_localize_dialog_param functionrom_dialog_trans[] = {
    { IDC_C128_FUNCTIONROM_INTERNAL_TYPE_LABEL, IDS_INT_FUNCTION_ROM_TYPE, 0 },
    { IDC_INTERNAL_FUNCTION_ROM, IDS_INT_FUNCTION_ROM, 0 },
    { IDC_FILE_NAME_1, IDS_FILE_NAME, 0 },
    { IDC_FILE_NAME_2, IDS_FILE_NAME, 0 },
    { IDC_C128_FUNCTIONROM_INTERNAL_BROWSE, IDS_BROWSE, 0 },
    { IDC_EXTERNAL_FUNCTION_ROM, IDS_EXT_FUNCTION_ROM, 0 },
    { IDC_C128_FUNCTIONROM_EXTERNAL, IDS_ENABLE_EXT_FUNCTION_ROM, 0 },
    { IDC_C128_FUNCTIONROM_EXTERNAL_BROWSE, IDS_BROWSE, 0 },
    { 0, 0, 0 }
};

static uilib_dialog_group enable_group[] = {
    { IDC_C128_FUNCTIONROM_INTERNAL_TYPE_LABEL, 0 },
    { IDC_C128_FUNCTIONROM_EXTERNAL, 1 },
    { 0, 0 }
};

static uilib_dialog_group file_name_group[] = {
    { IDC_FILE_NAME_1, 0 },
    { IDC_FILE_NAME_2, 0 },
    { 0, 0 }
};

static uilib_dialog_group file_name_indicator_group[] = {
    { IDC_C128_FUNCTIONROM_INTERNAL_NAME, 0 },
    { IDC_C128_FUNCTIONROM_EXTERNAL_NAME, 0 },
    { 0, 0 }
};

static void init_functionrom_dialog(HWND hwnd)
{
    int res_value;
    const char *romfile;
    TCHAR *st_romfile;
    int xstart;
    int xpos;
    int size;
    HWND temp_hwnd;

    /* translate all dialog items */
    uilib_localize_dialog(hwnd, functionrom_dialog_trans);

    /* adjust the size of the enable group elements */
    uilib_adjust_group_width(hwnd, enable_group);

    /* adjust the size of the file name group elements */
    uilib_adjust_group_width(hwnd, file_name_group);

    /* get the max x of the file name indicator group */
    uilib_get_group_max_x(hwnd, file_name_indicator_group, &xstart);

    /* get the size of the file name indicator group elements */
    uilib_get_group_width(hwnd, file_name_indicator_group, &size);

    /* get the max x of the file name group */
    uilib_get_group_max_x(hwnd, file_name_group, &xpos);

    /* move the file name indicator group to the correct position */
    uilib_move_group(hwnd, file_name_indicator_group, xpos + 10);

    /* get the max x of the file name indicator group */
    uilib_get_group_max_x(hwnd, file_name_indicator_group, &xpos);

    /* set the size of the file name indicator group */
    uilib_set_element_width(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_NAME, size - (xpos - xstart));
    uilib_set_element_width(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_NAME, size - (xpos - xstart));

    /* get the size of the internal function rom type label */
    uilib_get_element_max_x(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_TYPE_LABEL, &xpos);

    /* move the internal function rom type box */
    uilib_move_element(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_TYPE, xpos + 10);

    resources_get_string("InternalFunctionName", &romfile);
    st_romfile = system_mbstowcs_alloc(romfile);
    SetDlgItemText(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_NAME, st_romfile != NULL ? st_romfile : TEXT(""));
    system_mbstowcs_free(st_romfile);

    resources_get_int("ExternalFunctionROM", &res_value);
    CheckDlgButton(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL, res_value ? BST_CHECKED : BST_UNCHECKED);

    resources_get_string("ExternalFunctionName", &romfile);
    st_romfile = system_mbstowcs_alloc(romfile);
    SetDlgItemText(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_NAME, st_romfile != NULL ? st_romfile : TEXT(""));
    system_mbstowcs_free(st_romfile);

    temp_hwnd = GetDlgItem(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_TYPE);
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)translate_text(IDS_NONE));
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"ROM");
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"RAM");
    SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)"RAM+RTC");

    resources_get_int("InternalFunctionROM", &res_value);
    SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)res_value, 0);

    enable_functionrom_controls(hwnd);
}

static uilib_localize_dialog_param rambanks_dialog_trans[] = {
    { IDC_C128_FULL_BANKS, IDS_C128_FULL_BANKS, 0 },
    { 0, 0, 0 }
};

static uilib_dialog_group rambanks_group[] = {
    { IDC_C128_FULL_BANKS, 1 },
    { 0, 0 }
};

static void init_rambanks_dialog(HWND hwnd)
{
    int res_value;

    /* translate all dialog items */
    uilib_localize_dialog(hwnd, rambanks_dialog_trans);

    /* adjust the size of the elements in the datasette_sub_group */
    uilib_adjust_group_width(hwnd, rambanks_group);

    resources_get_int("C128FullBanks", &res_value);
    CheckDlgButton(hwnd, IDC_C128_FULL_BANKS, res_value ? BST_CHECKED : BST_UNCHECKED);
}

static void end_machine_dialog(HWND hwnd)
{
    resources_set_int("MachineType", (int)SendMessage(GetDlgItem(hwnd, IDC_C128_MACHINE_TYPE), CB_GETCURSEL, 0, 0));
}

static INT_PTR CALLBACK machine_dialog_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
    switch (msg) {
        case WM_NOTIFY:
            switch (((NMHDR FAR *)lparam)->code) {
                case PSN_KILLACTIVE:
                    end_machine_dialog(hwnd);
                    return TRUE;
            }
            return FALSE;
        case WM_CLOSE:
            EndDialog(hwnd, 0);
            return TRUE;
        case WM_INITDIALOG:
            system_init_dialog(hwnd);
            init_machine_dialog(hwnd);
            return TRUE;
    }

    return FALSE;
}

static void end_functionrom_dialog(HWND hwnd)
{
    char name[MAX_PATH];
    TCHAR st_name[MAX_PATH];

    resources_set_int("InternalFunctionROM", SendMessage(GetDlgItem(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_TYPE), CB_GETCURSEL, 0, 0));

    GetDlgItemText(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_NAME, st_name, MAX_PATH);
    system_wcstombs(name, st_name, MAX_PATH);
    resources_set_string("InternalFunctionName", name);

    resources_set_int("ExternalFunctionROM", (IsDlgButtonChecked(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL) == BST_CHECKED ? 1 : 0 ));
    GetDlgItemText(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_NAME, st_name, MAX_PATH);
    system_wcstombs(name, st_name, MAX_PATH);
    resources_set_string("ExternalFunctionName", name);
}

static INT_PTR CALLBACK functionrom_dialog_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
    int command;

    switch (msg) {
        case WM_COMMAND:
            command = LOWORD(wparam);
            switch (command) {
                case IDC_C128_FUNCTIONROM_EXTERNAL:
                    enable_functionrom_controls(hwnd);
                    break;
                case IDC_C128_FUNCTIONROM_INTERNAL_BROWSE:
                    uilib_select_browse(hwnd, translate_text(IDS_SELECT_INT_FUNCTION_ROM), UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_LOAD, IDC_C128_FUNCTIONROM_INTERNAL_NAME);
                    break;
                case IDC_C128_FUNCTIONROM_EXTERNAL_BROWSE:
                    uilib_select_browse(hwnd, translate_text(IDS_SELECT_EXT_FUNCTION_ROM), UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_LOAD, IDC_C128_FUNCTIONROM_EXTERNAL_NAME);
                    break;
            }
            return FALSE;
        case WM_NOTIFY:
            switch (((NMHDR FAR *)lparam)->code) {
                case PSN_KILLACTIVE:
                    end_functionrom_dialog(hwnd);
                    return TRUE;
            }
            return FALSE;
        case WM_CLOSE:
            EndDialog(hwnd, 0);
            return TRUE;
        case WM_INITDIALOG:
            system_init_dialog(hwnd);
            init_functionrom_dialog(hwnd);
            return TRUE;
    }

    return FALSE;
}

static void end_rambanks_dialog(HWND hwnd)
{
    resources_set_int("C128FullBanks", (IsDlgButtonChecked(hwnd, IDC_C128_FULL_BANKS) == BST_CHECKED ? 1 : 0 ));
}

static INT_PTR CALLBACK rambanks_dialog_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
    int command;

    switch (msg) {
        case WM_COMMAND:
            command = LOWORD(wparam);
            return FALSE;
        case WM_NOTIFY:
            switch (((NMHDR FAR *)lparam)->code) {
                case PSN_KILLACTIVE:
                    end_rambanks_dialog(hwnd);
                    return TRUE;
            }
            return FALSE;
        case WM_CLOSE:
            EndDialog(hwnd, 0);
            return TRUE;
        case WM_INITDIALOG:
            system_init_dialog(hwnd);
            init_rambanks_dialog(hwnd);
            return TRUE;
    }

    return FALSE;
}

void ui_c128_dialog(HWND hwnd)
{
    PROPSHEETPAGE psp[3];
    PROPSHEETHEADER psh;

    psp[0].dwSize = sizeof(PROPSHEETPAGE);
    psp[0].dwFlags = PSP_USETITLE /*| PSP_HASHELP*/ ;
    psp[0].hInstance = winmain_instance;
#ifdef _ANONYMOUS_UNION
    psp[0].pszTemplate = MAKEINTRESOURCE(IDD_C128_MACHINE_SETTINGS_DIALOG);
    psp[0].pszIcon = NULL;
#else
    psp[0].DUMMYUNIONNAME.pszTemplate = MAKEINTRESOURCE(IDD_C128_MACHINE_SETTINGS_DIALOG);
    psp[0].u2.pszIcon = NULL;
#endif
    psp[0].lParam = 0;
    psp[0].pfnCallback = NULL;

    psp[1].dwSize = sizeof(PROPSHEETPAGE);
    psp[1].dwFlags = PSP_USETITLE /*| PSP_HASHELP*/ ;
    psp[1].hInstance = winmain_instance;
#ifdef _ANONYMOUS_UNION
    psp[1].pszTemplate = MAKEINTRESOURCE(IDD_C128_FUNCTIONROM_SETTINGS_DIALOG);
    psp[1].pszIcon = NULL;
#else
    psp[1].DUMMYUNIONNAME.pszTemplate = MAKEINTRESOURCE(IDD_C128_FUNCTIONROM_SETTINGS_DIALOG);
    psp[1].u2.pszIcon = NULL;
#endif
    psp[1].lParam = 0;
    psp[1].pfnCallback = NULL;

    psp[2].dwSize = sizeof(PROPSHEETPAGE);
    psp[2].dwFlags = PSP_USETITLE /*| PSP_HASHELP*/ ;
    psp[2].hInstance = winmain_instance;
#ifdef _ANONYMOUS_UNION
    psp[2].pszTemplate = MAKEINTRESOURCE(IDD_C128_RAM_BANKS_DIALOG);
    psp[2].pszIcon = NULL;
#else
    psp[2].DUMMYUNIONNAME.pszTemplate = MAKEINTRESOURCE(IDD_C128_RAM_BANKS_DIALOG);
    psp[2].u2.pszIcon = NULL;
#endif
    psp[2].lParam = 0;
    psp[2].pfnCallback = NULL;

    psp[0].pfnDlgProc = machine_dialog_proc;
    psp[0].pszTitle = translate_text(IDS_MACHINE_TYPE);
    psp[1].pfnDlgProc = functionrom_dialog_proc;
    psp[1].pszTitle = translate_text(IDS_FUNCTION_ROM);
    psp[2].pfnDlgProc = rambanks_dialog_proc;
    psp[2].pszTitle = translate_text(IDS_RAM_BANKS);

    psh.dwSize = sizeof(PROPSHEETHEADER);
    psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
    psh.hwndParent = hwnd;
    psh.hInstance = winmain_instance;
    psh.pszCaption = translate_text(IDS_C128_SETTINGS);
    psh.nPages = 3;
#ifdef _ANONYMOUS_UNION
    psh.pszIcon = NULL;
    psh.nStartPage = 0;
    psh.ppsp = psp;
#else
    psh.DUMMYUNIONNAME.pszIcon = NULL;
    psh.u2.nStartPage = 0;
    psh.u3.ppsp = psp;
#endif
    psh.pfnCallback = NULL;

    PropertySheet(&psh);
}


text:
package zhmt.dawn.util;

import java.util.HashMap;

@SuppressWarnings({ "rawtypes", "unchecked" })
public class TlsClassifiedObjectPool {

	private static final ThreadLocal<HashMap<Class, ObjectPool>> pool = new ThreadLocal<>();

	public static <T extends PooledObj> T getOne(Class<T> cls) {
		return (T) getClassifiedPool(cls).getOne();
	}

	public static <T extends PooledObj> void returnOne(T obj) {
		getClassifiedPool(obj.getClass()).returnOne(obj);
	}

	private static HashMap<Class, ObjectPool> getPool() {
		HashMap<Class, ObjectPool> ret = pool.get();
		if (ret != null) {
			return ret;
		}
		ret = new HashMap<>();
		pool.set(ret);
		return ret;
	}

	private static ObjectPool getClassifiedPool(final Class cls) {
		HashMap<Class, ObjectPool> all = getPool();
		ObjectPool ret = all.get(cls);
		if (ret != null) {
			return ret;
		}

		ret = new ObjectPool() {
			@Override
			protected PooledObj create() {
				try {
					return (PooledObj) cls.newInstance();
				} catch (Exception e) {
					throw new RuntimeException(e);
				}
			}
		};
		all.put(cls, ret);
		return ret;
	}
}


text:
namespace platform
{
	namespace window
	{
		struct EGLData;

		class EGLGraphicsProvider : public GraphicsProvider
		{
		public:
			EGLGraphicsProvider();

			virtual Result startup(WindowProvider* window_provider) override;
			virtual void shutdown(WindowProvider* window_provider) override;

			virtual void create_context(NativeWindow* window) override;
			virtual void destroy_context(NativeWindow* window) override;

			virtual void attach_context(NativeWindow* window) override;
			virtual void detach_context(NativeWindow* window) override;

			virtual void create_surface(NativeWindow* window) override;
			virtual void destroy_surface(NativeWindow* window) override;

			virtual void swap_buffers(NativeWindow* window) override;
			virtual void* get_symbol(const char* symbol_name) override;
			virtual size_t get_graphics_data_size() const override;

			virtual void pre_window_creation(const Parameters& window_parameters, void* graphics_data) override;
			virtual void* get_native_visual(void* graphics_data) override;

		private:
			EGLData* egldata_from(NativeWindow* window);

		private:
			EGLDisplay display;
		};
	} // namespace window
} // namespace platform


text:
"""
The module file for iosxr_lacp
"""

from __future__ import absolute_import, division, print_function
__metaclass__ = type

ANSIBLE_METADATA = {
    'metadata_version': '1.1',
    'status': ['preview'],
    'supported_by': 'network'
}

DOCUMENTATION = """
---
module: iosxr_lacp
version_added: 2.9
short_description: Manage Global Link Aggregation Control Protocol (LACP) on IOS-XR devices.
description:
  - This module manages Global Link Aggregation Control Protocol (LACP) on IOS-XR devices.
notes:
  - Tested against IOS-XR 6.1.3.
  - This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html).
author: Nilashish Chakraborty (@nilashishc)
options:
  config:
    description: The provided configurations.
    type: dict
    suboptions:
      system:
        description: This option sets the default system parameters for LACP bundles.
        type: dict
        suboptions:
          priority:
            description:
              - The system priority to use in LACP negotiations.
              - Lower value is higher priority.
              - Refer to vendor documentation for valid values.
            type: int
          mac:
            type: dict
            description:
              - The system MAC related configuration for LACP.
            suboptions:
              address:
                description:
                  - The system ID to use in LACP negotiations.
                type: str
  state:
    description:
      - The state of the configuration after module completion.
    type: str
    choices:
    - merged
    - replaced
    - deleted
    default: merged
"""
EXAMPLES = """
# Using merged
#
#
# ------------
# Before state
# ------------
#
#
# RP/0/0/CPU0:iosxr01#show running-config lacp
# Tue Jul 16 17:46:08.147 UTC
# % No such configuration item(s)
#
#

- name: Merge provided configuration with device configuration
  iosxr_lacp:
    config:
      system:
        priority: 10
        mac:
          address: 00c1.4c00.bd15
    state: merged

#
#
# -----------------------
# Module Execution Result
# -----------------------
#
# "before": {}
#
#
# "commands": [
#    "lacp system priority 10",
#    "lacp system mac 00c1.4c00.bd15"
#  ]
#
#
# "after": {
#    "system": {
#       "mac": {
#          "address": "00c1.4c00.bd15"
#       },
#       "priority": 10
#     }
#  }
#
# -----------
# After state
# -----------
#
#
# RP/0/0/CPU0:iosxr01#sh run lacp
# Tue Jul 16 17:51:29.365 UTC
# lacp system mac 00c1.4c00.bd15
# lacp system priority 10
#
#

# Using replaced
#
#
# -------------
# Before state
# -------------
#
#
# RP/0/0/CPU0:iosxr01#sh run lacp
# Tue Jul 16 17:53:59.904 UTC
# lacp system mac 00c1.4c00.bd15
# lacp system priority 10
#

- name: Replace device global lacp configuration with the given configuration
  iosxr_lacp:
    config:
      system:
        priority: 11
    state: replaced
#
#
# -----------------------
# Module Execution Result
# -----------------------
# "before": {
#    "system": {
#       "mac": {
#         "address": "00c1.4c00.bd15"
#       },
#       "priority": 10
#    }
#  }
#
#
# "commands": [
#    "no lacp system mac",
#    "lacp system priority 11"
#  ]
#
#
# "after": {
#    "system": {
#       "priority": 11
#    }
# }
#
# -----------
# After state
# -----------
#
#
# RP/0/0/CPU0:iosxr01#sh run lacp
# Tue Jul 16 18:02:40.379 UTC
# lacp system priority 11
#
#

# Using deleted
#
#
# ------------
# Before state
# ------------
#
#
# RP/0/0/CPU0:iosxr01#sh run lacp
# Tue Jul 16 18:37:09.727 UTC
# lacp system mac 00c1.4c00.bd15
# lacp system priority 11
#
#

- name: Delete global LACP configurations from the device
  iosxr_lacp:
    state: deleted

#
#
# -----------------------
# Module Execution Result
# -----------------------
# "before": {
#    "system": {
#       "mac": {
#         "address": "00c1.4c00.bd15"
#       },
#       "priority": 11
#    }
# }
#
#
# "commands": [
#     "no lacp system mac",
#     "no lacp system priority"
# ]
#
#
# "after": {}
#
# ------------
# After state
# ------------
#
#
# RP/0/0/CPU0:iosxr01#sh run lacp
# Tue Jul 16 18:39:44.116 UTC
# % No such configuration item(s)
#
#

"""
RETURN = """
before:
  description: The configuration as structured data prior to module invocation.
  returned: always
  type: dict
  sample: >
    The configuration returned will always be in the same format
     of the parameters above.
after:
  description: The configuration as structured data after module completion.
  returned: when changed
  type: dict
  sample: >
    The configuration returned will always be in the same format
     of the parameters above.
commands:
  description: The set of commands pushed to the remote device.
  returned: always
  type: list
  sample: ['lacp system priority 10', 'lacp system mac 00c1.4c00.bd15']
"""

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.iosxr.argspec.lacp.lacp import LacpArgs
from ansible.module_utils.network.iosxr.config.lacp.lacp import Lacp

def main():
    """
    Main entry point for module execution

    :returns: the result form module invocation
    """
    required_if = [('state', 'merged', ('config',)),
                   ('state', 'replaced', ('config',))]
    module = AnsibleModule(argument_spec=LacpArgs.argument_spec, required_if=required_if,
                           supports_check_mode=True)

    result = Lacp(module).execute_module()
    module.exit_json(**result)

if __name__ == '__main__':
    main()


text:
#ifndef __RISC_ISA_CATEGORIES_MULTIPLY_HH__
#define __RISC_ISA_CATEGORIES_MULTIPLY_HH__

#include "cpu/risc/isa/static_inst.hh"

namespace LILY2_NS
{
/* *********************************************************************
 * *************************** MULSL_M *********************************
 * ********************************************************************/
class MULSL_M : public StaticInst
{
public:
    /**
     * Constructor.
     *
     * @param (mnemonic)  : Mnemonic of instruction.
     * @param (mach_inst) : Machine code of instruction.
     */
    MULSL_M(ExtMachInst mach_inst);

    /**
     * Pure virtual function.
     * EXECUTE fucntions describe how an instruction is executed.
     *
     * @param (cpu) : Pointer to cpu.
     */
    void execute(RiscCPU *cpu) const;

   /**
    * Pure virtual function.
    *
    * @return : Disassembly language of instruction.
    */
   std::string generate_disassembly(void) const;
};

/* *********************************************************************
 * *************************** DIV_M ***********************************
 * ********************************************************************/
class DIV_M : public StaticInst
{
public:
    /**
     * Constructor.
     *
     * @param (mnemonic)  : Mnemonic of instruction.
     * @param (mach_inst) : Machine code of instruction.
     */
    DIV_M(ExtMachInst mach_inst);

    /**
     * Pure virtual function.
     * EXECUTE fucntions describe how an instruction is executed.
     *
     * @param (cpu) : Pointer to cpu.
     */
    void execute(RiscCPU *cpu) const;

   /**
    * Pure virtual function.
    *
    * @return : Disassembly language of instruction.
    */
   std::string generate_disassembly(void) const;
};

/* *********************************************************************
 * *************************** DIVU_M **********************************
 * ********************************************************************/
class DIVU_M : public StaticInst
{
public:
    /**
     * Constructor.
     *
     * @param (mnemonic)  : Mnemonic of instruction.
     * @param (mach_inst) : Machine code of instruction.
     */
    DIVU_M(ExtMachInst mach_inst);

    /**
     * Pure virtual function.
     * EXECUTE fucntions describe how an instruction is executed.
     *
     * @param (cpu) : Pointer to cpu.
     */
    void execute(RiscCPU *cpu) const;

   /**
    * Pure virtual function.
    *
    * @return : Disassembly language of instruction.
    */
   std::string generate_disassembly(void) const;
};

} // namespace LILY2_NS

#endif // __RISC_ISA_CATEGORIES_MULTIPLY_HH__


text:
import os
import json

import numpy as np

class AttrDict(dict):
    def __init__(self, *args, **kwargs):
        super(AttrDict, self).__init__(*args, **kwargs)
        self.__dict__ = self

class NumpyJSONEncoder(json.JSONEncoder):
    def default(self, o):
       if isinstance(o, np.ndarray):
            if np.iscomplex(o).any():
                return {'real': o.real.tolist(),
                        'imag': o.imag.tolist()}
            else:
                return o.tolist()
       return super(NumpyJSONEncoder, self).default(o)

def write_json(obj, fo, **kwargs):
    '''Write object *obj* (e.g. a dict) to file object *fo*.

    This is a wrapper for the standard library function :func:`json.dump``.
    It has a custom encoder for ndarrays, which are turned into (nested) lists.
    Complex ndarrays are turned into a dictionary with keys "real" and "imag"
    holding nested lists of the real and imaginary parts.

    See :func:`read_json`.

    '''
    kwargs['cls'] = NumpyJSONEncoder
    kwargs['encoding'] = 'ascii'
    kwargs['indent'] = 4
    return json.dump(obj, fo, **kwargs)

def resurrect_complex(d):
    for key, value in d.items():
        if isinstance(value, dict):
            if len(value.keys()) == 2 and 'real' in value and 'imag' in value:
                d[key] = np.asarray(value['real']) + np.asarray(value['imag']) * 1j
            else:
                resurrect_complex(value)
        elif isinstance(value, basestring):
            d[key] = value.encode('ascii')
        elif isinstance(value, list) or isinstance(value, tuple):
            d[key] = []
            for v in value:
                if isinstance(v, basestring):
                    d[key].append(v.encode('ascii'))
                else:
                    d[key].append(v)
        else:
            try:
                arr = np.asarray(value, dtype=np.float)
            except:
                logger.debug('failed to convert {}'.format(value))
            else:
                d[key] = arr
            continue
    for key, value in d.items():
        if isinstance(value, list) or isinstance(value, tuple):
            all_floats = True
            for item in traverse(value):
                try:
                    f = np.float(item)
                except ValueError:
                    all_floats = False
                    break
            if all_floats:
                d[key] = np.asarray(value)

def traverse(o, tree_types=(list, tuple)):
    '''http://stackoverflow.com/a/6340578'''
    if isinstance(o, tree_types):
        for value in o:
            for subvalue in traverse(value):
                yield subvalue
    else:
        yield o

def convert_keys_to_string(dictionary):
    """Recursively converts dictionary keys to strings."""
    if not isinstance(dictionary, dict):
        return dictionary
    return dict((str(k), convert_keys_to_string(v))
        for k, v in dictionary.items())

def read_json(fo, **kwargs):
    '''Read JSON file (especially one written by :func:`write_json`).

    This reconstitutes ndarrays (including the decomposed complex ones), and
    converts all the Unicode strings back into ASCII.

    '''
    if isinstance(fo, basestring) and os.path.isfile(fo):
        fo = open(fo, mode="r")
    kwargs.setdefault('encoding', 'ascii')
    jsondict = json.load(fo, **kwargs)
    fo.close()
    resurrect_complex(jsondict)
    return AttrDict(convert_keys_to_string(jsondict))


text:
from calvin.actor.actor import Actor, manage, condition, stateguard, calvinsys
from calvin.utilities.calvinlogger import get_actor_logger

_log = get_actor_logger(__name__)

class ImageSink(Actor):

    """
    Incoming tokens, as base64 endoded images, sent to renderer.

    Inputs:
      b64image: base64 encoded jpg
    """

    @manage(exclude=["_sink"])
    def init(self):
        self.setup()

    def setup(self):
        self._sink = calvinsys.open(self, "image.render")

    def did_migrate(self):
        self.setup()

    def will_end(self):
        calvinsys.close(self._sink)

    @stateguard(lambda self: calvinsys.can_write(self._sink))
    @condition(action_input=['b64image'])
    def render_image(self, image):
        calvinsys.write(self._sink, image)

    action_priority = (render_image, )
    requires = ['image.render']

    test_calvinsys = {'image.render': {'write': ["dummy_data"]}}
    test_set = [
        {
            'inports': {'b64image': ["dummy_data"]},
        }
    ]


text:
package org.pentaho.di.repository;

import static org.mockito.Mockito.mock;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.channels.FileChannel;

import junit.framework.Assert;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class RepositoryExportSaxParserTest {
  private static final String PKG = "org/pentaho/di/repository/";
  private static final String REPOSITORY_FILE = "test_repo";
  private static final String DIR_WITH_SPECIFIC_CHARS = "\u30A2\u30FF\u30CF";
  private static final String BASE_TEMP_DIR = System.getProperty( "java.io.tmpdir" );
  private static final File TEMP_DIR_WITH_REP_FILE = new File( BASE_TEMP_DIR, DIR_WITH_SPECIFIC_CHARS );

  private RepositoryExportSaxParser repExpSAXParser;
  private RepositoryImportFeedbackInterface repImpPgDlg = mock( RepositoryImportFeedbackInterface.class );
  private RepositoryImporter repImpMock = mock( RepositoryImporter.class );

  @Before
  public void setUp() throws IOException, URISyntaxException {
    System.out.println( "Temp Dir: " + BASE_TEMP_DIR );
    createTempDirWithSpecialCharactersInName();
    copyTestResourceIntoTempDir();
  }

  @After
  public void tearDown() throws IOException {
    cleanTempDir();

  }

  @Test
  public void testNoExceptionOccurs_WhenNameContainsJapaneseCharacters() throws Exception {
    repExpSAXParser = new RepositoryExportSaxParser( getRepositoryFile().getCanonicalPath(), repImpPgDlg );
    try {
      repExpSAXParser.parse( repImpMock );
    } catch ( Exception e ) {
      Assert.fail( "No exception is expected But occured: " + e );
    }
  }

  private static void createTempDirWithSpecialCharactersInName() throws IOException {
    if ( !TEMP_DIR_WITH_REP_FILE.exists() ) {
      if ( TEMP_DIR_WITH_REP_FILE.mkdir() ) {
        System.out.println( "CREATED: " + TEMP_DIR_WITH_REP_FILE.getCanonicalPath() );
      } else {
        System.out.println( "NOT CREATED: " + TEMP_DIR_WITH_REP_FILE.toString() );
      }
    }

  }

  private void copyTestResourceIntoTempDir() throws IOException, URISyntaxException {
    File destFile = getRepositoryFile();
    File sourceFile =
        new File( RepositoryExportSaxParserTest.class.getClassLoader().getResource( PKG + REPOSITORY_FILE ).toURI() );

    copyFile( sourceFile, destFile );
    System.out.println( "Copied: " + sourceFile + "-->" + destFile );
  }

  private static void copyFile( File sourceFile, File destFile ) throws IOException {
    if ( !destFile.exists() ) {
      destFile.createNewFile();
    }

    FileChannel source = null;
    FileChannel destination = null;

    try {
      source = new FileInputStream( sourceFile ).getChannel();
      destination = new FileOutputStream( destFile ).getChannel();
      destination.transferFrom( source, 0, source.size() );
    } catch ( Exception e ) {
      e.printStackTrace();
    } finally {
      if ( source != null ) {
        source.close();
      }
      if ( destination != null ) {
        destination.close();
      }
    }
  }

  private static void cleanTempDir() throws IOException {

    delete( TEMP_DIR_WITH_REP_FILE );
  }

  private static void delete( File file ) throws IOException {

    if ( file.isDirectory() ) {
      if ( file.list().length == 0 ) {
        file.delete();
      } else {
        String[] files = file.list();
        for ( String tempFile : files ) {
          File fileDelete = new File( file, tempFile );
          delete( fileDelete );
        }
        if ( file.list().length == 0 ) {
          file.delete();
          System.out.println( "Deleted: " + file );
        }
      }
    } else {
      file.delete();
      System.out.println( "Deleted: " + file );
    }

  }

  private File getRepositoryFile() {
    return new File( TEMP_DIR_WITH_REP_FILE, REPOSITORY_FILE );
  }
}


text:
Minimalistic JavaScript offline first application seed using PouchDB and ServiceWorker

Uses Express/Node for server. Runs PouchDB both on server and client to allow working offline and sync when online
Uses ServiceWorker to allow running page/app while offline
Uses MaterializeCSS for styling

# Usage

Install dependencies, under windows may require node-gyp
```bash
npm install
```

To start server
```bash
npm start
```

Now you can go to http://localhost:3000/

- Allows adding and removing messages
- Shows if in sync or disconnected
- Shows log of events/errors from PouchDB

![alt tag](https://raw.githubusercontent.com/wonderwhy-er/offline-first-seed/master/screen.png)


text:
package org.hibernate.validator.cfg.defs;

import java.lang.annotation.ElementType;
import javax.validation.constraints.Null;

import org.hibernate.validator.cfg.ConstraintDef;
import org.hibernate.validator.cfg.ConstraintMapping;

/**
 * @author Hardy Ferentschik
 */
public class NullDef extends ConstraintDef<Null> {
	public NullDef(Class<?> beanType, String property, ElementType elementType, ConstraintMapping mapping) {
		super( beanType, Null.class, property, elementType, mapping );
	}
}


text:
package tsm1

// Integer encoding uses two different strategies depending on the range of values in
// the uncompressed data.  Encoded values are first encoding used zig zag encoding.
// This interleaves positive and negative integers across a range of positive integers.
//
// For example, [-2,-1,0,1] becomes [3,1,0,2]. See
// https://developers.google.com/protocol-buffers/docs/encoding?hl=en#signed-integers
// for more information.
//
// If all the zig zag encoded values are less than 1 << 60 - 1, they are compressed using
// simple8b encoding.  If any value is larger than 1 << 60 - 1, the values are stored uncompressed.
//
// Each encoded byte slice contains a 1 byte header followed by multiple 8 byte packed integers
// or 8 byte uncompressed integers.  The 4 high bits of the first byte indicate the encoding type
// for the remaining bytes.
//
// There are currently two encoding types that can be used with room for 16 total.  These additional
// encoding slots are reserved for future use.  One improvement to be made is to use a patched
// encoding such as PFOR if only a small number of values exceed the max compressed value range.  This
// should improve compression ratios with very large integers near the ends of the int64 range.

import (
	"encoding/binary"
	"fmt"

	"github.com/jwilder/encoding/simple8b"
)

const (
	// intUncompressed is an uncompressed format using 8 bytes per point
	intUncompressed = 0
	// intCompressedSimple is a bit-packed format using simple8b encoding
	intCompressedSimple = 1
	// intCompressedRLE is a run-length encoding format
	intCompressedRLE = 2
)

// IntegerEncoder encodes int64s into byte slices.
type IntegerEncoder struct {
	prev   int64
	rle    bool
	values []uint64
}

// NewIntegerEncoder returns a new integer encoder with an initial buffer of values sized at sz.
func NewIntegerEncoder(sz int) IntegerEncoder {
	return IntegerEncoder{
		rle:    true,
		values: make([]uint64, 0, sz),
	}
}

// Flush is no-op
func (e *IntegerEncoder) Flush() {}

// Reset sets the encoder back to its initial state.
func (e *IntegerEncoder) Reset() {
	e.prev = 0
	e.rle = true
	e.values = e.values[:0]
}

// Write encodes v to the underlying buffers.
func (e *IntegerEncoder) Write(v int64) {
	// Delta-encode each value as it's written.  This happens before
	// ZigZagEncoding because the deltas could be negative.
	delta := v - e.prev
	e.prev = v
	enc := ZigZagEncode(delta)
	if len(e.values) > 1 {
		e.rle = e.rle && e.values[len(e.values)-1] == enc
	}

	e.values = append(e.values, enc)
}

// Bytes returns a copy of the underlying buffer.
func (e *IntegerEncoder) Bytes() ([]byte, error) {
	// Only run-length encode if it could reduce storage size.
	if e.rle && len(e.values) > 2 {
		return e.encodeRLE()
	}

	for _, v := range e.values {
		// Value is too large to encode using packed format
		if v > simple8b.MaxValue {
			return e.encodeUncompressed()
		}
	}

	return e.encodePacked()
}

func (e *IntegerEncoder) encodeRLE() ([]byte, error) {
	// Large varints can take up to 10 bytes.  We're storing 3 + 1
	// type byte.
	var b [31]byte

	// 4 high bits used for the encoding type
	b[0] = byte(intCompressedRLE) << 4

	i := 1
	// The first value
	binary.BigEndian.PutUint64(b[i:], e.values[0])
	i += 8
	// The first delta
	i += binary.PutUvarint(b[i:], e.values[1])
	// The number of times the delta is repeated
	i += binary.PutUvarint(b[i:], uint64(len(e.values)-1))

	return b[:i], nil
}

func (e *IntegerEncoder) encodePacked() ([]byte, error) {
	if len(e.values) == 0 {
		return nil, nil
	}

	// Encode all but the first value.  Fist value is written unencoded
	// using 8 bytes.
	encoded, err := simple8b.EncodeAll(e.values[1:])
	if err != nil {
		return nil, err
	}

	b := make([]byte, 1+(len(encoded)+1)*8)
	// 4 high bits of first byte store the encoding type for the block
	b[0] = byte(intCompressedSimple) << 4

	// Write the first value since it's not part of the encoded values
	binary.BigEndian.PutUint64(b[1:9], e.values[0])

	// Write the encoded values
	for i, v := range encoded {
		binary.BigEndian.PutUint64(b[9+i*8:9+i*8+8], v)
	}
	return b, nil
}

func (e *IntegerEncoder) encodeUncompressed() ([]byte, error) {
	if len(e.values) == 0 {
		return nil, nil
	}

	b := make([]byte, 1+len(e.values)*8)
	// 4 high bits of first byte store the encoding type for the block
	b[0] = byte(intUncompressed) << 4

	for i, v := range e.values {
		binary.BigEndian.PutUint64(b[1+i*8:1+i*8+8], v)
	}
	return b, nil
}

// IntegerDecoder decodes a byte slice into int64s.
type IntegerDecoder struct {
	// 240 is the maximum number of values that can be encoded into a single uint64 using simple8b
	values [240]uint64
	bytes  []byte
	i      int
	n      int
	prev   int64
	first  bool

	// The first value for a run-length encoded byte slice
	rleFirst uint64

	// The delta value for a run-length encoded byte slice
	rleDelta uint64
	encoding byte
	err      error
}

// SetBytes sets the underlying byte slice of the decoder.
func (d *IntegerDecoder) SetBytes(b []byte) {
	if len(b) > 0 {
		d.encoding = b[0] >> 4
		d.bytes = b[1:]
	} else {
		d.encoding = 0
		d.bytes = nil
	}

	d.i = 0
	d.n = 0
	d.prev = 0
	d.first = true

	d.rleFirst = 0
	d.rleDelta = 0
	d.err = nil
}

// Next returns true if there are any values remaining to be decoded.
func (d *IntegerDecoder) Next() bool {
	if d.i >= d.n && len(d.bytes) == 0 {
		return false
	}

	d.i++

	if d.i >= d.n {
		switch d.encoding {
		case intUncompressed:
			d.decodeUncompressed()
		case intCompressedSimple:
			d.decodePacked()
		case intCompressedRLE:
			d.decodeRLE()
		default:
			d.err = fmt.Errorf("unknown encoding %v", d.encoding)
		}
	}
	return d.err == nil && d.i < d.n
}

// Error returns the last error encountered by the decoder.
func (d *IntegerDecoder) Error() error {
	return d.err
}

// Read returns the next value from the decoder.
func (d *IntegerDecoder) Read() int64 {
	switch d.encoding {
	case intCompressedRLE:
		return ZigZagDecode(d.rleFirst) + int64(d.i)*ZigZagDecode(d.rleDelta)
	default:
		v := ZigZagDecode(d.values[d.i])
		// v is the delta encoded value, we need to add the prior value to get the original
		v = v + d.prev
		d.prev = v
		return v
	}
}

func (d *IntegerDecoder) decodeRLE() {
	if len(d.bytes) == 0 {
		return
	}

	if len(d.bytes) < 8 {
		d.err = fmt.Errorf("IntegerDecoder: not enough data to decode RLE starting value")
		return
	}

	var i, n int

	// Next 8 bytes is the starting value
	first := binary.BigEndian.Uint64(d.bytes[i : i+8])
	i += 8

	// Next 1-10 bytes is the delta value
	value, n := binary.Uvarint(d.bytes[i:])
	if n <= 0 {
		d.err = fmt.Errorf("IntegerDecoder: invalid RLE delta value")
		return
	}
	i += n

	// Last 1-10 bytes is how many times the value repeats
	count, n := binary.Uvarint(d.bytes[i:])
	if n <= 0 {
		d.err = fmt.Errorf("IntegerDecoder: invalid RLE repeat value")
		return
	}

	// Store the first value and delta value so we do not need to allocate
	// a large values slice.  We can compute the value at position d.i on
	// demand.
	d.rleFirst = first
	d.rleDelta = value
	d.n = int(count) + 1
	d.i = 0

	// We've process all the bytes
	d.bytes = nil
}

func (d *IntegerDecoder) decodePacked() {
	if len(d.bytes) == 0 {
		return
	}

	if len(d.bytes) < 8 {
		d.err = fmt.Errorf("IntegerDecoder: not enough data to decode packed value")
		return
	}

	v := binary.BigEndian.Uint64(d.bytes[0:8])
	// The first value is always unencoded
	if d.first {
		d.first = false
		d.n = 1
		d.values[0] = v
	} else {
		n, err := simple8b.Decode(&d.values, v)
		if err != nil {
			// Should never happen, only error that could be returned is if the the value to be decoded was not
			// actually encoded by simple8b encoder.
			d.err = fmt.Errorf("failed to decode value %v: %v", v, err)
		}

		d.n = n
	}
	d.i = 0
	d.bytes = d.bytes[8:]
}

func (d *IntegerDecoder) decodeUncompressed() {
	if len(d.bytes) == 0 {
		return
	}

	if len(d.bytes) < 8 {
		d.err = fmt.Errorf("IntegerDecoder: not enough data to decode uncompressed value")
		return
	}

	d.values[0] = binary.BigEndian.Uint64(d.bytes[0:8])
	d.i = 0
	d.n = 1
	d.bytes = d.bytes[8:]
}


text:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="@dimen/double_margin">

    <TextView
        android:id="@+id/title"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="4dp"
        android:layout_marginEnd="4dp"
        android:text="@string/add_account"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="?android:attr/textColorPrimary"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/account_name_layout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/title">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/accountNameEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/account_name"
            android:inputType="textCapWords" />
    </com.google.android.material.textfield.TextInputLayout>

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/account_balance_layout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/single_margin"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/account_name_layout">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/accountBalanceEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/account_balance"
            android:inputType="numberDecimal" />
    </com.google.android.material.textfield.TextInputLayout>

    <LinearLayout
        style="?android:attr/buttonBarStyle"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:gravity="end"
        android:orientation="horizontal"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/account_balance_layout">

        <Button
            android:id="@+id/submitButton"
            style="?android:attr/buttonBarButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/submit" />
    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>


text:
'use strict';

const baAsn1 = require('../asn1');
const baEnum = require('../enum');

module.exports.encode = (buffer, lowLimit, highLimit, objectId, objectName) => {
  if ((lowLimit >= 0) && (lowLimit <= baEnum.ASN1_MAX_INSTANCE) && (highLimit >= 0) && (highLimit <= baEnum.ASN1_MAX_INSTANCE)) {
    baAsn1.encodeContextUnsigned(buffer, 0, lowLimit);
    baAsn1.encodeContextUnsigned(buffer, 1, highLimit);
  }
  if (objectName && objectName !== '') {
    baAsn1.encodeContextCharacterString(buffer, 3, objectName);
  } else {
    baAsn1.encodeContextObjectId(buffer, 2, objectId.type, objectId.instance);
  }
};

module.exports.decode = (buffer, offset, apduLen) => {
  let len = 0;
  const value = {};
  let decodedValue;
  let result = baAsn1.decodeTagNumberAndValue(buffer, offset + len);
  len += result.len;
  if (result.tagNumber === 0) {
    decodedValue = baAsn1.decodeUnsigned(buffer, offset + len, result.value);
    len += decodedValue.len;
    if (decodedValue.value <= baEnum.ASN1_MAX_INSTANCE) {
      value.lowLimit = decodedValue.value;
    }
    result = baAsn1.decodeTagNumberAndValue(buffer, offset + len);
    len += result.len;
  }
  if (result.tagNumber === 1) {
    decodedValue = baAsn1.decodeUnsigned(buffer, offset + len, result.value);
    len += decodedValue.len;
    if (decodedValue.value <= baEnum.ASN1_MAX_INSTANCE) {
      value.highLimit = decodedValue.value;
    }
    result = baAsn1.decodeTagNumberAndValue(buffer, offset + len);
    len += result.len;
  }
  if (result.tagNumber === 2) {
    decodedValue = baAsn1.decodeObjectId(buffer, offset + len);
    len += decodedValue.len;
    value.objectId = {type: decodedValue.objectType, instance: decodedValue.instance};
  }
  if (result.tagNumber === 3) {
    decodedValue = baAsn1.decodeCharacterString(buffer, offset + len, apduLen - (offset + len), result.value);
    len += decodedValue.len;
    value.objectName = decodedValue.value;
  }
  value.len = len;
  return value;
};


text:
#ifndef QXML_H
#define QXML_H

#include <QtXml/qtxmlglobal.h>
#include <QtCore/qtextstream.h>
#include <QtCore/qfile.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qlist.h>
#include <QtCore/qscopedpointer.h>

QT_BEGIN_NAMESPACE

class QXmlNamespaceSupport;
class QXmlAttributes;
class QXmlContentHandler;
class QXmlDefaultHandler;
class QXmlDTDHandler;
class QXmlEntityResolver;
class QXmlErrorHandler;
class QXmlLexicalHandler;
class QXmlDeclHandler;
class QXmlInputSource;
class QXmlLocator;
class QXmlNamespaceSupport;
class QXmlParseException;

class QXmlReader;
class QXmlSimpleReader;

class QXmlSimpleReaderPrivate;
class QXmlNamespaceSupportPrivate;
class QXmlAttributesPrivate;
class QXmlInputSourcePrivate;
class QXmlParseExceptionPrivate;
class QXmlLocatorPrivate;
class QXmlDefaultHandlerPrivate;

//
// SAX Namespace Support
//

class Q_XML_EXPORT QXmlNamespaceSupport
{
public:
    QXmlNamespaceSupport();
    ~QXmlNamespaceSupport();

    void setPrefix(const QString&, const QString&);

    QString prefix(const QString&) const;
    QString uri(const QString&) const;
    void splitName(const QString&, QString&, QString&) const;
    void processName(const QString&, bool, QString&, QString&) const;
    QStringList prefixes() const;
    QStringList prefixes(const QString&) const;

    void pushContext();
    void popContext();
    void reset();

private:
    QXmlNamespaceSupportPrivate *d;

    friend class QXmlSimpleReaderPrivate;
    Q_DISABLE_COPY(QXmlNamespaceSupport)
};

//
// SAX Attributes
//

class Q_XML_EXPORT QXmlAttributes
{
public:
    QXmlAttributes();
#ifdef Q_COMPILER_DEFAULT_MEMBERS
    QXmlAttributes(const QXmlAttributes &) = default;
    QXmlAttributes(QXmlAttributes &&) Q_DECL_NOTHROW = default;
    QXmlAttributes &operator=(const QXmlAttributes &) = default;
    QXmlAttributes &operator=(QXmlAttributes &&) Q_DECL_NOTHROW = default;
#endif // default members
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
    virtual // ### Qt 6: this value class don't need no virtual dtor
#endif
    ~QXmlAttributes();

    void swap(QXmlAttributes &other) Q_DECL_NOTHROW
    {
        qSwap(attList, other.attList);
        qSwap(d, other.d);
    }

    int index(const QString& qName) const;
    int index(QLatin1String qName) const;
    int index(const QString& uri, const QString& localPart) const;
    int length() const;
    int count() const;
    QString localName(int index) const;
    QString qName(int index) const;
    QString uri(int index) const;
    QString type(int index) const;
    QString type(const QString& qName) const;
    QString type(const QString& uri, const QString& localName) const;
    QString value(int index) const;
    QString value(const QString& qName) const;
    QString value(QLatin1String qName) const;
    QString value(const QString& uri, const QString& localName) const;

    void clear();
    void append(const QString &qName, const QString &uri, const QString &localPart, const QString &value);

private:
    struct Attribute {
        QString qname, uri, localname, value;
    };
    typedef QList<Attribute> AttributeList;
    AttributeList attList;

    QXmlAttributesPrivate *d;
};
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QXmlAttributes)

//
// SAX Input Source
//

class Q_XML_EXPORT QXmlInputSource
{
public:
    QXmlInputSource();
    explicit QXmlInputSource(QIODevice *dev);
    virtual ~QXmlInputSource();

    virtual void setData(const QString& dat);
    virtual void setData(const QByteArray& dat);
    virtual void fetchData();
    virtual QString data() const;
    virtual QChar next();
    virtual void reset();

    static const ushort EndOfData;
    static const ushort EndOfDocument;

protected:
    virtual QString fromRawData(const QByteArray &data, bool beginning = false);

private:
    void init();
    QXmlInputSourcePrivate *d;
};

//
// SAX Exception Classes
//

class Q_XML_EXPORT QXmlParseException
{
public:
    explicit QXmlParseException(const QString &name = QString(), int c = -1, int l = -1,
                                const QString &p = QString(), const QString &s = QString());
    QXmlParseException(const QXmlParseException &other);
    ~QXmlParseException();

    int columnNumber() const;
    int lineNumber() const;
    QString publicId() const;
    QString systemId() const;
    QString message() const;

private:
    QScopedPointer<QXmlParseExceptionPrivate> d;
};

//
// XML Reader
//

class Q_XML_EXPORT QXmlReader
{
public:
    virtual ~QXmlReader() {}
    virtual bool feature(const QString& name, bool *ok = Q_NULLPTR) const = 0;
    virtual void setFeature(const QString& name, bool value) = 0;
    virtual bool hasFeature(const QString& name) const = 0;
    virtual void* property(const QString& name, bool *ok = Q_NULLPTR) const = 0;
    virtual void setProperty(const QString& name, void* value) = 0;
    virtual bool hasProperty(const QString& name) const = 0;
    virtual void setEntityResolver(QXmlEntityResolver* handler) = 0;
    virtual QXmlEntityResolver* entityResolver() const = 0;
    virtual void setDTDHandler(QXmlDTDHandler* handler) = 0;
    virtual QXmlDTDHandler* DTDHandler() const = 0;
    virtual void setContentHandler(QXmlContentHandler* handler) = 0;
    virtual QXmlContentHandler* contentHandler() const = 0;
    virtual void setErrorHandler(QXmlErrorHandler* handler) = 0;
    virtual QXmlErrorHandler* errorHandler() const = 0;
    virtual void setLexicalHandler(QXmlLexicalHandler* handler) = 0;
    virtual QXmlLexicalHandler* lexicalHandler() const = 0;
    virtual void setDeclHandler(QXmlDeclHandler* handler) = 0;
    virtual QXmlDeclHandler* declHandler() const = 0;
    virtual bool parse(const QXmlInputSource& input) = 0;
    virtual bool parse(const QXmlInputSource* input) = 0;
};

class Q_XML_EXPORT QXmlSimpleReader : public QXmlReader
{
public:
    QXmlSimpleReader();
    virtual ~QXmlSimpleReader();

    bool feature(const QString& name, bool *ok = Q_NULLPTR) const Q_DECL_OVERRIDE;
    void setFeature(const QString& name, bool value) Q_DECL_OVERRIDE;
    bool hasFeature(const QString& name) const Q_DECL_OVERRIDE;

    void* property(const QString& name, bool *ok = Q_NULLPTR) const Q_DECL_OVERRIDE;
    void setProperty(const QString& name, void* value) Q_DECL_OVERRIDE;
    bool hasProperty(const QString& name) const Q_DECL_OVERRIDE;

    void setEntityResolver(QXmlEntityResolver* handler) Q_DECL_OVERRIDE;
    QXmlEntityResolver* entityResolver() const Q_DECL_OVERRIDE;
    void setDTDHandler(QXmlDTDHandler* handler) Q_DECL_OVERRIDE;
    QXmlDTDHandler* DTDHandler() const Q_DECL_OVERRIDE;
    void setContentHandler(QXmlContentHandler* handler) Q_DECL_OVERRIDE;
    QXmlContentHandler* contentHandler() const Q_DECL_OVERRIDE;
    void setErrorHandler(QXmlErrorHandler* handler) Q_DECL_OVERRIDE;
    QXmlErrorHandler* errorHandler() const Q_DECL_OVERRIDE;
    void setLexicalHandler(QXmlLexicalHandler* handler) Q_DECL_OVERRIDE;
    QXmlLexicalHandler* lexicalHandler() const Q_DECL_OVERRIDE;
    void setDeclHandler(QXmlDeclHandler* handler) Q_DECL_OVERRIDE;
    QXmlDeclHandler* declHandler() const Q_DECL_OVERRIDE;

    bool parse(const QXmlInputSource& input) Q_DECL_OVERRIDE;
    bool parse(const QXmlInputSource* input) Q_DECL_OVERRIDE;
    virtual bool parse(const QXmlInputSource* input, bool incremental);
    virtual bool parseContinue();

private:
    Q_DISABLE_COPY(QXmlSimpleReader)
    Q_DECLARE_PRIVATE(QXmlSimpleReader)
    QScopedPointer<QXmlSimpleReaderPrivate> d_ptr;

    friend class QXmlSimpleReaderLocator;
    friend class QDomHandler;
};

//
// SAX Locator
//

class Q_XML_EXPORT QXmlLocator
{
public:
    QXmlLocator();
    virtual ~QXmlLocator();

    virtual int columnNumber() const = 0;
    virtual int lineNumber() const = 0;
//    QString getPublicId() const
//    QString getSystemId() const
};

//
// SAX handler classes
//

class Q_XML_EXPORT QXmlContentHandler
{
public:
    virtual ~QXmlContentHandler() {}
    virtual void setDocumentLocator(QXmlLocator* locator) = 0;
    virtual bool startDocument() = 0;
    virtual bool endDocument() = 0;
    virtual bool startPrefixMapping(const QString& prefix, const QString& uri) = 0;
    virtual bool endPrefixMapping(const QString& prefix) = 0;
    virtual bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts) = 0;
    virtual bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName) = 0;
    virtual bool characters(const QString& ch) = 0;
    virtual bool ignorableWhitespace(const QString& ch) = 0;
    virtual bool processingInstruction(const QString& target, const QString& data) = 0;
    virtual bool skippedEntity(const QString& name) = 0;
    virtual QString errorString() const = 0;
};

class Q_XML_EXPORT QXmlErrorHandler
{
public:
    virtual ~QXmlErrorHandler() {}
    virtual bool warning(const QXmlParseException& exception) = 0;
    virtual bool error(const QXmlParseException& exception) = 0;
    virtual bool fatalError(const QXmlParseException& exception) = 0;
    virtual QString errorString() const = 0;
};

class Q_XML_EXPORT QXmlDTDHandler
{
public:
    virtual ~QXmlDTDHandler() {}
    virtual bool notationDecl(const QString& name, const QString& publicId, const QString& systemId) = 0;
    virtual bool unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName) = 0;
    virtual QString errorString() const = 0;
};

class Q_XML_EXPORT QXmlEntityResolver
{
public:
    virtual ~QXmlEntityResolver() {}
    virtual bool resolveEntity(const QString& publicId, const QString& systemId, QXmlInputSource*& ret) = 0;
    virtual QString errorString() const = 0;
};

class Q_XML_EXPORT QXmlLexicalHandler
{
public:
    virtual ~QXmlLexicalHandler() {}
    virtual bool startDTD(const QString& name, const QString& publicId, const QString& systemId) = 0;
    virtual bool endDTD() = 0;
    virtual bool startEntity(const QString& name) = 0;
    virtual bool endEntity(const QString& name) = 0;
    virtual bool startCDATA() = 0;
    virtual bool endCDATA() = 0;
    virtual bool comment(const QString& ch) = 0;
    virtual QString errorString() const = 0;
};

class Q_XML_EXPORT QXmlDeclHandler
{
public:
    virtual ~QXmlDeclHandler() {}
    virtual bool attributeDecl(const QString& eName, const QString& aName, const QString& type, const QString& valueDefault, const QString& value) = 0;
    virtual bool internalEntityDecl(const QString& name, const QString& value) = 0;
    virtual bool externalEntityDecl(const QString& name, const QString& publicId, const QString& systemId) = 0;
    virtual QString errorString() const = 0;
    // ### Conform to SAX by adding elementDecl
};

class Q_XML_EXPORT QXmlDefaultHandler : public QXmlContentHandler, public QXmlErrorHandler, public QXmlDTDHandler, public QXmlEntityResolver, public QXmlLexicalHandler, public QXmlDeclHandler
{
public:
    QXmlDefaultHandler();
    virtual ~QXmlDefaultHandler();

    void setDocumentLocator(QXmlLocator* locator) Q_DECL_OVERRIDE;
    bool startDocument() Q_DECL_OVERRIDE;
    bool endDocument() Q_DECL_OVERRIDE;
    bool startPrefixMapping(const QString& prefix, const QString& uri) Q_DECL_OVERRIDE;
    bool endPrefixMapping(const QString& prefix) Q_DECL_OVERRIDE;
    bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts) Q_DECL_OVERRIDE;
    bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName) Q_DECL_OVERRIDE;
    bool characters(const QString& ch) Q_DECL_OVERRIDE;
    bool ignorableWhitespace(const QString& ch) Q_DECL_OVERRIDE;
    bool processingInstruction(const QString& target, const QString& data) Q_DECL_OVERRIDE;
    bool skippedEntity(const QString& name) Q_DECL_OVERRIDE;

    bool warning(const QXmlParseException& exception) Q_DECL_OVERRIDE;
    bool error(const QXmlParseException& exception) Q_DECL_OVERRIDE;
    bool fatalError(const QXmlParseException& exception) Q_DECL_OVERRIDE;

    bool notationDecl(const QString& name, const QString& publicId, const QString& systemId) Q_DECL_OVERRIDE;
    bool unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName) Q_DECL_OVERRIDE;

    bool resolveEntity(const QString& publicId, const QString& systemId, QXmlInputSource*& ret) Q_DECL_OVERRIDE;

    bool startDTD(const QString& name, const QString& publicId, const QString& systemId) Q_DECL_OVERRIDE;
    bool endDTD() Q_DECL_OVERRIDE;
    bool startEntity(const QString& name) Q_DECL_OVERRIDE;
    bool endEntity(const QString& name) Q_DECL_OVERRIDE;
    bool startCDATA() Q_DECL_OVERRIDE;
    bool endCDATA() Q_DECL_OVERRIDE;
    bool comment(const QString& ch) Q_DECL_OVERRIDE;

    bool attributeDecl(const QString& eName, const QString& aName, const QString& type, const QString& valueDefault, const QString& value) Q_DECL_OVERRIDE;
    bool internalEntityDecl(const QString& name, const QString& value) Q_DECL_OVERRIDE;
    bool externalEntityDecl(const QString& name, const QString& publicId, const QString& systemId) Q_DECL_OVERRIDE;

    QString errorString() const Q_DECL_OVERRIDE;

private:
    QXmlDefaultHandlerPrivate *d;
    Q_DISABLE_COPY(QXmlDefaultHandler)
};

// inlines

inline int QXmlAttributes::count() const
{ return length(); }

QT_END_NAMESPACE

#endif // QXML_H


text:
layout: emd_issue
status: publish
published: true
title: '#1421'
author: Project Manager
author_login: issues-pm
author_email: issues-pm@emarketdesign.com
excerpt: google-sitemap-generator
wordpress_id: 13407
wordpress_url: http://wordpressc.com/emd_issue/1421/
date: 2013-04-29 02:56:30.000000000 -04:00
categories: []
tags: []
comments: []
---
Exclude id not working.