text:
import gc
import operator
import os
import random

import dozer
import flask
import objgraph

app = flask.Flask(__name__)
app.secret_key = "it's a secret to everyone"

# Dozer
app.wsgi_app = dozer.Dozer(app.wsgi_app)

#
# Our leaky app -- simulate a leak by storing some objects in a global var.
#

LEAKY = []
class Leaker(object):
    pass

@app.route('/')
def index():
    for i in range(random.randint(0, 1000)):
        LEAKY.append(Leaker())
    return "drip drip"

@app.route('/growth')
def object_growth():
    """
    Shows changes in allocations, like objgraph.show_growth(), except:

    - show_growth() prints to stdout, this is flask view.

    - this saves the peaks in the session, so that each user sees the changes
      between their last page load, not some global.

    - this function is commented :)

    """
    # We don't want our numbers crudded up by a GC cycle that hasn't run yet,
    # so force GC before we gather stats.
    gc.collect()

    # `typestats() `returns a dict of {type-name: count-of-allocations}. We'll
    # compare the current count for each type to the previous count, stored
    # in the session as `peak_stats`, and save the changes into `deltas`.
    peak_stats = flask.session.get('peak_stats', {})
    stats = objgraph.typestats()
    deltas = {}

    # For each type, look it the old count in `peak_stats`, defaulting to 0.
    # We're really only interested in *growth* -- remember, we're looking for
    # memory leaks -- so if the current count is greater than the peak count,
    # we want to return that change in `deltas` and also note the new peak
    # for later.
    for name, count in stats.iteritems():
        old_count = peak_stats.get(name, 0)
        if count > old_count:
            deltas[name] = count - old_count
            peak_stats[name] = count

    # We have to remember to store `peak_stats` back in the session, otherwise
    # Flask won't notice that it's changed.
    flask.session['peak_stats'] = peak_stats

    # Create (type-name, delta) tuples, sorted by objects with the biggest growth.
    deltas = sorted(deltas.items(), key=operator.itemgetter(1), reverse=True)

    return flask.render_template('growth.html',
        growth = deltas,
    )

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 5000)))


text:
package sql.hdfs.mapreduce;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerHelper;
import com.pivotal.gemfirexd.callbacks.Event.Type;
import com.pivotal.gemfirexd.hadoop.mapreduce.Key;
import com.pivotal.gemfirexd.hadoop.mapreduce.Row;
import com.pivotal.gemfirexd.hadoop.mapreduce.RowInputFormat;
import com.pivotal.gemfirexd.hadoop.mapreduce.RowOutputFormat;
import com.pivotal.gemfirexd.internal.engine.GfxdDataSerializable;

public class TradeNetworthHdfsDataVerifierV2 extends Configured implements Tool {

  public static class HdfsDataMapper extends  Mapper<Key, Row, Key, TradeNetworthRow> {
    public void map(Key key, Row value, Context context) throws IOException , InterruptedException{
      try {
        if ( ! value.getEventType().equals(Type.AFTER_DELETE)) {
        ResultSet rs = value.getRowAsResultSet();
        int cid=rs.getInt("cid");
        Key k = new Key();
        k.setKey(CacheServerHelper.serialize(cid));
        context.write(k, new TradeNetworthRow(cid, rs.getInt("tid"), rs.getBigDecimal("cash"), rs.getBigDecimal("securities"), rs.getInt("loanlimit"), rs.getBigDecimal("availloan")) );
        }
      } catch (SQLException se) {
        System.err.println("mapper -  -Error logging result set" + se);
        throw new  IOException(se);
      }
    }
  }

  public static class HdfsDataReducer extends  Reducer<Key, TradeNetworthRow, Key, TradeNetworthOutputObject> {
    public void reduce(Key key, Iterable<TradeNetworthRow> values, Context context) throws IOException, InterruptedException {
      try {
        for (TradeNetworthRow networth  : values ) {
          context.write(key, new TradeNetworthOutputObject(networth));
        }
      } catch (Exception e) {
        System.out.println("error in reducer " + e.getMessage());
        throw new IOException(e);
      }
  }
  }
  public static class TradeNetworthRow implements Writable  {
    int cid, tid, loanLimit;
    BigDecimal cash, securities,availLoan;

    public TradeNetworthRow (){
    }

    public TradeNetworthRow (int cid, int tid, BigDecimal cash, BigDecimal securities, int loanLimit, BigDecimal availLoan){
      this.cid=cid;
      this.tid=tid;
      this.cash=cash;
      this.securities=securities;
      this.loanLimit=loanLimit;
      this.availLoan=availLoan;
    }

    public int getCid() {
      return cid;
    }

    public void setCid(int cid) {
      this.cid = cid;
    }

    public int getTid() {
      return tid;
    }

    public void setTid(int tid) {
      this.tid = tid;
    }

    public BigDecimal getCash() {
      return cash;
    }

    public void setCash(BigDecimal cash) {
      this.cash = cash;
    }

    public BigDecimal getSecurities() {
      return securities;
    }

    public void setSecurities(BigDecimal securities) {
      this.securities = securities;
    }

    public int getLoanLimit() {
      return loanLimit;
    }

    public void setLoanLimit(int loanLimit) {
      this.loanLimit = loanLimit;
    }

    public BigDecimal getAvailLoan() {
      return availLoan;
    }

    public void setAvailLoan(BigDecimal availLoan) {
      this.availLoan = availLoan;
    }

    @Override
    public void write(DataOutput out) throws IOException {
      System.out.println("writing Networth cid: " + cid + " tid: " + tid + " cash: " + cash.toPlainString() + " securities: " + securities.toPlainString() + " loanLimit: " + loanLimit + " availLoan: " + availLoan.toPlainString());
      out.writeInt(cid);
      out.writeInt(tid);
      out.writeUTF(cash.toPlainString());
      out.writeUTF(securities.toPlainString());
      out.writeInt(loanLimit);
      out.writeUTF(availLoan.toPlainString());

    }

    @Override
    public void readFields(DataInput in) throws IOException {
      cid = in.readInt();
      tid=in.readInt();
      cash=new BigDecimal(in.readUTF());
      securities=new BigDecimal(in.readUTF());
      loanLimit=in.readInt();
      availLoan=new BigDecimal(in.readUTF());
    }
  }

  public static class TradeNetworthOutputObject  {
    int cid, tid , loanLimit;
    BigDecimal cash, securities,availLoan;

    public TradeNetworthOutputObject (){
    }

    public TradeNetworthOutputObject (int cid, int tid, BigDecimal cash, BigDecimal securities, int loanLimit, BigDecimal availLoan){
      this.cid=cid;
      this.tid=tid;
      this.cash=cash;
      this.securities=securities;
      this.loanLimit=loanLimit;
      this.availLoan=availLoan;
    }

    public TradeNetworthOutputObject (TradeNetworthRow row){
      this.cid=row.cid;
      this.tid=row.tid;
      this.cash=row.cash;
      this.securities=row.securities;
      this.loanLimit=row.loanLimit;
      this.availLoan=row.availLoan;
    }

    public void setCid(int i, PreparedStatement ps) throws SQLException {
      ps.setInt(i,cid);
    }

    public void setTid(int i, PreparedStatement ps) throws SQLException  {
      ps.setInt(i,tid);
    }

    public void setCash(int i, PreparedStatement ps) throws SQLException  {
      ps.setBigDecimal(i,cash);
    }

    public void setSecurities(int i, PreparedStatement ps) throws SQLException  {
      ps.setBigDecimal(i,securities);
    }

    public void setLoanLimit(int i, PreparedStatement ps) throws SQLException  {
      ps.setInt(i,loanLimit);
    }

    public void setAvailLoan(int i, PreparedStatement ps) throws SQLException  {
      ps.setBigDecimal(i,availLoan);
    }
  }

  public int run(String[] args) throws Exception {

    GfxdDataSerializable.initTypes();

    Configuration conf = getConf();

    String hdfsHomeDir = args[0];
    String url         = args[1];
    String tableName   = args[2];

    System.out.println("TradeNetworthHdfsDataVerifier.run() invoked with "
                       + " hdfsHomeDir = " + hdfsHomeDir
                       + " url = " + url
                       + " tableName = " + tableName);

    // Job-specific params
    conf.set(RowInputFormat.HOME_DIR, hdfsHomeDir);
    conf.set(RowInputFormat.INPUT_TABLE, tableName);
    conf.setBoolean(RowInputFormat.CHECKPOINT_MODE, false);
    conf.set(RowOutputFormat.OUTPUT_TABLE,tableName + "_HDFS");
    conf.set(RowOutputFormat.OUTPUT_URL, url);

    Job job = Job.getInstance(conf, "TradeNetworthHdfsDataVerifierV2");
    job.setJobName("TradeNetworthHdfsDataVerifierV2");
    job.setInputFormatClass(RowInputFormat.class);
    job.setOutputFormatClass(RowOutputFormat.class);

    job.setMapperClass(HdfsDataMapper.class);
    job.setMapOutputKeyClass(Key.class);
    job.setMapOutputValueClass(TradeNetworthRow.class);

    job.setReducerClass(HdfsDataReducer.class);
    job.setOutputKeyClass(Key.class);
    job.setOutputValueClass(TradeNetworthOutputObject.class);

    StringBuffer aStr = new StringBuffer();
    aStr.append("HOME_DIR = " + conf.get(RowInputFormat.HOME_DIR) + " ");
    aStr.append("INPUT_TABLE = " + conf.get(RowInputFormat.INPUT_TABLE) + " ");
    aStr.append("OUTPUT_TABLE = " + conf.get(RowOutputFormat.OUTPUT_TABLE) + " ");
    aStr.append("OUTPUT_URL = " + conf.get(RowOutputFormat.OUTPUT_URL) + " ");
    System.out.println("VerifyHdfsData running with the following conf: " + aStr.toString());

    return job.waitForCompletion(false) ? 0 : 1;
  }

  public static void main(String[] args) throws Exception {
    System.out.println("TradeNetworthHdfsDataVerifierV2.main() invoked with " + args);
    int rc = ToolRunner.run(new Configuration(),new TradeNetworthHdfsDataVerifierV2(), args);
    System.exit(rc);
  }
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>
<!--
Copyright 2016 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/tracing/base/utils.html">
<link rel="import" href="/tracing/value/diagnostics/diagnostic.html">

<script>
'use strict';

tr.exportTo('tr.v.d', function() {
  class DeviceInfo extends tr.v.d.Diagnostic {
    constructor(opt_info) {
      super();

      let info = opt_info || {};
      this.chromeVersion_ = info.chromeVersion || '';
      this.osName_ = info.osName || '';
      this.osVersion_ = info.osVersion || '';
      this.gpuInfo_ = info.gpuInfo || undefined;
      this.arch_ = info.arch || undefined;
      this.ram_ = info.ram || 0;
    }

    addToHistogram(hist) {
      hist.diagnostics.set(DeviceInfo.NAME, this);
    }

    /**
     * @param {!tr.v.Histogram} hist
     * @return {(undefined|!tr.v.d.DeviceInfo)}
     */
    static getFromHistogram(hist) {
      return hist.diagnostics.get(DeviceInfo.NAME);
    }

    clone() {
      let clone = new tr.v.d.MergedDeviceInfo();
      clone.addDiagnostic(this);
      return clone;
    }

    asDictInto_(d) {
      d.chromeVersion = this.chromeVersion;
      d.osName = this.osName;
      d.osVersion = this.osVersion;
      d.gpuInfo = this.gpuInfo;
      d.arch = this.arch;
      d.ram = this.ram;
    }

    static fromDict(d) {
      return new DeviceInfo(d);
    }

    get chromeVersion() {
      return this.chromeVersion_;
    }

    get osName() {
      return this.osName_;
    }

    get osVersion() {
      return this.osVersion_;
    }

    get gpuInfo() {
      return this.gpuInfo_;
    }

    get arch() {
      return this.arch_;
    }

    get ram() {
      return this.ram_;
    }
  }

  DeviceInfo.NAME = 'device';

  tr.v.d.Diagnostic.register(DeviceInfo, {
    elementName: 'tr-v-ui-device-info-span'
  });

  return {
    DeviceInfo,
  };
});
</script>


text:
package com.beijunyi.parallelgit.utils;

import java.io.IOException;

import com.beijunyi.parallelgit.AbstractParallelGitTest;
import org.eclipse.jgit.lib.PersonIdent;
import org.junit.Before;
import org.junit.Test;

import static com.beijunyi.parallelgit.utils.RepositoryUtils.*;
import static org.junit.Assert.*;

public class RepositoryUtilsConfigTest extends AbstractParallelGitTest {

  @Before
  public void setUp() throws IOException {
    initFileRepository(true);
  }

  @Test
  public void setDefaultCommitter_newPersonIdentInstanceShouldHaveTheSpecifiedUserNameAndEmail() throws IOException {
    String name = "test_user";
    String email = "test@user.com";
    RepositoryUtils.setDefaultCommitter(name, email, repo);
    PersonIdent actual = new PersonIdent(repo);
    assertEquals(name, actual.getName());
    assertEquals(email, actual.getEmailAddress());
  }

  @Test
  public void setRefLogEnabledToTrue_RefLogShouldBeEnabled() throws IOException {
    setRefLogEnabled(true, repo);
    assertTrue(isRefLogEnabled(repo));
  }

  @Test
  public void setRefLogEnabledToFalse_RefLogShouldBeDisabled() throws IOException {
    setRefLogEnabled(false, repo);
    assertFalse(isRefLogEnabled(repo));
  }

}


text:
ARG CUDA_VERSION=11.1
ARG CUDNN_VERSION=8
ARG OS_VERSION=16.04
ARG NVCR_SUFFIX=
FROM nvidia/cuda:${CUDA_VERSION}-cudnn${CUDNN_VERSION}-devel-ubuntu${OS_VERSION}${NVCR_SUFFIX}

LABEL maintainer="Simpledet"

WORKDIR workspace

# basic
RUN apt-get update && \
    apt-get install -y --no-install-recommends && \
    apt-get install -y build-essential python-dev python3-dev && \
    apt-get install -y git wget sudo curl openssh-server openssh-client bash-completion command-not-found \
    vim htop tmux zsh rsync bzip2 zip unzip patch time make cmake locales locales-all libgtk2.0-dev libgl1-mesa-glx python3-tk \
    ninja-build libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm libncurses5-dev libncursesw5-dev \
    xz-utils tk-dev libffi-dev liblzma-dev python-openssl libopenblas-dev && \
    rm -rf /var/lib/apt/lists/*
RUN ln -sfv /usr/bin/python3 /usr/bin/python

# zsh and fzf
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true && \
    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \
    sed -i 's/robbyrussell/fishy/' ~/.zshrc && \
    sed -i 's/(git)/(git zsh-autosuggestions)/' ~/.zshrc && \
    sed -i 's/# DISABLE_AUTO_UPDATE/DISABLE_AUTO_UPDATE/' ~/.zshrc && \
    git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install --all

# use pyenv to manage python version
RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv && \
    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc && \
    echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc && \
    echo 'export PYTHON_CONFIGURE_OPTS="--enable-shared"' >> ~/.zshrc && \
    echo 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.zshrc

RUN /usr/bin/zsh -c "source ~/.zshrc && \
                     pyenv install 3.6.8 && \
                     pyenv global 3.6.8 && \
                     eval zsh && \
                     pip install -U pipenv setuptools && \
                     pip install ipython numpy scipy scikit-learn tqdm graphviz easydict matplotlib pyarrow pyzmq pillow cython requests pytz opencv-python tensorboard && \
                     rm -rf ~/.cache"

# build mxnet
RUN /usr/bin/zsh -c "source ~/.zshrc && \
                     git clone --recursive https://github.com/apache/incubator-mxnet /tmp/mxnet -b 1.6.0 && \
                     git clone https://github.com/Tusimple/simpledet /tmp/simpledet && \
                     git clone https://github.com/RogerChern/cocoapi /tmp/cocoapi && \
                     cp -r /tmp/simpledet/operator_cxx/* /tmp/mxnet/src/operator && \
                     mkdir -p /tmp/mxnet/src/coco_api && \
                     cp -r /tmp/cocoapi/common /tmp/mxnet/src/coco_api && \
                     cd /tmp/mxnet && \
                     echo 'USE_SIGNAL_HANDLER = 1' >> ./config.mk && \
                     echo 'USE_OPENCV = 0' >> ./config.mk && \
                     echo 'USE_MKLDNN = 0' >> ./config.mk && \
                     echo 'USE_BLAS = openblas' >> ./config.mk && \
                     echo 'USE_CUDA = 1' >> ./config.mk && \
                     echo 'USE_CUDA_PATH = /usr/local/cuda' >> ./config.mk && \
                     echo 'USE_CUDNN = 1' >> ./config.mk && \
                     echo 'USE_NCCL = 1' >> ./config.mk && \
                     echo 'USE_DIST_KVSTORE = 1' >> ./config.mk && \
                     echo 'CUDA_ARCH = -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86' >> ./config.mk && \
                     rm /tmp/mxnet/src/operator/nn/group_norm* && \
                     make -j$((`nproc`-1)) && \
                     cd python && \
                     python3 setup.py install && \
                     rm -rf /tmp/mxnet /tmp/simpledet /tmp/cocoapi"

# install pycocotools and mxnext
RUN /usr/bin/zsh -c "source ~/.zshrc && \
                     pip install 'git+https://github.com/RogerChern/cocoapi.git#subdirectory=PythonAPI' && \
                     pip install 'git+https://github.com/RogerChern/mxnext#egg=mxnext'"

# ssh
RUN chsh -s /usr/bin/zsh root && \
    mkdir /var/run/sshd && \
    echo 'root:simpledet' | chpasswd && \
    sed -i '/PermitRootLogin/s/prohibit-password/yes/' /etc/ssh/sshd_config
EXPOSE 22

# env
RUN echo "export PATH=/usr/local/cuda/bin:\$PATH" >> ~/.zshrc && \
    echo "export LD_LIBRARY_PATH=/usr/local/cuda/lib64:\$LD_LIBRARY_PATH" >> ~/.zsrhc

CMD ["/usr/sbin/sshd", "-D"]


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Bilimbia tornensis H. Magn.

### Remarks
null


text:
package io.singleton.wearcomplications;

public class Constants {

    static final String BASE_URL = "http://www.dial.fyi/";
    static final String USER_FRIENDLY_BASE_URL = "dial.fyi/";

    static final String REGISTER_PATH = "register_complications";
    static final String IMG_LIST_PATH = "imgs/%s";
    static final String FEED_PATH = "feed/%s";
    static final String CURL_PATH = "x/%s";

    static final String USER_CONFIG_PATH = "%s/%s";

    static String getRegisterUrl() {
        return BASE_URL + REGISTER_PATH;
    }

    static String getFeedUrl(String token) {
        return BASE_URL + String.format(FEED_PATH, token);
    }

    static String getCurlUrl(String token) {
        return BASE_URL + String.format(CURL_PATH, token);
    }
}


text:
class ConcretePrototype1: public Prototype
{
public:
    ConcretePrototype1(string n);
    ~ConcretePrototype1();
    ConcretePrototype1(const ConcretePrototype1 &other);

    string name();
    void setName(string newName);
    Prototype *clone();

private:
    string myName;
};

#endif


text:
Before you can run the tests you need to add a session token so the tests are able to log in. See .env.example on the root of this repo for more info about how to set the required `CYPRESS_SANITY_SESSION_TOKEN` environment variable.

Run the tests like so:

```
$ npm run test-e2e
```

Or open cypress for interactivity:

```
$ npm run cypress:open
```


text:
import {DefaultIterableDifferFactory} from './differs/default_iterable_differ';
import {DefaultKeyValueDifferFactory} from './differs/default_keyvalue_differ';
import {IterableDifferFactory, IterableDiffers} from './differs/iterable_differs';
import {KeyValueDifferFactory, KeyValueDiffers} from './differs/keyvalue_differs';

export {SimpleChange, SimpleChanges} from '../interface/simple_change';
export {devModeEqual} from './change_detection_util';
export {ChangeDetectorRef} from './change_detector_ref';
export {ChangeDetectionStrategy, ChangeDetectorStatus, isDefaultChangeDetectionStrategy} from './constants';
export {DefaultIterableDifferFactory} from './differs/default_iterable_differ';
export {DefaultIterableDiffer} from './differs/default_iterable_differ';
export {DefaultKeyValueDifferFactory} from './differs/default_keyvalue_differ';
export {IterableChangeRecord, IterableChanges, IterableDiffer, IterableDifferFactory, IterableDiffers, NgIterable, TrackByFunction} from './differs/iterable_differs';
export {KeyValueChangeRecord, KeyValueChanges, KeyValueDiffer, KeyValueDifferFactory, KeyValueDiffers} from './differs/keyvalue_differs';
export {PipeTransform} from './pipe_transform';

/**
 * Structural diffing for `Object`s and `Map`s.
 */
const keyValDiff: KeyValueDifferFactory[] = [new DefaultKeyValueDifferFactory()];

/**
 * Structural diffing for `Iterable` types such as `Array`s.
 */
const iterableDiff: IterableDifferFactory[] = [new DefaultIterableDifferFactory()];

export const defaultIterableDiffers = new IterableDiffers(iterableDiff);

export const defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);


text:
package logbook.api;

import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;

import javax.json.JsonObject;

import javafx.application.Platform;
import javafx.util.Duration;
import logbook.bean.AppBouyomiConfig;
import logbook.bean.AppConfig;
import logbook.bean.DeckPortCollection;
import logbook.bean.MissionCollection;
import logbook.bean.MissionCondition;
import logbook.bean.Ship;
import logbook.bean.ShipCollection;
import logbook.internal.Audios;
import logbook.internal.BouyomiChanUtils;
import logbook.internal.BouyomiChanUtils.Type;
import logbook.internal.LoggerHolder;
import logbook.internal.Missions;
import logbook.internal.Tuple;
import logbook.internal.gui.Tools;
import logbook.proxy.RequestMetaData;
import logbook.proxy.ResponseMetaData;

/**
 * /kcsapi/api_req_mission/start
 *
 */
@API("/kcsapi/api_req_mission/start")
public class ApiReqMissionStart implements APIListenerSpi {

    @Override
    public void accept(JsonObject json, RequestMetaData req, ResponseMetaData res) {

        JsonObject data = json.getJsonObject("api_data");
        if (data != null) {
            Integer deckId = Integer.valueOf(req.getParameter("api_deck_id"));
            Integer missionId = Integer.valueOf(req.getParameter("api_mission_id"));

            try {
                Optional<MissionCondition> condition = Missions.getMissionCondition(missionId);
                if (condition.isPresent()) {
                    Map<Integer, Ship> shipMap = ShipCollection.get()
                            .getShipMap();
                    List<Ship> fleet = DeckPortCollection.get().getDeckPortMap().get(deckId).getShip()
                            .stream()
                            .map(shipMap::get)
                            .filter(Objects::nonNull)
                            .collect(Collectors.toList());

                    if (!condition.get().test(fleet)) {
                        Integer id = missionId;
                        Platform.runLater(() -> displayAlert(deckId, id));
                        // 通知音再生
                        if (AppConfig.get().isUseSound()) {
                            Platform.runLater(Audios.playDefaultNotifySound());
                        }
                        // 棒読みちゃん連携
                        sendBouyomi(deckId, missionId);
                    }
                }
            } catch (Exception e) {
                LoggerHolder.get().error("遠征開始で例外", e);
            }
        }
    }

    /**
     * 遠征警告
     *
     * @param deckId デッキID
     * @param missionId 遠征ID
     */
    private static void displayAlert(Integer deckId, Integer missionId) {
        StringBuilder sb = new StringBuilder();
        sb.append("「")
                .append(DeckPortCollection.get().getDeckPortMap().get(deckId).getName())
                .append("」")
                .append("は")
                .append("「")
                .append(MissionCollection.get().getMissionMap().get(missionId).getName())
                .append("」")
                .append("の条件を満たしていません");

        Tools.Controls.showNotify(null, "遠征警告", sb.toString(), Duration.seconds(10));
    }

    /**
     * 棒読みちゃん連携
     *
     * @param deckId デッキID
     * @param missionId 遠征ID
     */
    private static void sendBouyomi(Integer deckId, Integer missionId) {
        if (AppBouyomiConfig.get().isEnable()) {
            BouyomiChanUtils.speak(Type.MissionStartAlert,
                    Tuple.of("${fleetName}", DeckPortCollection.get().getDeckPortMap().get(deckId).getName()),
                    Tuple.of("${fleetNumber}", String.valueOf(deckId)),
                    Tuple.of("${missionName}", MissionCollection.get().getMissionMap().get(missionId).getName()));
        }
    }
}


text:
//                       __________________________________
//                ______|      Copyright 2008-2015         |______
//                \     |     Breakpoint Pty Limited       |     /
//                 \    |   http://www.breakpoint.com.au   |    /
//                 /    |__________________________________|    \
//                /_________/                          \_________\
//
// 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 au.com.breakpoint.hedron.core.value;

import java.util.function.Supplier;

/**
 * Immutable. Opposite calculation policy to LazyValue. Exists really only to allow
 * dynamic policy at runtime. If policy is known at compile time, you can use HeldValue
 * instead.
 */
public class EagerValue<T> extends HeldValue<T>
{
    /**
     * Eager evaluation constructor.
     *
     * @param evaluator
     */
    public EagerValue (final Supplier<T> evaluator)
    {
        super (evaluator.get ());
    }

    public static <T> EagerValue<T> of (final Supplier<T> evaluator)
    {
        return new EagerValue<T> (evaluator);
    }
}


text:
package io.stardog.stardao.jackson;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.google.common.collect.ImmutableSet;
import io.stardog.stardao.core.TestModel;
import io.stardog.stardao.core.Update;
import org.junit.Test;

import java.time.LocalDate;

import static org.junit.Assert.*;

public class UpdateSerializerTest {
    @Test
    public void serialize() throws Exception {
        Update<TestModel> update = Update.of(TestModel.builder()
                .email("test@example.com")
                .birthday(LocalDate.of(2017, 3, 1))
                .name("Test")
                .build(),
                ImmutableSet.of("email", "birthday"),
                ImmutableSet.of("country"));

        ObjectMapper mapper = new ObjectMapper()
                .registerModule(new JavaTimeModule());

        String json = mapper.writeValueAsString(update);
        assertEquals("{\"email\":\"test@example.com\",\"birthday\":\"2017-03-01\",\"country\":null}", json);
    }
}


text:
@implementation LLResponse

- (id) initWithRequest: (LLRequest *) aRequest {
  self = [super init];
  if (self) {
    request = aRequest;
  }
  return self;
}

- (NSDictionary *) headers {
  return request.responseHeaders;
}

- (NSString *) text {
  return request.responseString;
}

- (NSData *) data {
  return request.responseData;
}

- (NSInteger) status {
  return request.responseStatusCode;
}

- (NSString *) contentType {
  return [[self headers] objectForKey: @"Content-Type"];
}

- (BOOL) hasReadableContentType {
  NSString *contentType = [self contentType];
  return [contentType hasPrefix: @"text/"]
      || [contentType llContainsString: @"javascript"]
      || [contentType llContainsString: @"json"]
      || [contentType llContainsString: @"xml"];
}

- (BOOL) matchesExpectedContentType {
  NSString *actual = self.contentType;
  switch (request.expectedContentType) {
    case LLHTMLResponseType:
      return [actual hasPrefix: @"text/html"] || [actual hasPrefix: @"application/xhtml+xml"];
    case LLImageResponseType:
    case LLImageDataResponseType:
      return [actual hasPrefix: @"image/"];
    case LLJSONResponseType:
      return [actual llContainsString: @"javascript"] || [actual llContainsString: @"json"];
    case LLXMLResponseType:
      return [actual llContainsString: @"/xml"];
    case LLBinaryResponseType:
      return ![self hasReadableContentType];
    case LLAnyResponseType:
      return YES;
    default:
      return NO;
  }
}

- (NSString *) description {
  NSString *message = LLFormat(@"request to %@: status = %d, content type = %@",
                               request.url, self.status, self.contentType);
  if ([self hasReadableContentType] && (self.text.length <= DEBUG_RESPONSE_LIMIT)) {
    message = [message stringByAppendingFormat: @", text = %@", self.text];
  } else {
    message = [message stringByAppendingFormat: @", length = %d", self.text.length];
  }

  return message;
}

@end

#endif


text:
<!DOCTYPE html>

        <meta http-equiv="Content-Security-Policy" content="default-src * 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
        <meta name="format-detection" content="telephone=no">
        <meta name="msapplication-tap-highlight" content="no">
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
        <link rel="stylesheet" type="text/css" href="css/index.css">
		<link rel="manifest" href="manifest.json">
        <title>CC</title>

CC


text:
package com.amazonaws.services.opsworks.model;

import java.io.Serializable;

/**
 *

 * Contains the response to a DescribeElasticLoadBalancers
 * request.
 *

 */
public class DescribeElasticLoadBalancersResult implements Serializable, Cloneable {

    /**
     * A list of ElasticLoadBalancer objects that describe the
     * specified Elastic Load Balancing instances.
     */
    private com.amazonaws.internal.ListWithAutoConstructFlag<ElasticLoadBalancer> elasticLoadBalancers;

    /**
     * A list of ElasticLoadBalancer objects that describe the
     * specified Elastic Load Balancing instances.
     *
     * @return A list of ElasticLoadBalancer objects that describe the
     *         specified Elastic Load Balancing instances.
     */
    public java.util.List<ElasticLoadBalancer> getElasticLoadBalancers() {
        if (elasticLoadBalancers == null) {
              elasticLoadBalancers = new com.amazonaws.internal.ListWithAutoConstructFlag<ElasticLoadBalancer>();
              elasticLoadBalancers.setAutoConstruct(true);
        }
        return elasticLoadBalancers;
    }

    /**
     * A list of ElasticLoadBalancer objects that describe the
     * specified Elastic Load Balancing instances.
     *
     * @param elasticLoadBalancers A list of ElasticLoadBalancer objects that describe the
     *         specified Elastic Load Balancing instances.
     */
    public void setElasticLoadBalancers(java.util.Collection<ElasticLoadBalancer> elasticLoadBalancers) {
        if (elasticLoadBalancers == null) {
            this.elasticLoadBalancers = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<ElasticLoadBalancer> elasticLoadBalancersCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<ElasticLoadBalancer>(elasticLoadBalancers.size());
        elasticLoadBalancersCopy.addAll(elasticLoadBalancers);
        this.elasticLoadBalancers = elasticLoadBalancersCopy;
    }

    /**
     * A list of ElasticLoadBalancer objects that describe the
     * specified Elastic Load Balancing instances.
     *

     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setElasticLoadBalancers(java.util.Collection)} or
     * {@link #withElasticLoadBalancers(java.util.Collection)} if you want to
     * override the existing values.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param elasticLoadBalancers A list of ElasticLoadBalancer objects that describe the
     *         specified Elastic Load Balancing instances.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeElasticLoadBalancersResult withElasticLoadBalancers(ElasticLoadBalancer... elasticLoadBalancers) {
        if (getElasticLoadBalancers() == null) setElasticLoadBalancers(new java.util.ArrayList<ElasticLoadBalancer>(elasticLoadBalancers.length));
        for (ElasticLoadBalancer value : elasticLoadBalancers) {
            getElasticLoadBalancers().add(value);
        }
        return this;
    }

    /**
     * A list of ElasticLoadBalancer objects that describe the
     * specified Elastic Load Balancing instances.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param elasticLoadBalancers A list of ElasticLoadBalancer objects that describe the
     *         specified Elastic Load Balancing instances.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeElasticLoadBalancersResult withElasticLoadBalancers(java.util.Collection<ElasticLoadBalancer> elasticLoadBalancers) {
        if (elasticLoadBalancers == null) {
            this.elasticLoadBalancers = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<ElasticLoadBalancer> elasticLoadBalancersCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<ElasticLoadBalancer>(elasticLoadBalancers.size());
            elasticLoadBalancersCopy.addAll(elasticLoadBalancers);
            this.elasticLoadBalancers = elasticLoadBalancersCopy;
        }

        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getElasticLoadBalancers() != null) sb.append("ElasticLoadBalancers: " + getElasticLoadBalancers() );
        sb.append("}");
        return sb.toString();
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getElasticLoadBalancers() == null) ? 0 : getElasticLoadBalancers().hashCode());
        return hashCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;

        if (obj instanceof DescribeElasticLoadBalancersResult == false) return false;
        DescribeElasticLoadBalancersResult other = (DescribeElasticLoadBalancersResult)obj;

        if (other.getElasticLoadBalancers() == null ^ this.getElasticLoadBalancers() == null) return false;
        if (other.getElasticLoadBalancers() != null && other.getElasticLoadBalancers().equals(this.getElasticLoadBalancers()) == false) return false;
        return true;
    }

    @Override
    public DescribeElasticLoadBalancersResult clone() {
        try {
            return (DescribeElasticLoadBalancersResult) super.clone();

        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }

    }

}


text:
apt-get install curl zsh tmux neovim
apt-get install php7.2-cli php7.2-xml php7.2-curl php7.2-mbstring


text:
require 'spec_helper'

describe Tugboat::CLI do
  include_context 'spec'

  let(:snapshot_name) { 'foo-snapshot' }

  describe 'snapshots a droplet' do
    it 'without a droplet parameter' do
      stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
        with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
        to_return(status: 200, body: fixture('show_droplets'), headers: {})

      snapshot_no_droplet_parameter_stdout = <<-eos
You must provide a snapshot name followed by the droplet's name.
For example: `tugboat snapshot foo-snapshot example-node.com`
      eos

      expect { cli.snapshot(snapshot_name) }.to raise_error(SystemExit).and output(snapshot_no_droplet_parameter_stdout).to_stdout
    end

    it 'with a fuzzy name' do
      stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
        with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
        to_return(status: 200, body: fixture('show_droplets'), headers: {})

      stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
        with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
        to_return(status: 200, body: fixture('show_droplets'), headers: {})

      stub_request(:post, 'https://api.digitalocean.com/v2/droplets/3164444/actions').
        with(body: '{"type":"snapshot","name":"foo-snapshot"}',
             headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
        to_return(status: 200, body: fixture('snapshot_response'), headers: {})

      snapshot_fuzzy_stdout = <<-eos
Droplet fuzzy name provided. Finding droplet ID...done\e[0m, 3164444 (example3.com)
Warning: Droplet must be in a powered off state for snapshot to be successful
Queuing snapshot 'foo-snapshot' for 3164444 (example3.com)...Snapshot successful!
      eos

      expect { cli.snapshot(snapshot_name, 'example3.com') }.to output(snapshot_fuzzy_stdout).to_stdout
    end

    it 'with an id' do
      stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
        with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
        to_return(status: 200, body: fixture('show_droplets'), headers: {})

      stub_request(:get, 'https://api.digitalocean.com/v2/droplets/3164444?per_page=200').
        with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
        to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_droplet_inactive'))

      stub_request(:post, 'https://api.digitalocean.com/v2/droplets/3164494/actions').
        with(body: '{"type":"snapshot","name":"foo-snapshot"}',
             headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
        to_return(status: 200, body: fixture('snapshot_response'), headers: {})

      cli.options = cli.options.merge(id: '3164444')

      snapshot_id_stdout = <<-eos
Droplet id provided. Finding Droplet...done\e[0m, 3164494 (example.com)
Warning: Droplet must be in a powered off state for snapshot to be successful
Queuing snapshot 'foo-snapshot' for 3164494 (example.com)...Snapshot successful!
      eos

      expect { cli.snapshot(snapshot_name) }.to output(snapshot_id_stdout).to_stdout
    end

    it 'with a name' do
      stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
        with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
        to_return(status: 200, body: fixture('show_droplets'), headers: {})

      stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
        with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
        to_return(status: 200, body: fixture('show_droplets'), headers: {})

      stub_request(:post, 'https://api.digitalocean.com/v2/droplets/3164444/actions').
        with(body: '{"type":"snapshot","name":"foo-snapshot"}',
             headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
        to_return(status: 200, body: fixture('snapshot_response'), headers: {})

      cli.options = cli.options.merge(name: 'example3.com')

      snapshot_name_stdout = <<-eos
Droplet name provided. Finding droplet ID...done\e[0m, 3164444 (example3.com)
Warning: Droplet must be in a powered off state for snapshot to be successful
Queuing snapshot 'foo-snapshot' for 3164444 (example3.com)...Snapshot successful!
      eos

      expect { cli.snapshot(snapshot_name) }.to output(snapshot_name_stdout).to_stdout
    end

    it 'does not snapshot a droplet that is active' do
      stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
        with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
        to_return(status: 200, body: fixture('show_droplets'), headers: {})

      stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
        with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
        to_return(status: 200, body: fixture('show_droplets'), headers: {})

      cli.options = cli.options.merge(name: 'example.com')

      snapshot_active_error_stdout = <<-eos
Droplet name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
Droplet must be off for this operation to be successful.
      eos

      expect { cli.snapshot(snapshot_name) }.to raise_error(SystemExit).and output(snapshot_active_error_stdout).to_stdout
    end
  end
end


text:
title: How to export RadListView to PDF
description: See how to print RadListView data to Landscape in a pdf or png file with the help of RadClientExportManager.
type: how-to
page_title: How to export RadListView to PDF file
slug: listview-print-export-to-pdf
position:
tags: export, pdf, print
ticketid: 1584782
res_type: kb
---

## Environment

			Product
			RadListView for ASP.NET AJAX

## Description
You can find below how to export the RadListView data to a pdf file with the help of RadClientExportManager.

## Solution
Here is an example:

````ASPX
           <telerik:RadScriptManager ID="QsfScriptManager" runat="server" />
            <telerik:RadClientExportManager ID="RadClientExportManager1" runat="server">
                <PdfSettings FileName="ListViewExport.pdf" />
            </telerik:RadClientExportManager>
            <telerik:RadButton runat="server" ID="RadButton1" Text="Export ListView to PDF" AutoPostBack="false" OnClientClicked="OnClientClicked" />
            <script>
                function OnClientClicked(sender, args) {
                    var listview = $find("<%= RadListView1.ClientID %>");
                    var clientExportManager = $find("<%= RadClientExportManager1.ClientID %>");
                    clientExportManager.exportPDF($telerik.$(listview.get_element())); //clientExportManager.exportToPng($telerik.$(listview.get_element())) will export the content to a png image
                }
            </script>
            <telerik:RadListView ID="RadListView1" Width="97%" AllowPaging="True" runat="server"
                AllowSorting="true" OnNeedDataSource="RadListView1_NeedDataSource" ItemPlaceholderID="ProductsHolder"
                DataKeyNames="OrderID">
                <LayoutTemplate>
                    <fieldset style="width: 700px;" id="RadListView1">
                        <legend>Products</legend>
                        <asp:Panel ID="ProductsHolder" runat="server" />
                    </fieldset>
                </LayoutTemplate>
                <ItemTemplate>
                    <div style="float: left;">
                        <table cellpadding="0" cellspacing="0" style="width: 230px;">
                            <tr>
                                <td style="width: 20%;">Name:
                                </td>
                                <td style="width: 80%; padding-left: 5px;">
                                    <%# Eval("ShipName") %>
                                </td>
                            </tr>

                        </table>
                    </div>
                </ItemTemplate>
            </telerik:RadListView>
````
````C#
   private DataTable OrdersTable()
    {
        DataTable dt = new DataTable();

        dt.Columns.Add(new DataColumn("OrderID", typeof(int)));
        dt.Columns.Add(new DataColumn("OrderDate", typeof(DateTime)));
        dt.Columns.Add(new DataColumn("Freight", typeof(decimal)));
        dt.Columns.Add(new DataColumn("ShipName", typeof(string)));
        dt.Columns.Add(new DataColumn("ShipCountry", typeof(string)));

        dt.PrimaryKey = new DataColumn[] { dt.Columns["OrderID"] };

        for (int i = 0; i < 70; i++)
        {
            int index = i + 1;

            DataRow row = dt.NewRow();

            row["OrderID"] = index;
            row["OrderDate"] = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0).AddHours(index);
            row["Freight"] = index * 0.1 + index * 0.01;
            row["ShipName"] = "Name " + index;
            row["ShipCountry"] = "Country " + index;

            dt.Rows.Add(row);
        }

        return dt;
    }

    protected void RadListView1_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
    {
        (sender as RadListView).DataSource = OrdersTable();
    }
````
````VB
    Private Function OrdersTable() As DataTable
        Dim dt As DataTable = New DataTable()
        dt.Columns.Add(New DataColumn("OrderID", GetType(Integer)))
        dt.Columns.Add(New DataColumn("OrderDate", GetType(DateTime)))
        dt.Columns.Add(New DataColumn("Freight", GetType(Decimal)))
        dt.Columns.Add(New DataColumn("ShipName", GetType(String)))
        dt.Columns.Add(New DataColumn("ShipCountry", GetType(String)))
        dt.PrimaryKey = New DataColumn() {dt.Columns("OrderID")}

        For i As Integer = 0 To 70 - 1
            Dim index As Integer = i + 1
            Dim row As DataRow = dt.NewRow()
            row("OrderID") = index
            row("OrderDate") = New DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0).AddHours(index)
            row("Freight") = index * 0.1 + index * 0.01
            row("ShipName") = "Name " & index
            row("ShipCountry") = "Country " & index
            dt.Rows.Add(row)
        Next

        Return dt
    End Function

    Protected Sub RadListView1_NeedDataSource(ByVal sender As Object, ByVal e As RadListViewNeedDataSourceEventArgs)
        (TryCast(sender, RadListView)).DataSource = OrdersTable()
    End Sub
    ````

## See Also
* [RadClientExportManager demo](https://demos.telerik.com/aspnet-ajax/client-export-manager/overview/defaultcs.aspx)


text:
cask 'ceceree' do
  version :latest
  sha256 :no_check

  # dl.devmate.com/com.appiculous.Ceceree was verified as official when first introduced to the cask
  url 'https://dl.devmate.com/com.appiculous.Ceceree/Ceceree.zip'
  name 'Ceceree'
  homepage 'https://ceceree.com/'
  license :commercial

  depends_on macos: '>= :yosemite'

  app 'Ceceree.app'
end


text:
<!DOCTYPE html>
<title>Canvas tests - 2d.composite.uncovered.fill.*</title>
<link rel="stylesheet" href="../frame.css">

[index]

2d.composite.uncovered.fill.*

(iframe fallback)(iframe fallback)(iframe fallback)(iframe fallback)(iframe fallback)


text:
<?php

namespace spec\Sylius\Bundle\CoreBundle\EventListener;

use Finite\Event\TransitionEvent;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\OrderProcessing\StateResolverInterface;
use Sylius\Component\Resource\StateMachine\StateMachineInterface;
use Symfony\Component\EventDispatcher\GenericEvent;

/**
 * @author Paweł Jędrzejewski <pawel@sylius.org>
 */
class OrderStateListenerSpec extends ObjectBehavior
{
    function let(StateResolverInterface $stateResolver)
    {
        $this->beConstructedWith($stateResolver);
    }

    function it_is_initializable()
    {
        $this->shouldHaveType('Sylius\Bundle\CoreBundle\EventListener\OrderStateListener');
    }

    function it_resolves_order_states(
            StateResolverInterface $stateResolver,
            GenericEvent $event,
            OrderInterface $order
    )
    {
        $event->getSubject()->willReturn($order);
        $stateResolver->resolveShippingState($order)->shouldBeCalled();
        $stateResolver->resolvePaymentState($order)->shouldBeCalled();

        $this->resolveOrderStates($event);
    }

    function it_resolves_order_states_with_finite_event(
        StateResolverInterface $stateResolver,
        TransitionEvent $event,
        OrderInterface $order,
        StateMachineInterface $sm
    )
    {
        $event->getStateMachine()->willReturn($sm);
        $sm->getObject()->willReturn($order);

        $stateResolver->resolveShippingState($order)->shouldBeCalled();
        $stateResolver->resolvePaymentState($order)->shouldBeCalled();

        $this->resolveOrderStatesOnTransition($event);
    }
}


text:
package eu.cdevreeze.yaidom.convert

/**
 * Conversions between yaidom nodes and JS DOM nodes.
 *
 * @author Chris de Vreeze
 */
object JsDomConversions extends YaidomToJsDomConversions with JsDomToYaidomConversions


text:
Open-Source-Tools-Assignments
=============================


text:
from mock import call

from raptiformica.cli import parse_slave_arguments
from tests.testcase import TestCase

class TestParseSlaveArguments(TestCase):
    def setUp(self):
        self.argument_parser = self.set_up_patch('raptiformica.cli.ArgumentParser')
        self.parse_arguments = self.set_up_patch('raptiformica.cli.parse_arguments')
        self.get_first_server_type = self.set_up_patch(
            'raptiformica.cli.get_first_server_type'
        )
        self.get_first_server_type.return_value = 'headless'
        self.get_server_types = self.set_up_patch(
            'raptiformica.cli.get_server_types'
        )
        self.get_first_server_type.return_value = [
            self.get_first_server_type.return_value
        ]

    def test_parse_slave_arguments_instantiates_argparser(self):
        parse_slave_arguments()

        self.argument_parser.assert_called_once_with(
            prog='raptiformica slave',
            description='Provision and join a machine into the network'
        )

    def test_parse_slave_arguments_adds_arguments(self):
        parse_slave_arguments()

        expected_calls = [
            call('host', type=str, help='Hostname or ip of the machine'),
            call('--port', '-p', type=int, default=22,
                 help='Port to use to connect to the remote machine with over SSH'),
            call('--no-provision', action='store_true', default=False,
                 help='Do not run the provisioning scripts for the specified server type'),
            call('--no-assimilate', action='store_true', default=False,
                 help='Do not join or set up the distributed network.'),
            call('--no-after-assimilate', action='store_true', default=False,
                 help='Do not perform the after assimilation hooks'),
            call('--no-after-mesh', action='store_true', default=False,
                 help='Do not perform the after mesh hooks'),
            call('--server-type', type=str, default=self.get_first_server_type.return_value,
                 choices=self.get_server_types.return_value,
                 help='Specify a server type. Default is {}'.format(self.get_first_server_type.return_value)),
        ]
        self.assertEqual(
            self.argument_parser.return_value.add_argument.mock_calls,
            expected_calls
        )

    def test_parse_slave_arguments_parses_arguments(self):
        parse_slave_arguments()

        self.parse_arguments.assert_called_once_with(self.argument_parser.return_value)

    def test_parse_slave_arguments_returns_parsed_arguments(self):
        ret = parse_slave_arguments()

        self.assertEqual(ret, self.parse_arguments.return_value)


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

    <title>View Sources</title>
    <link href="/struts2-showcase-2.0.6/styles/main.css" rel="stylesheet" type="text/css" media="all"/>
    <link href="/struts2-showcase-2.0.6/struts/niftycorners/niftyCorners.css" rel="stylesheet" type="text/css"/>
    <link href="/struts2-showcase-2.0.6/struts/niftycorners/niftyPrint.css" rel="stylesheet" type="text/css" media="print"/>

<link rel="stylesheet" href="/struts2-showcase-2.0.6/struts/xhtml/styles.css" type="text/css"/>

    <link rel="stylesheet" type="text/css" href="/struts2-showcase-2.0.6/struts/tabs.css?page=%2Ffileupload%2Findex.jsp">
    <link rel="stylesheet" type="text/css" href="/struts2-showcase-2.0.6/struts/niftycorners/niftyCorners.css?page=%2Ffileupload%2Findex.jsp">
    <link rel="stylesheet" type="text/css" href="/struts2-showcase-2.0.6/struts/niftycorners/niftyPrint.css?page=%2Ffileupload%2Findex.jsp" media="print">

Struts Showcase

2007/04/06 03:18:13

View Sources

/fileupload/index.jsp

1: <%@taglib prefix="s" uri="/struts-tags" %>
2: <html>
3: <head>
4: <title>Showcase - Fileupload</title>
5: </head>
6: <body>
7:
8: <ul>
9: 	<li>
10: 		<s:url id="url" action="upload" namespace="/fileupload" />
11: 		<s:a href="%{#url}">Single File Upload</s:a>
12: 	</li>
13: 	<li>
14: 		<s:url id="url" action="multipleUploadUsingList" namespace="/fileupload" />
15: 		<s:a href="%{#url}">Multiple File Upload (List)</s:a>
16:
17: 	</li>
18: 	<li>
19: 		<s:url id="url" action="multipleUploadUsingArray" namespace="/fileupload" />
20: 		<s:a href="%{#url}">Multiple File Upload (Array)</s:a>
21: 	</li>
22: </ul>
23:
24: </body>
25: </html>

Unknown configuration

Unknown or unavailable Action class

Navigation

Home

Ajax

Ajax Chat

Action Chaining

Config Browser

Conversion

CRUD

Execute & Wait

File Download

File Upload

Freemarker

Hangman

JavaServer Faces

Person Manager

Tags

Tiles

Token

Validation

Help

        View Sources

Copyright © 2003-2007 The Apache Software Foundation.


text:
struct Squirrel;

void
main_conf(int argc, char **argv, struct Squirrel *squirrel);

#endif


text:
#ifndef SECURITY_MANAGER_H__
#define SECURITY_MANAGER_H__

#include <stdint.h>
#include "sdk_errors.h"
#include "ble.h"
#include "ble_gap.h"
#include "peer_manager_types.h"
#include "security_dispatcher.h"

/**
 * @cond NO_DOXYGEN
 * @defgroup security_manager Security Manager
 * @ingroup peer_manager
 * @{
 * @brief An internal module of @ref peer_manager. A module for streamlining pairing, bonding, and
 *        encryption, including flash storage of shared data.
 */

/**@brief Events that can come from the Security Manager module.
 */
typedef enum
{
    // SM_EVT_PARAMS_REQ             = SMD_EVT_PARAMS_REQ,             /**< Parameters are required for a pairing procedure on the specified connection. The user must provide them using @ref sm_sec_params_set or @ref sm_sec_params_reply (only this procedure, currently unimplemented). */
    SM_EVT_SLAVE_SECURITY_REQ     = SMD_EVT_SLAVE_SECURITY_REQ,     /**< The peer (peripheral) has requested link encryption, which has been enabled. */
    SM_EVT_SEC_PROCEDURE_START    = SMD_EVT_SEC_PROCEDURE_START,    /**< A security procedure has started. */
    SM_EVT_PAIRING_SUCCESS        = SMD_EVT_PAIRING_SUCCESS,        /**< A pairing procedure (and bonding if applicable) has completed with success. */
    SM_EVT_PAIRING_FAIL           = SMD_EVT_PAIRING_FAIL,           /**< A pairing procedure has failed which means no encryption and no bond could be established. */
    SM_EVT_LINK_ENCRYPTION_UPDATE = SMD_EVT_LINK_ENCRYPTION_UPDATE, /**< The security level of the link has been updated. The link is encrypted. */
    SM_EVT_LINK_ENCRYPTION_FAILED = SMD_EVT_LINK_ENCRYPTION_FAILED, /**< An attempt to start encryption on an unencrypted link failed because the peripheral did not have the correct keys. If the peer is the peripheral, the force_repairing flag should be set when reattempting @ref sm_link_secure. */
    SM_EVT_BONDING_INFO_STORED    = SMD_EVT_BONDING_INFO_STORED,    /**< Information exchanged during bonding with a peer has been stored persistently. */
    SM_EVT_ERROR_BONDING_INFO     = SMD_EVT_ERROR_BONDING_INFO,     /**< Information exchanged during bonding with a peer could not be stored persistently, because of an unexpected error. */
    SM_EVT_ERROR_UNEXPECTED       = SMD_EVT_ERROR_UNEXPECTED,       /**< An operation failed with an unexpected error. The error is provided. This is possibly a fatal error. */
    SM_EVT_ERROR_NO_MEM           /*= SMD_EVT_ERROR_NO_MEM*/,       /**< An operation failed because there was no available storage room in persistent storage. Please free up room and the operation will automatically continue after the next compression. */
    SM_EVT_ERROR_SMP_TIMEOUT,                                       /**< An operation failed because there has been an SMP timeout on the link, which entails that no more security operations can be performed on it. */
    SM_EVT_CONN_SEC_CONFIG_REQ,                                     /**< The peer (central) has requested pairing, but a bond already exists with that peer. Reply by calling @ref sm_conn_sec_config_reply before the event handler returns. If no reply is sent, a default is used. */
} sm_evt_id_t;

typedef struct
{
    sm_evt_id_t      evt_id;
    uint16_t         conn_handle;
    smd_evt_params_t params;
} sm_evt_t;

/**@brief Event handler for events from the Security Manager module.
 *
 * @param[in]  event        The event that has happened.
 * @param[in]  conn_handle  The connection handle the event pertains to.
 */
typedef void (*sm_evt_handler_t)(sm_evt_t const * p_event);

/**@brief Function for registering with the Security Manager module. This function also
 *        initializes the module if uninitialized.
 *
 * @param[in]  evt_handler  Callback for events from the Security Manager module.
 *
 * @retval NRF_SUCCESS        Registration was successful.
 * @retval NRF_ERROR_NO_MEM   No more registrations possible.
 * @retval NRF_ERROR_NULL     evt_handler was NULL.
 * @retval NRF_ERROR_INTERNAL An unexpected error occurred.
 */
ret_code_t sm_register(sm_evt_handler_t evt_handler);

/**@brief Function for dispatching SoftDevice events to the Security Manager module.
 *
 * @param[in]  ble_evt    The SoftDevice event.
 */
void sm_ble_evt_handler(ble_evt_t * ble_evt);

/**@brief Function for providing pairing and bonding parameters to use for pairing procedures.
 *
 * @details Until this is called, all bonding procedures initiated by the peer will be rejected.
 *          This function can be called multiple times, even with NULL p_sec_params, in which case
 *          it will go back to rejecting all procedures.
 *
 * @param[in]  p_sec_params  The security parameters to use for this link. Can be NULL to reject
 *                           all pairing procedures.
 *
 * @retval NRF_SUCCESS                    Success.
 * @retval NRF_ERROR_INVALID_PARAM        Invalid combination of parameters.
 * @retval NRF_ERROR_INVALID_STATE        Module is not initialized.
 */
ret_code_t sm_sec_params_set(ble_gap_sec_params_t * p_sec_params);

/**@brief Function for providing security configuration for a link.
 *
 * @details This function is optional, and must be called in reply to a @ref
 *          SM_EVT_CONN_SEC_CONFIG_REQ event, before the Peer Manager event handler returns. If it
 *          is not called in time, a default configuration is used. See @ref pm_conn_sec_config_t
 *          for the value of the default.
 *
 * @param[in]  conn_handle        The connection to set the configuration for.
 * @param[in]  p_conn_sec_config  The configuration.
 */
void sm_conn_sec_config_reply(uint16_t conn_handle, pm_conn_sec_config_t * p_conn_sec_config);

/**@brief Experimental function for specifying the public key to use for LESC operations.
 *
 * @details This function can be called multiple times. The specified public key will be used for
 *          all subsequent LESC (LE Secure Connections) operations until the next time this function
 *          is called.
 *
 * @note The key must continue to reside in application memory as it is not copied by Peer Manager.
 *
 * @param[in]  p_public_key  The public key to use for all subsequent LESC operations.
 *
 * @retval NRF_SUCCESS                    Pairing initiated successfully.
 * @retval NRF_ERROR_INVALID_STATE        Peer Manager is not initialized.
 */
ret_code_t sm_lesc_public_key_set(ble_gap_lesc_p256_pk_t * p_public_key);

/**@brief Function for providing pairing and bonding parameters to use for the current pairing
 *        procedure on a connection.
 *
 * @warning This function is not yet implemented.
 *
 * @note If this function returns an @ref NRF_ERROR_NULL, @ref NRF_ERROR_INVALID_PARAM, @ref
 *       BLE_ERROR_INVALID_CONN_HANDLE, or @ref NRF_ERROR_NO_MEM, this function can be called again
 *       after corrective action.
 *
 * @note To reject a request, call this function with NULL p_sec_params.
 *
 * @param[in]  conn_handle   The connection handle of the connection the pairing is happening on.
 * @param[in]  p_sec_params  The security parameters to use for this link.
 *
 * @retval NRF_SUCCESS                    Success.
 * @retval NRF_ERROR_INVALID_STATE        Module is not initialized, or no parameters have been
 *                                        requested on that conn_handle, or this error originates
 *                                        from the SoftDevice.
 * @retval NRF_ERROR_INVALID_PARAM        Invalid combination of parameters (not including conn_handle).
 * @retval NRF_ERROR_TIMEOUT              There has been an SMP timeout, so no more SMP operations
 *                                        can be performed on this link.
 * @retval BLE_ERROR_INVALID_CONN_HANDLE  Invalid connection handle.
 * @retval NRF_ERROR_NO_MEM               No more room in flash. Fix and reattempt later.
 * @retval NRF_ERROR_BUSY                 No write buffer. Reattempt later.
 */
ret_code_t sm_sec_params_reply(uint16_t conn_handle, ble_gap_sec_params_t * p_sec_params);

/**@brief Function for initiating security on the link, with the specified parameters.
 *
 * @note If the connection is a peripheral connection, this will send a security request to the
 *       master, but the master is not obligated to initiate pairing or encryption in response.
 * @note If the connection is a central connection and a key is available, the parameters will be
 *       used to determine whether to re-pair or to encrypt using the existing key. If no key is
 *       available, pairing will be started.
 *
 * @param[in]  conn_handle      Handle of the connection to initiate pairing on.
 * @param[in]  force_repairing  Whether to force a pairing procedure to happen regardless of whether
 *                              an encryption key already exists. This argument is only relevant for
 *                              the central role. Recommended value: false
 *
 * @retval NRF_SUCCESS                    Success.
 * @retval NRF_ERROR_TIMEOUT              There has been an SMP timeout, so no more SMP operations
 *                                        can be performed on this link.
 * @retval BLE_ERROR_INVALID_CONN_HANDLE  Invalid connection handle.
 * @retval NRF_ERROR_NOT_FOUND            Security parameters have not been set.
 * @retval NRF_ERROR_INVALID_STATE        Module is not initialized.
 * @retval NRF_ERROR_INTERNAL             An unexpected error occurred.
 */
ret_code_t sm_link_secure(uint16_t conn_handle, bool force_repairing);

/** @}
 * @endcond
 */

#endif /* SECURITY_MANAGER_H__ */


text:
using Android.Locations;
using Java.IO;
using System.Linq;
using Newtonsoft.Json;
using Object = Java.Lang.Object;

namespace ExpertSolutions.Speurtochten.App.Android.Common.Entities
{
    public class Routepunt : Object, ISerializable
    {
        [JsonProperty("id")]
        public int ID { get; set; }

        [JsonProperty("autospeurtochtID")]
        public int AutospeurtochtID { get; set; }

        /// Angle from the equator (zero at the equator, plus or minus 90 at the poles)
        /// and is indicated with N(orth) or S(outh). This is the first item given.
        [JsonProperty("latitude")]
        public double Latitude { get; set; }

        /// Angle from the main equator that runs through Greenwich and is indicated
        /// with either an E(ast) or W(est).
        [JsonProperty("longitude")]
        public double Longitude { get; set; }

        ///// This is the height above the earths surface.
        //[JsonProperty("altitude")]
        //public double Altitude { get; set; }

        [JsonProperty("radius")]
        public double Radius { get; set; }

        [JsonProperty("file")]
        public string File { get; set; }

        [JsonProperty("fileName")]
        public string FileName { get; set; }

        [JsonProperty("description")]
        public string Description { get; set; }

        public double Distance { get; set; }

        public void SetDistance(Location location)
        {
            Distance = GetDistance(location);
        }

        private float GetDistance(Location location)
        {
            var distance = new float[3];
            Location.DistanceBetween(location.Latitude, location.Longitude, Latitude, Longitude, distance);

            return distance.FirstOrDefault();
        }

        private string FormatDistance()
        {
            var fancyDescription = string.Empty;
            var wholeNumber = (int)Distance;
            if (wholeNumber > 1000)
                fancyDescription += wholeNumber / 1000 + "km";
            else
                fancyDescription += wholeNumber + "m";

            return fancyDescription;
        }
    }
}


text:
package com.voodoodyne.gstrap.json;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.guava.GuavaModule;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;

import java.io.IOException;

/**
 * Jackson mapper which has been configured properly. Overrides some of Jackson's obnoxious defaults
 * and adds some good stuff like Guava.
 */
public class BetterObjectMapper extends ObjectMapper {
	public BetterObjectMapper() {
		init();
	}

	/** Copy constructor, will add our behavior if src is not already BOM */
	public BetterObjectMapper(final ObjectMapper src) {
		super(src);
		if (!(src instanceof BetterObjectMapper))
			init();
	}

	private void init() {
		this.registerModule(new GuavaModule());
		this.registerModule(new ParameterNamesModule());
		this.registerModule(new Jdk8Module());
		this.registerModule(new JavaTimeModule());

		this.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
		this.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
	}

	/** Pretty prints json */
	public String pretty(Object object) {
		return JSONUtils.pretty(this, object);
	}

	public <T> T read(byte[] content, Class<T> type) {
		try {
			return readValue(content, type);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
}


text:
require 'spec_helper'

describe DisqusRails::Model do
  %w(Category Forum Post Thread User).each do |klass|
    it "should create singleton method find in #{klass} class" do
      klass_instance = DisqusRails.const_get(klass).new()
      klass_instance.singleton_class.should respond_to(:find)
    end

    it "should create singleton method where if #{klass} api class has list method" do
      if DisqusRails::Api.const_get(klass.pluralize).respond_to?(:list)
        klass_instance = DisqusRails.const_get(klass).new()
        klass_instance.singleton_class.should respond_to(:where)
      end
    end

    %w(update_attributes reload).each do |method|
      it "should create method #{method} in #{klass} class" do
        klass_instance = DisqusRails.const_get(klass).new()
        klass_instance.should respond_to(method)
      end
    end
  end
end


text:
package com.scaleunlimited.classify;

import org.kohsuke.args4j.Option;

import com.scaleunlimited.cascading.BaseOptions;

public class ClassifyOptions extends BaseOptions {

    private String _workingDir;

    @Option(name = "-workingdir", usage = "working directory", required = true)
    public void setWorkingDir(String workingDir) {
        _workingDir = workingDir;
    }

    public String getWorkingDir() {
        return _workingDir;
    }
}


text:
<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">
	<title>{{ page.title | site.name }}</title>

	<link rel="shortcut icon" href="{{ '/styles/images/favicon.jpg' | prepend: site.baseurl }}">
	<link rel="icon" href="{{ '/styles/images/favicon.jpg' | prepend: site.baseurl }}">

	<link rel="stylesheet" href="{{ '/styles/css/index.css' | prepend: site.baseurl }}">
	<link rel="stylesheet" href="{{ '/styles/css/fontawesome/css/font-awesome.min.css' | prepend: site.baseurl }}">
	<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl }}">
	<link rel="alternate" type="application/rss+xml" title="{{ site.name }}" href="{{ '/feed.xml' | prepend: site.baseurl }}">

	<meta name="description" content="{{site.meta_description}}">

	<script src="{{ '/styles/js/jquery.min.js' | prepend: site.baseurl }}"></script>
	<!--[if lt IE 9]>
    	<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  	<![endif]-->

  	<style type="text/css">
	  	.docs-content{
	  		margin-bottom: 10px;
	  	}
  	</style>
</head>


text:
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

//! Potentially invalid X.509 certificates, both for testing the parser
//! and for use with end-to-end tests.

/* GENERATED START */

/// X509 certificate generated from `bad_ca_without_cert_sign.tbs`.
#[rustfmt::skip]
pub const BAD_CA_WITHOUT_CERT_SIGN: &[u8] = include_bytes!("x509/generated/bad_ca_without_cert_sign.tbs.bin");

/// X509 certificate generated from `bad_cert_sign_with_other_use.tbs`.
#[rustfmt::skip]
pub const BAD_CERT_SIGN_WITH_OTHER_USE: &[u8] = include_bytes!("x509/generated/bad_cert_sign_with_other_use.tbs.bin");

/// X509 certificate generated from `bad_cert_sign_without_bc.tbs`.
#[rustfmt::skip]
pub const BAD_CERT_SIGN_WITHOUT_BC: &[u8] = include_bytes!("x509/generated/bad_cert_sign_without_bc.tbs.bin");

/// X509 certificate generated from `bad_different_sig_alg.tbs`.
#[rustfmt::skip]
pub const BAD_DIFFERENT_SIG_ALG: &[u8] = include_bytes!("x509/generated/bad_different_sig_alg.tbs.bin");

/// X509 certificate generated from `bad_missing_extns.tbs`.
#[rustfmt::skip]
pub const BAD_MISSING_EXTNS: &[u8] = include_bytes!("x509/generated/bad_missing_extns.tbs.bin");

/// X509 certificate generated from `bad_missing_issuer.tbs`.
#[rustfmt::skip]
pub const BAD_MISSING_ISSUER: &[u8] = include_bytes!("x509/generated/bad_missing_issuer.tbs.bin");

/// X509 certificate generated from `bad_missing_rsa_null.tbs`.
#[rustfmt::skip]
pub const BAD_MISSING_RSA_NULL: &[u8] = include_bytes!("x509/generated/bad_missing_rsa_null.tbs.bin");

/// X509 certificate generated from `bad_missing_serial.tbs`.
#[rustfmt::skip]
pub const BAD_MISSING_SERIAL: &[u8] = include_bytes!("x509/generated/bad_missing_serial.tbs.bin");

/// X509 certificate generated from `bad_missing_sig_alg.tbs`.
#[rustfmt::skip]
pub const BAD_MISSING_SIG_ALG: &[u8] = include_bytes!("x509/generated/bad_missing_sig_alg.tbs.bin");

/// X509 certificate generated from `bad_missing_spki_rsa_modulus.tbs`.
#[rustfmt::skip]
pub const BAD_MISSING_SPKI_RSA_MODULUS: &[u8] = include_bytes!("x509/generated/bad_missing_spki_rsa_modulus.tbs.bin");

/// X509 certificate generated from `bad_missing_spki.tbs`.
#[rustfmt::skip]
pub const BAD_MISSING_SPKI: &[u8] = include_bytes!("x509/generated/bad_missing_spki.tbs.bin");

/// X509 certificate generated from `bad_missing_subject.tbs`.
#[rustfmt::skip]
pub const BAD_MISSING_SUBJECT: &[u8] = include_bytes!("x509/generated/bad_missing_subject.tbs.bin");

/// X509 certificate generated from `bad_missing_validty.tbs`.
#[rustfmt::skip]
pub const BAD_MISSING_VALIDTY: &[u8] = include_bytes!("x509/generated/bad_missing_validty.tbs.bin");

/// X509 certificate generated from `bad_missing_version.tbs`.
#[rustfmt::skip]
pub const BAD_MISSING_VERSION: &[u8] = include_bytes!("x509/generated/bad_missing_version.tbs.bin");

/// X509 certificate generated from `bad_serial_too_long.tbs`.
#[rustfmt::skip]
pub const BAD_SERIAL_TOO_LONG: &[u8] = include_bytes!("x509/generated/bad_serial_too_long.tbs.bin");

/// X509 certificate generated from `bad_unknown_critical.tbs`.
#[rustfmt::skip]
pub const BAD_UNKNOWN_CRITICAL: &[u8] = include_bytes!("x509/generated/bad_unknown_critical.tbs.bin");

/// X509 certificate generated from `bad_wrong_version.tbs`.
#[rustfmt::skip]
pub const BAD_WRONG_VERSION: &[u8] = include_bytes!("x509/generated/bad_wrong_version.tbs.bin");

/// X509 certificate generated from `chain1.tbs`.
#[rustfmt::skip]
pub const CHAIN1: &[u8] = include_bytes!("x509/generated/chain1.tbs.bin");

/// X509 certificate generated from `chain2.tbs`.
#[rustfmt::skip]
pub const CHAIN2: &[u8] = include_bytes!("x509/generated/chain2.tbs.bin");

/// X509 certificate generated from `chain3.tbs`.
#[rustfmt::skip]
pub const CHAIN3: &[u8] = include_bytes!("x509/generated/chain3.tbs.bin");

/// X509 certificate generated from `ok_no_ca_without_bc.tbs`.
#[rustfmt::skip]
pub const OK_NO_CA_WITHOUT_BC: &[u8] = include_bytes!("x509/generated/ok_no_ca_without_bc.tbs.bin");

/// X509 certificate generated from `ok_unknown_default_criticality.tbs`.
#[rustfmt::skip]
pub const OK_UNKNOWN_DEFAULT_CRITICALITY: &[u8] = include_bytes!("x509/generated/ok_unknown_default_criticality.tbs.bin");

/// X509 certificate generated from `ok_unknown_noncritical.tbs`.
#[rustfmt::skip]
pub const OK_UNKNOWN_NONCRITICAL: &[u8] = include_bytes!("x509/generated/ok_unknown_noncritical.tbs.bin");

/// X509 certificate generated from `self_signed.tbs`.
#[rustfmt::skip]
pub const SELF_SIGNED: &[u8] = include_bytes!("x509/generated/self_signed.tbs.bin");

/// X509 certificate generated from `sub_signed.tbs`.
#[rustfmt::skip]
pub const SUB_SIGNED: &[u8] = include_bytes!("x509/generated/sub_signed.tbs.bin");


text:
from flask import render_template, redirect, url_for, abort, Blueprint, \
    current_app, make_response
from cwr.parser.decoder.cwrjson import JSONDecoder

__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'
__status__ = 'Development'

cwr_contents_blueprint = Blueprint('cwr_contents', __name__,
                                   template_folder='templates',
                                   static_folder='static',
                                   static_url_path='/static/cwr')

"""
CWR validation routes.
"""

@cwr_contents_blueprint.route('/<string:file_id>', methods=['GET'])
def summary(file_id):
    cwr_service = current_app.config['CWR_ADMIN_SERVICE']
    cwr = cwr_service.get_file(file_id)

    if not cwr or 'contents' not in cwr or not cwr['contents']:
        abort(404)

    cwr = cwr['contents']

    decoder = JSONDecoder()

    cwr = decoder.decode(cwr)

    groups = cwr.transmission.groups

    return render_template('summary.html', cwr=cwr, current_tab='summary_item',
                           groups=groups, file_id=file_id)

@cwr_contents_blueprint.route('/<string:file_id>/group/<int:index>',
                              defaults={'page': 1}, methods=['GET'])
@cwr_contents_blueprint.route(
    '/<string:file_id>/group/<int:index>/page/<int:page>', methods=['GET'])
def transactions(index, page, file_id):
    cwr_service = current_app.config['CWR_ADMIN_SERVICE']
    cwr = cwr_service.get_file(file_id)
    cwr = cwr['contents']

    if not cwr and page != 1:
        abort(404)

    decoder = JSONDecoder()

    cwr = decoder.decode(cwr)

    group = cwr.transmission.groups[index]

    pagination_service = current_app.config['PAGINATION_SERVICE']

    transactions = pagination_service.get_page_transactions(page, group)
    pagination = pagination_service.get_transactions_paginator(page, group)

    return render_template('transactions.html', paginator=pagination,
                           groups=cwr.transmission.groups,
                           group=group, transactions=transactions,
                           current_tab='agreements_item', file_id=file_id)

@cwr_contents_blueprint.route('/download', methods=['GET'])
def report_download():
    return redirect(url_for('.summary'))

@cwr_contents_blueprint.route('/<string:file_id>/report/', methods=['GET'])
def report(file_id):
    cwr_service = current_app.config['CWR_ADMIN_SERVICE']
    cwr = cwr_service.get_file(file_id)
    filename = cwr['name']

    if not cwr or 'contents' not in cwr or not cwr['contents']:
        abort(404)

    cwr = cwr['contents']

    decoder = JSONDecoder()

    cwr = decoder.decode(cwr)

    report_service = current_app.config['CWR_REPORT_SERVICE']

    report = report_service.generate_report_excel(cwr, filename)

    response = make_response(report)

    response.headers["Content-Disposition"] = "attachment; filename=result.xlsx"
    response.headers[
        "Content-type"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"

    return response


text:
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

import * as action from './action';
import Index from './Index';

export class Container extends React.Component {

  render() {
    const { edit } = this.props.indexState;
    const { onFieldsChange } = this.props;
    return (
      <Index
        edit={edit}
        onFieldsChange={onFieldsChange}
      />
    );
  }
}

Container.propTypes = {
  indexState: React.PropTypes.object.isRequired,
  onFieldsChange: React.PropTypes.func.isRequired,
};

const mapStateToProps = state => ({
  indexState: state.indexReducer,
});

const mapDispatchToProps = dispatch => bindActionCreators(action, dispatch);

export default connect(mapStateToProps,
  mapDispatchToProps)(Container);


text:
package net.krazyweb.starmodmanager.data;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javafx.concurrent.Task;
import javafx.concurrent.WorkerStateEvent;
import javafx.event.EventHandler;
import net.krazyweb.helpers.FileHelper;
import net.krazyweb.starmodmanager.dialogue.MessageDialogue;
import net.krazyweb.starmodmanager.dialogue.MessageDialogue.MessageType;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class HyperSQLDatabase implements DatabaseModelInterface {

	private static final Logger log = LogManager.getLogger(HyperSQLDatabase.class);

	private static final String MOD_TABLE_NAME = "mods";
	private static final String SETTINGS_TABLE_NAME = "settings";

	private Connection connection;

	private SettingsModelInterface settings;
	private SettingsModelFactory settingsFactory;

	private Set<Observer> observers;

	protected HyperSQLDatabase(final SettingsModelFactory settingsFactory) {
		observers = new HashSet<>();
		this.settingsFactory = settingsFactory;
	}

	@Override
	public Task<Void> getInitializerTask() {

		final Task<Void> task = new Task<Void>() {

			@Override
			protected Void call() throws Exception {

				settings = settingsFactory.getInstance();

				this.updateMessage("Connecting to Database");
				this.updateProgress(0.0, 2.0);

				connection = DriverManager.getConnection("jdbc:hsqldb:file:" + new File("").getAbsolutePath().replaceAll("\\\\", "/") + "/data/db", "SA", "");

				this.updateMessage("Creating Default Tables");
				this.updateProgress(1.0, 2.0);

				createTables();

				this.updateProgress(2.0, 2.0);

				return null;

			}

		};

		task.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
			@Override
			public void handle(final WorkerStateEvent event) {
				notifyObservers("databaseinitialized");
			}
		});

		task.setOnFailed(new EventHandler<WorkerStateEvent>() {
			@Override
			public void handle(final WorkerStateEvent event) {
				log.error("", task.getException());
				MessageDialogue dialogue = new MessageDialogue("An error occurred while connecting to the database. Please see the log for more information.", "Database Error", MessageType.ERROR, new NotLoadedLocalizerFactory());
				dialogue.getResult();
			}
		});

		return task;

	}

	@Override
	public Task<Void> getCloseTask() {

		final Task<Void> task = new Task<Void>() {

			@Override
			protected Void call() throws Exception {

				connection.commit();
				connection.close();

				return null;

			}

		};

		task.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
			@Override
			public void handle(final WorkerStateEvent event) {
				notifyObservers("databaseclosed");
			}
		});

		return task;

	}

	private void createTables() throws SQLException {

		StringBuilder sb = new StringBuilder();

		sb.append("CREATE TABLE IF NOT EXISTS ");
		sb.append(MOD_TABLE_NAME);
		sb.append(" (");
		sb.append("internalName VARCHAR(255) NOT NULL, ");
		sb.append("archiveName VARCHAR(255) NOT NULL, ");
		sb.append("displayName VARCHAR(255) NOT NULL, ");
		sb.append("modVersion VARCHAR(255) DEFAULT NULL, ");
		sb.append("gameVersion VARCHAR(255) NOT NULL, ");
		sb.append("author VARCHAR(255) DEFAULT NULL, ");
		sb.append("description VARCHAR(65535) DEFAULT NULL, ");
		sb.append("url VARCHAR(255) DEFAULT NULL, ");
		sb.append("checksum BIGINT NOT NULL, ");
		sb.append("loadOrder INT NOT NULL, ");
		sb.append("hidden BIT NOT NULL, ");
		sb.append("installed BIT NOT NULL, ");
		sb.append("dependencies VARCHAR(16777215) DEFAULT NULL, "); //"internalName\ninternalName\ninternalName"
		sb.append("files VARCHAR(16777215) NOT NULL, "); //"filepath::json::ignored::automerge\nfilepath::json::ignored::automerge"
		sb.append("PRIMARY KEY (internalName)");
		sb.append(");");

		Statement tableCreator = connection.createStatement();
		tableCreator.execute(sb.toString());

		log.debug("'{}' executed.", sb);

		sb = new StringBuilder();
		sb.append("CREATE TABLE IF NOT EXISTS ");
		sb.append(SETTINGS_TABLE_NAME);
		sb.append(" (");
		sb.append("property VARCHAR(65535) NOT NULL, ");
		sb.append("value VARCHAR(65535) NOT NULL, ");
		sb.append("PRIMARY KEY (property)");
		sb.append(");");

		tableCreator.execute(sb.toString());

		tableCreator.closeOnCompletion();

		log.debug("'{}' executed.", sb);

	}

	/*
	 * updateMod() is used for both updating and adding mods.
	 * It picks the right one for the mod in question.
	 */
	@Override
	public void updateMod(final Mod mod) throws SQLException {

		StringBuilder dependencyList = new StringBuilder();

		for (String dependency : mod.getDependencies()) {
			dependencyList.append(dependency).append("\n");
		}

		StringBuilder fileList = new StringBuilder();

		for (ModFile file : mod.getFiles()) {
			fileList
			.append(file.getPath()).append(":::")
			.append(file.isJson()).append(":::")
			.append(file.isIgnored()).append(":::")
			.append(file.isAutoMerged()).append("\n");
		}

		StringBuilder query = new StringBuilder();

		if (containsMod(mod)) {

			query.append("UPDATE ");
			query.append(MOD_TABLE_NAME);
			query.append(" SET ");

			query.append("internalName = ?,");
			query.append("archiveName = ?,");
			query.append("displayName = ?,");
			query.append("modVersion = ?,");
			query.append("gameVersion = ?,");
			query.append("author = ?,");
			query.append("description = ?,");
			query.append("url = ?,");
			query.append("checksum = ?,");
			query.append("loadOrder = ?,");
			query.append("hidden = ?,");
			query.append("installed = ?,");
			query.append("dependencies = ?,");
			query.append("files = ?");
			query.append("WHERE internalName = ?");

			PreparedStatement statement = connection.prepareStatement(query.toString());

			statement.setString(1, mod.getInternalName());
			statement.setString(2, mod.getArchiveName());
			statement.setString(3, mod.getDisplayName());
			statement.setString(4, mod.getModVersion());
			statement.setString(5, mod.getGameVersion());
			statement.setString(6, mod.getAuthor());
			statement.setString(7, mod.getDescription());
			statement.setString(8, mod.getURL());
			statement.setLong(9, mod.getChecksum());
			statement.setInt(10, mod.getOrder());
			statement.setInt(11, mod.isHidden() ? 1 : 0);
			statement.setInt(12, mod.isInstalled() ? 1 : 0);
			statement.setString(13, dependencyList.toString());
			statement.setString(14, fileList.toString());
			statement.setString(15, mod.getInternalName());

			statement.executeUpdate();
			log.trace("Statement Executed: {}", statement);
			statement.closeOnCompletion();

		} else {

			query.append("INSERT INTO ");
			query.append(MOD_TABLE_NAME).append("(");
			query.append("internalName,");
			query.append("archiveName,");
			query.append("displayName,");
			query.append("modVersion,");
			query.append("gameVersion,");
			query.append("author,");
			query.append("description,");
			query.append("url,");
			query.append("checksum,");
			query.append("loadOrder,");
			query.append("hidden,");
			query.append("installed,");
			query.append("dependencies,");
			query.append("files");
			query.append(") VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");

			PreparedStatement statement = connection.prepareStatement(query.toString());

			statement.setString(1, mod.getInternalName());
			statement.setString(2, mod.getArchiveName());
			statement.setString(3, mod.getDisplayName());
			statement.setString(4, mod.getModVersion());
			statement.setString(5, mod.getGameVersion());
			statement.setString(6, mod.getAuthor());
			statement.setString(7, mod.getDescription());
			statement.setString(8, mod.getURL());
			statement.setLong(9, mod.getChecksum());
			statement.setInt(10, mod.getOrder());
			statement.setInt(11, mod.isHidden() ? 1 : 0);
			statement.setInt(12, mod.isInstalled() ? 1 : 0);

			if (dependencyList.toString().isEmpty()) {
				statement.setString(13, "NULL");
			} else {
				statement.setString(13, dependencyList.toString());
			}

			statement.setString(14, fileList.toString());

			statement.execute();
			log.trace("Statement Executed: {}", statement);
			statement.closeOnCompletion();

		}

	}

	@Override
	public void deleteMod(final Mod mod) throws SQLException {

		StringBuilder query = new StringBuilder();
		query.append("DELETE FROM ").append(MOD_TABLE_NAME);
		query.append(" WHERE internalName = ?");

		PreparedStatement deleteMod = connection.prepareStatement(query.toString());
		deleteMod.setString(1, mod.getInternalName());
		log.trace("Statement Executed: {}", query);
		deleteMod.execute();
		deleteMod.closeOnCompletion();

	}

	private boolean containsMod(final Mod mod) throws SQLException {

		StringBuilder query = new StringBuilder();

		query.append("SELECT internalName FROM ");
		query.append(MOD_TABLE_NAME);
		query.append(" WHERE internalName = ?");
		query.append(" LIMIT 1");

		PreparedStatement modQuery = connection.prepareStatement(query.toString());
		modQuery.setString(1, mod.getInternalName());

		ResultSet results = modQuery.executeQuery();

		log.trace("Statement Executed: {}", query);

		if (!hasRows(results)) {
			results.close();
			modQuery.close();
			return false;
		}

		results.close();
		modQuery.close();

		return true;

	}

	private boolean containsProperty(final String property) throws SQLException {

		StringBuilder query = new StringBuilder();

		query.append("SELECT property FROM ");
		query.append(SETTINGS_TABLE_NAME);
		query.append(" WHERE property = ?");
		query.append(" LIMIT 1");

		PreparedStatement modQuery = connection.prepareStatement(query.toString());
		modQuery.setString(1, property);

		ResultSet results = modQuery.executeQuery();

		log.trace("Statement Executed: {}", query);

		if (!hasRows(results)) {
			results.close();
			modQuery.close();
			return false;
		}

		results.close();
		modQuery.close();

		return true;

	}

	@Override
	public List<String> getModNames() throws SQLException {

		List<String> output = new ArrayList<>();

		StringBuilder query = new StringBuilder();

		query.append("SELECT * FROM ");
		query.append(MOD_TABLE_NAME);

		PreparedStatement modQuery = connection.prepareStatement(query.toString());

		ResultSet results = modQuery.executeQuery();

		if (hasRows(results)) {
			while (results.next()) {
				output.add(results.getString("internalName") + "\n" + results.getString("archiveName"));
			}
		}

		return output;

	}

	@Override
	public Mod getModByName(final String modName) throws SQLException, IOException {

		Mod output = null;

		StringBuilder query = new StringBuilder();

		query.append("SELECT * FROM ");
		query.append(MOD_TABLE_NAME);
		query.append(" WHERE internalName = ?");
		query.append(" LIMIT 1");

		PreparedStatement modQuery = connection.prepareStatement(query.toString());
		modQuery.setString(1, modName);

		ResultSet results = modQuery.executeQuery();

		log.trace("Statement Executed: {}", query);

		if (hasRows(results)) {

			log.debug("Mod found in database: {}", modName);

			results.next();

			Mod mod = new Mod(new LocalizerFactory(), new SettingsFactory());

			mod.setInternalName(results.getString("internalName"));
			mod.setArchiveName(results.getString("archiveName"));
			mod.setDisplayName(results.getString("displayName"));
			mod.setModVersion(results.getString("modVersion"));
			mod.setGameVersion(results.getString("gameVersion"));
			mod.setAuthor(results.getString("author"));
			mod.setDescription(results.getString("description"));
			mod.setURL(results.getString("url"));
			mod.setChecksum(results.getLong("checksum"));
			mod.setOrder(results.getInt("loadOrder"));
			mod.setHidden(results.getInt("hidden") == 1);
			mod.setInstalled(results.getInt("installed") == 1);

			Set<String> dependencies = new HashSet<>();

			for (String data : results.getString("dependencies").split("\n")) {
				dependencies.add(data);
			}

			mod.setDependencies(dependencies);

			Set<ModFile> files = new HashSet<>();

			for (String data : results.getString("files").split("\n")) {

				String[] fields = data.split(":::");

				ModFile file = new ModFile();

				file.setPath(Paths.get(fields[0]));
				file.setJson(Boolean.parseBoolean(fields[1]));
				file.setIgnored(Boolean.parseBoolean(fields[2]));
				file.setAutoMerged(Boolean.parseBoolean(fields[3]));

				files.add(file);

			}

			mod.setFiles(files);

			if (Files.notExists(settings.getPropertyPath("modsdir").resolve(mod.getArchiveName()))) {
				deleteMod(mod);
				return null;
			}

			Set<Mod> mods = null;

			long checksum = FileHelper.getChecksum(settings.getPropertyPath("modsdir").resolve(mod.getArchiveName()));

			if (mod.getChecksum() != checksum) {
				log.debug("Mod file checksum mismatch: {} ({})", mod.getArchiveName(), mod.getChecksum());
				mods = Mod.load(settings.getPropertyPath("modsdir").resolve(mod.getArchiveName()), mod.getOrder(), new SettingsFactory(), new DatabaseFactory(), new LocalizerFactory());
			} else {
				mods = new HashSet<>();
				mods.add(mod);
			}

			output = mod;

		}

		results.close();
		modQuery.closeOnCompletion();

		return output;

	}

	private String getSettingsValue(final String property) throws SQLException {

		StringBuilder query = new StringBuilder();

		query.append("SELECT value FROM ");
		query.append(SETTINGS_TABLE_NAME);
		query.append(" WHERE property = ?");
		query.append(" LIMIT 1");

		PreparedStatement propertyQuery = connection.prepareStatement(query.toString());
		propertyQuery.setString(1, property);

		log.trace("Statement Executed: {}", propertyQuery);

		ResultSet results = propertyQuery.executeQuery();

		String output = null;

		if (hasRows(results)) {
			while (results.next()) {
				output = results.getString(1);
				log.debug("'{}' retrieved from database for property '{}'.", output, property);
			}
		}

		results.close();
		propertyQuery.closeOnCompletion();

		return output;

	}

	@Override
	public Map<String, String> getProperties() throws SQLException {

		Map<String, String> properties = new HashMap<>();

		StringBuilder query = new StringBuilder();

		query.append("SELECT * FROM ");
		query.append(SETTINGS_TABLE_NAME);

		PreparedStatement propertyQuery = connection.prepareStatement(query.toString());

		log.trace("Statement Executed: " + propertyQuery.toString());

		ResultSet results = propertyQuery.executeQuery();

		if (hasRows(results)) {
			while (results.next()) {
				properties.put(results.getString(1), results.getString(2));
				log.debug("'{}' retrieved from database for property '{}'.", results.getString(2), results.getString(1));
			}
		}

		results.close();
		propertyQuery.closeOnCompletion();

		return properties;

	}

	@Override
	public String getPropertyString(final String property, final String defaultValue) {

		String result = null;

		try {
			result = getSettingsValue(property);
		} catch (SQLException e) {
			log.error("", e);
		}

		if (result == null) {
			return defaultValue;
		}

		return result;

	}

	@Override
	public int getPropertyInt(final String property, final int defaultValue) {
		return Integer.parseInt(getPropertyString(property, "" + defaultValue));
	}

	@Override
	public void setProperty(final String property, Object value) {

		StringBuilder query = new StringBuilder();

		try {

			if (containsProperty(property)) {

				query.append("UPDATE ");
				query.append(SETTINGS_TABLE_NAME);
				query.append(" SET ");
				query.append("value = ?");
				query.append("WHERE property = ?");

				PreparedStatement statement = connection.prepareStatement(query.toString());

				statement.setString(1, value.toString());
				statement.setString(2, property);

				statement.executeUpdate();
				log.trace("Statement Executed: {}", statement);
				statement.closeOnCompletion();

			} else {

				query.append("INSERT INTO ");
				query.append(SETTINGS_TABLE_NAME).append("(");
				query.append("property,");
				query.append("value");
				query.append(") VALUES(?, ?);");

				PreparedStatement statement = connection.prepareStatement(query.toString());

				statement.setString(1, property);
				statement.setString(2, value.toString());

				statement.executeUpdate();
				log.trace("Statement Executed: {}", statement);
				statement.closeOnCompletion();

			}

		} catch (final SQLException e) {
			log.error("", e);
		}

		log.debug("'{}' -> '{}' added to database.", property, value);

	}

	private boolean hasRows(final ResultSet resultSet) throws SQLException {
		return resultSet.isBeforeFirst();
	}

	@Override
	public void addObserver(final Observer observer) {
		observers.add(observer);
	}

	@Override
	public void removeObserver(final Observer observer) {
		observers.remove(observer);
	}

	private final void notifyObservers(final String message) {
		for (final Observer o : observers) {
			o.update(this, (Object) message);
		}
	}

}


text: export const dropdownButtonContent: string;


text:
typedef struct {
    int          no_eval;
    int          use_http;
    int          use_test_funs;
    int          stack_size;
    const char** scripts;
    const char*  uri_file;
    JSString*    uri;
} couch_args;

couch_args* couch_parse_args(int argc, const char* argv[]);
int couch_fgets(char* buf, int size, FILE* fp);
JSString* couch_readline(JSContext* cx, FILE* fp);
JSString* couch_readfile(JSContext* cx, const char* filename);
void couch_print(JSContext* cx, uintN argc, jsval* argv);
void couch_error(JSContext* cx, const char* mesg, JSErrorReport* report);
JSBool couch_load_funcs(JSContext* cx, JSObject* obj, JSFunctionSpec* funcs);

#endif // Included util.h


text:
from __future__ import print_function

import django
import os

if __name__ == "__main__":
    os.environ['DJANGO_SETTINGS_MODULE'] = 'pdc.settings'
    django.setup()

    from django.contrib.contenttypes.models import ContentType
    from django.db import connection
    from django.db.utils import OperationalError

    for c in ContentType.objects.all().order_by("app_label", "model"):
        if not c.model_class():
            print('Deleting Content Type %s %s' % (c.app_label, c.model))
            c.delete()

    tables = ['partners_partner', 'partners_partnermapping', 'partners_partnertype']

    cursor = connection.cursor()
    for t in tables:
        try:
            cursor.execute("DROP TABLE %s" % t)
        except OperationalError:
            pass