text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AsyncQueue (TaskChain (Core) 3.7.2 API)</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

co.aikar.taskchain

Interface AsyncQueue

All Known Implementing Classes:

TaskChainAsyncQueue

public interface AsyncQueue

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

void
postAsync(Runnable runnable)

Task to post async of main thread

void
shutdown(int timeout,
        TimeUnit unit)

Call during game shutdown state

Method Detail

postAsync

void postAsync(Runnable runnable)

Task to post async of main thread

Parameters:

runnable -

shutdown

void shutdown(int timeout,
              TimeUnit unit)

Call during game shutdown state

Parameters:

timeout -

unit -

Skip navigation links

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2018. All rights reserved.


text:
title: GBK
summary: This document provides details about the TiDB support of the GBK character set.
---

# GBK

Since v5.4.0, TiDB supports the GBK character set. This document provides the TiDB support and compatibility information of the GBK character set.

```sql
SHOW CHARACTER SET WHERE CHARSET = 'gbk';
+---------+-------------------------------------+-------------------+--------+
| Charset | Description                         | Default collation | Maxlen |
+---------+-------------------------------------+-------------------+--------+
| gbk     | Chinese Internal Code Specification | gbk_bin           |      2 |
+---------+-------------------------------------+-------------------+--------+
1 row in set (0.00 sec)

SHOW COLLATION WHERE CHARSET = 'gbk';
+----------------+---------+------+---------+----------+---------+
| Collation      | Charset | Id   | Default | Compiled | Sortlen |
+----------------+---------+------+---------+----------+---------+
| gbk_bin        | gbk     |   87 |         | Yes      |       1 |
+----------------+---------+------+---------+----------+---------+
1 rows in set (0.00 sec)
```

## MySQL compatibility

This section provides the compatibility information between MySQL and TiDB.

### Collations

The default collation of the GBK character set in MySQL is `gbk_chinese_ci`. Unlike MySQL, the default collation of the GBK character set in TiDB is `gbk_bin`. Additionally, because TiDB converts GBK to UTF8MB4 and then uses a binary collation, the `gbk_bin` collation in TiDB is not the same as the `gbk_bin` collation in MySQL.

<CustomContent platform="tidb">

To make TiDB compatible with the collations of MySQL GBK character set, when you first initialize the TiDB cluster, you need to set the TiDB option [`new_collations_enabled_on_first_bootstrap`](/tidb-configuration-file.md#new_collations_enabled_on_first_bootstrap) to `true` to enable the [new framework for collations](/character-set-and-collation.md#new-framework-for-collations).

</CustomContent>

<CustomContent platform="tidb-cloud">

To make TiDB compatible with the collations of MySQL GBK character set, when you first initialize the TiDB cluster, TiDB Cloud enables the [new framework for collations](/character-set-and-collation.md#new-framework-for-collations) by default.

</CustomContent>

After enabling the new framework for collations, if you check the collations corresponding to the GBK character set, you can see that the TiDB GBK default collation is changed to `gbk_chinese_ci`.

```sql
SHOW CHARACTER SET WHERE CHARSET = 'gbk';
+---------+-------------------------------------+-------------------+--------+
| Charset | Description                         | Default collation | Maxlen |
+---------+-------------------------------------+-------------------+--------+
| gbk     | Chinese Internal Code Specification | gbk_chinese_ci    |      2 |
+---------+-------------------------------------+-------------------+--------+
1 row in set (0.00 sec)

SHOW COLLATION WHERE CHARSET = 'gbk';
+----------------+---------+------+---------+----------+---------+
| Collation      | Charset | Id   | Default | Compiled | Sortlen |
+----------------+---------+------+---------+----------+---------+
| gbk_bin        | gbk     |   87 |         | Yes      |       1 |
| gbk_chinese_ci | gbk     |   28 | Yes     | Yes      |       1 |
+----------------+---------+------+---------+----------+---------+
2 rows in set (0.00 sec)
```

### Illegal character compatibility

* If the system variables [`character_set_client`](/system-variables.md#character_set_client) and [`character_set_connection`](/system-variables.md#character_set_connection) are not set to `gbk` at the same time, TiDB handles illegal characters in the same way as MySQL.
* If `character_set_client` and `character_set_connection` are both set to `gbk`, TiDB handles illegal characters differently than MySQL.

    - MySQL handles illegal GBK character sets in reading and writing operations differently.
    - TiDB handles illegal GBK character sets in reading and writing operations in the same way. In the SQL strict mode, TiDB reports an error when either reading or writing illegal GBK characters. In the non-strict mode, TiDB replaces illegal GBK characters with `?` when either reading or writing illegal GBK characters.

For example, after `SET NAMES gbk`, if you create a table using the `CREATE TABLE gbk_table(a VARCHAR(32) CHARACTER SET gbk)` statement in MySQL and TiDB respectively and then execute the SQL statements in the following table, you can see the detailed differences.

| Database    |    If the configured SQL mode contains either `STRICT_ALL_TABLES` or `STRICT_TRANS_TABLES`                                               | If the configured SQL mode contains neither `STRICT_ALL_TABLES` nor `STRICT_TRANS_TABLES`                                                                     |
|-------|-------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|
| MySQL | `SELECT HEX('一a');`
 `e4b88061`

`INSERT INTO gbk_table values('一a');`
 `Incorrect Error`       | `SELECT HEX('一a');`
 `e4b88061`

`INSERT INTO gbk_table VALUES('一a');`
`SELECT HEX(a) FROM gbk_table;`
 `e4b8` |
| TiDB  | `SELECT HEX('一a');`
 `Incorrect Error`

`INSERT INTO gbk_table VALUES('一a');`
 `Incorrect Error` | `SELECT HEX('一a');`
 `e4b83f`

`INSERT INTO gbk_table VALUES('一a');`
`SELECT HEX(a) FROM gbk_table;`
 `e4b83f`  |

In the above table, the result of `SELECT HEX('a');` in the `utf8mb4` byte set is `e4b88061`.

### Other MySQL compatibility

- Currently, TiDB does not support using the `ALTER TABLE` statement to convert other character set types to `gbk` or from `gbk` to other character set types.

* TiDB does not support the use of `_gbk`. For example:

  ```sql
  CREATE TABLE t(a CHAR(10) CHARSET BINARY);
  Query OK, 0 rows affected (0.00 sec)
  INSERT INTO t VALUES (_gbk'啊');
  ERROR 1115 (42000): Unsupported character introducer: 'gbk'
  ```

- Currently, for binary characters of the `ENUM` and `SET` types, TiDB deals with them as the `utf8mb4` character set.

## Component compatibility

- Currently, TiFlash does not support the GBK character set.

- TiDB Data Migration (DM) does not support migrating `charset=GBK` tables to TiDB clusters earlier than v5.4.0.

- TiDB Lightning does not support importing `charset=GBK` tables to TiDB clusters earlier than v5.4.0.

- TiCDC versions earlier than v6.1.0 do not support replicating `charset=GBK` tables. No version of TiCDC supports replicating `charset=GBK` tables to TiDB clusters earlier than v6.1.0.

- Backup & Restore (BR) versions earlier than v5.4.0 do not support recovering `charset=GBK` tables. No version of BR supports recovering `charset=GBK` tables to TiDB clusters earlier than v5.4.0.

redpajama_set_name: RedPajamaGithub


text:
package com.mastertheboss;

import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class NativeSimpleRESTServiceItfIT extends SimpleRESTServiceItfTest {

    // Execute the same tests but in native mode.
}


text:
license: >
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you 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.
---

# iOS Command-line Tools

The `cordova` command-line utility is a high-level tool that allows
you to build applications across several platforms at once. An older
version of the Cordova framework provides sets of command-line tools
specific to each platform. To use them as an alternative to the CLI,
you need to download this version of Cordova from
[cordova.apache.org](http://cordova.apache.org). The download contains
separate archives for each platform. Expand the platform you wish to
target. The tools described here are typically available in the
top-level `bin` directory, otherwise consult the __README__ file for
more detailed directions.

The iOS command-line tools are built upon shell scripts and rely on
Xcode command-line tools such as `xcode-select` and `xcodebuild`.

## Create a project

Run the `create` command, specifying the existing path to the project,
the reverse-domain-style package identifier, and the app's display
name.

    $ ./path/to/cordova-ios/bin/create /path/to/my_new_project com.example.project_name ProjectName

## Build a project

    $ /path/to/my_new_project/cordova/build

## Run app on emulator

    $ /path/to/my_new_project/cordova/run

## Releasing

    $ /path/to/my_new_project/cordova/release

## Logging

    $ /path/to/my_new_project/cordova/log


text:
"""
Testing singletask/multitask data loading capabilities.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals

__author__ = "Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"

import os
import shutil
import unittest
import tempfile
import deepchem as dc
import numpy as np

class TestLoad(unittest.TestCase):
  """
  Test singletask/multitask data loading.
  """

  def test_move_load(self):
    """Test that datasets can be moved and loaded."""
    current_dir = os.path.dirname(os.path.realpath(__file__))
    base_dir = tempfile.mkdtemp()
    data_dir = os.path.join(base_dir, "data")
    moved_data_dir = os.path.join(base_dir, "moved_data")
    dataset_file = os.path.join(current_dir, "../../models/tests/example.csv")

    featurizer = dc.feat.CircularFingerprint(size=1024)
    tasks = ["log-solubility"]
    loader = dc.data.CSVLoader(
        tasks=tasks, smiles_field="smiles", featurizer=featurizer)
    dataset = loader.featurize(dataset_file, data_dir)

    X, y, w, ids = (dataset.X, dataset.y, dataset.w, dataset.ids)
    shutil.move(data_dir, moved_data_dir)

    moved_dataset = dc.data.DiskDataset(moved_data_dir)

    X_moved, y_moved, w_moved, ids_moved = (moved_dataset.X, moved_dataset.y,
                                            moved_dataset.w, moved_dataset.ids)

    np.testing.assert_allclose(X, X_moved)
    np.testing.assert_allclose(y, y_moved)
    np.testing.assert_allclose(w, w_moved)
    np.testing.assert_array_equal(ids, ids_moved)

  def test_multiload(self):
    """Check can re-use featurization for multiple task selections.
    """
    # Only for debug!
    np.random.seed(123)

    current_dir = os.path.dirname(os.path.realpath(__file__))
    ##Make directories to store the raw and featurized datasets.
    data_dir = tempfile.mkdtemp()

    # Load dataset
    print("About to load dataset.")
    dataset_file = os.path.join(current_dir,
                                "../../models/tests/multitask_example.csv")

    # Featurize tox21 dataset
    print("About to featurize dataset.")
    featurizer = dc.feat.CircularFingerprint(size=1024)
    all_tasks = ["task%d" % i for i in range(17)]

    ####### Do featurization
    loader = dc.data.CSVLoader(
        tasks=all_tasks, smiles_field="smiles", featurizer=featurizer)
    dataset = loader.featurize(dataset_file, data_dir)

    # Do train/valid split.
    X_multi, y_multi, w_multi, ids_multi = (dataset.X, dataset.y, dataset.w,
                                            dataset.ids)

    ####### Do singletask load
    y_tasks, w_tasks, = [], []
    dataset = dc.data.DiskDataset(data_dir)
    for ind, task in enumerate(all_tasks):
      print("Processing task %s" % task)

      X_task, y_task, w_task, ids_task = (dataset.X, dataset.y, dataset.w,
                                          dataset.ids)
      y_tasks.append(y_task[:, ind])
      w_tasks.append(w_task[:, ind])

    ################## Do comparison
    for ind, task in enumerate(all_tasks):
      y_multi_task = y_multi[:, ind]
      w_multi_task = w_multi[:, ind]

      y_task = y_tasks[ind]
      w_task = w_tasks[ind]

      np.testing.assert_allclose(y_multi_task.flatten(), y_task.flatten())
      np.testing.assert_allclose(w_multi_task.flatten(), w_task.flatten())

  def test_singletask_matches_multitask_load(self):
    """Check that singletask load and multitask load of dataset are same."""
    # Only for debug!
    np.random.seed(123)

    # Set some global variables up top
    reload = True

    current_dir = os.path.dirname(os.path.realpath(__file__))
    #Make directories to store the raw and featurized datasets.
    data_dir = tempfile.mkdtemp()

    # Load dataset
    print("About to load dataset.")
    dataset_file = os.path.join(current_dir,
                                "../../models/tests/multitask_example.csv")

    # Featurize tox21 dataset
    print("About to featurize dataset.")
    featurizer = dc.feat.CircularFingerprint(size=1024)
    all_tasks = ["task%d" % i for i in range(17)]
    # For debugging purposes
    n_tasks = 17
    tasks = all_tasks[0:n_tasks]

    ####### Do multitask load
    loader = dc.data.CSVLoader(
        tasks=tasks, smiles_field="smiles", featurizer=featurizer)
    dataset = loader.featurize(dataset_file, data_dir)

    # Do train/valid split.
    X_multi, y_multi, w_multi, ids_multi = (dataset.X, dataset.y, dataset.w,
                                            dataset.ids)

    ####### Do singletask load
    y_tasks, w_tasks, ids_tasks = [], [], []
    for task in tasks:
      print("Processing task %s" % task)
      if os.path.exists(data_dir):
        shutil.rmtree(data_dir)
      loader = dc.data.CSVLoader(
          tasks=[task], smiles_field="smiles", featurizer=featurizer)
      dataset = loader.featurize(dataset_file, data_dir)

      X_task, y_task, w_task, ids_task = (dataset.X, dataset.y, dataset.w,
                                          dataset.ids)
      y_tasks.append(y_task)
      w_tasks.append(w_task)
      ids_tasks.append(ids_task)

    ################## Do comparison
    for ind, task in enumerate(tasks):
      y_multi_task = y_multi[:, ind]
      w_multi_task = w_multi[:, ind]

      y_task = y_tasks[ind]
      w_task = w_tasks[ind]
      ids_task = ids_tasks[ind]

      np.testing.assert_allclose(y_multi_task.flatten(), y_task.flatten())
      np.testing.assert_allclose(w_multi_task.flatten(), w_task.flatten())


text:
package com.ecollege.prospero.simulator;

import com.ecollege.prospero.messagegenerator.Prospero;
import com.ecollege.prospero.messagegenerator.ProsperoPrincipal;
import com.ecollege.prospero.messagegenerator.UnsubscribeResponse;
import com.ecollege.prospero.messagegenerator.logger.Logger;
import com.ecollege.prospero.messagegenerator.logger.SystemOutLogger;

public class DeleteSubscription {
	public static void main(String[] args)
	{
		if(args.length != 5)
			printUsageAndQuit();

		String prosperoHost = args[0];
		int prosperoPort = Integer.parseInt(args[1]);
		String principalId = args[2];
		String sharedKey = args[3];
		String subscriptionId = args[4];

		ProsperoPrincipal principal = new ProsperoPrincipal();
		principal.setKey(sharedKey);
		principal.setPrincipalId(principalId);
		principal.setProsperoHost(prosperoHost);
		principal.setProsperoPort(prosperoPort);

		Logger logger = new SystemOutLogger();

		try {
			UnsubscribeResponse response = Prospero.unsubscribe(subscriptionId, principal, logger);
			if(response.getException() == null)
			{
				logger.log("Deleted subscription " + response.getSubscriptionId());
			}
			logger.log("Done");
		} catch (Exception e) {
			logger.log(e);
		}
	}

	private static void printUsageAndQuit()
	{
		System.out.println("USAGE: java -cp messagegenerator.jar com.ecollege.prospero.simulator.DeleteSubscription prosperoHost prosperoPort principalId sharedKey subscriptionId");
		System.exit(1);
	}
}


text:
require 'rails_helper'

RSpec.describe "profiles/show", type: :view do
  before(:each) do
    @profile = assign(:profile, FactoryGirl.create(:profile))
  end

  it "renders attributes" do
    render
    [:first_name, :last_name, :birth_date, :street_name, :zip_code, :city, :state, :country, :discovery_of_site].each do |attr_name|
      expect(rendered).to have_text(@profile.public_send(attr_name))
    end
  end

  %i[organizer admin].each do |each|
    it "logged in as #{each} I can see the mail address" do
      sign_in(FactoryGirl.create(:user, role: each))
      render
      expect(rendered).to have_link(@profile.user.email, :href => 'mailto:' + @profile.user.email)
    end
  end
end


text:
@interface BlankCell : JHBaseCell

@end

@interface BlankCellModel : NSObject

@property (nonatomic, assign) CGFloat height;
@property (nonatomic, strong) UIColor *color;

@end


text:
package co.blocke
package latekafka

import org.scalatest._
import scala.concurrent._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import akka.pattern.ask
import akka.actor.{ Props, ActorSystem }
import akka.stream.{ ActorMaterializerSettings, ActorMaterializer }
import akka.util.Timeout
import scala.language.postfixOps
import scala.sys.process._
import scala.util.Try

class KafkaSpec() extends FunSpec with Matchers with BeforeAndAfterAll {
  def timeme(label: String, fn: () => Unit) {
    val now = System.currentTimeMillis()
    fn()
    val later = System.currentTimeMillis()
    println(s"$label: " + (later - now) / 1000.0)
  }

  val topic = "lowercaseStrings"
  val group = "group1"
  val pwd = System.getProperty("user.dir")
  val extraPath = s"$pwd/src/test/resources/extra"
  var wid = "" // world id
  var dip = "" // docker ip
  var kafkaHost = "" // kafka host
  var zooHost = "" // zookeeper host
  val producer = LateProducer()

  implicit val as = ActorSystem("ReactiveKafka")
  implicit val m = ActorMaterializer(
    ActorMaterializerSettings(as)
      .withAutoFusing(false)
      .withInputBuffer(32, 32)
  )

  val props = Map("auto.offset.reset" -> "earliest")

  // Set server.propertise in /opt/kakfa in world server:
  override def beforeAll() {
    wid = worldWait()
    dip = getDockerIP()
    val ips = List(9092, 2181).map(p => s"$dip:" + getDockerPort(wid, p))
    kafkaHost = ips(0)
    zooHost = ips(1)
    println("KAFKA HOST: " + kafkaHost)
    println("ZOO   HOST: " + zooHost)
    Thread.sleep(9000) // let it all come up and settle down in World server
    producer.create(kafkaHost, zooHost, topic)
  }

  override def afterAll() {
    as.shutdown()
    s"docker kill $wid".!!
  }

  describe("Kafka Must...") {
    it("Is fast") {
      val num = 1000000
      producer.populate(num, topic)
      Thread.sleep(2000)
      partitionInfo(topic)

      println("Consuming...")
      Aggregator.reset()
      val sg = SpeedGraph(kafkaHost, "speed", topic, Map("auto.offset.reset" -> "earliest"))
      val sa = as.actorOf(Props(new SpeedActor(num, sg)), "sa")

      implicit val timeout = Timeout(55 seconds)
      val tps = Try { Await.result(sa ? num, 55.seconds) }.toOption.getOrElse(0)

      Thread.sleep(10000)
      println(tps + " TPS")
      groupInfo("speed")
      as.stop(sa)
      Thread.sleep(3000)
    }

    it("Multiplexes") {
      val num = 1000000

      println("Consuming...")

      Aggregator.reset()
      val c = (0 to 3).map { i =>
        println("Make " + i)
        val sg = SpeedGraph(kafkaHost, "multiplex", topic, Map("auto.offset.reset" -> "earliest"))
        as.actorOf(Props(new SpeedActor(num, sg)))
      }
      println("Let's get started...")
      implicit val timeout = Timeout(25 seconds)
      val futures = c.map(_ ? num)
      val f = Future.sequence(futures)

      val tps = Try { Await.result(f, 25.seconds) }.toOption.getOrElse(List(0, 0, 0, 0))
      Thread.sleep(10000)
      println(tps + " TPS")
      groupInfo("multiplex")
      c.foreach(as.stop(_))
      Thread.sleep(3000)
    }

    it("Can FanOut") {
      val fg = FilterGraph(kafkaHost, "filter", topic, Map())
      val fa = as.actorOf(Props(new FlowActor(fg)), "fa")
      Thread.sleep(3000)

      println("Posting")
      producer.enqueue(topic, Json.serializeToString[Message[MessagePayload]](Message(Map.empty[String, Any], MyThing("Gregory"))))
      producer.enqueue(topic, Json.serializeToString[Message[MessagePayload]](Message(Map.empty[String, Any], MyThing("David"))))
      producer.enqueue(topic, Json.serializeToString[Message[MessagePayload]](Message(Map.empty[String, Any], MyThing("Graham"))))
      producer.enqueue(topic, Json.serializeToString[Message[MessagePayload]](Message(Map.empty[String, Any], MyThing("Katie"))))
      producer.enqueue(topic, Json.serializeToString[Message[MessagePayload]](Message(Map.empty[String, Any], MyThing("Garth"))))

      println("Waiting...")
      Thread.sleep(5000)
      partitionInfo(topic)
      println("Time's up!")
      as.stop(fa)
      Thread.sleep(2000)
    }
  }

  def partitionInfo(topic: String) =
    kafka.tools.GetOffsetShell.main(Array("--topic", topic, "--broker-list", kafkaHost, "--time", "-1"))
  def groupInfo(group: String) =
    kafka.admin.ConsumerGroupCommand.main(Array("--describe", "--group", group, "--bootstrap-server", kafkaHost, "--new-consumer"))
  def worldWait(limit: Int = 30) = {
    println("++ Starting the World")
    val worldId = s"$pwd/src/test/resources/startWorld.sh $extraPath".!!
    while (cheapGet(s"http://${getDockerIP()}:${getDockerPort(worldId, 80)}/status").isEmpty) { Thread.sleep(500) }
    println("++ World started")
    worldId
  }

  private def cheapGet(uri: String) = Try { scala.io.Source.fromURL(uri, "utf-8").mkString }.toOption
  /** Get a port mapping from Docker.  Must be called only from outside a Docker! Use portster inside. Basically here for testing. */
  private def getDockerPort(containerId: String, port: Int) = (s"docker port $containerId $port".!!).split(':')(1).trim
  /** Get the IP of the active Docker machine.  Must be called only from outside a Docker! Basically here for testing. */
  private def getDockerIP() = {
    val machineName = (Seq("sh", "-c", "docker-machine active 2>/dev/null").!!).trim
    (s"docker-machine ip $machineName".!!).trim
  }
}


text:
package client

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
)

type Events []Event

type Event struct {
	Key          string      `json:"key"`
	Count        int         `json:"count"`
	Sum          float64     `json:"sum,omitempty"`
	Dur          int         `json:"dur,omitempty"`
	Segmentation interface{} `json:"segmentation,omitempty"`
}

func (c *Client) WriteEvent(appKey, deviceId string, events Events) error {
	values := url.Values{}
	values.Add("app_key", appKey)
	values.Add("device_id", deviceId)

	evs, err := json.Marshal(events)
	if err != nil {
		return err
	}
	values.Add("events", string(evs))

	return c.do(http.MethodGet, "/i", values, nil)
}

// BulkData holds the bulk data
type BulkDatas []BulkData

type BulkData struct {
	DeviceID string  `json:"device_id"`
	AppKey   string  `json:"app_key"`
	Events   []Event `json:"events"`
}

// WriteEventWithBulk wip Don't use
func (c *Client) WriteEventWithBulk(appKey string, bulk BulkDatas) error {
	values := url.Values{}
	values.Add("app_key", appKey)

	b := new(bytes.Buffer)
	err := json.NewEncoder(b).Encode(bulk)
	if err != nil {
		return err
	}

	u := c.createURL("/i/bulk", values)

	req, err := http.NewRequest(http.MethodPost, u.String(), nil)
	req.Header.Set("Content-Type", "application/json")
	if err != nil {
		return err
	}

	resp, err := c.httpClient.Do(req)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	response, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("Errvar", err)
		return err
	}

	fmt.Println(string(response))

	return nil
}


text:
(function() {
  'use strict';

  angular
    .module('ders')
    .controller('SearchController', SearchController);

  SearchController.$inject = ['KategorisService','dersSearchService'];

  function SearchController(KategorisService, dersSearchService) {
    var vm = this;
    vm.kategoris = KategorisService.query();

    vm.lessons={};

    vm.searchvalue = searchvalueF;
    function searchvalueF(srec) {
      vm.lessons = dersSearchService.query({
        srch: srec
      });
    }
    init();

    function init() {
    }
  }
})();


text:
@class PSCollectionView;

@interface PSCollectionViewCell : UIView

@property (nonatomic, strong) id object;
@property (nonatomic, weak) PSCollectionView *collectionView;
@property (nonatomic, assign) NSInteger index;

- (void)prepareForReuse;
- (void)collectionView:(PSCollectionView *)collectionView fillCellWithObject:(id)object atIndex:(NSInteger)index;
+ (CGFloat)rowHeightForObject:(id)object inColumnWidth:(CGFloat)columnWidth;

@end


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

import com.nortal.blaze.core.model.ResourceVersion;
import com.nortal.blaze.core.model.search.SearchResult;
import com.nortal.blaze.fhir.structure.api.ResourceComposer;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Bundle.*;

import java.util.List;

public class BundleUtil {

  public static Bundle compose(List<ResourceVersion> versions, BundleType bundleType) {
    return compose(null, versions, bundleType);
  }

  public static Bundle compose(SearchResult search) {
    Bundle bundle = compose(search.getTotal(), search.getEntries(), BundleType.SEARCHSET);
    search.getIncludes().forEach(v -> {
      BundleEntryComponent e = composeEntry(v);
      e.setSearch(new BundleEntrySearchComponent());
      e.getSearch().setMode(SearchEntryMode.INCLUDE);
      bundle.addEntry(e);
    });
    return bundle;
  }

  public static Bundle compose(Integer total, List<ResourceVersion> versions, BundleType bundleType) {
    Bundle bundle = new Bundle();
    bundle.setTotal(total == null ? versions.size() : total);
    bundle.setType(bundleType);
    versions.forEach(v -> bundle.addEntry(composeEntry(v)));
    return bundle;
  }

  public static BundleEntryComponent composeEntry(ResourceVersion version) {
    BundleEntryComponent entry = new BundleEntryComponent();
    entry.setResource(ResourceComposer.parse(version.getContent().getValue()));

    BundleEntryRequestComponent request = new BundleEntryRequestComponent();
    request.setMethod(calcMethod(version));
    entry.setRequest(request);
    return entry;
  }

  private static HTTPVerb calcMethod(ResourceVersion version) {
    //XXX: this is NOT how it should be. need to somehow save action maybe? stupid
    return version.isDeleted() ? HTTPVerb.DELETE : version.getId().getVersion() == 1 ? HTTPVerb.POST : HTTPVerb.PUT;
  }
}


text:
import { Component } from '@angular/core';

@Component({
    selector: 'winery-boundary-definitions',
    templateUrl: 'boundaryDefinitions.component.html'
})
export class BoundaryDefinitionsComponent {
    constructor() {
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/sectionObjectSchema.xsd">
    <section name="AmazonCheckoutSection">
        <element name="shippingAddress" type="text" selector="#checkout-step-shipping .shipping-address-item.selected-item"/>
        <element name="billingAddress" type="text" selector="#amazon-billing-address"/>
        <element name="countryNameByCode" type="text" selector="select[name=country_id] option[value={{country_code}}]" parameterized="true"/>
        <element name="editShippingButton" type="button" selector="#checkout-step-shipping .shipping-address-item.selected-item .edit-address-link"/>
        <element name="editPaymentButton" type="button" selector="#amazon-payment .action-edit-payment"/>
        <element name="v1Method" type="input" selector="#amazonlogin"/>
        <element name="method" type="input" selector="#amazon_payment_v2"/>
        <element name="returnToStandardCheckout" type="text" selector="#checkout-step-shipping .revert-checkout"/>
    </section>
</sections>


text:
<!doctype html>

  <meta charset="utf-8">
  <title>DBFlute Intro</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.2.13/dist/semantic.min.css">
  <link rel="stylesheet" href="./app/index.css">


text:
namespace noob
{
	class graphics
	{
		public:
			typedef noob::handle<noob::shader> shader_handle;
			typedef noob::handle<noob::linked_shader> program_handle;

			// Call before using.
			void init(const noob::vec2ui Dims, const noob::texture_loader_2d&) noexcept(true);

			// Call this every frame...
			void frame(const noob::vec2ui) const noexcept(true);

			// Call before killing.
			void destroy() noexcept(true);

			void set_light_direction(const noob::vec3f&) noexcept(true);
			void set_eye_position(const noob::vec3f&) noexcept(true);

			void use_program(noob::graphics::program_handle) const noexcept(true);
			void set_view_mat(const noob::mat4f) noexcept(true);
			void set_projection_mat(const noob::mat4f) noexcept(true);

			// Currently, instanced models only support the basic vertex colours. This may change.
			void draw_instanced(const noob::instanced_model_handle Handle, uint32_t MaxInstances) const noexcept(true);
			void draw_text(const noob::billboard_buffer_handle, noob::texture_2d_handle Tex, uint32_t MaxBillboards) const noexcept(true);

			noob::instanced_model_handle add_instanced_models(const noob::mesh_3d& Mesh, uint32_t NumNnstances) noexcept(true);
			noob::billboard_buffer_handle add_billboards(uint32_t MaxBillboards) noexcept(true);

			void resize_buffers(noob::instanced_model_handle Handle, uint32_t MaxInstances) noexcept(true);
			void resize_buffers(noob::billboard_buffer_handle Handle, uint32_t MaxBillboards) noexcept(true);
			void upload_instanced_uniforms() const noexcept(true);

			// Currently implemented as a triplanar-shaded, single-buffer model.
			// Due to the flexibility of the shaders used, it is easy to support peeling visible faces off objects and sending them to video buffer to keep drawcalls down to one.
			// It should run smoothly using compressed textures because although texture reads are done three times, those values get reused to recreate all needed maps.
			void draw_terrain(uint32_t Verts) const noexcept(true);
			void resize_terrain(uint32_t MaxVerts) noexcept(true);
			uint32_t get_max_terrain_verts() const noexcept(true);
			void set_terrain_uniforms(const noob::terrain_shading Shading) noexcept(true);
			void upload_terrain_uniforms() const noexcept(true);

			// These are VBO buffer mapping/unmapping methods
			// There are two matrices per instance: Model and MVP.
			noob::gpu_write_buffer map_matrices_buffer(noob::instanced_model_handle Handle, uint32_t Min, uint32_t Max) const noexcept(true);
			noob::gpu_write_buffer map_colours_buffer(noob::instanced_model_handle Handle, uint32_t Min, uint32_t Max) const noexcept(true);
			// Terrain vertices each have three vec4f's as attributes: Position (x,y,z,1), normal (x,y,z,0), and colour - with (1,1,1,1) as default.
			noob::gpu_write_buffer map_terrain_buffer(uint32_t Min, uint32_t Max) const noexcept(true);
			// Billboards are buffered as tringle pairs with each vertex using a vec4f (x,y,u,v)
			noob::gpu_write_buffer map_billboards(noob::billboard_buffer_handle Handle, uint32_t Min, uint32_t Max) const noexcept(true);

			// NOTE: MUST be called as soon as you're finished using a mapped buffer!
			void unmap_buffer() const noexcept(true);

			// noob::texture_1d_handle reserve_texture_1d(uint32_t length, bool compressed, noob::texture_channels, noob::attrib::unit_type) noexcept(true); // TODO
			noob::texture_2d_handle texture_2d(const noob::texture_loader_2d&, bool GenMips, bool Immutable) noexcept(true);
			noob::texture_array_2d_handle texture_array_2d(const noob::vec2ui Dims, uint32_t Indices, const noob::texture_info) noexcept(true);
			noob::texture_3d_handle texture_3d(const noob::vec3ui Dims, const noob::texture_info) noexcept(true);
			// noob::texture_handle reserve_texture_cube(uint32_t dims, bool mips, noob::texture_channels, noob::attrib::unit_type, const std::string& data) noexcept(true); // TODO

			// Texture data uploaders
			// void texture_data(noob::texture_1d_handle, const std::string&) const noexcept(true);	// TODO
			// void texture_data(noob::texture_2d_handle, uint32_t Mip, const noob::vec2ui Offsets, const noob::vec2ui Dims, const uint8_t* DataPtr) const noexcept(true);
			// void texture_data(noob::texture_array_2d_handle, uint32_t Mip, uint32_t Index, const noob::vec2ui Offsets, const noob::vec2ui Dims, const uint8_t* DataPtr) const noexcept(true);
			// void texture_data(noob::texture_3d_handle, uint32_t Mip, const noob::vec3ui Offsets, const noob::vec3ui Dims, const uint8_t* DataPtr) const noexcept(true);

			// Texture parameter setters, made typesafe, at the cost of more overloads. Ah well, tradeoffs...
			// Params for 2d textures
			void texture_base_level(uint32_t Mip = 0) const noexcept(true);
			void texture_compare_mode(noob::tex_compare_mode) const noexcept(true);
			void texture_compare_func(noob::tex_compare_func) const noexcept(true);
			void texture_min_filter(noob::tex_min_filter) const noexcept(true);
			void texture_mag_filter(noob::tex_mag_filter) const noexcept(true);
			void texture_min_lod(int32_t Mip = -1000) const noexcept(true);
			void texture_max_lod(int32_t Mip = 1000) const noexcept(true);
			void texture_swizzle(const std::array<noob::tex_swizzle, 2>) const noexcept(true);
			void texture_swizzle(const std::array<noob::tex_swizzle, 3>) const noexcept(true);
			void texture_swizzle(const std::array<noob::tex_swizzle, 4>) const noexcept(true);
			void texture_wrap_mode(const std::array<noob::tex_wrap_mode, 2>) const noexcept(true);
			void texture_wrap_mode(const std::array<noob::tex_wrap_mode, 3>) const noexcept(true);

			// Texture packing and unpacking alignments.
			// Fun fact: The GLES3 spec gives all the other pixel packing/unpacking attributes an initial value of 0 and a range of 0, so they aren't even exposed here. How simple!
			void texture_pack_alignment(uint32_t) const noexcept(true);
			void texture_unpack_alignment(uint32_t) const noexcept(true);

			// Note: These have no effect on compressed textures, which have to be mipped offline as a preprocessing step.
			void generate_mips(noob::texture_2d_handle) const noexcept(true);
			void generate_mips(noob::texture_array_2d_handle) const noexcept(true);
			void generate_mips(noob::texture_3d_handle) const noexcept(true);

			noob::graphics::program_handle get_instanced_shader() const noexcept(true);
			noob::graphics::program_handle get_billboard_shader() const noexcept(true);

		protected:
			std::vector<noob::instanced_model> instanced_models;
			std::vector<noob::billboard_buffer> billboards;

			noob::terrain_model terrain;

			std::vector<noob::texture_1d> textures_1d;
			std::vector<noob::texture_2d> textures_2d;
			std::vector<noob::texture_array_2d> texture_arrays_2d;
			std::vector<noob::texture_3d> textures_3d;

			noob::graphics::program_handle instanced_shader;
			noob::graphics::program_handle terrain_shader;
			noob::graphics::program_handle text_shader;

			// These will soon be replaced by proper UBO's and made typesafe. The only reason they're here is to serve as a stable, well-understood prior case example.
			uint32_t u_eye_pos, u_light_directional, u_view, u_projection;
			uint32_t u_mvp_terrain, u_view_terrain, u_eye_pos_terrain, u_light_directional_terrain, u_texture_0, u_colour_0, u_colour_1, u_colour_2, u_colour_3, u_blend_0, u_blend_1, u_tex_scales, u_model_scales;
			uint32_t u_text_texture_0;

			noob::mat4f view_mat, proj_mat;
			noob::vec3f eye_pos, light_direction;
			noob::terrain_shading terrain_unis;
			noob::texture_2d_handle terrain_tex;

			uint32_t max_terrain_verts = 0;

			void bind_texture(noob::texture_2d_handle) const noexcept(true);
			void bind_texture(noob::texture_array_2d_handle) const noexcept(true);
			void bind_texture(noob::texture_3d_handle) const noexcept(true);

	};

	static noob::singleton<noob::graphics> gfx_instance;
	static noob::graphics& get_graphics() { return gfx_instance.get(); }
}


text:
var assert = require('assert')
  , connect = require('connect')
  , valid = require('../lib/valid');

var testSever = connect()
                .use('/available', function (req, res, next) {
                  res.writeHead(200, {
                    'Content-Type': 'text/html; charset=UTF-8'
                  });
                  res.statusCode = 200;
                  res.end('hello world!');
                })
                .use('/move1', function (req, res, next) {
                  res.writeHead(302, {
                    'Location': 'http://localhost:7777/available'
                  });
                  res.statusCode = 302;
                  res.end();
                })
                .use('/move2', function (req, res, next) {
                  res.writeHead(301, {
                    'Location': '/available'
                  });
                  res.statusCode = 301;
                  res.end();
                })
                .use('/move3', function (req, res, next) {
                  res.writeHead(301, {
                    'Location': '../available'
                  });
                  res.statusCode = 301;
                  res.end();
                })
                .listen(7777);

describe('valid', function () {
  it('should able to check one url', function (done) {
    valid('HTTP://localhost:7777/available', function (err, valid) {
      assert.deepEqual(err, null);
      valid.should.be.true;
      done();
    });
  });

  it('should able to use .on method for one url', function (done) {
    valid('http://localhost:7777/available').on('check', function (err, valid) {
      assert.deepEqual(err, null);
      valid.should.be.true;
      done();
    });
  });

  it('should able to detect a 404 url', function (done) {
    valid('http://localhost:7777/unavailable', function (err, valid) {
      valid.should.be.false;
      done();
    });
  });

  it('should able to validate a url', function (done) {
    valid('test.test', function (err, valid) {
      valid.should.be.false;
      done();
    });
  });

  it('should able to fire when response finish', function (done) {
    valid('http://localhost:7777/available').on('end', function () {
      done();
    });
  });

  it('should able to fire when response send data', function (done) {
    valid('http://localhost:7777/available').on('data', function (err, data) {
      data.toString().should.equal('hello world!');
      done();
    });
  });

  it('should able to support a redirect url', function (done) {
    valid('http://localhost:7777/move1', function (err, valid) {
      valid.should.be.true;
      done();
    });
  });

  it('should able to support a absolute path', function (done) {
    valid('http://localhost:7777/move2', function (err, valid) {
      valid.should.be.true;
      done();
    });
  });

  it('should able to support a relative path', function (done) {
    valid('http://localhost:7777/move3', function (err, valid) {
      valid.should.be.true;
      done();
    });
  });

  it('should able to use .on method if it is a redirect url', function (done) {
    valid('http://localhost:7777/move1', function (err, valid) {
      valid.should.be.true;
    }).on('data', function (err, data) {
      data.toString().should.equal('hello world!');
      done();
    });
  });

  it('should able to destroy a Valid instance', function (done) {
    var v = valid('http://localhost:7777/available')
            .on('check', function (err, valid) {
              valid.should.be.true;
            }).on('end', function () {
              v.destroy();
              v.listeners().length.should.equal(0);
              done();
            });
  });

  it('should emit end event when finish validity detection', function (done) {
    var step = 0
      , v = valid('http://localhost:7777/move1').on('check', function (err, valid) {
          step.should.equal(0);
          step = 1;
          valid.should.be.true;
        }).on('data', function (err, data) {
          step.should.equal(1);
          step = 2;
          data.toString().should.equal('hello world!');
        }).on('end', function () {
          step.should.equal(2);
          done();
        });
  });

  it('should able to get the listeners', function () {
    var v = valid('http://localhost:7777/available')
            .on('data', function () {})
            .on('check', function () {})
            .on('data', function () {})
            .on('end', function () {});
    v.listeners().length.should.equal(4);
    v.listeners('end').length.should.equal(1);
    v.listeners('data').length.should.equal(2);
  });

  it('should able to remove all event listeners', function () {
    var v = valid('http://localhost:7777/available')
            .on('data', function () {})
            .on('check', function () {})
            .on('end', function () {});
    v.listeners().length.should.equal(3);
    v.removeAllListeners().listeners().length.should.equal(0);
  });

  it('should able to remove specified event listeners', function () {
    var v = valid('http://localhost:7777/available')
            .on('data', function () {})
            .on('check', function () {})
            .on('end', function () {});
    v.listeners().length.should.equal(3);
    v.removeAllListeners('data').listeners().length.should.equal(2);
  });
});


text:
/**
 * Contains classes related to the split operator.
 */
package org.gradoop.flink.model.impl.operators.split;


text:
/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package org.openrtb.common.api;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class Data extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Data\",\"namespace\":\"org.openrtb.common.api\",\"fields\":[{\"name\":\"id\",\"type\":[\"string\",\"null\"]},{\"name\":\"name\",\"type\":[\"string\",\"null\"]},{\"name\":\"segment\",\"type\":[{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"Segment\",\"fields\":[{\"name\":\"id\",\"type\":[\"string\",\"null\"]},{\"name\":\"name\",\"type\":[\"string\",\"null\"]},{\"name\":\"value\",\"type\":[\"string\",\"null\"]},{\"name\":\"ext\",\"type\":[\"string\",\"null\"]}]}},\"null\"]},{\"name\":\"ext\",\"type\":[\"string\",\"null\"]}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
   public java.lang.CharSequence id;
   public java.lang.CharSequence name;
   public java.util.List<org.openrtb.common.api.Segment> segment;
   public java.lang.CharSequence ext;

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

  /**
   * All-args constructor.
   */
  public Data(java.lang.CharSequence id, java.lang.CharSequence name, java.util.List<org.openrtb.common.api.Segment> segment, java.lang.CharSequence ext) {
    this.id = id;
    this.name = name;
    this.segment = segment;
    this.ext = ext;
  }

  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
  // Used by DatumWriter.  Applications should not call.
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return id;
    case 1: return name;
    case 2: return segment;
    case 3: return ext;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }
  // Used by DatumReader.  Applications should not call.
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: id = (java.lang.CharSequence)value$; break;
    case 1: name = (java.lang.CharSequence)value$; break;
    case 2: segment = (java.util.List<org.openrtb.common.api.Segment>)value$; break;
    case 3: ext = (java.lang.CharSequence)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'id' field.
   */
  public java.lang.CharSequence getId() {
    return id;
  }

  /**
   * Sets the value of the 'id' field.
   * @param value the value to set.
   */
  public void setId(java.lang.CharSequence value) {
    this.id = value;
  }

  /**
   * Gets the value of the 'name' field.
   */
  public java.lang.CharSequence getName() {
    return name;
  }

  /**
   * Sets the value of the 'name' field.
   * @param value the value to set.
   */
  public void setName(java.lang.CharSequence value) {
    this.name = value;
  }

  /**
   * Gets the value of the 'segment' field.
   */
  public java.util.List<org.openrtb.common.api.Segment> getSegment() {
    return segment;
  }

  /**
   * Sets the value of the 'segment' field.
   * @param value the value to set.
   */
  public void setSegment(java.util.List<org.openrtb.common.api.Segment> value) {
    this.segment = value;
  }

  /**
   * Gets the value of the 'ext' field.
   */
  public java.lang.CharSequence getExt() {
    return ext;
  }

  /**
   * Sets the value of the 'ext' field.
   * @param value the value to set.
   */
  public void setExt(java.lang.CharSequence value) {
    this.ext = value;
  }

  /** Creates a new Data RecordBuilder */
  public static org.openrtb.common.api.Data.Builder newBuilder() {
    return new org.openrtb.common.api.Data.Builder();
  }

  /** Creates a new Data RecordBuilder by copying an existing Builder */
  public static org.openrtb.common.api.Data.Builder newBuilder(org.openrtb.common.api.Data.Builder other) {
    return new org.openrtb.common.api.Data.Builder(other);
  }

  /** Creates a new Data RecordBuilder by copying an existing Data instance */
  public static org.openrtb.common.api.Data.Builder newBuilder(org.openrtb.common.api.Data other) {
    return new org.openrtb.common.api.Data.Builder(other);
  }

  /**
   * RecordBuilder for Data instances.
   */
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<Data>
    implements org.apache.avro.data.RecordBuilder<Data> {

    private java.lang.CharSequence id;
    private java.lang.CharSequence name;
    private java.util.List<org.openrtb.common.api.Segment> segment;
    private java.lang.CharSequence ext;

    /** Creates a new Builder */
    private Builder() {
      super(org.openrtb.common.api.Data.SCHEMA$);
    }

    /** Creates a Builder by copying an existing Builder */
    private Builder(org.openrtb.common.api.Data.Builder other) {
      super(other);
    }

    /** Creates a Builder by copying an existing Data instance */
    private Builder(org.openrtb.common.api.Data other) {
            super(org.openrtb.common.api.Data.SCHEMA$);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.name)) {
        this.name = data().deepCopy(fields()[1].schema(), other.name);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.segment)) {
        this.segment = data().deepCopy(fields()[2].schema(), other.segment);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.ext)) {
        this.ext = data().deepCopy(fields()[3].schema(), other.ext);
        fieldSetFlags()[3] = true;
      }
    }

    /** Gets the value of the 'id' field */
    public java.lang.CharSequence getId() {
      return id;
    }

    /** Sets the value of the 'id' field */
    public org.openrtb.common.api.Data.Builder setId(java.lang.CharSequence value) {
      validate(fields()[0], value);
      this.id = value;
      fieldSetFlags()[0] = true;
      return this;
    }

    /** Checks whether the 'id' field has been set */
    public boolean hasId() {
      return fieldSetFlags()[0];
    }

    /** Clears the value of the 'id' field */
    public org.openrtb.common.api.Data.Builder clearId() {
      id = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'name' field */
    public java.lang.CharSequence getName() {
      return name;
    }

    /** Sets the value of the 'name' field */
    public org.openrtb.common.api.Data.Builder setName(java.lang.CharSequence value) {
      validate(fields()[1], value);
      this.name = value;
      fieldSetFlags()[1] = true;
      return this;
    }

    /** Checks whether the 'name' field has been set */
    public boolean hasName() {
      return fieldSetFlags()[1];
    }

    /** Clears the value of the 'name' field */
    public org.openrtb.common.api.Data.Builder clearName() {
      name = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'segment' field */
    public java.util.List<org.openrtb.common.api.Segment> getSegment() {
      return segment;
    }

    /** Sets the value of the 'segment' field */
    public org.openrtb.common.api.Data.Builder setSegment(java.util.List<org.openrtb.common.api.Segment> value) {
      validate(fields()[2], value);
      this.segment = value;
      fieldSetFlags()[2] = true;
      return this;
    }

    /** Checks whether the 'segment' field has been set */
    public boolean hasSegment() {
      return fieldSetFlags()[2];
    }

    /** Clears the value of the 'segment' field */
    public org.openrtb.common.api.Data.Builder clearSegment() {
      segment = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    /** Gets the value of the 'ext' field */
    public java.lang.CharSequence getExt() {
      return ext;
    }

    /** Sets the value of the 'ext' field */
    public org.openrtb.common.api.Data.Builder setExt(java.lang.CharSequence value) {
      validate(fields()[3], value);
      this.ext = value;
      fieldSetFlags()[3] = true;
      return this;
    }

    /** Checks whether the 'ext' field has been set */
    public boolean hasExt() {
      return fieldSetFlags()[3];
    }

    /** Clears the value of the 'ext' field */
    public org.openrtb.common.api.Data.Builder clearExt() {
      ext = null;
      fieldSetFlags()[3] = false;
      return this;
    }

    @Override
    public Data build() {
      try {
        Data record = new Data();
        record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
        record.name = fieldSetFlags()[1] ? this.name : (java.lang.CharSequence) defaultValue(fields()[1]);
        record.segment = fieldSetFlags()[2] ? this.segment : (java.util.List<org.openrtb.common.api.Segment>) defaultValue(fields()[2]);
        record.ext = fieldSetFlags()[3] ? this.ext : (java.lang.CharSequence) defaultValue(fields()[3]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}


text:
var args = arguments[0] || {};
var controller = {
	title: "editRoom",
	imageCollection: Alloy.Collections.image
}

function filterImages (collection) {
	return args.room.getImagesForRoom(collection);
}

function saveRoom () {
	Ti.Analytics.featureEvent(controller.title+".saveRoom");

	var room = args.room;
	room.set('name', $.nameInput.value);
	room.set('value', parseInt($.valueInput.value, 10));
	room.save();

	$.editRoom.close();
}

function deleteRoom () {
	Ti.Analytics.featureEvent(controller.title+".deleteRoom");

	var room = args.room;
	var imagesForRoom = args.room.getImagesForRoom(controller.imageCollection);

	// Delete room
	room.destroy();

	// Remove all images for this room, once this page closes
	$.editRoom.addEventListener("close", function () {
		imagesForRoom.forEach(function(imageModel) {
			imageModel.destroy();
		});
	})

	$.editRoom.close();
}

function init () {
	Ti.Analytics.featureEvent(Ti.Platform.osname+"."+controller.title+".viewed");

    Alloy.Globals.setUpNavBar({
        currentWindow: $.editRoom,
        appWrapper: $.AppWrapper
    });

	$.roomDetail.set(args.room.attributes);

	controller.imageCollection.fetch();
}

// Initialize Page
init()


text:
@interface AppodealPlugin : CDVPlugin <AODAdViewDelegate, AODInterstitialDelegate, AODVideoAdDelegate>

@property NSString *callbackIdKeepCallback;
//
@property NSString *email;
@property NSString *licenseKey_;
@property BOOL validLicenseKey;
//
@property NSString *applicationKey;
@property BOOL isOverlap;
@property BOOL isTest;
//
@property NSString *bannerPreviousPosition;
//
@property BOOL bannerAdPreload;
@property BOOL fullScreenAdPreload;
@property BOOL rewardedVideoAdPreload;
//
@property AODAdView *bannerView;

- (void) setLicenseKey: (CDVInvokedUrlCommand*)command;
- (void) setUp:(CDVInvokedUrlCommand*)command;
- (void) preloadBannerAd: (CDVInvokedUrlCommand*)command;
- (void) showBannerAd: (CDVInvokedUrlCommand*)command;
- (void) reloadBannerAd: (CDVInvokedUrlCommand*)command;
- (void) hideBannerAd: (CDVInvokedUrlCommand*)command;
- (void) preloadFullScreenAd:(CDVInvokedUrlCommand*)command;
- (void) showFullScreenAd:(CDVInvokedUrlCommand*)command;
- (void) preloadRewardedVideoAd:(CDVInvokedUrlCommand*)command;
- (void) showRewardedVideoAd:(CDVInvokedUrlCommand*)command;

@end


text:
import {readFile} from 'fs';

function f() {
//  outcommented because TypeScript 2.4+ is not on the build server
//  import('os').then(function() {})
}


text:
pip install virtualenv
virtualenv .venv
source .venv/bin/activate
pip install redis


text:
var Bacon = require("bacon");

module.exports = {
  initialize: function(Scene, messages){
    var update = messages.filter(function(v){
      return v.type == "controls/update";
    });

    var initial = Scene.simulation.initialize();
    var step = Bacon.constant(Scene.simulation.step);
    var state = Bacon.update(initial,
      [step,update],Scene.simulation.iterate);

    return {
      module: "simulation",
      streams: {"simulation/state": state}
    }
  }
}


text:
package org.apache.tephra;

import org.apache.tephra.TxConstants.ConflictDetection;
import org.junit.Test;

import java.io.IOException;
import java.util.Collections;
import java.util.Set;

import static org.junit.Assert.assertEquals;

public class AbstractTransactionAwareTableTest {
  public static final byte[] TABLE_NAME = "a".getBytes();
  public static final String ROW1 = "r1";
  public static final String ROW2 = "r2";
  public static final String FAM1 = "f1";

  private static class ConcreteTransactionAwareTable extends AbstractTransactionAwareTable {
    private final byte[] tableKey;

    public ConcreteTransactionAwareTable(ConflictDetection conflictLevel,
        boolean allowNonTransactional, byte[] tableKey) {
      super(conflictLevel, allowNonTransactional);
      this.tableKey = tableKey;
    }

    @Override
    protected boolean doCommit() throws IOException {
      return false;
    }

    @Override
    protected byte[] getTableKey() {
      return tableKey;
    }

    @Override
    protected boolean doRollback() throws Exception {
      return false;
    }

    public Set<ActionChange> getChangeSet() {
      return changeSets.isEmpty() ?
          Collections.<ActionChange>emptySet() :
            changeSets.values().iterator().next();
    }
  }

  @Test
  public void testActionChangeEquality() {
    long wp = System.currentTimeMillis();
    long rp = wp - 100;
    ConcreteTransactionAwareTable table1 =
        new ConcreteTransactionAwareTable(ConflictDetection.ROW, false, TABLE_NAME);
    ConcreteTransactionAwareTable table2 =
        new ConcreteTransactionAwareTable(ConflictDetection.ROW, false, TABLE_NAME);
    Transaction tx = new Transaction(rp, wp, new long[] {}, new long[] {}, wp);
    table1.startTx(tx);
    table2.startTx(tx);
    table1.addToChangeSet(ROW1.getBytes(), FAM1.getBytes(), null);
    table1.addToChangeSet(ROW1.getBytes(), FAM1.getBytes(), null);
    table2.addToChangeSet(ROW1.getBytes(), FAM1.getBytes(), null);
    assertEquals(table1.getChangeSet(), table2.getChangeSet());
    table1.addToChangeSet(ROW2.getBytes(), FAM1.getBytes(), null);
    table2.addToChangeSet(ROW2.getBytes(), FAM1.getBytes(), null);
    table2.addToChangeSet(ROW2.getBytes(), FAM1.getBytes(), null);
    assertEquals(table1.getChangeSet(), table2.getChangeSet());
  }
}


text:
module Bitpagos
  class Client
    attr_reader :api_key

    def initialize(api_key)
      @api_key = api_key
    end

    def transaction_state(transaction_id, reference_id)
      get_transaction_info(transaction_id)
    end

    def transaction_state!(transaction_id, reference_id)
      response = get_transaction_info(transaction_id)
      if response[:reference_id] != reference_id
        raise ::Bitpagos::Exceptions::ReferenceIdDoesntMatch.new transaction_id, response[:reference_id], reference_id
      end
      response
    end

    private

    def get_transaction_info(transaction_id)
      http_response = ::RestClient.get transaction_url(transaction_id), {:'user-agent' => 'curl/7.43.0'}
      JSON.parse http_response.body, symbolize_names: true
    end

    def transaction_url(transaction_id)
      "https://www.bitpagos.net/api/v1/transaction/#{transaction_id}/?format=json&api_key=#{api_key}"
    end
  end
end


text:
class SponsorSerializer < SafeSerializer
  attributes :id, :name, :constituency_name, :party_name, :url_details, :url_photo, :email, :sponsor_type, :count_bills, :count_posts, :cached_votes_score, :voted

  has_many :bills
  has_one :party

  def voted
    if current_user
      Vote.to_direction( current_user.voted_as_when_voted_for(object) )
    end
  end

end


text:
rm directory.log
./bettercd /home/nakamura/Dropbox/hobby/bettercd
./bettercd ~/.bettercd
./bettercd ~/protobuf-3.0.0-beta-1/
./bettercd bet
./bettercd -w $(pwd)


text:
"""Runs YCSB against Cloud Bigtable.

Cloud Bigtable (https://cloud.google.com/bigtable/) is a managed NoSQL database
with an HBase-compatible API.

Compared to hbase_ycsb, this benchmark:
  * Modifies hbase-site.xml to work with Cloud Bigtable.
  * Adds the Bigtable client JAR.
  * Adds alpn-boot-7.0.0.v20140317.jar to the bootclasspath, required to
    operate.

This benchmark requires a Cloud Bigtable cluster to be provisioned before
running.
The benchmark will fail if the specified cluster is not found.
"""

import json
import logging
import os
import posixpath
import subprocess

from perfkitbenchmarker import data
from perfkitbenchmarker import flags
from perfkitbenchmarker import vm_util
from perfkitbenchmarker.packages import hbase
from perfkitbenchmarker.packages import ycsb

FLAGS = flags.FLAGS

flags.DEFINE_string('google_bigtable_endpoint', 'bigtable.googleapis.com',
                    'Google API endpoint for Cloud Bigtable.')
flags.DEFINE_string('google_bigtable_admin_endpoint',
                    'bigtabletableadmin.googleapis.com',
                    'Google API endpoint for Cloud Bigtable table '
                    'administration.')
flags.DEFINE_string('google_bigtable_zone_name', 'us-central1-b',
                    'Bigtable zone.')
flags.DEFINE_string('google_bigtable_cluster_name', None,
                    'Bigtable cluster name.')
flags.DEFINE_string(
    'google_bigtable_alpn_jar_url',
    'http://central.maven.org/maven2/org/mortbay/jetty/alpn/'
    'alpn-boot/7.0.0.v20140317/alpn-boot-7.0.0.v20140317.jar',
    'URL for the ALPN boot JAR, required for HTTP2')
flags.DEFINE_string(
    'google_bigtable_hbase_jar_url',
    'https://storage.googleapis.com/cloud-bigtable/jars/'
    'bigtable-hbase/bigtable-hbase-0.1.5.jar',
    'URL for the Bigtable-HBase client JAR.')

BENCHMARK_INFO = {'name': 'cloud_bigtable_ycsb',
                  'description': 'Run YCSB against an existing Cloud Bigtable '
                  'cluster. Configure the number of client VMs via '
                  '--num_vms.',
                  'scratch_disk': False,
                  'num_machines': None}

HBASE_SITE = 'cloudbigtable/hbase-site.xml.j2'
HBASE_CONF_FILES = [HBASE_SITE]
YCSB_HBASE_LIB = posixpath.join(ycsb.YCSB_DIR, 'hbase-binding', 'lib')
YCSB_HBASE_CONF = posixpath.join(ycsb.YCSB_DIR, 'hbase-binding', 'conf')

REQUIRED_SCOPES = (
    'https://www.googleapis.com/auth/bigtable.admin',
    'https://www.googleapis.com/auth/bigtable.data')

# TODO(connormccoy): Make table parameters configurable.
COLUMN_FAMILY = 'cf'

def GetInfo():
  info = BENCHMARK_INFO.copy()
  return info

def CheckPrerequisites():
  """Verifies that the required resources are present.

  Raises:
    perfkitbenchmarker.data.ResourceNotFound: On missing resource.
  """
  for resource in HBASE_CONF_FILES:
    data.ResourcePath(resource)

  hbase.CheckPrerequisites()
  ycsb.CheckPrerequisites()

  for scope in REQUIRED_SCOPES:
    if scope not in FLAGS.gcloud_scopes:
      raise ValueError('Scope {0} required.'.format(scope))

  # TODO: extract from gcloud config if available.
  if not FLAGS.google_bigtable_cluster_name:
    raise ValueError('Missing --google_bigtable_cluster_name')
  if not FLAGS.google_bigtable_zone_name:
    raise ValueError('Missing --google_bigtable_zone_name')
  cluster = _GetClusterDescription(FLAGS.project or _GetDefaultProject(),
                                   FLAGS.google_bigtable_zone_name,
                                   FLAGS.google_bigtable_cluster_name)
  logging.info('Found cluster: %s', cluster)

def _GetALPNLocalPath():
  bn = os.path.basename(FLAGS.google_bigtable_alpn_jar_url)
  if not bn.endswith('.jar'):
    bn = 'alpn.jar'
  return posixpath.join(vm_util.VM_TMP_DIR, bn)

def _GetClusterDescription(project, zone, cluster_name):
  """Gets the description for a Cloud Bigtable cluster.

  Args:
    project: str. Name of the project in which the cluster was created.
    zone: str. Zone of the project in which the cluster was created.
    cluster_name: str. Cluster ID of the desired Bigtable cluster.

  Returns:
    A dictionary containing a cluster description.

  Raises:
    KeyError: when the cluster was not found.
  """
  cmd = [FLAGS.gcloud_path, 'alpha', 'bigtable', 'clusters', 'list', '--format',
         'json']
  stdout, stderr, returncode = vm_util.IssueCommand(cmd)
  if returncode:
    raise IOError('Command "{0}" failed:\nSTDOUT:\n{1}\nSTDERR:\n{2}'.format(
        ' '.join(cmd), stdout, stderr))
  result = json.loads(stdout)
  clusters = {cluster['name']: cluster for cluster in result['clusters']}
  expected_cluster_name = 'projects/{0}/zones/{1}/clusters/{2}'.format(
      project, zone, cluster_name)
  try:
    return clusters[expected_cluster_name]
  except KeyError:
    raise KeyError('Cluster {0} not found in {1}'.format(
        expected_cluster_name, list(clusters)))

def _GetTableName():
  return 'ycsb{0}'.format(FLAGS.run_uri)

def _GetDefaultProject():
  cmd = [FLAGS.gcloud_path, 'config', 'list', '--format', 'json']
  stdout, stderr, return_code = vm_util.IssueCommand(cmd)
  if return_code:
    raise subprocess.CalledProcessError(return_code, cmd, stdout)

  config = json.loads(stdout)

  try:
    return config['core']['project']
  except KeyError:
    raise KeyError('No default project found in {0}'.format(config))

def _Install(vm):
  """Install YCSB and HBase on 'vm'."""
  vm.Install('hbase')
  vm.Install('ycsb')

  hbase_lib = posixpath.join(hbase.HBASE_DIR, 'lib')
  for url in [FLAGS.google_bigtable_hbase_jar_url]:
    jar_name = os.path.basename(url)
    jar_path = posixpath.join(YCSB_HBASE_LIB, jar_name)
    vm.RemoteCommand('curl -Lo {0} {1}'.format(jar_path, url))
    vm.RemoteCommand('cp {0} {1}'.format(jar_path, hbase_lib))

  vm.RemoteCommand('curl -Lo {0} {1}'.format(
      _GetALPNLocalPath(),
      FLAGS.google_bigtable_alpn_jar_url))
  vm.RemoteCommand(('echo "export JAVA_HOME=/usr\n'
                    'export HBASE_OPTS=-Xbootclasspath/p:{0}"'
                    ' >> {1}/hbase-env.sh').format(_GetALPNLocalPath(),
                                                   hbase.HBASE_CONF_DIR))

  context = {
      'google_bigtable_endpoint': FLAGS.google_bigtable_endpoint,
      'google_bigtable_admin_endpoint': FLAGS.google_bigtable_admin_endpoint,
      'project': FLAGS.project or _GetDefaultProject(),
      'cluster': FLAGS.google_bigtable_cluster_name,
      'zone': FLAGS.google_bigtable_zone_name,
  }

  for file_name in HBASE_CONF_FILES:
    file_path = data.ResourcePath(file_name)
    for conf_dir in [hbase.HBASE_CONF_DIR, YCSB_HBASE_CONF]:
      remote_path = posixpath.join(conf_dir, os.path.basename(file_name))
      if file_name.endswith('.j2'):
        vm.RenderTemplate(file_path, os.path.splitext(remote_path)[0], context)
      else:
        vm.RemoteCopy(file_path, remote_path)

  # Patch YCSB to include ALPN on the bootclasspath
  ycsb_memory = min(vm.total_memory_kb // 1024, 4096)
  cmd = ("""sed -i.bak -e '/^ycsb_command =/a """
         """  "-Xmx{0}m", "-Xbootclasspath/p:{1}",' {2}""").format(
             ycsb_memory, _GetALPNLocalPath(), ycsb.YCSB_EXE)
  vm.RemoteCommand(cmd)
  # ... and fail if Java exits non-zero
  cmd = "sed -i -e 's/^subprocess.call/subprocess.check_call/' {0} ".format(
      ycsb.YCSB_EXE)
  vm.RemoteCommand(cmd)

def Prepare(benchmark_spec):
  """Prepare the virtual machines to run cloud bigtable.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.
  """
  benchmark_spec.always_call_cleanup = True
  vms = benchmark_spec.vms

  vm_util.RunThreaded(_Install, vms)

  # Create table
  command = """echo 'create "{0}", "{1}"; exit' | {2}/hbase shell""".format(
      _GetTableName(), COLUMN_FAMILY, hbase.HBASE_BIN)
  vms[0].RemoteCommand(command, should_log=True)

def Run(benchmark_spec):
  """Spawn YCSB and gather the results.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.

  Returns:
    A list of sample.Sample instances.
  """
  vms = benchmark_spec.vms

  table_name = _GetTableName()

  executor = ycsb.YCSBExecutor('hbase-10', table=table_name)
  cluster_info = _GetClusterDescription(FLAGS.project or _GetDefaultProject(),
                                        FLAGS.google_bigtable_zone_name,
                                        FLAGS.google_bigtable_cluster_name)

  metadata = {'ycsb_client_vms': len(vms),
              'bigtable_nodes': cluster_info.get('serveNodes')}

  kwargs = {'columnfamily': COLUMN_FAMILY}
  # By default YCSB uses a BufferedMutator for Puts / Deletes.
  # This leads to incorrect update latencies, since since the call returns
  # before the request is acked by the server.
  # Disable this behavior during the benchmark run.
  run_kwargs = {'clientbuffering': 'false'}
  run_kwargs.update(kwargs)
  samples = list(executor.LoadAndRun(vms,
                                     load_kwargs=kwargs,
                                     run_kwargs=run_kwargs))
  for sample in samples:
    sample.metadata.update(metadata)

  return samples

def Cleanup(benchmark_spec):
  """Cleanup.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.
  """
  vm = benchmark_spec.vms[0]
  # Delete table
  command = ("""echo 'disable "{0}"; drop "{0}"; exit' | """
             """{1}/hbase shell""").format(_GetTableName(), hbase.HBASE_BIN)
  vm.RemoteCommand(command, should_log=True, ignore_failure=True)


text:
namespace Switch {
  /// @brief The System namespace contains fundamental classes and base classes that define commonly-used value and reference data types, events and event handlers, interfaces, attributes, and processing exceptions.
  namespace System {
    /// @brief References a method to be called when a corresponding asynchronous operation completes.
    /// @par Library
    /// Switch.Core
    /// @param ar The result of the asynchronous operation.
    /// @remarks Use an AsyncCallback delegate to process the results of an asynchronous operation in a separate thread. The AsyncCallback delegate represents a callback method that is called when the asynchronous operation completes. The callback method takes an IAsyncResult parameter, which is subsequently used to obtain the results of the asynchronous operation.
    /// @par Examples
    /// The following code example demonstrates using asynchronous methods in the Dns class to retrieve Domain Name System (DNS) information for user-specified computers. This example creates an AsyncCallback delegate that references the ProcessDnsInformation method. This method is called once for each asynchronous request for DNS information.
    /// @include EventHandler.cpp
    /// @par Examples
    /// This example show how to used a specialized EventHandler.
    /// @include AsyncCallback.cpp
    using AsyncCallback = Delegate<void, const IAsyncResult&>;
  }
}
using namespace Switch;


text:
package io.vamp.common.util

import java.nio.charset.StandardCharsets
import java.util.Base64

object TextUtil {

  /**
   * Converts given string to lower camel case format, e.g. "lower-camel' -> "lowerCamel".
   * Hyphens and underscores are used as delimiters and will be removed from the result.
   * Each substring a part of the first one is only capitalized - no other case conversions are applied.
   *
   * @param s String
   * @return String
   */
  def toLowerCamelCase(s: String): String = {
    val chars = s.replace('-', '_').split('_')
    chars.tail.foldLeft(chars.head)((s1, s2) ⇒ s1 + s2.capitalize)
  }

  /**
   * Converts given string to upper camel case format, e.g. "upper_camel' -> "UpperCamel".
   * Hyphens and underscores are used as delimiters and will be removed from the result.
   * Each substring is only capitalized - no other case conversions are applied.
   *
   * @param s String
   * @return String
   */
  def toUpperCamelCase(s: String): String = toLowerCamelCase(s).capitalize

  /**
   * Converts given string to snake case format, e.g. "UpperCamel' -> "upper_camel".
   *
   * @param s String
   * @return String
   */
  def toSnakeCase(s: String, dash: Boolean = true): String = {
    var lower = false
    val snake = new StringBuilder

    for (c ← s.toCharArray) {
      val previous = lower
      lower = !Character.isUpperCase(c)
      if (previous && !lower)
        if (dash) snake.append("-") else snake.append("_")
      snake.append(c)
    }

    snake.toString().toLowerCase
  }

  def encodeBase64(data: String): String = Base64.getEncoder.encodeToString(data.getBytes(StandardCharsets.UTF_8))
}


text:
@(pollForm: Form[PollsController.PollFormData])(implicit token: play.filters.csrf.CSRF.Token)
@import helper._

@initData = {
  <input type="hidden" class="json-data" id="init-data" value='{"pageName": "polls/new"}'/>
}

@layout(title="Create a new poll", initData=initData) {

Create Poll

  <form method="POST" role="form" id="new-poll" class="form-horizontal" action="@routes.PollsController.create">

      Poll question

        <input type="text" class="form-control" name="description" placeholder="Which is better?" />

      Choice 1

        <input type="text" class="form-control" name="choices[0].description" placeholder="Socialized medicine" />

      Choice 2

        <input type="text" class="form-control" name="choices[1].description" placeholder="Privatized medicine" />

      Twitter handles

        <input type="text" class="form-control" name="pollTargetHandles" placeholder="@@MicheleBachmann @@HilaryClinton"/>

    @CSRF.formField

        <button type="submit" class="btn btn-primary" value="Tweet Poll">Create Poll</button>

  </form>

}


text:
#ifndef _INC_CRYPTXML
#define _INC_CRYPTXML

#ifdef __cplusplus
extern "C" {
#endif

#ifndef DECLSPEC_IMPORT
#ifndef __WIDL__
#define DECLSPEC_IMPORT __declspec(dllimport)
#else
#define DECLSPEC_IMPORT
#endif
#endif

#ifndef CRYPTXMLAPI
#define CRYPTXMLAPI DECLSPEC_IMPORT
#endif

#ifndef __HCRYPTPROV_OR_NCRYPT_KEY_HANDLE_DEFINED__
#define __HCRYPTPROV_OR_NCRYPT_KEY_HANDLE_DEFINED__
/*Also in wincrypth*/
typedef ULONG_PTR HCRYPTPROV_OR_NCRYPT_KEY_HANDLE;
#endif /*__HCRYPTPROV_OR_NCRYPT_KEY_HANDLE_DEFINED__*/

#ifndef __BCRYPT_KEY_HANDLE_DEFINED__
#define __BCRYPT_KEY_HANDLE_DEFINED__
/*also in bcrypt.h*/
typedef LPVOID BCRYPT_KEY_HANDLE;
#endif /*__BCRYPT_KEY_HANDLE_DEFINED__*/

typedef HANDLE HCRYPTXML;

#if (_WIN32_WINNT >= 0x0601)

typedef enum tagCRYPT_XML_CHARSET {
  CRYPT_XML_CHARSET_AUTO      = 0,
  CRYPT_XML_CHARSET_UTF8      = 1,
  CRYPT_XML_CHARSET_UTF16LE   = 2,
  CRYPT_XML_CHARSET_UTF16BE   = 3
} CRYPT_XML_CHARSET;

typedef enum tagCRYPT_XML_KEYINFO_SPEC {
  CRYPT_XML_KEYINFO_SPEC_NONE      = 0,
  CRYPT_XML_KEYINFO_SPEC_ENCODED   = 1,
  CRYPT_XML_KEYINFO_SPEC_PARAM     = 2
} CRYPT_XML_KEYINFO_SPEC;

typedef enum tagCRYPT_XML_PROPERTY_ID {
  CRYPT_XML_PROPERTY_MAX_HEAP_SIZE        = 1,
  CRYPT_XML_PROPERTY_SIGNATURE_LOCATION   = 2,
  CRYPT_XML_PROPERTY_MAX_SIGNATURES       = 3,
  CRYPT_XML_PROPERTY_DOC_DECLARATION      = 4,
  CRYPT_XML_PROPERTY_XML_OUTPUT_CHARSET   = 5,
  CRYPT_XML_PROPERTY_HMAC_OUTPUT_LENGTH   = 6
} CRYPT_XML_PROPERTY_ID;

typedef struct _CRYPT_XML_BLOB {
  CRYPT_XML_CHARSET dwCharset;
  ULONG             cbData;
  BYTE              *pbData;
} CRYPT_XML_BLOB, *PCRYPT_XML_BLOB;

#define CRYPT_XML_BLOB_MAX 0x7FFFFFF8

typedef struct _CRYPT_XML_ALGORITHM {
  ULONG          cbSize;
  LPCWSTR        wszAlgorithm;
  CRYPT_XML_BLOB Encoded;
} CRYPT_XML_ALGORITHM, *PCRYPT_XML_ALGORITHM;

typedef struct _CRYPT_XML_ALGORITHM_INFO {
  DWORD cbSize;
  WCHAR *wszAlgorithmURI;
  WCHAR *wszName;
  DWORD dwGroupId;
  WCHAR *wszCNGAlgid;
  WCHAR wszCNGExtraAlgid;
  DWORD dwSignFlags;
  DWORD dwVerifyFlags;
  void  pvPaddingInfo;
  void  pvExtraInfo;
} CRYPT_XML_ALGORITHM_INFO, *PCRYPT_XML_ALGORITHM_INFO;

#define CRYPT_XML_GROUP_ID_HASH 1
#define CRYPT_XML_GROUP_ID_SIGN 2

typedef HRESULT (CALLBACK *PFN_CRYPT_XML_WRITE_CALLBACK)(
  void *pvCallbackState,
  BYTE pbData,
  ULONG cbData
);

typedef HRESULT ( WINAPI *CryptXmlDllEncodeAlgorithm )(
  CRYPT_XML_ALGORITHM_INFO *pAlgInfo,
  CRYPT_XML_CHARSET dwCharset,
  void *pvCallbackState,
  PFN_CRYPT_XML_WRITE_CALLBACK pfnWrite
);

typedef HANDLE CRYPT_XML_DIGEST;

typedef HRESULT ( WINAPI *CryptXmlDllCreateDigest )(
  const CRYPT_XML_ALGORITHM *pDigestMethod,
  ULONG *pcbSize,
  CRYPT_XML_DIGEST *phDigest
);

typedef HRESULT ( WINAPI *CryptXmlDllDigestData )(
    CRYPT_XML_DIGEST hDigest,
    BYTE *pbData,
    ULONG cbDigest
);

typedef HRESULT ( WINAPI *CryptXmlDllFinalizeDigest )(
  CRYPT_XML_DIGEST hDigest,
  BYTE *pbDigest,
  ULONG cbDigest
);

typedef HRESULT ( WINAPI *CryptXmlDllCloseDigest )(
  CRYPT_XML_DIGEST hDigest
);

typedef HRESULT ( WINAPI *CryptXmlDllSignData )(
  const CRYPT_XML_ALGORITHM *pSignatureMethod,
  HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProvOrNCryptKey,
  DWORD dwKeySpec,
  const BYTE *pbInput,
  ULONG cbInput,
  BYTE *pbOutput,
  ULONG cbOutput,
  ULONG *pcbResult
);

typedef HRESULT ( WINAPI *CryptXmlDllVerifySignature )(
  const CRYPT_XML_ALGORITHM *pSignatureMethod,
  HCRYPTXML_PROV hCryptProv,
  HCRYPTXML_KEY hKey,
  const BYTE *pbInput,
  ULONG cbInput,
  const BYTE *pbSignature,
  ULONG cbSignature
);

typedef HRESULT ( WINAPI *CryptXmlDllCreateKey )(
  CRYPT_XML_BLOB *pEncoded,
  const BCRYPT_KEY_HANDLE *phKey
);

typedef HRESULT ( WINAPI *CryptXmlDllEncodeKeyValue )(
  NCRYPT_KEY_HANDLE hKey,
  CRYPT_XML_CHARSET dwCharset,
  void *pvCallbackState,
  PFN_CRYPT_XML_WRITE_CALLBACK pfnWrite
);

typedef struct _CRYPT_XML_CRYPTOGRAPHIC_INTERFACE {
  ULONG                       cbSize;
  CryptXmlDllEncodeAlgorithm  fpCryptXmlEncodeAlgorithm;
  CryptXmlDllCreateDigest     fpCryptXmlCreateDigest;
  CryptXmlDllDigestData       fpCryptXmlDigestData;
  CryptXmlDllFinalizeDigest   fpCryptXmlFinalizeDigest;
  CryptXmlDllCloseDigest      fpCryptXmlCloseDigest;
  CryptXmlDllSignData         fpCryptXmlSignData;
  CryptXmlDllVerifySignature  fpCryptXmlVerifySignature;
  CryptXmlDllGetAlgorithmInfo fpCryptXmlGetAlgorithmInfo;
} CRYPT_XML_CRYPTOGRAPHIC_INTERFACE, *PCRYPT_XML_CRYPTOGRAPHIC_INTERFACE;

typedef HRESULT ( WINAPI *CryptXmlDllGetInterface )(
  DWORD dwFlags,
  const CRYPT_XML_ALGORITHM_INFO *pMethod,
  CRYPT_XML_CRYPTOGRAPHIC_INTERFACE *pInterface
);

typedef struct _CRYPT_XML_DATA_BLOB {
  ULONG cbData;
  BYTE  *pbData;
} CRYPT_XML_DATA_BLOB, *PCRYPT_XML_DATA_BLOB;

typedef HRESULT (CALLBACK *PFN_CRYPT_XML_DATA_PROVIDER_READ)(
  void *pvCallbackState,
  BYTE *pbData,
  ULONG cbData,
  ULONG *pcbRead
);

typedef HRESULT (CALLBACK *PFN_CRYPT_XML_DATA_PROVIDER_CLOSE)(
  void *pvCallbackState
);

typedef struct _CRYPT_XML_DATA_PROVIDER {
  void                              *pvCallbackState;
  ULONG                             cbBufferSize;
  PFN_CRYPT_XML_DATA_PROVIDER_READ  pfnRead;
  PFN_CRYPT_XML_DATA_PROVIDER_CLOSE pfnClose;
} CRYPT_XML_DATA_PROVIDER, *PCRYPT_XML_DATA_PROVIDER;

typedef HRESULT (CALLBACK *PFN_CRYPT_XML_CREATE_TRANSFORM)(
  const CRYPT_XML_ALGORITHM *pTransform,
  CRYPT_XML_DATA_PROVIDER *pProviderIn,
  CRYPT_XML_DATA_PROVIDER *pProviderOut
);

typedef struct _CRYPT_XML_TRANSFORM_INFO {
  ULONG                          cbSize;
  LPCWSTR                        wszAlgorithm;
  ULONG                          cbBufferSize;
  DWORD                          dwFlags;
  PFN_CRYPT_XML_CREATE_TRANSFORM pfnCreateTransform;
} CRYPT_XML_TRANSFORM_INFO, *PCRYPT_XML_TRANSFORM_INFO;

#define CRYPT_XML_TRANSFORM_ON_STREAM 0x00000001
#define CRYPT_XML_TRANSFORM_ON_NODESET 0x00000002
#define CRYPT_XML_TRANSFORM_URI_QUERY_STRING 0x00000003

typedef struct _CRYPT_XML_TRANSFORM_CHAIN_CONFIG {
  ULONG                     cbSize;
  ULONG                     cTransformInfo;
  PCRYPT_XML_TRANSFORM_INFO *rgpTransformInfo;
} CRYPT_XML_TRANSFORM_CHAIN_CONFIG, *PCRYPT_XML_TRANSFORM_CHAIN_CONFIG;

typedef struct _CRYPT_XML_REFERENCE {
  ULONG               cbSize;
  HCRYPTXML           hReference;
  LPCWSTR             wszId;
  LPCWSTR             wszUri;
  LPCWSTR             wszType;
  CRYPT_XML_ALGORITHM DigestMethod;
  CRYPT_DATA_BLOB     DigestValue;
  ULONG               cTransform;
  CRYPT_XML_ALGORITHM *rgTransform;
} CRYPT_XML_REFERENCE, *PCRYPT_XML_REFERENCE;

typedef struct _CRYPT_XML_REFERENCES {
  ULONG                cReference;
  PCRYPT_XML_REFERENCE *rgpReference;
} CRYPT_XML_REFERENCES, *PCRYPT_XML_REFERENCES;

typedef struct _CRYPT_XML_SIGNED_INFO {
  ULONG                cbSize;
  LPCWSTR              wszId;
  CRYPT_XML_ALGORITHM  Canonicalization;
  CRYPT_XML_ALGORITHM  SignatureMethod;
  ULONG                cReference;
  PCRYPT_XML_REFERENCE *rgpReference;
  CRYPT_XML_BLOB       Encoded;
} CRYPT_XML_SIGNED_INFO, *PCRYPT_XML_SIGNED_INFO;

typedef struct _CRYPT_XML_ISSUER_SERIAL {
  LPCWSTR wszIssuer ;
  LPCWSTR wszSerial;
} CRYPT_XML_ISSUER_SERIAL;

typedef struct _CRYPT_XML_X509DATA_ITEM {
  DWORD dwType;
  __C89_NAMELESS union {
    CRYPT_XML_ISSUER_SERIAL IssuerSerial;
    CRYPT_XML_DATA_BLOB     SKI;
    LPCWSTR                 wszSubjectName;
    CRYPT_XML_DATA_BLOB     Certificate;
    CRYPT_XML_DATA_BLOB     CRL;
    CRYPT_XML_BLOB          Custom;
  } ;
} CRYPT_XML_X509DATA_ITEM;

#define CRYPT_XML_X509DATA_TYPE_ISSUER_SERIAL 0x00000001
#define CRYPT_XML_X509DATA_TYPE_SKI 0x00000002
#define CRYPT_XML_X509DATA_TYPE_SUBJECT_NAME 0x00000003
#define CRYPT_XML_X509DATA_TYPE_CERTIFICATE 0x00000004
#define CRYPT_XML_X509DATA_TYPE_CRL 0x00000005
#define CRYPT_XML_X509DATA_TYPE_CUSTOM 0x00000006

typedef struct _CRYPT_XML_X509DATA {
  UINT                    cX509Data;
  CRYPT_XML_X509DATA_ITEM *rgX509Data;
} CRYPT_XML_X509DATA, *PCRYPT_XML_X509DATA;

typedef struct _CRYPT_XML_KEY_INFO_ITEM {
  DWORD dwType;
  __C89_NAMELESS union {
    LPCWSTR             wszKeyName;
    CRYPT_XML_KEY_VALUE KeyValue;
    CRYPT_XML_BLOB      RetrievalMethod;
    CRYPT_XML_X509DATA  X509Data;
    CRYPT_XML_BLOB      Custom;
  } ;
} CRYPT_XML_KEY_INFO_ITEM;

#define CRYPT_XML_KEYINFO_TYPE_KEYNAME 0x00000001
#define CRYPT_XML_KEYINFO_TYPE_KEYVALUE 0x00000002
#define CRYPT_XML_KEYINFO_TYPE_RETRIEVAL 0x00000003
#define CRYPT_XML_KEYINFO_TYPE_X509DATA 0x00000004
#define CRYPT_XML_KEYINFO_TYPE_CUSTOM 0x00000005

typedef struct _CRYPT_XML_KEY_DSA_KEY_VALUE {
  CRYPT_XML_DATA_BLOB P;
  CRYPT_XML_DATA_BLOB Q;
  CRYPT_XML_DATA_BLOB G;
  CRYPT_XML_DATA_BLOB Y;
  CRYPT_XML_DATA_BLOB J;
  CRYPT_XML_DATA_BLOB Seed;
  CRYPT_XML_DATA_BLOB Counter;
} CRYPT_XML_KEY_DSA_KEY_VALUE;

typedef struct _CRYPT_XML_KEY_RSA_KEY_VALUE {
  CRYPT_XML_DATA_BLOB Modulus;
  CRYPT_XML_DATA_BLOB Exponent;
} CRYPT_XML_KEY_RSA_KEY_VALUE;

typedef struct _CRYPT_XML_KEY_ECDSA_KEY_VALUE {
  LPCWSTR                  wszNamedCurve;
  CRYPT_XML_DATA_BLOB      X;
  CRYPT_XML_DATA_BLOB      Y;
  CRYPT_XML_BLOB           ExplicitPara;
} CRYPT_XML_KEY_ECDSA_KEY_VALUE;

typedef struct _CRYPT_XML_KEY_VALUE {
  DWORD dwType;
  __C89_NAMELESS union {
    CRYPT_XML_KEY_DSA_KEY_VALUE   DSAKeyValue;
    CRYPT_XML_KEY_RSA_KEY_VALUE   RSAKeyValue;
    CRYPT_XML_KEY_ECDSA_KEY_VALUE ECDSAKeyValue;
    CRYPT_XML_BLOB                Custom;
  } ;
} CRYPT_XML_KEY_VALUE;

#define CRYPT_XML_KEY_VALUE_TYPE_DSA 0x00000001
#define CRYPT_XML_KEY_VALUE_TYPE_RSA 0x00000002
#define CRYPT_XML_KEY_VALUE_TYPE_ECDSA 0x00000003
#define CRYPT_XML_KEY_VALUE_TYPE_CUSTOM 0x00000004

typedef struct _CRYPT_XML_KEY_INFO {
  ULONG                   cbSize;
  LPCWSTR                 wszId;
  UINT                    cKeyInfo;
  CRYPT_XML_KEY_INFO_ITEM *rgKeyInfo;
  BCRYPT_KEY_HANDLE       hVerifyKey;
} CRYPT_XML_KEY_INFO;

typedef struct _CRYPT_XML_OBJECT {
  ULONG                cbSize;
  HCRYPTXML            hObject;
  LPCWSTR              wszId;
  LPCWSTR              wszMimeType;
  LPCWSTR              wszEncoding;
  CRYPT_XML_REFERENCES Manifest;
  CRYPT_XML_BLOB       Encoded;
} CRYPT_XML_OBJECT, *PCRYPT_XML_OBJECT;

typedef struct _CRYPT_XML_SIGNATURE {
  ULONG                 cbSize;
  HCRYPTXML             hSignature;
  LPCWSTR               wszId;
  CRYPT_XML_SIGNED_INFO SignedInfo;
  CRYPT_DATA_BLOB       SignatureValue;
  CRYPT_XML_KEY_INFO    *pKeyInfo;
  ULONG                 cObject;
  PCRYPT_XML_OBJECT     *rgpObject;
} CRYPT_XML_SIGNATURE, *PCRYPT_XML_SIGNATURE;

typedef struct _CRYPT_XML_DOC_CTXT {
  ULONG                            cbSize;
  HCRYPTXML                        hDocCtxt;
  CRYPT_XML_TRANSFORM_CHAIN_CONFIG *pTransformsConfig;
  ULONG                            cSignature;
  PCRYPT_XML_SIGNATURE             *rgpSignature;
} CRYPT_XML_DOC_CTXT, *PCRYPT_XML_DOC_CTXT;

typedef struct _CRYPT_XML_KEYINFO_PARAM {
  LPCWSTR   wszId;
  LPCWSTR   wszKeyName;
  CERT_BLOB SKI;
  LPCWSTR   wszSubjectName;
  ULONG     cCertificate;
  CERT_BLOB *rgCertificate;
  ULONG     cCRL;
  CERT_BLOB *rgCRL;
} CRYPT_XML_KEYINFO_PARAM;

typedef struct _CRYPT_XML_PROPERTY {
  CRYPT_XML_PROPERTY_ID dwPropId;
  const void            *pvValue;
  ULONG                 cbValue;
} CRYPT_XML_PROPERTY, *PCRYPT_XML_PROPERTY;

typedef struct _CRYPT_XML_STATUS {
  ULONG cbSize;
  DWORD dwErrorStatus;
  DWORD dwInfoStatus;
} CRYPT_XML_STATUS, *PCRYPT_XML_STATUS;

#define CRYPT_XML_STATUS_ERROR_NOT_RESOLVED 0x00000001
#define CRYPT_XML_STATUS_ERROR_DIGEST_INVALID 0x00000002
#define CRYPT_XML_STATUS_ERROR_NOT_SUPPORTED_ALGORITHM 0x00000005
#define CRYPT_XML_STATUS_ERROR_NOT_SUPPORTED_TRANSFORM 0x00000008
#define CRYPT_XML_STATUS_ERROR_SIGNATURE_INVALID 0x00010000
#define CRYPT_XML_STATUS_ERROR_KEYINFO_NOT_PARSED 0x00020000

#define CRYPT_XML_STATUS_INTERNAL_REFERENCE 0x00000001
#define CRYPT_XML_STATUS_KEY_AVAILABLE 0x00000002
#define CRYPT_XML_STATUS_DIGESTING 0x00000004
#define CRYPT_XML_STATUS_DIGEST_VALID 0x00000008
#define CRYPT_XML_STATUS_SIGNATURE_VALID 0x00010000
#define CRYPT_XML_STATUS_OPENED_TO_ENCODE 0x80000000

CRYPTXMLAPI HRESULT WINAPI CryptXmlAddObject(
  HCRYPTXML hSignatureOrObject,
  DWORD dwFlags,
  const CRYPT_XML_PROPERTY *rgProperty,
  ULONG cProperty,
  const PCRYPT_XML_BLOB pEncoded,
  const CRYPT_XML_OBJECT **ppObject
);

CRYPTXMLAPI HRESULT WINAPI CryptXmlClose(
  HCRYPTXML hCryptXml
);

CRYPTXMLAPI HRESULT WINAPI CryptXmlCreateReference(
  HCRYPTXML hCryptXml,
  DWORD dwFlags,
  LPCWSTR wszId,
  LPCWSTR wszURI,
  LPCWSTR wszType,
  const CRYPT_XML_ALGORITHM *pDigestMethod,
  ULONG cTransform,
  const CRYPT_XML_ALGORITHM *rgTransform,
  HCRYPTXML *phReference
);

#define CRYPT_XML_FLAG_CREATE_REFERENCE_AS_OBJECT 0x00000001

CRYPTXMLAPI HRESULT WINAPI CryptXmlDigestReference(
  HCRYPTXML hReference,
  DWORD dwFlags,
  CRYPT_XML_DATA_PROVIDER *pDataProviderIn
);

#define CRYPT_XML_REFERENCE_DATA_TRANSFORMED 0x00000001

CRYPTXMLAPI HRESULT WINAPI CryptXmlEncode(
  HCRYPTXML hCryptXml,
  CRYPT_XML_CHARSET dwCharset,
  const CRYPT_XML_PROPERTY *rgProperty,
  ULONG cProperty,
  void *pvCallbackState,
  PFN_CRYPT_XML_WRITE_CALLBACK pfnWrite
);

CRYPTXMLAPI HRESULT WINAPI CryptXmlGetAlgorithmInfo(
  const CRYPT_XML_ALGORITHM *pXmlAlgorithm,
  DWORD dwFlags,
  CRYPT_XML_ALGORITHM_INFO **ppAlgInfo
);

CRYPTXMLAPI HRESULT WINAPI CryptXmlGetDocContext(
  HCRYPTXML hCryptXml,
  const CRYPT_XML_DOC_CTXT **ppStruct
);

CRYPTXMLAPI HRESULT WINAPI CryptXmlGetReference(
  HCRYPTXML HCRYPTXML,
  const CRYPT_XML_REFERENCE **ppStruct
);

CRYPTXMLAPI HRESULT WINAPI CryptXmlGetSignature(
  HCRYPTXML hCryptXml,
  const PCRYPT_XML_SIGNATURE **ppStruct
);

CRYPTXMLAPI HRESULT WINAPI CryptXmlGetStatus(
  HCRYPTXML hCryptXml,
  CRYPT_XML_STATUS *pStatus
);

CRYPTXMLAPI HRESULT WINAPI CryptXmlGetTransforms(
  PCRYPT_XML_TRANSFORM_CHAIN_CONFIG **pConfig
);

CRYPTXMLAPI HRESULT WINAPI CryptXmlImportPublicKey(
  DWORD dwFlags,
  CRYPT_XML_KEY_VALUE *pKeyValue,
  BCRYPT_KEY_HANDLE *phKey
);

#define CRYPT_XML_FLAG_DISABLE_EXTENSIONS 0x10000000

CRYPTXMLAPI HRESULT WINAPI CryptXmlOpenToDecode(
  CRYPT_XML_TRANSFORM_CHAIN_CONFIG *pConfig,
  DWORD dwFlags,
  const CRYPT_XML_PROPERTY *rgProperty,
  ULONG cProperty,
  const CRYPT_XML_BLOB *pEncoded,
  HCRYPTXML phCryptXml
);

#define CRYPT_XML_FLAG_NO_SERIALIZE 0x80000000
#define CRYPT_XML_FLAG_DISABLE_EXTENSION 0x10000000

CRYPTXMLAPI HRESULT WINAPI CryptXmlOpenToEncode(
  CRYPT_XML_TRANSFORM_CHAIN_CONFIG *pConfig,
  DWORD dwFlags,
  LPCWSTR wszId,
  CRYPT_XML_PROPERTY *rgProperty,
  ULONG cProperty,
  CRYPT_XML_BLOB *pEncoded,
  HCRYPTXML *phSignature
);

#define CRYPT_XML_FLAG_NO_SERIALIZE 0x80000000
#define CRYPT_XML_FLAG_DISABLE_EXTENSIONS 0x10000000

CRYPTXMLAPI HRESULT WINAPI CryptXmlSetHMACSecret(
  HCRYPTXML hSignature,
  const BYTE *pbSecret,
  ULONG cbSecret
);

CRYPTXMLAPI HRESULT WINAPI CryptXmlSign(
  HCRYPTXML hSignature,
  HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hKey,
  DWORD dwKeySpec,
  DWORD dwFlags,
  CRYPT_XML_KEYINFO_SPEC dwKeyInfoSpec,
  const void pvKeyInfoSpec,
  const CRYPT_XML_ALGORITHM pSignatureMethod,
  const CRYPT_XML_ALGORITHM pCanonicalization
);

#define AT_KEYEXCHANGE 1
#define AT_SIGNATURE 2
#define CERT_NCRYPT_KEY_SPEC 0xFFFFFFFF

#define CRYPT_XML_SIGN_ADD_KEYVALUE 0x00000001
#define CRYPT_XML_FLAG_DISABLE_EXTENSIONS 0x10000000

CRYPTXMLAPI HRESULT WINAPI CryptXmlVerifySignature(
  HCRYPTXML hSignature,
  BCRYPT_KEY_HANDLE hKey,
  DWORD dwFlags
);

#endif /*(_WIN32_WINNT >= 0x0601)*/

#ifdef __cplusplus
}
#endif
#endif /*_INC_CRYPTXML*/


text:
package com.ymsino.esb.protocol.strutc;

import com.gmail.xcjava.base.math.DataConverter;
import com.gmail.xcjava.base.str.ByteTool;
import com.ymsino.esb.protocol.AbstractMessage;

public class LoadWmItem {

	/**
	 * 水表序号
	 * 2字节
	 */
	public String[] waterMeterSn = {"FF", "FF"};

	/**
	 * 表号
	 * 6字节
	 */
	public String[] waterMeterId = {"FF", "FF", "FF", "FF", "FF", "FF"};

	/**
	 * 新表类型
	 * 1字节
	 */
	private String[] newMeterType = {"00"};

	/**
	 * 中继序号1
	 * 2字节
	 */
	private String[] relayNo1 = {"FF", "FF"};

	/**
	 * 中继序号2
	 * 2字节
	 */
	private String[] relayNo2 = {"FF", "FF"};

	/**
	 * 中继序号3
	 * 2字节
	 */
	private String[] relayNo3 = {"FF", "FF"};

	/**
	 * 中继序号4
	 * 2字节
	 */
	private String[] relayNo4 = {"FF", "FF"};

	/**
	 * CT
	 * 2字节
	 */
	private String[] ct = {"00", "00"};

	/**
	 * 测量性质
	 * 1字节
	 */
	private String[] testKind = {"12"};

	/**
	 * 自动中继条件
	 * 7字节
	 */
	private String[] autoRelayCondition = {"00", "00", "00", "00", "00", "00", "00"};

	/**
	 * 对应采集终端地址
	 * 6字节
	 */
	private String[] collectTerminalSite = {"FF", "FF", "FF", "FF", "FF", "FF"};

	/**
	 * 字节数
	 */
	public static final int dataLength = 	2 +
											6 +
											1 +
											2 +
											2 +
											2 +
											2 +
											2 +
											1 +
											7 +
											6;

	public LoadWmItem(){}

	public LoadWmItem(byte[] bytes){
		int offset = 0;

		byte[] temp = ByteTool.subByte(bytes, offset, this.waterMeterSn.length);
		offset += this.waterMeterSn.length;
		this.waterMeterSn[0] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 1, 1));
		this.waterMeterSn[1] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 0, 1));

		temp = ByteTool.subByte(bytes, offset, this.waterMeterId.length);
		offset += this.waterMeterId.length;
		this.waterMeterId[0] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 5, 1));
		this.waterMeterId[1] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 4, 1));
		this.waterMeterId[2] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 3, 1));
		this.waterMeterId[3] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 2, 1));
		this.waterMeterId[4] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 1, 1));
		this.waterMeterId[5] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 0, 1));

		this.newMeterType[0] = DataConverter.bytesToHexString(ByteTool.subByte(bytes, offset, 1));
		offset += this.newMeterType.length;

		temp = ByteTool.subByte(bytes, offset, this.relayNo1.length);
		offset += this.relayNo1.length;
		this.relayNo1[0] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 1, 1));
		this.relayNo1[1] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 0, 1));

		temp = ByteTool.subByte(bytes, offset, this.relayNo2.length);
		offset += this.relayNo2.length;
		this.relayNo2[0] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 1, 1));
		this.relayNo2[1] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 0, 1));

		temp = ByteTool.subByte(bytes, offset, this.relayNo3.length);
		offset += this.relayNo3.length;
		this.relayNo3[0] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 1, 1));
		this.relayNo3[1] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 0, 1));

		temp = ByteTool.subByte(bytes, offset, this.relayNo4.length);
		offset += this.relayNo4.length;
		this.relayNo4[0] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 1, 1));
		this.relayNo4[1] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 0, 1));

		temp = ByteTool.subByte(bytes, offset, this.ct.length);
		offset += this.ct.length;
		this.ct[0] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 1, 1));
		this.ct[1] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 0, 1));

		this.testKind[0] = DataConverter.bytesToHexString(ByteTool.subByte(bytes, offset, 1));
		offset += this.testKind.length;

		temp = ByteTool.subByte(bytes, offset, this.autoRelayCondition.length);
		offset += this.autoRelayCondition.length;
		this.autoRelayCondition[0] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 6, 1));
		this.autoRelayCondition[1] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 5, 1));
		this.autoRelayCondition[2] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 4, 1));
		this.autoRelayCondition[3] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 3, 1));
		this.autoRelayCondition[4] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 2, 1));
		this.autoRelayCondition[5] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 1, 1));
		this.autoRelayCondition[6] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 0, 1));

		temp = ByteTool.subByte(bytes, offset, this.collectTerminalSite.length);
		offset += this.collectTerminalSite.length;
		this.collectTerminalSite[0] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 5, 1));
		this.collectTerminalSite[1] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 4, 1));
		this.collectTerminalSite[2] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 3, 1));
		this.collectTerminalSite[3] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 2, 1));
		this.collectTerminalSite[4] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 1, 1));
		this.collectTerminalSite[5] = DataConverter.bytesToHexString(ByteTool.subByte(temp, 0, 1));
	}

	public byte[] toBytes() {
		byte[] bytes = new byte[dataLength];

		int offset = 0;

		System.arraycopy(ByteTool.reverse(DataConverter.hexStringToByte(AbstractMessage.getFieldString(this.waterMeterSn))), 0, bytes, offset, this.waterMeterSn.length);
		offset += this.waterMeterSn.length;

		System.arraycopy(ByteTool.reverse(DataConverter.hexStringToByte(AbstractMessage.getFieldString(this.waterMeterId))), 0, bytes, offset, this.waterMeterId.length);
		offset += this.waterMeterId.length;

		System.arraycopy(ByteTool.reverse(DataConverter.hexStringToByte(AbstractMessage.getFieldString(this.newMeterType))), 0, bytes, offset, this.newMeterType.length);
		offset += this.newMeterType.length;

		System.arraycopy(ByteTool.reverse(DataConverter.hexStringToByte(AbstractMessage.getFieldString(this.relayNo1))), 0, bytes, offset, this.relayNo1.length);
		offset += this.relayNo1.length;

		System.arraycopy(ByteTool.reverse(DataConverter.hexStringToByte(AbstractMessage.getFieldString(this.relayNo2))), 0, bytes, offset, this.relayNo2.length);
		offset += this.relayNo2.length;

		System.arraycopy(ByteTool.reverse(DataConverter.hexStringToByte(AbstractMessage.getFieldString(this.relayNo3))), 0, bytes, offset, this.relayNo3.length);
		offset += this.relayNo3.length;

		System.arraycopy(ByteTool.reverse(DataConverter.hexStringToByte(AbstractMessage.getFieldString(this.relayNo4))), 0, bytes, offset, this.relayNo4.length);
		offset += this.relayNo4.length;

		System.arraycopy(ByteTool.reverse(DataConverter.hexStringToByte(AbstractMessage.getFieldString(this.ct))), 0, bytes, offset, this.ct.length);
		offset += this.ct.length;

		System.arraycopy(ByteTool.reverse(DataConverter.hexStringToByte(AbstractMessage.getFieldString(this.testKind))), 0, bytes, offset, this.testKind.length);
		offset += this.testKind.length;

		System.arraycopy(ByteTool.reverse(DataConverter.hexStringToByte(AbstractMessage.getFieldString(this.autoRelayCondition))), 0, bytes, offset, this.autoRelayCondition.length);
		offset += this.autoRelayCondition.length;

		System.arraycopy(ByteTool.reverse(DataConverter.hexStringToByte(AbstractMessage.getFieldString(this.collectTerminalSite))), 0, bytes, offset, this.collectTerminalSite.length);
		offset += this.collectTerminalSite.length;

		return bytes;
	}

	protected String getString(){
		String str = "";
		str += AbstractMessage.getNioFieldString(this.waterMeterSn) + "|";
		str += AbstractMessage.getNioFieldString(this.waterMeterId) + "|";
		str += AbstractMessage.getNioFieldString(this.newMeterType) + "|";
		str += AbstractMessage.getNioFieldString(this.relayNo1) + "|";
		str += AbstractMessage.getNioFieldString(this.relayNo2) + "|";
		str += AbstractMessage.getNioFieldString(this.relayNo3) + "|";
		str += AbstractMessage.getNioFieldString(this.relayNo4) + "|";
		str += AbstractMessage.getNioFieldString(this.ct) + "|";
		str += AbstractMessage.getNioFieldString(this.testKind) + "|";
		str += AbstractMessage.getNioFieldString(this.autoRelayCondition) + "|";
		str += AbstractMessage.getNioFieldString(this.collectTerminalSite) + "|";
		return str;
	}

	public static void main(String[] args){

	}

}