text:
'use strict';

var request = require('supertest'),
    fs = require('fs'),
    should = require('should'),
    assert = require('assert'),
    path = require('path'),
    express = require('express'),
    bodyParser = require('body-parser'),
    HookRoutes = require('../lib/hookroutes');

describe('hooks', function () {
    var app;

    function startServer() {

        var app = express();

        // set xmpp options
        var options = {
            jid: 'romeo@example.net',
            password: 'romeo',
            host: 'localhost',
            port: '5222',
            room: 'room1'
        };

        app.use(bodyParser.json({
            limit: '1mb'
        }));

        // load routes
        var hRoutes = new HookRoutes(options);
        app.use('/', hRoutes.routes());

        // error handler
        app.use(function (err, req, res, next) {
            console.log("ERROR handler");
            res.status(500);
            res.send({
                error: 'Internal Error'
            });
        });

        return app;
    }

    beforeEach(function (done) {
        app = startServer();
        setTimeout(done, 1000);
    });

    afterEach(function (done) {
        // nothing to do yet
        done();
    });

    it('bitbucket git', function (done) {

        var data = fs.readFileSync(path.resolve(__dirname, './hooks/bitbucket_git.json'));
        var json = JSON.parse(data);
        request(app)
            .post('/bitbucket')
            .send(json)
            .set('Accept', 'application/json')
            .expect(200)
            .end(function (err, res) {
                should.not.exist(err);
                done();
            });
    });

    it('github push', function (done) {

        var data = fs.readFileSync(path.resolve(__dirname, './hooks/github_push.json'));
        var json = JSON.parse(data);
        request(app)
            .post('/github')
            .set('X-GitHub-Event', 'push')
            .set('X-GitHub-Delivery', '12321')
            .send(json)
            .expect(200)
            .end(function (err, res) {
                should.not.exist(err);
                done();
            });
    });

    it('github pull_request', function (done) {

        var data = fs.readFileSync(path.resolve(__dirname, './hooks/github_pull_request.json'));
        var json = JSON.parse(data);
        request(app)
            .post('/github')
            .set('X-GitHub-Event', 'pull_request')
            .set('X-GitHub-Delivery', '12321')
            .send(json)
            .expect(200)
            .end(function (err, res) {
                should.not.exist(err);
                done();
            });
    });

    it('gitlab 6', function (done) {

        var data = fs.readFileSync(path.resolve(__dirname, './hooks/gitlab6.json'));
        var json = JSON.parse(data);
        request(app)
            .post('/gitlab')
            .send(json)
            .expect(200)
            .end(function (err, res) {
                should.not.exist(err);
                done();
            });
    });
});


text:
package com.navercorp.pinpoint.plugin.logback;

import com.navercorp.pinpoint.plugin.AgentPath;
import com.navercorp.pinpoint.test.plugin.PinpointAgent;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

import com.navercorp.pinpoint.test.plugin.Dependency;
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;

@RunWith(PinpointPluginTestSuite.class)
@PinpointAgent(AgentPath.PATH)
@Dependency({"ch.qos.logback:logback-classic:[1.0.13],[1.1.3,1.2.3]", "org.slf4j:slf4j-api:1.7.12"})
@PinpointConfig("pinpoint-spring-bean-test.config")
public class LogbackIT {

    @Test
    public void test() throws Exception {
        Logger logger = LoggerFactory.getLogger(getClass());
        logger.error("maru");

        Assert.assertNotNull(MDC.get("PtxId"));
        Assert.assertNotNull(MDC.get("PspanId"));
    }
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

<!--
  Copyright (c) 2016, <your name>. All rights reserved. Use of this source code
  is governed by a BSD-style license that can be found in the LICENSE file.
-->

<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="scaffolded-by" content="https://github.com/google/stagehand">
  <title>mobiledeviceadmin</title>

  <!-- Add to homescreen for Chrome on Android -->
  <meta name="mobile-web-app-capable" content="yes">
  <link rel="icon" sizes="192x192" href="images/touch/chrome-touch-icon-192x192.png">

  <!-- Add to homescreen for Safari on iOS -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="Web Starter Kit">
  <link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png">

  <!-- Tile icon for Win8 (144x144 + tile color) -->
  <meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png">
  <meta name="msapplication-TileColor" content="#3372DF">

  <!--  Polyfill of Custom Elements and HTML Imports -->
  <!-- <script src="packages/web_components/webcomponents-lite.min.js"></script> -->

  <!-- ie11 support-->
  <script src="packages/web_components/webcomponents.min.js"></script>
  <script src="packages/web_components/dart_support.js"></script>

  <script defer type="application/dart" src="index.dart"></script>
  <script defer src="packages/browser/dart.js"></script>

  <!-- example of using a paper element -->
  <link rel="import" href="packages/polymer_elements/roboto.html">

  <link rel="stylesheet" href="styles.css">
</head>

<body unresolved fullbleed>
  <main-app></main-app>

</body>
</html>


text:
package org.nescent.protege.obolint;

import java.awt.BorderLayout;

import javax.swing.JScrollPane;

import org.protege.editor.owl.ui.framelist.OWLFrameList;
import org.protege.editor.owl.ui.view.AbstractActiveOntologyViewComponent;
import org.semanticweb.owlapi.model.OWLOntology;

@SuppressWarnings("serial")
public class OBOLintView extends AbstractActiveOntologyViewComponent {

	private OWLFrameList<OWLOntology> oboLintList;

	@Override
	public void initialiseOntologyView() {
		final OBOlintFrame frame = new OBOlintFrame(this.getOWLEditorKit());
		this.oboLintList = new OWLFrameList<OWLOntology>(this.getOWLEditorKit(), frame);
		this.setLayout(new BorderLayout());
		this.add(new JScrollPane(this.oboLintList));
	}

	@Override
	protected void disposeOntologyView() {
		this.oboLintList.dispose();
	}

	@Override
	protected void updateView(OWLOntology ontology) throws Exception {
		this.oboLintList.getFrame().setRootObject(ontology);
	}

}


text:
{%  extends 'survey/base.html' %}

{% csrf_token %}

{% block content %}

Download

Stel uw parameters op

        <form role="form" method="get">

                Hoeveel gegevens?

Het maximale aantal meetpunten is {{ stampcount }}

                <input type="datetime" class="form-control" name="amount" placeholder="{{ stampcount }}"></input>

                Interval
                <select class="form-control" name="interval">
                    <option value="1">Tien minuten</option>
                    <option value="3">Half uur</option>
                    <option value="6">Uur</option>
                    <option value="18">Drie uur</option>
                    <option value="36">Zes uur</option>
                    <option value="72">12 uur</option>
                    <option value="144">Dagelijks</option>
                </select>

                <button class="btn btn-success btn-block">Downloaden</button>

        </form>

{%  endblock %}


text:
// This file is automatically generated.

package adila.db;

/*
 * ZTE Z667T
 *
 * DEVICE: bonnie
 * MODEL: Z667T
 */
final class bonnie {
    public static final String DATA = "ZTE|Z667T|";
}


text:
package com.nio.filecopy.job;

public class JobStatus {
	public final static int JOB_ERROR = -1;

	public final static int JOB_NOT_INITIALIZED = 0;

	public final static int JOB_INITIALIZING = 1;

	public final static int JOB_INITIALIZED = 2;

	public final static int JOB_RUNNING = 3;

	public final static int JOB_STOPED = 4;

	public final static int JOB_COMPLETED = 5;

	public final static int JOB_COMPLETED_WITH_ERROR = 6;
}


text:
import functools
import re

from oslo_log import log as logging
from oslo_utils import timeutils
import six

from sahara import conductor as c
from sahara import context
from sahara import exceptions as e
from sahara.i18n import _LI
from sahara.utils.notification import sender

conductor = c.API
LOG = logging.getLogger(__name__)

NATURAL_SORT_RE = re.compile('([0-9]+)')

def find_dict(iterable, **rules):
    """Search for dict in iterable of dicts using specified key-value rules."""

    for item in iterable:
        # assert all key-value pairs from rules dict
        ok = True
        for k, v in six.iteritems(rules):
            ok = ok and k in item and item[k] == v

        if ok:
            return item

    return None

def find(lst, **kwargs):
    for obj in lst:
        match = True
        for attr, value in kwargs.items():
            if getattr(obj, attr) != value:
                match = False

        if match:
            return obj

    return None

def get_by_id(lst, id):
    for obj in lst:
        if obj.id == id:
            return obj

    return None

# Taken from http://stackoverflow.com/questions/4836710/does-
# python-have-a-built-in-function-for-string-natural-sort
def natural_sort_key(s):
    return [int(text) if text.isdigit() else text.lower()
            for text in re.split(NATURAL_SORT_RE, s)]

def change_cluster_status_description(cluster, status_description):
    ctx = context.ctx()

    cluster = conductor.cluster_get(ctx, cluster) if cluster else None

    if cluster is None or cluster.status == "Deleting":
        return cluster
    return conductor.cluster_update(
        ctx, cluster, {'status_description': status_description})

def change_cluster_status(cluster, status, status_description=None):
    ctx = context.ctx()

    # Update cluster status. Race conditions with deletion are still possible,
    # but this reduces probability at least.
    cluster = conductor.cluster_get(ctx, cluster) if cluster else None

    # 'Deleting' is final and can't be changed
    if cluster is None or cluster.status == 'Deleting':
        return cluster

    update_dict = {"status": status}
    if status_description:
        update_dict["status_description"] = status_description

    cluster = conductor.cluster_update(ctx, cluster, update_dict)

    LOG.info(_LI("Cluster status has been changed: id=%(id)s, New status="
                 "%(status)s"), {'id': cluster.id, 'status': cluster.status})

    sender.notify(ctx, cluster.id, cluster.name, cluster.status,
                  "update")

    return cluster

def count_instances(cluster):
    return sum([node_group.count for node_group in cluster.node_groups])

def check_cluster_exists(cluster):
    ctx = context.ctx()
    # check if cluster still exists (it might have been removed)
    cluster = conductor.cluster_get(ctx, cluster)
    return cluster is not None

def get_instances(cluster, instances_ids=None):
    inst_map = {}
    for node_group in cluster.node_groups:
        for instance in node_group.instances:
            inst_map[instance.id] = instance

    if instances_ids is not None:
        return [inst_map[id] for id in instances_ids]
    else:
        return [v for v in six.itervalues(inst_map)]

def clean_cluster_from_empty_ng(cluster):
    ctx = context.ctx()
    for ng in cluster.node_groups:
        if ng.count == 0:
            conductor.node_group_remove(ctx, ng)

def generate_etc_hosts(cluster):
    hosts = "127.0.0.1 localhost\n"
    for node_group in cluster.node_groups:
        for instance in node_group.instances:
            hosts += "%s %s %s\n" % (instance.internal_ip,
                                     instance.fqdn(),
                                     instance.hostname())

    return hosts

def generate_instance_name(cluster_name, node_group_name, index):
    return ("%s-%s-%03d" % (cluster_name, node_group_name, index)).lower()

def generate_auto_security_group_name(node_group):
    return ("%s-%s-%s" % (node_group.cluster.name, node_group.name,
                          node_group.id[:8])).lower()

def generate_aa_group_name(cluster_name):
    return ("%s-aa-group" % cluster_name).lower()

def _get_consumed(start_time):
    return timeutils.delta_seconds(start_time, timeutils.utcnow())

def get_obj_in_args(check_obj, *args, **kwargs):
    for arg in args:
        val = check_obj(arg)
        if val is not None:
            return val

    for arg in kwargs.values():
        val = check_obj(arg)
        if val is not None:
            return val
    return None

def await_process(timeout, sleeping_time, op_name, check_object):
    """"Awaiting something in cluster."""
    def decorator(func):
        @functools.wraps(func)
        def handler(*args, **kwargs):
            start_time = timeutils.utcnow()
            cluster = get_obj_in_args(check_object, *args, **kwargs)

            while _get_consumed(start_time) < timeout:
                consumed = _get_consumed(start_time)
                if func(*args, **kwargs):
                    LOG.info(
                        _LI("Operation %(op_name)s was successfully executed "
                            "in seconds: %(sec)s"), {'op_name': op_name,
                                                     'sec': consumed})
                    return

                if not check_cluster_exists(cluster):
                    return

                context.sleep(sleeping_time)

            raise e.TimeoutException(timeout, op_name)
        return handler
    return decorator


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

<title>Source code</title>
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

001package squidpony;
002
003import com.badlogic.gdx.utils.Json;
004import com.badlogic.gdx.utils.JsonValue;
005import com.badlogic.gdx.utils.JsonWriter;
006import regexodus.Pattern;
007import squidpony.squidgrid.Direction;
008import squidpony.squidgrid.Radius;
009import squidpony.squidmath.*;
010
011import java.util.*;
012
013/**
014 * Augmented version of LibGDX's Json class that knows how to handle various data types common in SquidLib.
015 * This includes OrderedMap, which notably allows non-String keys (LibGDX's default Map serializer requires keys to be
016 * Strings), but does not currently allow the IHasher to be set (which only should affect OrderedMaps with array keys).
017 * It also makes significantly shorter serialized output for 2D char arrays, GreasedRegion and FakeLanguageGen objects,
018 * and various collections (IntDoubleOrderedMap, IntVLA, Arrangement, K2, and K2V1 at least).
019 * Created by Tommy Ettinger on 1/9/2017.
020 */
021public class DataConverter extends Json {
022    /**
023     * Creates a new DataConverter using "minimal" output type, so it omits double quotes whenever possible but gives
024     * up compatibility with most other JSON readers. Give the constructor
025     * {@link com.badlogic.gdx.utils.JsonWriter.OutputType#json} if you need full compatibility.
026     */
027    public DataConverter() {
028        super();
029        initialize(this);
030    }
031
032    /**
033     * Creates a new DataConverter with the given OutputType; typically minimal is fine, but compatibility may require
034     * you to use json; the javascript type is a sort of middle ground.
035     * @param outputType a JsonWriter.OutputType enum value that determines what syntax can be omitted from the output
036     */
037    public DataConverter(JsonWriter.OutputType outputType) {
038        super(outputType);
039        initialize(this);
040    }
041
042    public static final Object INVALID = Float.NaN;
043
044    public static void initialize(Json json)
045    {
046        json.addClassTag("#St", String.class);
047        json.addClassTag("#Z", Boolean.class);
048        json.addClassTag("#z", boolean.class);
049        json.addClassTag("#B", Byte.class);
050        json.addClassTag("#b", byte.class);
051        json.addClassTag("#S", Short.class);
052        json.addClassTag("#s", short.class);
053        json.addClassTag("#C", Character.class);
054        json.addClassTag("#c", char.class);
055        json.addClassTag("#I", Integer.class);
056        json.addClassTag("#i", int.class);
057        json.addClassTag("#F", Float.class);
058        json.addClassTag("#f", float.class);
059        json.addClassTag("#L", Long.class);
060        json.addClassTag("#l", long.class);
061        json.addClassTag("#D", Double.class);
062        json.addClassTag("#d", double.class);
063        json.addClassTag("#SSet", SortedSet.class);
064        json.addClassTag("#Patt", Pattern.class);
065        json.addClassTag("#Grea", GreasedRegion.class);
066        json.addClassTag("#IDOM", IntDoubleOrderedMap.class);
067        json.addClassTag("#Lang", FakeLanguageGen.class);
068        json.addClassTag("#LnAl", FakeLanguageGen.Alteration.class);
069        json.addClassTag("#LnMd", FakeLanguageGen.Modifier.class);
070        json.addClassTag("#SSMp", StringStringMap.class);
071        json.addClassTag("#OMap", OrderedMap.class);
072        json.addClassTag("#OSet", OrderedSet.class);
073        json.addClassTag("#Aran", Arrangement.class);
074        json.addClassTag("#K2", K2.class);
075        json.addClassTag("#K2V1", K2V1.class);
076        json.addClassTag("#IVLA", IntVLA.class);
077        json.addClassTag("#SVLA", ShortVLA.class);
078        json.addClassTag("#RNG", RNG.class);
079        json.addClassTag("#SRNG", StatefulRNG.class);
080        json.addClassTag("#EdiR", EditRNG.class);
081        json.addClassTag("#DhaR", DharmaRNG.class);
082        json.addClassTag("#DecR", DeckRNG.class);
083        json.addClassTag("#Ligh", LightRNG.class);
084        json.addClassTag("#LonP", LongPeriodRNG.class);
085        json.addClassTag("#Thun", ThunderRNG.class);
086        json.addClassTag("#XoRo", XoRoRNG.class);
087        json.addClassTag("#XorR", XorRNG.class);
088        json.addClassTag("#Strm", CrossHash.Storm.class);
089        json.addClassTag("#Dir", Direction.class);
090        json.addClassTag("#Rad", Radius.class);
091
092        json.setSerializer(Pattern.class, new Json.Serializer<Pattern>() {
093            @Override
094            public void write(Json json, Pattern object, Class knownType) {
095                if(object == null)
096                {
097                    json.writeValue(null);
098                    return;
099                }
100                json.writeValue((Object) object.serializeToString(), String.class);
101            }
102
103            @Override
104            public Pattern read(Json json, JsonValue jsonData, Class type) {
105                if(jsonData == null || jsonData.isNull()) return null;
106                String data = jsonData.asString();
107                if(data == null || data.length() < 2) return null;
108                return Pattern.deserializeFromString(data);
109            }
110        });
111
112        json.setSerializer(GreasedRegion.class, new Json.Serializer<GreasedRegion>() {
113            @Override
114            public void write(Json json, GreasedRegion object, Class knownType) {
115                if(object == null)
116                {
117                    json.writeValue(null);
118                    return;
119                }
120                json.writeObjectStart();
121                json.writeObjectStart("items", GreasedRegion.class, GreasedRegion.class);
122                json.writeValue("w", object.width);
123                json.writeValue("h", object.height);
124                json.writeValue("d", object.data);
125                json.writeObjectEnd();
126                json.writeObjectEnd();
127            }
128
129            @Override
130            public GreasedRegion read(Json json, JsonValue jsonData, Class type) {
131                if(jsonData == null || jsonData.isNull()) return null;
132                return new GreasedRegion(jsonData.get("d").asLongArray(), jsonData.getInt("w"), jsonData.getInt("h"));
133            }
134        });
135        json.setSerializer(IntVLA.class, new Json.Serializer<IntVLA>() {
136            @Override
137            public void write(Json json, IntVLA object, Class knownType) {
138                if(object == null)
139                {
140                    json.writeValue(null);
141                    return;
142                }
143                json.writeValue(object.toArray(), int[].class);
144            }
145
146            @Override
147            public IntVLA read(Json json, JsonValue jsonData, Class type) {
148                if(jsonData == null || jsonData.isNull()) return null;
149                return new IntVLA(jsonData.asIntArray());
150            }
151        });
152
153        json.setSerializer(IntDoubleOrderedMap.class, new Json.Serializer<IntDoubleOrderedMap>() {
154            @Override
155            public void write(Json json, IntDoubleOrderedMap object, Class knownType) {
156                if(object == null)
157                {
158                    json.writeValue(null);
159                    return;
160                }
161                json.writeObjectStart();
162                json.writeArrayStart("k");
163                IntDoubleOrderedMap.KeyIterator ki = object.keySet().iterator();
164                while (ki.hasNext())
165                    json.writeValue(ki.nextInt());
166                json.writeArrayEnd();
167                json.writeArrayStart("v");
168                IntDoubleOrderedMap.DoubleIterator vi = object.values().iterator();
169                while (vi.hasNext())
170                    json.writeValue(vi.nextDouble());
171                json.writeArrayEnd();
172                json.writeValue("f", object.f);
173                json.writeObjectEnd();
174            }
175
176            @Override
177            public IntDoubleOrderedMap read(Json json, JsonValue jsonData, Class type) {
178                if(jsonData == null || jsonData.isNull()) return null;
179                return new IntDoubleOrderedMap(jsonData.get("k").asIntArray(), jsonData.get("v").asDoubleArray(), jsonData.getFloat("f"));
180            }
181        });
182
183        json.setSerializer(StringStringMap.class, new Json.Serializer<StringStringMap>() {
184            @Override
185            public void write(Json json, StringStringMap object, Class knownType) {
186                if(object == null)
187                {
188                    json.writeValue(null);
189                    return;
190                }
191                json.writeObjectStart();
192                json.writeValue("k", object.keysAsOrderedSet(), OrderedSet.class, String.class);
193                json.writeValue("v", object.valuesAsList(), ArrayList.class, String.class);
194                json.writeValue("f", object.f);
195                json.writeObjectEnd();
196            }
197
198            @Override
199            @SuppressWarnings("unchecked")
200            public StringStringMap read(Json json, JsonValue jsonData, Class type) {
201                if(jsonData == null || jsonData.isNull()) return null;
202                return new StringStringMap(json.readValue(OrderedSet.class, String.class, jsonData.get("k")),
203                        json.readValue(ArrayList.class, String.class, jsonData.get("v")), jsonData.getFloat("f"));
204            }
205        });
206
207        json.setSerializer(OrderedMap.class, new Json.Serializer<OrderedMap>() {
208            @Override
209            public void write(Json json, OrderedMap object, Class knownType) {
210                if(object == null)
211                {
212                    json.writeValue(null);
213                    return;
214                }
215                json.writeObjectStart();
216                json.writeValue("f", object.f);
217                if(!object.isEmpty()) {
218                    json.writeValue("k", object.firstKey(), null);
219                    json.writeValue("v", object.getAt(0), null);
220                    int sz = object.size();
221                    Object[] r = new Object[(sz - 1) * 2];
222                    for (int i = 1, p = 0; i < sz; i++) {
223                        r[p++] = object.keyAt(i);
224                        r[p++] = object.getAt(i);
225                    }
226                    json.writeValue("r", r, Object[].class, Object.class);
227                }
228                json.writeObjectEnd();
229            }
230
231            @Override
232            @SuppressWarnings("unchecked")
233            public OrderedMap read(Json json, JsonValue jsonData, Class type) {
234                if(jsonData == null || jsonData.isNull()) return null;
235                float f = json.readValue("f", float.class, jsonData);
236                Object k = json.readValue("k", null, INVALID, jsonData);
237                Object v = json.readValue("v", null, INVALID, jsonData);
238                Object[] r = json.readValue("r", Object[].class, jsonData);
239                if(k == INVALID)
240                    return new OrderedMap(0, f);
241                return Maker.makeOM(f, k, v, r);
242                //return new OrderedMap(json.readValue(OrderedSet.class, jsonData.get("k")),
243                //        json.readValue(ArrayList.class, jsonData.get("v")), jsonData.getFloat("f"));
244            }
245        });
246
247        json.setSerializer(EnumMap.class, new Json.Serializer<EnumMap>() {
248            @Override
249            public void write(Json json, EnumMap object, Class knownType) {
250                if(object == null)
251                {
252                    json.writeValue(null);
253                    return;
254                }
255                json.writeObjectStart();
256                if(!object.isEmpty()) {
257                    Iterator it = object.entrySet().iterator();
258                    Map.Entry en = (Map.Entry)it.next();
259                    json.writeValue("e", en.getKey(), Enum.class);
260                    json.writeValue("v", en.getValue(), null);
261                    int sz = object.size();
262                    Object[] r = new Object[(sz - 1) * 2];
263                    for (int i = 1, p = 0; i < sz; i++) {
264                        if(!it.hasNext())
265                            break;
266                        en = (Map.Entry)it.next();
267                        r[p++] = en.getKey();
268                        r[p++] = en.getValue();
269                    }
270                    json.writeValue("r", r, Object[].class, Object.class);
271                }
272                json.writeObjectEnd();
273            }
274
275            @Override
276            @SuppressWarnings("unchecked")
277            public EnumMap read(Json json, JsonValue jsonData, Class type) {
278                if(jsonData == null || jsonData.isNull() || jsonData.size == 0) return null;
279                return new EnumMap(Maker.makeOM(0.75f,
280                        json.readValue("e", null, jsonData),
281                        json.readValue("v", null, jsonData),
282                        json.readValue("r", Object[].class, jsonData)));
283                //return new OrderedMap(json.readValue(OrderedSet.class, jsonData.get("k")),
284                //        json.readValue(ArrayList.class, jsonData.get("v")), jsonData.getFloat("f"));
285            }
286        });
287
288        json.setSerializer(Arrangement.class, new Json.Serializer<Arrangement>() {
289            @Override
290            public void write(Json json, Arrangement object, Class knownType) {
291                if(object == null)
292                {
293                    json.writeValue(null);
294                    return;
295                }
296                json.writeObjectStart();
297                json.writeValue("k", object.keysAsOrderedSet(), OrderedSet.class);
298                json.writeValue("f", object.f);
299                json.writeObjectEnd();
300            }
301
302            @Override
303            @SuppressWarnings("unchecked")
304            public Arrangement read(Json json, JsonValue jsonData, Class type) {
305                if(jsonData == null || jsonData.isNull()) return null;
306                return new Arrangement(json.readValue(OrderedSet.class, jsonData.get("k")), jsonData.getFloat("f"));
307            }
308        });
309
310        json.setSerializer(K2.class, new Json.Serializer<K2>() {
311            @Override
312            public void write(Json json, K2 object, Class knownType) {
313                if(object == null)
314                {
315                    json.writeValue(null);
316                    return;
317                }
318                json.writeObjectStart();
319                json.writeValue("a", object.getSetA(), SortedSet.class);
320                json.writeValue("b", object.getSetB(), SortedSet.class);
321                json.writeObjectEnd();
322            }
323
324            @Override
325            @SuppressWarnings("unchecked")
326            public K2 read(Json json, JsonValue jsonData, Class type) {
327                if(jsonData == null || jsonData.isNull()) return null;
328                return new K2(json.readValue(SortedSet.class, jsonData.get("a")), json.readValue(SortedSet.class, jsonData.get("b")));
329            }
330        });
331
332        json.setSerializer(K2V1.class, new Json.Serializer<K2V1>() {
333            @Override
334            public void write(Json json, K2V1 object, Class knownType) {
335                if(object == null)
336                {
337                    json.writeValue(null);
338                    return;
339                }
340                json.writeObjectStart();
341                json.writeValue("a", object.getSetA(), SortedSet.class);
342                json.writeValue("b", object.getSetB(), SortedSet.class);
343                json.writeValue("q", object.getListQ(), ArrayList.class);
344                json.writeObjectEnd();
345            }
346
347            @Override
348            @SuppressWarnings("unchecked")
349            public K2V1 read(Json json, JsonValue jsonData, Class type) {
350                if(jsonData == null || jsonData.isNull()) return null;
351                return new K2V1(
352                        json.readValue(SortedSet.class, jsonData.get("a")),
353                        json.readValue(SortedSet.class, jsonData.get("b")),
354                        json.readValue(ArrayList.class, jsonData.get("q")));
355            }
356        });
357
358        json.setSerializer(char[][].class, new Json.Serializer<char[][]>() {
359            @Override
360            public void write(Json json, char[][] object, Class knownType) {
361                if(object == null)
362                {
363                    json.writeValue(null);
364                    return;
365                }
366                int sz = object.length;
367                json.writeArrayStart();
368                for (int i = 0; i < sz; i++) {
369                    json.writeValue(String.valueOf(object[i]));
370                }
371                json.writeArrayEnd();
372            }
373
374            @Override
375            public char[][] read(Json json, JsonValue jsonData, Class type) {
376                if(jsonData == null || jsonData.isNull())
377                    return null;
378                int sz = jsonData.size;
379                char[][] data = new char[sz][];
380                JsonValue c = jsonData.child();
381                for (int i = 0; i < sz && c != null; i++, c = c.next()) {
382                    data[i] = c.asString().toCharArray();
383                }
384                return data;
385            }
386        });
387        json.setSerializer(FakeLanguageGen.class, new Json.Serializer<FakeLanguageGen>() {
388            @Override
389            public void write(Json json, FakeLanguageGen object, Class knownType) {
390                if(object == null)
391                {
392                    json.writeValue(null);
393                    return;
394                }
395                json.writeValue(object.serializeToString());
396            }
397
398            @Override
399            public FakeLanguageGen read(Json json, JsonValue jsonData, Class type) {
400                if(jsonData == null || jsonData.isNull())
401                    return null;
402                return FakeLanguageGen.deserializeFromString(jsonData.asString());
403            }
404        });
405    }
406}


text:
#ifndef TextPath_h
#define TextPath_h

namespace blink {

enum CodePath { SimplePath, ComplexPath };

}

#endif // TextPath_h


text:
NSString * const LSUnexpectedRequest = @"Unexpected Request";

@interface LSNocilla ()
@property (nonatomic, strong) NSMutableArray *mutableRequests;
@property (nonatomic, strong) NSMutableArray *hooks;
@property (nonatomic, assign, getter = isStarted) BOOL started;

- (void)loadHooks;
- (void)unloadHooks;
- (void)loadNSURLConnectionHook;
@end

static LSNocilla *sharedInstace = nil;

@implementation LSNocilla

+ (LSNocilla *)sharedInstance {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedInstace = [[self alloc] init];
    });
    return sharedInstace;
}

- (id)init {
    self = [super init];
    if (self) {
        _mutableRequests = [NSMutableArray array];
        _hooks = [NSMutableArray array];
    }
    return self;
}

- (NSArray *)stubbedRequests {
    return [NSArray arrayWithArray:self.mutableRequests];
}

- (void)start {
    if (!self.isStarted){
        [self loadHooks];
        self.started = YES;
    }
}

- (void)stop {
    [self unloadHooks];
    [self clearStubs];
    self.started = NO;
}

- (void)addStubbedRequest:(LSStubRequest *)request {
    [self.mutableRequests addObject:request];
}

- (void)clearStubs {
    [self.mutableRequests removeAllObjects];
}

#pragma mark - Private
- (void)loadHooks {
    [self loadNSURLConnectionHook];
}

- (void)unloadHooks {
    for (LSHTTPClientHook *hook in self.hooks) {
        [hook unload];
    }
}

- (void)loadNSURLConnectionHook {
    LSHTTPClientHook *hook = [[LSNSURLHook alloc] init];
    [self.hooks addObject:hook];
    [hook load];
}

@end


text:
<!DOCTYPE html>

<meta charset="iso-8859-1">

<link href="css" rel="stylesheet">

Draggable

Drag me around


text:
{% extends "base.html" %}

{% block body %}

Thank you for registration.

{% endblock body %}


text:
create schema Test
go
create schema TestStage
go

drop table if exists [Test].[Student]
drop table if exists [TestStage].[Student]

IF EXISTS (SELECT * FROM sys.partition_schemes WHERE name = 'ps_ETLId')
	DROP PARTITION SCHEME ps_ETLId ;

IF EXISTS (SELECT * FROM sys.partition_functions WHERE name = 'pf_ETLId')
	DROP PARTITION function pf_ETLId;

--create partition function
CREATE PARTITION FUNCTION [pf_ETLId](int) AS RANGE LEFT FOR VALUES (1, 2)

--create partition schema
CREATE PARTITION SCHEME [ps_ETLId] AS PARTITION [pf_ETLId] ALL TO ([Primary])

--create table
CREATE TABLE [Test].[Student](
	[StudentID] int identity not null,
	StudentName  varchar(20) not null,
	EtlID  int not null
 CONSTRAINT [PK_Student] Primary Key
(
	[StudentID] ASC,
	[EtlId] ASC
)ON [ps_ETLId] ([EtlId] )
) ON [ps_ETLId] ([EtlId]);
go

SELECT
	pstats.partition_number AS PartitionNumber
	,pstats.row_count AS PartitionRowCount
FROM sys.dm_db_partition_stats AS pstats
WHERE pstats.object_id = OBJECT_ID('Test.Student')
ORDER BY PartitionNumber;

CREATE NONCLUSTERED INDEX ix_Student_StudnetID ON Test.student ([StudentID] ASC)
CREATE NONCLUSTERED INDEX ix_Student_StudnetName  ON Test.student ([StudentName] ASC)
go

--let us say we already have some data in the
insert into [Test].[Student]
select 'Lisa', 1
union
select 'Wenlei', 1

--let us say we do second incremental load, first need to load to stage
drop table if exists TestStage.Student
select * into TestStage.Student  from [Test].[Student] where 2=1   --create a table based  on Student but not include content

--add constraint to this table
--alter table TestStage.Student
--drop constraint  pk_stage_student

alter table TestStage.Student
--add constraint pk_stage_student primary key  ([StudentID],[EtlId])
add CONSTRAINT pk_stage_student Primary key ([StudentID],[EtlId]) on [ps_ETLId] ([EtlId])

--this is need if you need to do a switch
alter table TestStage.Student
add constraint chk_stage_student check (EtlID =2)

declare @id_begin int = (select max(Studentid) from [Test].[Student] ) +1
DBCC CHECKIDENT ('TestStage.Student', RESEED, @id_begin) WITH NO_INFOMSGS;

insert into TestStage.Student  --select * from
select  'Donald Trump', 2

SELECT
	pstats.partition_number AS PartitionNumber
	,pstats.row_count AS PartitionRowCount
FROM sys.dm_db_partition_stats AS pstats
WHERE pstats.object_id = OBJECT_ID('TestStage.Student')
ORDER BY PartitionNumber;

--if your table is big, it is good for performance purpose to drop index and recreate those after ETL complete.
drop index Test.student.ix_Student_StudnetID
drop index Test.student.ix_Student_StudnetName

select * from Test.Student
ALTER TABLE TestStage.Student SWITCH PARTITION 2  TO Test.Student PARTITION 2;
select * from Test.Student

--add back the non clustered index
CREATE NONCLUSTERED INDEX ix_Student_StudnetID ON Test.student ([StudentID] ASC)
CREATE NONCLUSTERED INDEX ix_Student_StudnetName  ON Test.student ([StudentName] ASC)

drop table TestStage.Student

--can you remove PK as well, answer is no  for switch

--switch diable index  and enable index spc_EnableOrDisableNonClusteredIndexes

--what if out of boundry
	ALTER PARTITION SCHEME ps_ETLAggregateId
		NEXT USED [PRIMARY];
ALTER PARTITION FUNCTION pf_EtlID () SPLIT RANGE (3);

SELECT
	pstats.partition_number AS PartitionNumber
	,pstats.row_count AS PartitionRowCount
FROM sys.dm_db_partition_stats AS pstats
WHERE pstats.object_id = OBJECT_ID('Test.Student')
ORDER BY PartitionNumber;

drop table if exists TestStage.Student
select * into TestStage.Student  from [Test].[Student] where 2=1

alter table TestStage.Student
--add constraint pk_stage_student primary key  ([StudentID],[EtlId])
add CONSTRAINT pk_stage_student Primary key ([StudentID],[EtlId]) on [ps_ETLId] ([EtlId])

--alter table TestStage.Student
--drop constraint chk_stage_student

alter table TestStage.Student
add constraint chk_stage_student check (EtlID =3)

SELECT
	pstats.partition_number AS PartitionNumber
	,pstats.row_count AS PartitionRowCount
FROM sys.dm_db_partition_stats AS pstats
WHERE pstats.object_id = OBJECT_ID('Teststage.Student')
ORDER BY PartitionNumber;

--now you are ready for next cycle

declare @id_begin2 int = (select max(Studentid) from [Test].[Student] ) +1
DBCC CHECKIDENT ('TestStage.Student', RESEED, @id_begin2) WITH NO_INFOMSGS;

insert into TestStage.Student
select  'Bill Clinton', 3
select * from TestStage.Student

drop index Test.student.ix_Student_StudnetID
drop index Test.student.ix_Student_StudnetName

select * from Test.Student
ALTER TABLE TestStage.Student SWITCH PARTITION 3  TO Test.Student PARTITION 3;
select * from Test.Student

--add back the non clustered index
CREATE NONCLUSTERED INDEX ix_Student_StudnetID ON Test.student ([StudentID] ASC)
CREATE NONCLUSTERED INDEX ix_Student_StudnetName  ON Test.student ([StudentName] ASC)

truncate table TestStage.Student

--make this change dynamic
/*****************
pseudo code
1. maintain a ETL execution table, get next id from there.
2. create dynamic sql from above hard coded script to handle etlID increment, different table,index created and drop
**************/

--for example to add one more partition

declare @etlid int  = (select max(etlid) +1  from yourETLtable),
@sql = 'ALTER PARTITION FUNCTION pf_EtlID () SPLIT RANGE (' + cast(@etlid as varchar(10)) +');'
exec (@sql)

/************************
--clean up
drop table if exists [Test].[Student]
drop table if exists [TestStage].[Student]
IF EXISTS (SELECT * FROM sys.partition_schemes WHERE name = 'ps_ETLId')
	DROP PARTITION SCHEME ps_ETLId ;

IF EXISTS (SELECT * FROM sys.partition_functions WHERE name = 'pf_ETLId')
	DROP PARTITION function pf_ETLId;
go
drop schema Test
go
drop schema TestStage
go
****************************/


text:
CREATE TABLE Author (
    id INTEGER PRIMARY KEY,
    name VARCHAR(40)
);

CREATE TABLE Genre (
    id INTEGER PRIMARY KEY,
    name VARCHAR(20) UNIQUE
);

CREATE TABLE Book (
    id INTEGER PRIMARY KEY,
    title VARCHAR(60) NOT NULL,
    author_id INTEGER NOT NULL,
    genre_id INTEGER NOT NULL,
    FOREIGN KEY (author_id) REFERENCES Author (id) ON UPDATE CASCADE ON DELETE CASCADE,
    FOREIGN KEY (genre_id) REFERENCES Genre (id) ON UPDATE CASCADE ON DELETE SET NULL
);

INSERT INTO Author (name) VALUES
 ('J.R.R. Tolkein'),
 ('J.K. Rowling'),
 ('George Orwell')
;

INSERT INTO Genre (name) VALUES
 ('Science Fiction'),
 ('Fantasy')
;

INSERT INTO Book (author_id, genre_id, title) VALUES
 (1, 2, 'The Lord of the Rings: The Fellowship of the Ring'),
 (1, 2, 'The Lord of the Rings: The Two Towers'),
 (1, 2, 'The Lord of the Rings: The Return of the King'),
 (2, 2, 'Harry Potter and the Philosopher''s Stone'),
 (2, 2, 'Harry Potter and the Chamber of Secrets'),
 (2, 2, 'Harry Potter and the Prisoner of Azkaban'),
 (2, 2, 'Harry Potter and the Goblet of Fire'),
 (2, 2, 'Harry Potter and the Order of the Phoenix'),
 (2, 2, 'Harry Potter and the Half-Blood Prince'),
 (3, 1, 'Animal Farm')
;


text:
/**
* @author Alexander V. Astapchuk
*/

package org.apache.harmony.security.tests.java.security;
import java.security.*;
import java.security.cert.CertPath;
import java.util.Date;

import org.apache.harmony.security.tests.support.cert.MyCertPath;

import junit.framework.TestCase;

/**
 * Tests for Timestamp class fields and methods
 *
 */

public class TimestampTest extends TestCase {

    private Date now = new Date();

    private static final byte[] encoding = { 1, 2, 3 };

    private CertPath cpath = new MyCertPath(encoding);

    public void testTimestamp() {
        try {
            new Timestamp(null, cpath);
            fail("null was accepted");
        } catch (NullPointerException ex) { /* ok */
        }

        try {
            new Timestamp(now, null);
            fail("null was accepted");
            return;
        } catch (NullPointerException ex) { /* ok */
        }
    }

    /*
     * Class under test for boolean equals(Object)
     */
    public void testEqualsObject() {
        Timestamp one = new Timestamp(now, cpath);
        Timestamp two = new Timestamp(now, cpath);

        assertTrue(one.equals(one));
        assertTrue(one.equals(two));
        assertTrue(two.equals(one));
        assertFalse(one.equals(null));
        assertFalse(one.equals(new Object()));

        Timestamp two1 = new Timestamp(new Date(9999), cpath);
        assertFalse(one.equals(two1));
        assertTrue(two1.equals(two1));
    }

    public void testGetSignerCertPath() {
        assertSame(new Timestamp(now, cpath).getSignerCertPath(), cpath);
    }

    public void testGetTimestamp() {
    	Timestamp t = new Timestamp(now, cpath);
        assertEquals(now, t.getTimestamp());
        assertNotSame(now, t.getTimestamp());
    }

    /*
     * Class under test for String toString()
     */
    public void testToString() {
        new Timestamp(now, cpath).toString();
    }

}


text:
using namespace sp;
using namespace debug;
using namespace graphics;
using namespace maths;

using namespace entity;
using namespace component;

using namespace API;

#if 0

DeferredTest::DeferredTest()
	: Layer3D(new Scene())
{
	m_Rotation = 0.0f;
	m_SetUniforms[0] = true;
	m_SetUniforms[1] = true;
}

DeferredTest::~DeferredTest()
{
}

static vec3 g_CubeTransform(-4, 0, 0);
static vec3 g_LightDir(0.5f, 2, 2);
static float roughness = 0.5f;
static Material* material;

static Scene* g_Scene;

void DeferredTest::OnInit(Renderer3D& renderer, Scene& scene)
{
	g_Scene = &scene;

	Texture* crate = TextureManager::Add(Texture2D::CreateFromFile("Crate", "res/Crate.jpg"));

	m_Scene = &scene;
	material = new Material(Shader::CreateFromFile("AdvancedLighting", "shaders/AdvancedLighting.shader"));

	MaterialInstance* cubeMaterial = new MaterialInstance(material);
	cubeMaterial->SetUniform("u_Roughness", 0.5f);

	m_Cube = new Entity();
	Model* cubeModel = new Model("res/Cube.obj", cubeMaterial);
	m_Cube->AddComponent(new MeshComponent(cubeModel->GetMesh()));
	m_Cube->AddComponent(new TransformComponent(mat4::Identity()));

	m_Plane = new Entity();
	m_Plane->AddComponent(new MeshComponent(MeshFactory::CreatePlane(128, 128, vec3(0, 1, 0), new MaterialInstance(material))));
	m_Plane->AddComponent(new TransformComponent(mat4::Identity()));

	m_Scene->Add(m_Cube);
	m_Scene->Add(m_Plane);

	Entity* obj = new Entity();
	Model* objModel = new Model("res/Plane.obj", new MaterialInstance(material));
	obj->AddComponent(new MeshComponent(objModel->GetMesh()));
	obj->AddComponent(new TransformComponent(mat4::Identity()));
	m_Scene->Add(obj);

	LightSetup* lights = new LightSetup();
	lights->Add(new Light(vec3(0.8f)));
	m_Scene->PushLightSetup(lights);

	DebugMenu::Add("Cube", &g_CubeTransform, -20.0f, 20.0f);
	DebugMenu::Add("LightDir", &g_LightDir, -20.0f, 20.0f);
	DebugMenu::Add("Light Pos", &lights->GetLights()[0]->position, -20.0f, 40.0f);
	DebugMenu::Add("Light Atten.", &lights->GetLights()[0]->intensity, 0, 100);
	DebugMenu::Add("Roughness", &roughness, 0, 1);

	DeferredRenderer& r = (DeferredRenderer&)renderer;
//	DebugLayer::GetInstance()->Add(new Sprite(0, 0, 8, 4.5f, new Texture2D(r.GetGBuffer().GetTexture(0))));
}

void DeferredTest::OnTick()
{
	Application& app = Application::GetApplication();
	SP_INFO(app.GetUPS(), " ups, ", app.GetFPS(), " fps");
}

void DeferredTest::OnUpdate(const Timestep& ts)
{
	material->SetUniform("u_CameraPos", m_Scene->GetCamera()->GetPosition());

	TransformComponent* cubeTransform = m_Cube->GetComponent<TransformComponent>();
	// TransformComponent* sphereTransform = m_Sphere->GetComponent<TransformComponent>();

	mat4 transform = mat4::Translate(vec3(0, 2.5f, 0)) * mat4::Rotate(m_Rotation, vec3(1, 0, 0)) * mat4::Rotate(m_Rotation, vec3(0, 1, 0)) * mat4::Rotate(m_Rotation, vec3(0, 0, 1));
	cubeTransform->transform = mat4::Translate(g_CubeTransform) * transform * mat4::Scale(vec3(1.4f, 1.4f, 1.4f));
	// sphereTransform->transform = mat4::Translate(vec3(4, 0, 0)) * transform;
	//m_Rotation++;

	material->SetUniform("u_Roughness", roughness);
}

void DeferredTest::OnRender(Renderer3D& renderer)
{
	Layer3D::OnRender(renderer);
}

void DeferredTest::OnEvent(sp::events::Event& event)
{
}

#endif


text:
package io.fabric8.mq.controller.protocol.openwire;

import io.fabric8.mq.controller.AsyncExecutors;
import io.fabric8.mq.controller.protocol.ProtocolTransport;
import io.fabric8.mq.controller.protocol.ProtocolTransportFactory;
import org.apache.activemq.openwire.OpenWireFormat;
import org.apache.activemq.openwire.OpenWireFormatFactory;
import org.apache.activemq.transport.TransportFactory;
import org.apache.activemq.transport.TransportServer;
import org.apache.activemq.wireformat.WireFormatFactory;
import org.vertx.java.core.Vertx;

import java.io.IOException;
import java.net.URI;

public class OpenWireTransportFactory extends TransportFactory implements ProtocolTransportFactory {
    protected WireFormatFactory wireFormatFactory = new OpenWireFormatFactory();

    public ProtocolTransport connect(Vertx vertx, AsyncExecutors asyncExecutors, String name) throws IOException {
        OpenWireFormat wireFormat = (OpenWireFormat) wireFormatFactory.createWireFormat();
        //OpenWireFormat wireFormat = new OpenWireFormat(1);
        OpenWireTransport openWireTransport = new OpenWireTransport(vertx, asyncExecutors, name, wireFormat);
        return openWireTransport;
    }

    @Override
    public TransportServer doBind(URI uri) throws IOException {
        return null;
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Coverage Report</title>
<link title="Style" type="text/css" rel="stylesheet" href="css/main.css"/>

Coverage Report - org.mybatis.generator.api.dom.DefaultXmlFormatter

  Classes in this File	  Line Coverage	  Branch Coverage	  Complexity

DefaultXmlFormatter

0%

0/4

N/A

N/A

	1.0;1

   1

   16

 package org.mybatis.generator.api.dom;

   17

   18

 import org.mybatis.generator.api.XmlFormatter;

   19

 import org.mybatis.generator.api.dom.xml.Document;

   20

 import org.mybatis.generator.config.Context;

   21

   22

 /**

   23

  * This class is the default formatter for generated XML.  This class will use the

   24

  * built in formatting of the DOM classes directly.

   25

  *

   26

  * @author Jeff Butler

   27

  *

   28

  */

   29	   0
 public class DefaultXmlFormatter implements XmlFormatter {

   30

     protected Context context;

   31

   32

     public String getFormattedContent(Document document) {

   33	   0
         return document.getFormattedContent();

   34

     }

   35

   36

     public void setContext(Context context) {

   37	   0
         this.context = context;

   38	   0
     }

   39

 }

Report generated by Cobertura 2.0.3 on 14-12-20 上午9:21.


text:
class ConceptsController < ApplicationController

	def create
		@concept = Concept.new(params[:concept].permit(:sentence, :translation, :tags))

		@concept.save
		redirect_to :admin_concepts
	end

	def edit
		@concept = Concept.find(params[:id])

	end

	def destroy
		@concept = Concept.find(params[:id])
		@concept.destroy

		redirect_to :admin_concepts
	end
end


text:
#include "console/inputdlg.h"

InputDialog::InputDialog (Screen& screen, const char *pCaption, const char *pPrompt,
			  char *pText, int length, History *pHist) :
    Popup (screen, 80, 7)
{
    draw (pCaption, pPrompt);
    mpEdit = new Edit (screen, mX + 2, mY + 3, 76, pText, length, pHist);
    if (mpEdit == 0)
	throw AppException (WHERE, ERR_OUT_OF_MEMORY);
}

InputDialog::~InputDialog ()
{
    delete mpEdit;
}

void InputDialog::draw (const char *pCaption, const char *pPrompt)
{
    drawBackground ();
    drawBorder (pCaption);
    writeText (2, 2, pPrompt);
    writeText (2, 5, "Press Enter to accept or Esc to cancel.");
}

void InputDialog::run ()
{
    mpEdit->run ();
    mExitKey = mpEdit->getExitCode ();
}

// End


text:
/**
 *
 */
package org.jasig.schedassist.impl.caldav.xml;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;

import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;

import net.fortuna.ical4j.data.CalendarBuilder;
import net.fortuna.ical4j.data.ParserException;
import net.fortuna.ical4j.model.Calendar;
import net.fortuna.ical4j.util.CompatibilityHints;

import org.apache.commons.io.input.TeeInputStream;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jasig.schedassist.impl.caldav.CalendarWithURI;
import org.jasig.schedassist.impl.caldav.ReportMethod;

/**
 * StaX based parser for handling the response body of {@link ReportMethod}
 * requests.
 *
 * This class has a static initializer that sets
 * {@link CompatibilityHints#KEY_RELAXED_UNFOLDING} to true.
 *
 * @author Nicholas Blair
 * @version $ Id: ReportResponseHandlerImpl.java $
 */
public class ReportResponseHandlerImpl {

	static {
		CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_UNFOLDING, true);
	}
	protected static final String WEBDAV_NS = "DAV:";
	protected static final String HREF = "href";
	protected static final String ETAG = "getetag";
	protected static final String CALDAV_NS = "urn:ietf:params:xml:ns:caldav";
	protected static final String CALENDAR_DATA = "calendar-data";
	protected final Log log = LogFactory.getLog(this.getClass());

	/**
	 * Extracts a {@link List} of {@link Calendar}s from the {@link InputStream}, if present.
	 *
	 * @param inputStream
	 * @return a never null, but possibly empty {@link List} of {@link Calendar}s from the {@link InputStream}
	 * @throws XmlParsingException in the event the stream could not be properly parsed
	 */
	public List<CalendarWithURI> extractCalendars(InputStream inputStream) {
		List<CalendarWithURI> results = new ArrayList<CalendarWithURI>();
		ByteArrayOutputStream capturedContent = null;
		XMLInputFactory factory = XMLInputFactory.newInstance();
		try {
			InputStream localReference = inputStream;
			if(log.isDebugEnabled()) {
				capturedContent = new ByteArrayOutputStream();
				localReference = new TeeInputStream(inputStream, capturedContent);
			}
			BufferedInputStream buffered = new BufferedInputStream(localReference);
			buffered.mark(1);
			int firstbyte = buffered.read();
			if(-1 == firstbyte) {
				// short circuit on empty stream
				return results;
			}
			buffered.reset();
			XMLStreamReader parser = factory.createXMLStreamReader(buffered);

			String currentUri = null;
			String currentEtag = null;
			for (int eventType = parser.next(); eventType != XMLStreamConstants.END_DOCUMENT; eventType = parser.next()) {
				switch(eventType) {
				case XMLStreamConstants.START_ELEMENT:
					QName name= parser.getName();
					if(isWebdavHrefElement(name)) {
						currentUri = parser.getElementText();
					} else if (isWebdavEtagElement(name)){
						currentEtag = parser.getElementText();
					} else if(isCalendarDataElement(name)) {
						Calendar cal = extractCalendar(parser.getElementText());
						if(cal != null) {
							CalendarWithURI withUri = new CalendarWithURI(cal, currentUri, currentEtag);
							results.add(withUri);
						} else if(log.isDebugEnabled()) {
							log.debug("extractCalendar returned null for " + currentUri + ", skipping");
						}
					}
					break;
				}
			}

			if(log.isDebugEnabled()) {
				log.debug("extracted " + results.size() + " calendar from " + capturedContent.toString());
			}

		} catch (XMLStreamException e) {
			if(capturedContent != null) {
				log.error("caught XMLStreamException in extractCalendars, captured content: " + capturedContent.toString(), e);
			} else {
				log.error("caught XMLStreamException in extractCalendars, no captured content available", e);
			}
			throw new XmlParsingException("caught XMLStreamException in extractCalendars", e);
		} catch (IOException e) {
			log.error("caught IOException in extractCalendars", e);
			throw new XmlParsingException("caught IOException in extractCalendars", e);
		}

		return results;
	}
	/**
	 *
	 * @param qname
	 * @return true if the argument is a WebDAV 'getetag' element
	 */
	protected boolean isWebdavEtagElement(QName qname) {
		if(qname == null) {
			return false;
		} else {
			return WEBDAV_NS.equals(qname.getNamespaceURI()) && ETAG.equals(qname.getLocalPart());
		}
	}
	/**
	 *
	 * @param qname
	 * @return true if the argument is a WebDAV 'href' element
	 */
	protected boolean isWebdavHrefElement(QName qname) {
		if(qname == null) {
			return false;
		} else {
			return WEBDAV_NS.equals(qname.getNamespaceURI()) && HREF.equals(qname.getLocalPart());
		}
	}
	/**
	 *
	 * @param qname
	 * @return true if the argument is a CalDAV 'calendar-data' element
	 */
	protected boolean isCalendarDataElement(QName qname) {
		if(qname == null) {
			return false;
		} else {
			return CALDAV_NS.equals(qname.getNamespaceURI()) && CALENDAR_DATA.equals(qname.getLocalPart());
		}
	}

	/**
	 *
	 * @param text
	 * @return a {@link Calendar} from the text, or null if not parseable
	 */
	protected Calendar extractCalendar(String text) {
		CalendarBuilder builder = new CalendarBuilder();
		Calendar result;
		try {
			result = builder.build(new StringReader(text));
			return result;
		} catch (IOException e) {
			log.warn("caught IOException", e);
			return null;
		} catch (ParserException e) {
			log.warn("caught ParserException", e);
			return null;
		}
	}

}


text:
// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!

#include "config.h"
#include "V8HTMLMapElement.h"

#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/V8DOMConfiguration.h"
#include "bindings/core/v8/V8HTMLCollection.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
#include "core/HTMLNames.h"
#include "core/dom/ClassCollection.h"
#include "core/dom/ContextFeatures.h"
#include "core/dom/Document.h"
#include "core/dom/TagCollection.h"
#include "core/dom/custom/CustomElementProcessingStack.h"
#include "core/html/HTMLCollection.h"
#include "core/html/HTMLDataListOptionsCollection.h"
#include "core/html/HTMLFormControlsCollection.h"
#include "core/html/HTMLTableRowsCollection.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/TraceEvent.h"
#include "wtf/GetPtr.h"
#include "wtf/RefPtr.h"

namespace blink {

// Suppress warning: global constructors, because struct WrapperTypeInfo is trivial
// and does not depend on another global objects.
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
const WrapperTypeInfo V8HTMLMapElement::wrapperTypeInfo = { gin::kEmbedderBlink, V8HTMLMapElement::domTemplate, V8HTMLMapElement::refObject, V8HTMLMapElement::derefObject, V8HTMLMapElement::trace, 0, 0, V8HTMLMapElement::preparePrototypeObject, V8HTMLMapElement::installConditionallyEnabledProperties, "HTMLMapElement", &V8HTMLElement::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::NodeClassId, WrapperTypeInfo::InheritFromEventTarget, WrapperTypeInfo::Dependent, WrapperTypeInfo::WillBeGarbageCollectedObject };
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic pop
#endif

// This static member must be declared by DEFINE_WRAPPERTYPEINFO in HTMLMapElement.h.
// For details, see the comment of DEFINE_WRAPPERTYPEINFO in
// bindings/core/v8/ScriptWrappable.h.
const WrapperTypeInfo& HTMLMapElement::s_wrapperTypeInfo = V8HTMLMapElement::wrapperTypeInfo;

namespace HTMLMapElementV8Internal {

static void nameAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    Element* impl = V8Element::toImpl(holder);
    v8SetReturnValueString(info, impl->getNameAttribute(), info.GetIsolate());
}

static void nameAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
    HTMLMapElementV8Internal::nameAttributeGetter(info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void nameAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    Element* impl = V8Element::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    impl->setAttribute(HTMLNames::nameAttr, cppValue);
}

static void nameAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Value> v8Value = info[0];
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
    CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
    HTMLMapElementV8Internal::nameAttributeSetter(v8Value, info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void areasAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    HTMLMapElement* impl = V8HTMLMapElement::toImpl(holder);
    v8SetReturnValueFast(info, WTF::getPtr(impl->areas()), impl);
}

static void areasAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
    HTMLMapElementV8Internal::areasAttributeGetter(info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

} // namespace HTMLMapElementV8Internal

static const V8DOMConfiguration::AccessorConfiguration V8HTMLMapElementAccessors[] = {
    {"name", HTMLMapElementV8Internal::nameAttributeGetterCallback, HTMLMapElementV8Internal::nameAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
    {"areas", HTMLMapElementV8Internal::areasAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
};

static void installV8HTMLMapElementTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
{
    functionTemplate->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "HTMLMapElement", V8HTMLElement::domTemplate(isolate), V8HTMLMapElement::internalFieldCount,
        0, 0,
        V8HTMLMapElementAccessors, WTF_ARRAY_LENGTH(V8HTMLMapElementAccessors),
        0, 0);
    v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
    ALLOW_UNUSED_LOCAL(instanceTemplate);
    v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
    ALLOW_UNUSED_LOCAL(prototypeTemplate);

    // Custom toString template
    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
}

v8::Local<v8::FunctionTemplate> V8HTMLMapElement::domTemplate(v8::Isolate* isolate)
{
    return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8HTMLMapElementTemplate);
}

bool V8HTMLMapElement::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
{
    return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
}

v8::Local<v8::Object> V8HTMLMapElement::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
{
    return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
}

HTMLMapElement* V8HTMLMapElement::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value)
{
    return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : 0;
}

void V8HTMLMapElement::refObject(ScriptWrappable* scriptWrappable)
{
#if !ENABLE(OILPAN)
    scriptWrappable->toImpl<HTMLMapElement>()->ref();
#endif
}

void V8HTMLMapElement::derefObject(ScriptWrappable* scriptWrappable)
{
#if !ENABLE(OILPAN)
    scriptWrappable->toImpl<HTMLMapElement>()->deref();
#endif
}

} // namespace blink