text:
#include <cerrno>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <memory>
#include <vector>

#include <errno.h>
#include <getopt.h>
#include <unistd.h>

#include <uv.h>

#include <pruv/http_pipelining_dispatcher.hpp>
#include <pruv/http_worker.hpp>
#include <pruv/log.hpp>
#include <pruv/termination.hpp>

std::unique_ptr<pruv::dispatcher> dispatcher;

void stop_handler(uv_signal_t * /*handle*/, int signum)
{
    pruv_log(LOG_NOTICE, "Received signal %d", signum);
    if (dispatcher)
        dispatcher->stop();
}

int parse_int_arg(const char *s, const char *optname)
{
    char *endptr = nullptr;
    unsigned long res = strtol(s, &endptr, 0);
    if ((res == ULONG_MAX && errno == ERANGE) || res > INT_MAX) {
        pruv_log(LOG_EMERG, "Options \"%s\" value \"%s\" is out of range",
                optname, s);
        exit(EXIT_FAILURE);
    }

    if (*endptr) {
        pruv_log(LOG_EMERG, "Options \"%s\" has non unsigned integer value",
                optname);
        exit(EXIT_FAILURE);
    }

    return (int)res;
}

int main(int argc, char * const *argv)
{
    uv_disable_stdio_inheritance();

    int daemon_or_worker = 0;
    int disable_timeouts = 0;
    int log_level = LOG_INFO;
    int log_locations = 1;
    const char *listen_addr = "::";
    int listen_port = 8000;
    int workers_num = 1;
    const char *worker_exe = argv[0];
    std::vector<const char *> worker_args;
    const option opts[] = {
        {"daemon", no_argument, &daemon_or_worker, 1},
        {"worker", no_argument, &daemon_or_worker, 2},
        {"notimeouts", no_argument, &disable_timeouts, 1},
        {"loglevel", required_argument, &log_level, LOG_INFO},
        {"nologlocations", no_argument, &log_locations, 0},
        {"listen-addr", required_argument, nullptr, 1},
        {"listen-port", required_argument, &listen_port, 8000},
        {"workers-num", required_argument, &workers_num, 1},
        {"worker-executable", required_argument, nullptr, 2},
        {"worker-arg", required_argument, nullptr, 3},
        {0, 0, nullptr, 0}
    };

    for (;;) {
        int opt_idx = 0;
        int c = getopt_long(argc, argv, "", opts, &opt_idx);
        if (c == -1)
            break;
        if (c == 0) {
            if (optarg)
                *opts[opt_idx].flag = parse_int_arg(optarg, opts[opt_idx].name);
        }
        else if (c == 1)
            listen_addr = optarg;
        else if (c == 2)
            worker_exe = optarg;
        else if (c == 3)
            worker_args.push_back(optarg);
        else if (c != '?') {
            pruv_log(LOG_EMERG, "Unknown option");
            exit(EXIT_FAILURE);
        }
    }
    pruv::openlog(
        (daemon_or_worker ? pruv::log_type::JOURNALD : pruv::log_type::STDERR),
        log_level);
    pruv::log_setup_locations(log_locations);

    if (daemon_or_worker == 2) {
        int r = pruv::worker_loop::setup(argc, argv);
        if (r)
            return r;
        std::unique_ptr<pruv::http_worker> loop(
                new (std::nothrow) pruv::http_worker);
        if (!loop) {
            pruv_log(LOG_EMERG, "No memory for worker loop object.");
            return EXIT_FAILURE;
        }
        return loop->run();
    }

    if (worker_exe == argv[0]) {
        worker_args.push_back("--worker");
        worker_args.push_back("--loglevel");
        static const char levels[] = "0\0001\0002\0003\0004\0005\0006\0007\000";
        worker_args.push_back(levels + 2 * std::min(7, std::max(0, log_level)));
    }
    worker_args.insert(worker_args.begin(), worker_exe);
    worker_args.push_back(nullptr);

    if (daemon_or_worker == 1) {
        pruv_log(LOG_NOTICE, "Begin daemon initialization.");

        pid_t pid = fork();
        if (pid < 0) {
            pruv_log(LOG_EMERG, "fork failed at start. errno = %d.", errno);
            return EXIT_FAILURE;
        }
        if (pid > 0)
            return EXIT_SUCCESS;
        umask(0);
        pid_t sid = setsid();
        if (sid < 0)
            pruv_log(LOG_ERR, "setsid failed at start. errno = %d.", errno);

        pruv_log(LOG_NOTICE, "Daemon started.");
    }

    int r;
    uv_loop_t loop;
    if ((r = uv_loop_init(&loop)) < 0) {
        pruv::log_uv_err(LOG_EMERG, "uv_loop_init main loop", r);
        return EXIT_FAILURE;
    }

    uv_signal_t sig[3];
    int signum[3] = {SIGTERM, SIGINT, SIGHUP};
    for (size_t i = 0; i < sizeof(sig) / sizeof(*sig); ++i)
        if ((r = uv_signal_init(&loop, &sig[i])) < 0) {
            pruv::log_uv_err(LOG_ERR, "uv_signal_init SIGTERM handler", r);
            uv_close((uv_handle_t *)&sig[i], nullptr);
        }
        else if ((r = uv_signal_start(&sig[i], stop_handler, signum[i])) < 0) {
            pruv::log_uv_err(LOG_ERR, "uv_signal_start SIGTERM handler", r);
            uv_close((uv_handle_t *)&sig[i], nullptr);
        }
        else
            uv_unref((uv_handle_t *)&sig[i]);

    dispatcher.reset(new pruv::http_pipelining_dispatcher);
    if (disable_timeouts)
        dispatcher->set_timeouts(!disable_timeouts);
    dispatcher->start(&loop, listen_addr, listen_port,
            workers_num, worker_exe, worker_args.data());

    uv_run(&loop, UV_RUN_DEFAULT);

    dispatcher->on_loop_exit();

    for (uv_signal_t & sigi : sig) {
        if ((r = uv_signal_stop(&sigi)) < 0)
            pruv::log_uv_err(LOG_ERR, "uv_signal_stop in SIGTERM handler", r);
        uv_close((uv_handle_t *)&sigi, nullptr);
    }
    // Do one loop iteration to remove sigterm handler from loop.
    uv_run(&loop, UV_RUN_NOWAIT);

    if ((r = uv_loop_close(&loop)) < 0)
        pruv::log_uv_err(LOG_ERR, "uv_loop_close main loop", r);

    if (daemon_or_worker == 1)
        pruv_log(LOG_NOTICE, "Daemon stopped.");

    return EXIT_SUCCESS;
}


text:
class local_map{
  public:
    local_map(lcm_t* publish_lcm);

    ~local_map(){
    }

  private:
    lcm_t* publish_lcm_;
    BotParam* botparam_;
    BotFrames* botframes_;

    pointcloud_lcm* pc_lcm_;
    pointcloud_vis* pc_vis_;

    Isometry3dTime current_poseT;
    bool current_pose_init; // have we started
    Isometry3dTime null_poseT;
    Isometry3dTime local_poseT; // LIDAR pose where we started the most recent local map

    // Current submap clouds
    pcl::PointCloud<PointXYZRGB>::Ptr cloud;
    int cloud_counter;
    int fill_counter; // counter to fille the rotating cloud
    int newmap_requested;
    bool newmap_started;

    static void newmap_handler_aux(const lcm_recv_buf_t* rbuf,
                                const char* channel,
                                const drc_localize_reinitialize_cmd_t* msg,
                                void* user_data){
      ((local_map *) user_data)->newmap_handler(msg);
    }
    void newmap_handler(const drc_localize_reinitialize_cmd_t *msg);

    static void lidar_handler_aux(const lcm_recv_buf_t* rbuf,
                                const char* channel,
                                const bot_core_planar_lidar_t* msg,
                                void* user_data) {
      ((local_map *) user_data)->lidar_handler(msg);
    }
    void lidar_handler(const bot_core_planar_lidar_t *msg);

    void send_newmap();

    deque<bot_core_planar_lidar_t *> * laser_queue_;
};

#endif

redpajama_set_name: RedPajamaGithub


text:
'use strict';

class BaseModel {
constructor(db, table, schema) {
  this.db = db;
  this.table = table;
  this.schema = schema;
  this.impl = {
  }
}

create() {
  if (this.impl.create) {
    return this.impl.create.apply(this, arguments);
  } else {
    throw Error('Implementation of "create" not exists');
  }
}

read() {
  if (this.impl.read) {
    return this.impl.read.apply(this, arguments);
  } else {
    throw Error('Implementation of "read" not exists');
  }
}

update() {
  if (this.impl.update) {
    return this.impl.update.apply(this, arguments);
  } else {
    throw Error('Implementation of "update" not exists');
  }
}

delete() {
  if (this.impl.delete) {
    return this.impl.delete.apply(this, arguments);
  } else {
    throw Error('Implementation of "update" not exists');
  }
}

list() {
  if (this.impl.list) {
    return this.impl.list.apply(this, arguments);
  } else {
    throw Error('Implementation of "list" not exists');
  }
}

} // class BaseModel

module.exports = BaseModel;


text:
sort: 3
related:
- /api/output/status/
---

# Idempotence and status

In the context of software deployment, idempotence means that an action with the same parameters can be executed multiple times without changing the final state of the system. It is a fundamental concept and every action in Nikita follows this principle.

The [`$status` output](/current/api/output/status/) property is used and interpreted with different meanings but in most cases, it indicates that a change occurred. For example, when calling the `nikita.file.touch` action, the status is `true` if the file was created. However, the second call returns the status of `false`:

```js
nikita
.call(async function() {
  const path = '/tmp/nikita/a_file'
  // Remove the file to make sure it is not exist
  this.fs.remove(path)
  // Touch 1st time
  var {$status} = await this.file.touch(path)
  console.info($status)  // true
  // Touch 2nd time
  var {$status} = await this.file.touch(path)
  console.info($status)  // false
})
```


text:
.class Lcom/quizup/core/activities/ProfileActivity$21;
.super Ljava/lang/Object;
.source ""

# interfaces
.implements Landroid/view/View$OnClickListener;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/quizup/core/activities/ProfileActivity;->setMyTopics(Ljava/util/List;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/quizup/core/activities/ProfileActivity;

# direct methods
.method constructor <init>(Lcom/quizup/core/activities/ProfileActivity;)V
    .locals 0

    .line 1057
    iput-object p1, p0, Lcom/quizup/core/activities/ProfileActivity$21;->this$0:Lcom/quizup/core/activities/ProfileActivity;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public onClick(Landroid/view/View;)V
    .locals 4

    .line 1061
    new-instance p1, Landroid/content/Intent;

    iget-object v0, p0, Lcom/quizup/core/activities/ProfileActivity$21;->this$0:Lcom/quizup/core/activities/ProfileActivity;

    invoke-virtual {v0}, Lcom/quizup/core/activities/ProfileActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    const-class v1, Lcom/quizup/core/activities/topicWidgetLists/FavoriteTopicsActivity;

    invoke-direct {p1, v0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 1063
    iget-object v0, p0, Lcom/quizup/core/activities/ProfileActivity$21;->this$0:Lcom/quizup/core/activities/ProfileActivity;

    #getter for: Lcom/quizup/core/activities/ProfileActivity;->playerId:Ljava/lang/String;
    invoke-static {v0}, Lcom/quizup/core/activities/ProfileActivity;->access$400(Lcom/quizup/core/activities/ProfileActivity;)Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_0

    .line 1065
    const-string v0, "isOpponent"

    const/4 v1, 0x1

    invoke-virtual {p1, v0, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    .line 1066
    goto :goto_0

    :catchall_0
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Throwable;->getCause()Ljava/lang/Throwable;

    move-result-object v0

    throw v0

    :goto_0
    :try_start_0
    const-string v0, "o.\u0295"

    invoke-static {v0}, Lo/Ꮀ$Ɩ;->ィ(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v0

    const-string v1, "\u02ca"

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object v0

    const/4 v1, 0x0

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    iget-object v0, p0, Lcom/quizup/core/activities/ProfileActivity$21;->this$0:Lcom/quizup/core/activities/ProfileActivity;

    #getter for: Lcom/quizup/core/activities/ProfileActivity;->player:Lo/ⅹ;
    invoke-static {v0}, Lcom/quizup/core/activities/ProfileActivity;->access$1200(Lcom/quizup/core/activities/ProfileActivity;)Lo/ⅹ;

    move-result-object v2

    const-string v0, "o.\u0295"

    invoke-static {v0}, Lo/Ꮀ$Ɩ;->ィ(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v0

    const-string v3, "\u02bd"

    invoke-virtual {v0, v3}, Ljava/lang/Class;->getField(Ljava/lang/String;)Ljava/lang/reflect/Field;

    move-result-object v0

    invoke-virtual {v0, v1, v2}, Ljava/lang/reflect/Field;->set(Ljava/lang/Object;Ljava/lang/Object;)V

    .line 1069
    :cond_0
    iget-object v0, p0, Lcom/quizup/core/activities/ProfileActivity$21;->this$0:Lcom/quizup/core/activities/ProfileActivity;

    invoke-virtual {v0, p1}, Lcom/quizup/core/activities/ProfileActivity;->startActivity(Landroid/content/Intent;)V

    .line 1070
    iget-object v0, p0, Lcom/quizup/core/activities/ProfileActivity$21;->this$0:Lcom/quizup/core/activities/ProfileActivity;

    const v1, 0x7f040005

    const v2, 0x7f040007

    invoke-virtual {v0, v1, v2}, Lcom/quizup/core/activities/ProfileActivity;->overridePendingTransition(II)V

    .line 1071
    return-void
.end method


text:
package main

import "github.com/getlantern/httpseverywhere"

func main() {
	httpseverywhere.Preprocessor.Preprocess("./https-everywhere/src/chrome/content/rules/")
}


text:
import {GetNodeL3, WeightingType, MapView} from "@debate-map/server-link/Source/Link";
import {observable} from "mobx";
import {StoreAccessor} from "mobx-firelink";
import {ignore, version} from "mobx-sync";
import {store} from "Store";
import {O, StoreAction} from "vwebapp-framework";
import {MapState} from "./maps/mapStates/@MapState";
import {GetMapView} from "./maps/mapViews/$mapView";

export class MapsState {
	// @Oervable maps = observable.map<string, MapState>();
	// @ref(MapState_) maps = {} as {[key: string]: MapState};
	// @map(MapState_) maps = observable.map<string, MapState>();
	// @O maps = {} as ObservableMap<string, MapState>;
	@O mapStates = observable.map<string, MapState>();
	/* ACTEnsureMapStateInit(mapID: string) {
		if (this.maps.get(mapID)) return;
		this.maps.set(mapID, new MapState());
	} */
	@O @version(2) mapViews = observable.map<string, MapView>();

	@O nodeLastAcknowledgementTimes = observable.map<string, number>();
	@O @ignore currentNodeBeingAdded_path: string;

	// openMap: number;

	@O copiedNodePath: string;
	@O copiedNodePath_asCut: boolean;

	@O lockMapScrolling = true;
	@O initialChildLimit = 5;
	@O showReasonScoreValues = false;
	@O weighting = WeightingType.Votes;

	// node panels
	@O detailsPanel = new DetailsPanelState();
	@O addChildDialog = new AddChildDialogState();
	@O exportSubtreeDialog = new ExportSubtreeDialogState();
	@O importSubtreeDialog = new ImportSubtreeDialogState();
}

export enum DetailsPanel_Subpanel {
	Text = 10,
	Attachment = 20,
	Permissions = 30,
	Others = 40,
}
export class DetailsPanelState {
	@O subpanel = DetailsPanel_Subpanel.Text;
}

export class AddChildDialogState {
	@O advanced = false;
}

export enum DataExchangeFormat {
	//DebateMap_JSON = 10,
	//CD_JSON = 20,
	GAD_CSV = 30,
}
export class ExportSubtreeDialogState {
	@O targetFormat = DataExchangeFormat.GAD_CSV;
	@O baseExportDepth = 5;
}
export class ImportSubtreeDialogState {
	@O importRatings = false;
	@O importRatings_userIDsStr = "";
}

export const GetLastAcknowledgementTime = StoreAccessor(s=>(nodeID: string)=>{
	return s.main.maps.nodeLastAcknowledgementTimes.get(nodeID) || 0;
});

/* export const GetLastAcknowledgementTime2 = StoreAccessor((nodeID: string) => {
	GetCopiedNodePath();
	return State('main', 'nodeLastAcknowledgementTimes', nodeID) as number || 0;
}); */

export const GetCopiedNodePath = StoreAccessor(s=>()=>{
	return s.main.maps.copiedNodePath;
});
export const GetCopiedNode = StoreAccessor(s=>()=>{
	const path = GetCopiedNodePath();
	if (!path) return null;
	return GetNodeL3(path);
});

// actions
// ==========

export const ACTEnsureMapStateInit = StoreAction((mapID: string)=>{
	if (!store.main.maps.mapStates.has(mapID)) {
		store.main.maps.mapStates.set(mapID, new MapState());
	}
	if (GetMapView(mapID) == null) {
		store.main.maps.mapViews.set(mapID, new MapView());
	}
	return {
		mapState: store.main.maps.mapStates.get(mapID),
		mapView: GetMapView(mapID),
	};
});

// the broadcast-channel allows us to easily replicate the node-copy operation in other tabs, enabling easy copy-paste between tabs
var ACTCopyNode_broadcastChannel = new BroadcastChannel("ACTCopyNode_broadcastChannel");
ACTCopyNode_broadcastChannel.onmessage = (ev: MessageEvent)=>{
	const {path, asCut} = ev.data as {path: string, asCut: boolean};
	ACTCopyNode(path, asCut, false);
};
export const ACTCopyNode = StoreAction((path: string, asCut: boolean, broadcastToOtherTabs = true)=>{
	store.main.maps.copiedNodePath = path;
	store.main.maps.copiedNodePath_asCut = asCut;
	if (broadcastToOtherTabs) {
		ACTCopyNode_broadcastChannel.postMessage({path, asCut});
	}
});


text:
<?xml version="1.0" encoding="UTF-8"?>
<GetServiceStatusResponse xmlns="http://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01/">
    <GetServiceStatusResult>
        <Status>String</Status>
        <Timestamp>1969-07-21T02:56:03Z</Timestamp>
    </GetServiceStatusResult>
    <ResponseMetadata>
        <RequestId>String</RequestId>
    </ResponseMetadata>
</GetServiceStatusResponse>


text:
namespace media {

class MEDIA_EXPORT Bitrate {
 public:
  // Indicates whether constant bitrate (CBR) or variable bitrate (VBR) should
  // be used for encoding.
  enum class Mode { kConstant, kVariable };

  // Required by Mojo for serialization and de-serialization. Creates an
  // invalid constant bitrate with |target_| and |peak_| set to 0u. Prefer
  // to use the Bitrate::ConstantBitrate() method.
  constexpr Bitrate() = default;

  constexpr Bitrate(const Bitrate& other) = default;
  constexpr Bitrate& operator=(const Bitrate& other) = default;

  // Do not use int or uint64_t variations of these. If you have a signed
  // or 64-bit value you want to use as input, you must explicitly convert to
  // uint32_t before calling. This is intended to prevent implicit and unsafe
  // type conversion.
  static constexpr Bitrate ConstantBitrate(uint32_t target_bps) {
    return Bitrate(Mode::kConstant, target_bps, 0);
  }
  static Bitrate VariableBitrate(uint32_t target_bps, uint32_t peak_bps);

  // Deleted variants: you must SAFELY convert to uint32_t before calling.
  // See base/numerics/safe_conversions.h for functions to safely convert
  // between types.
  static Bitrate ConstantBitrate(int target_bps) = delete;
  static Bitrate VariableBitrate(int target_bps, int peak_bps) = delete;
  static Bitrate VariableBitrate(int target_bps, uint32_t peak_bps) = delete;
  static Bitrate VariableBitrate(uint32_t target_bps, int peak_bps) = delete;
  static Bitrate ConstantBitrate(uint64_t target_bps) = delete;
  static Bitrate VariableBitrate(uint64_t target_bps,
                                 uint64_t peak_bps) = delete;
  static Bitrate VariableBitrate(uint64_t target_bps,
                                 uint32_t peak_bps) = delete;
  static Bitrate VariableBitrate(uint32_t target_bps,
                                 uint64_t peak_bps) = delete;

  bool operator==(const Bitrate& right) const;
  bool operator!=(const Bitrate& right) const;

  // Accessor for |mode_|.
  constexpr Mode mode() const { return mode_; }

  // Accessor for |target_|.
  constexpr uint32_t target_bps() const { return target_bps_; }

  // Accessor for |peak_|. Returns 0 if |mode_| is
  // Mode::kConstantBitrate.
  uint32_t peak_bps() const;

  std::string ToString() const;

 private:
  constexpr Bitrate(Mode mode, uint32_t target_bps, uint32_t peak_bps)
      : mode_(mode), target_bps_(target_bps), peak_bps_(peak_bps) {}

  // These member variables cannot be const (despite the intent that we do not
  // change them after creation) because we must have an assignment operator for
  // Mojo, and const member variables are incompatible with an assignment
  // operator.

  // The bitrate mode.
  Mode mode_ = Mode::kConstant;

  // Target bitrate for the stream in bits per second.
  uint32_t target_bps_ = 0u;

  // For use with Mode::kVariable. Peak bitrate in bits per second.
  uint32_t peak_bps_ = 0u;
};

}  // namespace media

#endif  // MEDIA_BASE_BITRATE_H_


text:
package com.royalstone.vss.vender;

import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;

import org.jdom.Element;

import com.royalstone.security.Token;
import com.royalstone.util.InvalidDataException;
import com.royalstone.util.sql.SqlFilter;
import com.royalstone.util.sql.SqlUtil;
import com.royalstone.workbook.Workbook;

/**
 * @note 供应商维护自身资料 此处供应商资料独立,不与业务MISC等系统中的供应商资料同步
 */
public class VenderInformationDIY {

	/**
	 * 获得供应商信息
	 *
	 * @param conn
	 * @param token
	 * @return
	 * @throws SQLException
	 * @throws UnsupportedEncodingException
	 */
	public Element getVenderInfoList(Connection conn, Map map) throws SQLException, UnsupportedEncodingException {
		String sql = " SELECT vi.venderid,v.vendername,"
				+ " vi.postaddress,vi.postcode,vi.contactperson,vi.telno,vi.mobileno, vi.note,vi.updatedate,decode(vi.taxtype,0,'一般纳税人','小规模或自然人') taxtype,vi.taxname,vi.taxno,vi.taxaddrtel,vi.taxbank "
				+ " FROM vender_diy vi join vender v on vi.venderid=v.venderid"
				+cookFilter(map).toWhereString();

		return SqlUtil.getRowSetElement(conn, sql, "rowset");
	}

	/**
	 * 供应商列表excel
	 *
	 * @param file
	 * @param map
	 * @throws InvalidDataException
	 * @throws SQLException
	 * @throws IOException
	 * @throws WriteException
	 * @throws RowsExceededException
	 */
	public void makeVenderListExcel(Connection conn, File file, Map map) throws InvalidDataException, SQLException,
			IOException, RowsExceededException, WriteException {
		String[] title = { "供应商编码", "供应商名称", "邮寄地址", "邮政编码", "联系人", "办公电话", "手机", "备注","更新时间" , "纳税人类型","开票名称","纳税识别号","税票地址电话","税票开户行及帐号"};
		String sql = " SELECT vi.venderid,v.vendername,"
				+ " vi.postaddress,vi.postcode,vi.contactperson,vi.telno,vi.mobileno, vi.note,vi.updatedate,decode(vi.taxtype,0,'一般纳税人','小规模或自然人') taxtype,vi.taxname,vi.taxno,vi.taxaddrtel,vi.taxbank "
				+ " FROM vender_diy vi join vender v on vi.venderid=v.venderid"
				+cookFilter(map).toWhereString();

		PreparedStatement pstmt = conn.prepareStatement(sql);
		ResultSet rs = pstmt.executeQuery();

		Workbook.writeToFile(file, rs, title, "供应商信息列表");

		rs.close();
		pstmt.close();
	}

	public SqlFilter cookFilter(Map<String, String[]> map) {
		return new SqlFilter(map).addFilter("v_min", "vi.venderid", ">=", true).
				addFilter("v_max","vi.venderid", "<=", true);
	}

	/**
	 * 获得供应商信息
	 *
	 * @param conn
	 * @param token
	 * @return
	 * @throws SQLException
	 */
	public Element getVenderInfo(Connection conn, Token token) throws SQLException {
		String sql = " SELECT vi.venderid,"
				+ " vi.postaddress,vi.postcode,vi.contactperson,vi.telno,vi.mobileno,"
				+ " vi.note,vi.updatedate,vi.taxtype,vi.taxname,vi.taxno,vi.taxaddrtel,vi.taxbank FROM vender_diy vi   WHERE vi.venderid='"
				+ token.getBusinessid() + "' ";
		return SqlUtil.getRowSetElement(conn, sql, "rowset");
	}

	/**
	 * 更新供应商信息
	 *
	 * @param conn
	 * @param elmVender
	 * @param token
	 * @throws Exception
	 */
	public void setVenderInfo1(Connection conn, Element elmVender, Token token) throws Exception {
		String sql = " INSERT INTO vender_diy(venderid, postaddress, postcode, contactperson, telno, mobileno, note) "
				+ " values( ?, ?, ?, ?, ?, ?, ?) ";

		try {
			conn.setAutoCommit(false);
			delVenderInfo(conn, token.getBusinessid());

			PreparedStatement pstmt = conn.prepareStatement(sql);
			pstmt.setString(1, token.getBusinessid());
			pstmt.setString(2, elmVender.getChildTextTrim("postaddress"));
			pstmt.setString(3, elmVender.getChildTextTrim("postcode"));
			pstmt.setString(4, elmVender.getChildTextTrim("contactperson"));
			pstmt.setString(5, elmVender.getChildTextTrim("telno"));
			pstmt.setString(6, elmVender.getChildTextTrim("mobileno"));
			pstmt.setString(7, elmVender.getChildTextTrim("note"));

			pstmt.executeUpdate();
			conn.commit();
			pstmt.close();
		} catch (Exception e) {
			conn.rollback();
			throw e;
		} finally {
			conn.setAutoCommit(true);
		}
	}

	public void setVenderInfo(Connection conn, Token token, HttpServletRequest request) throws Exception {
		String sql = " INSERT INTO vender_diy(venderid, postaddress, postcode, contactperson, telno, mobileno, note,taxtype,taxname,taxno,taxaddrtel,taxbank,updatedate) "
				+ " values( ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,sysdate) ";

		String postaddress = request.getParameter("postaddress");
		String postcode = request.getParameter("postcode");
		String contactperson = request.getParameter("contactperson");
		String telno = request.getParameter("telno");
		String mobileno = request.getParameter("mobileno");
		String note = request.getParameter("note");

		String taxtype = request.getParameter("taxtype");
		String taxname = request.getParameter("taxname");
		String taxno = request.getParameter("taxno");
		String taxaddrtel = request.getParameter("taxaddrtel");
		String taxbank = request.getParameter("taxbank");

		try {
			conn.setAutoCommit(false);
			delVenderInfo(conn, token.getBusinessid());
			SqlUtil.executePS(conn, sql, token.getBusinessid(), postaddress, postcode, contactperson, telno, mobileno,
					note, taxtype, taxname, taxno, taxaddrtel, taxbank);
			conn.commit();
		} catch (Exception e) {
			conn.rollback();
			throw e;
		} finally {
			conn.setAutoCommit(true);
		}
	}

	/**
	 * 删除供应商信息
	 *
	 * @param conn
	 * @param venderid
	 * @throws SQLException
	 */
	public void delVenderInfo(Connection conn, String venderid) throws SQLException {
		String sql = " DELETE FROM vender_diy WHERE venderid='" + venderid + "' ";
		Statement stmt = conn.createStatement();
		stmt.executeUpdate(sql);
		stmt.close();
	}

	public void agreeCrbLic(Connection conn, String venderid){
		String sql="update vender_diy set crblicstatus='Y',crblicdate=sysdate where venderid=?";
		SqlUtil.executePS(conn, sql, venderid);
	}

	public String getCrbLicStatus(Connection conn, String venderid){
		String sql ="select crblicstatus from vender_diy where venderid=?";
		List<String> list = SqlUtil.queryPS4SingleColumn(conn, sql, venderid);
		return list.size()>0?list.get(0):"N";
	}
}


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=../../cl_sys/constant.CL_ADDRESS_NONE.html">

Redirecting to ../../cl_sys/constant.CL_ADDRESS_NONE.html...


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Gram. unifl. sesquifl. 171. 1824 (non Nutt. 1818)

#### Original name
null

### Remarks
null


text:
<BroadcastMonitor>
  <updated>2015-08-05T13:49:41</updated>
  <stationName>Radio 6</stationName>
  <Current>
    <startTime>2015-08-05T13:49:41</startTime>
    <itemId>1000080538:1243590</itemId>
    <titleId>216041043</titleId>
    <itemCode>MS324</itemCode>
    <itemReference></itemReference>
    <titleName>Sure Thing</titleName>
    <artistName>St Germain</artistName>
    <albumName></albumName>
    <CategoryCode>737</CategoryCode>
    <CategoryName>JAZZ</CategoryName>
    <itemDuration>229</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Current>
  <Next>
    <startTime>2015-08-05T13:53:30</startTime>
    <itemId>1000080538:1241363</itemId>
    <titleId>216138364</titleId>
    <itemCode>10535</itemCode>
    <itemReference></itemReference>
    <titleName>Shame</titleName>
    <artistName>Tyrese</artistName>
    <albumName></albumName>
    <CategoryCode>736</CategoryCode>
    <CategoryName>SOUL</CategoryName>
    <itemDuration>309</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Next>
</BroadcastMonitor>


text:
import * as domUtil from './util/dom';
export var dom = domUtil;
export * from './util/util';
export * from './util/datetime-util';


text:
package org.wso2.carbon.user.mgt.bulkimport;

import org.wso2.carbon.user.core.UserStoreManager;
import org.wso2.carbon.user.mgt.common.UserAdminException;

public interface UserBulkImport {
    void addUserList(UserStoreManager userStore) throws UserAdminException;
}


text:
Search Financial Advisors

Keywords

          <input type="text" class="form-control" placeholder="Search questions." />

Categories

          <input type="checkbox"/>
          {{ category }}

Liscenced In:
          <select>
            <option ng-repeat="state in states" value="state">{{ state }}</option>
          </select>

More

          [Search results coming soon]


text:
package org.assertj.core.internal.objects;

import static java.lang.String.format;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.configuration.ConfigurationProvider.CONFIGURATION_PROVIDER;
import static org.assertj.core.error.ShouldBeEqualByComparingFieldByFieldRecursively.shouldBeEqualByComparingFieldByFieldRecursive;
import static org.assertj.core.internal.objects.SymmetricDateComparator.SYMMETRIC_DATE_COMPARATOR;
import static org.assertj.core.test.AlwaysEqualComparator.ALWAY_EQUALS;
import static org.assertj.core.test.AlwaysEqualComparator.ALWAY_EQUALS_TIMESTAMP;
import static org.assertj.core.test.NeverEqualComparator.NEVER_EQUALS;
import static org.assertj.core.test.TestData.someInfo;
import static org.assertj.core.test.TestFailures.failBecauseExpectedAssertionErrorWasNotThrown;
import static org.mockito.Mockito.verify;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.TreeSet;

import org.assertj.core.api.AssertionInfo;
import org.assertj.core.internal.AtPrecisionComparator;
import org.assertj.core.internal.DeepDifference.Difference;
import org.assertj.core.internal.ObjectsBaseTest;
import org.assertj.core.internal.TypeComparators;
import org.assertj.core.test.Patient;
import org.junit.Test;

public class Objects_assertIsEqualToComparingFieldByFieldRecursive_Test extends ObjectsBaseTest {

  @Test
  public void should_be_able_to_compare_objects_recursively() {
    Person actual = new Person();
    actual.name = "John";
    actual.home.address.number = 1;

    Person other = new Person();
    other.name = "John";
    other.home.address.number = 1;

    objects.assertIsEqualToComparingFieldByFieldRecursively(someInfo(), actual, other, noFieldComparators(),
                                                            defaultTypeComparators());
  }

  @Test
  public void should_be_able_to_compare_objects_of_different_types_recursively() {
    Person actual = new Person();
    actual.name = "John";
    actual.home.address.number = 1;

    Human other = new Human();
    other.name = "John";
    other.home.address.number = 1;

    objects.assertIsEqualToComparingFieldByFieldRecursively(someInfo(), actual, other, noFieldComparators(),
                                                            defaultTypeComparators());
  }

  @Test
  public void should_be_able_to_compare_objects_recursively_using_some_precision_for_numerical_types() {
    Giant goliath = new Giant();
    goliath.name = "Goliath";
    goliath.height = 3.0;

    Giant goliathTwin = new Giant();
    goliathTwin.name = "Goliath";
    goliathTwin.height = 3.1;

    assertThat(goliath).usingComparatorForType(new AtPrecisionComparator<>(0.2), Double.class)
                       .isEqualToComparingFieldByFieldRecursively(goliathTwin);
  }

  @Test
  public void should_be_able_to_compare_objects_recursively_using_given_comparator_for_specified_field() {
    Giant goliath = new Giant();
    goliath.name = "Goliath";
    goliath.height = 3.0;

    Giant goliathTwin = new Giant();
    goliathTwin.name = "Goliath";
    goliathTwin.height = 3.1;

    assertThat(goliath).usingComparatorForFields(new AtPrecisionComparator<>(0.2), "height")
                       .isEqualToComparingFieldByFieldRecursively(goliathTwin);
  }

  @Test
  public void should_be_able_to_compare_objects_recursively_using_given_comparator_for_specified_nested_field() {
    Giant goliath = new Giant();
    goliath.name = "Goliath";
    goliath.height = 3.0;
    goliath.home.address.number = 1;

    Giant goliathTwin = new Giant();
    goliathTwin.name = "Goliath";
    goliathTwin.height = 3.1;
    goliathTwin.home.address.number = 5;

    assertThat(goliath).usingComparatorForFields(new AtPrecisionComparator<>(0.2), "height")
                       .usingComparatorForFields(new AtPrecisionComparator<>(10), "home.address.number")
                       .isEqualToComparingFieldByFieldRecursively(goliathTwin);
  }

  @Test
  public void should_be_able_to_compare_objects_with_cycles_recursively() {
    FriendlyPerson actual = new FriendlyPerson();
    actual.name = "John";
    actual.home.address.number = 1;

    FriendlyPerson other = new FriendlyPerson();
    other.name = "John";
    other.home.address.number = 1;

    // neighbour
    other.neighbour = actual;
    actual.neighbour = other;

    // friends
    FriendlyPerson sherlock = new FriendlyPerson();
    sherlock.name = "Sherlock";
    sherlock.home.address.number = 221;
    actual.friends.add(sherlock);
    actual.friends.add(other);
    other.friends.add(sherlock);
    other.friends.add(actual);

    objects.assertIsEqualToComparingFieldByFieldRecursively(someInfo(), actual, other, noFieldComparators(),
                                                            defaultTypeComparators());
  }

  @Test
  public void should_fail_when_fields_differ() {
    AssertionInfo info = someInfo();

    Person actual = new Person();
    actual.name = "John";

    Person other = new Person();
    other.name = "Jack";

    try {
      objects.assertIsEqualToComparingFieldByFieldRecursively(info, actual, other, noFieldComparators(),
                                                              defaultTypeComparators());
    } catch (AssertionError err) {
      verify(failures).failure(info, shouldBeEqualByComparingFieldByFieldRecursive(actual, other,
                                                                                asList(new Difference(asList("name"),
                                                                                "John",
                                                                                "Jack")),
                                                                                CONFIGURATION_PROVIDER.representation()));
      return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
  }

  @Test
  public void should_fail_when_fields_of_child_objects_differ() {
    AssertionInfo info = someInfo();

    Person actual = new Person();
    actual.name = "John";
    actual.home.address.number = 1;

    Person other = new Person();
    other.name = "John";
    other.home.address.number = 2;

    try {
      objects.assertIsEqualToComparingFieldByFieldRecursively(info, actual, other, noFieldComparators(),
                                                              defaultTypeComparators());
    } catch (AssertionError err) {
      verify(failures).failure(info,
                               shouldBeEqualByComparingFieldByFieldRecursive(actual, other,
                                                                             asList(new Difference(asList("home.address.number"),
                                                                                1,
                                                                                2)),
                                                                             CONFIGURATION_PROVIDER.representation()));
      return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
  }

  @Test
  public void should_have_error_message_with_differences_and_path_to_differences() {
    Person actual = new Person();
    actual.name = "Jack";
    actual.home.address.number = 1;

    Person other = new Person();
    other.name = "John";
    other.home.address.number = 2;

    thrown.expectAssertionError(format("%nExpecting:%n  <%s>%nto be equal to:%n  <%s>%n", actual, other) +
                                "when recursively comparing field by field, but found the following difference(s):%n%n"
                                +
                                "Path to difference: <home.address.number>%n" +
                                "- expected: <2>%n" +
                                "- actual  : <1>%n%n" +
                                "Path to difference: <name>%n" +
                                "- expected: <\"John\">%n" +
                                "- actual  : <\"Jack\">");

    assertThat(actual).isEqualToComparingFieldByFieldRecursively(other);
  }

  @Test
  public void should_have_error_message_with_path_to_difference_when_difference_is_in_collection() {
    FriendlyPerson actual = new FriendlyPerson();
    FriendlyPerson friendOfActual = new FriendlyPerson();
    friendOfActual.home.address.number = 99;
    actual.friends = Arrays.asList(friendOfActual);

    FriendlyPerson other = new FriendlyPerson();
    FriendlyPerson friendOfOther = new FriendlyPerson();
    friendOfOther.home.address.number = 10;
    other.friends = Arrays.asList(friendOfOther);

    thrown.expectAssertionError(format("%nExpecting:%n  <%s>%nto be equal to:%n  <%s>%n", actual, other) +
                                "when recursively comparing field by field, but found the following difference(s):%n%n"
                                +
                                "Path to difference: <friends.home.address.number>%n" +
                                "- expected: <10>%n" +
                                "- actual  : <99>");

    assertThat(actual).isEqualToComparingFieldByFieldRecursively(other);
  }

  @Test
  public void should_not_use_equal_implementation_of_objects_to_compare() {
    AssertionInfo info = someInfo();

    EqualPerson actual = new EqualPerson();
    actual.name = "John";
    actual.home.address.number = 1;

    EqualPerson other = new EqualPerson();
    other.name = "John";
    other.home.address.number = 2;

    try {
      objects.assertIsEqualToComparingFieldByFieldRecursively(info, actual, other, noFieldComparators(),
                                                              defaultTypeComparators());
    } catch (AssertionError err) {
      verify(failures).failure(info,
                               shouldBeEqualByComparingFieldByFieldRecursive(actual, other,
                                                                             asList(new Difference(asList("home.address.number"),
                                                                                1, 2)),
                                                                             CONFIGURATION_PROVIDER.representation()));
      return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
  }

  @Test
  public void should_fail_when_comparing_unsorted_with_sorted_set() {
    WithCollection<String> actual = new WithCollection<>(new LinkedHashSet<String>());
    actual.collection.add("bar");
    actual.collection.add("foo");
    WithCollection<String> expected = new WithCollection<>(new TreeSet<String>());
    expected.collection.add("bar");
    expected.collection.add("foo");

    try {
      assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
    } catch (AssertionError err) {
      assertThat(err).hasMessageContaining(format("Path to difference: <collection>%n"));
      assertThat(err).hasMessageContaining(format("- actual  : <[\"bar\", \"foo\"] (LinkedHashSet@"));
      assertThat(err).hasMessageContaining(format("- expected: <[\"bar\", \"foo\"] (TreeSet@"));
      return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
  }

  @Test
  public void should_fail_when_comparing_sorted_with_unsorted_set() {
    WithCollection<String> actual = new WithCollection<>(new TreeSet<String>());
    actual.collection.add("bar");
    actual.collection.add("foo");
    WithCollection<String> expected = new WithCollection<>(new LinkedHashSet<String>());
    expected.collection.add("bar");
    expected.collection.add("foo");

    try {
      assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
    } catch (AssertionError err) {
      assertThat(err).hasMessageContaining(format("Path to difference: <collection>%n"));
      assertThat(err).hasMessageContaining(format("- actual  : <[\"bar\", \"foo\"] (TreeSet@"));
      assertThat(err).hasMessageContaining(format("- expected: <[\"bar\", \"foo\"] (LinkedHashSet@"));
      return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
  }

  @Test
  public void should_fail_when_comparing_unsorted_with_sorted_map() {
    WithMap<Long, Boolean> actual = new WithMap<>(new LinkedHashMap<Long, Boolean>());
    actual.map.put(1L, true);
    actual.map.put(2L, false);
    WithMap<Long, Boolean> expected = new WithMap<>(new TreeMap<Long, Boolean>());
    expected.map.put(2L, false);
    expected.map.put(1L, true);

    try {
      assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
    } catch (AssertionError err) {
      assertThat(err).hasMessageContaining(format("Path to difference: <map>%n"));
      assertThat(err).hasMessageContaining(format("- actual  : <{1L=true, 2L=false} (LinkedHashMap@"));
      assertThat(err).hasMessageContaining(format("- expected: <{1L=true, 2L=false} (TreeMap@"));
      return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
  }

  @Test
  public void should_fail_when_comparing_sorted_with_unsorted_map() {
    WithMap<Long, Boolean> actual = new WithMap<>(new TreeMap<Long, Boolean>());
    actual.map.put(1L, true);
    actual.map.put(2L, false);
    WithMap<Long, Boolean> expected = new WithMap<>(new LinkedHashMap<Long, Boolean>());
    expected.map.put(2L, false);
    expected.map.put(1L, true);

    try {
      assertThat(actual).isEqualToComparingFieldByFieldRecursively(expected);
    } catch (AssertionError err) {
      assertThat(err).hasMessageContaining(format("Path to difference: <map>%n"));
      assertThat(err).hasMessageContaining(format("- actual  : <{1L=true, 2L=false} (TreeMap@"));
      assertThat(err).hasMessageContaining(format("- expected: <{1L=true, 2L=false} (LinkedHashMap@"));
      return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
  }

  @Test
  public void should_handle_null_field_with_field_comparator() {
    // GIVEN
    Patient adam = new Patient(null);
    Patient eve = new Patient(new Timestamp(3L));
    // THEN
    assertThat(adam).usingComparatorForFields(ALWAY_EQUALS, "dateOfBirth", "health")
                    .isEqualToComparingFieldByFieldRecursively(eve);
  }

  @Test
  public void should_handle_null_field_with_type_comparator() {
    // GIVEN
    Patient adam = new Patient(null);
    Patient eve = new Patient(new Timestamp(3L));
    // THEN
    assertThat(adam).usingComparatorForType(ALWAY_EQUALS_TIMESTAMP, Timestamp.class)
                    .isEqualToComparingFieldByFieldRecursively(eve);
  }

  @Test
  public void should_not_bother_with_comparators_when_fields_are_the_same() {
    // GIVEN
    Timestamp dateOfBirth = new Timestamp(3L);
    Patient adam = new Patient(dateOfBirth);
    Patient eve = new Patient(dateOfBirth);
    // THEN
    assertThat(adam).usingComparatorForFields(NEVER_EQUALS, "dateOfBirth")
                    .isEqualToComparingFieldByFieldRecursively(eve);
  }

  @Test
  public void should_treat_date_as_equal_to_timestamp() {
    Person actual = new Person();
    actual.name = "Fred";
    actual.dateOfBirth = new Date(1000L);

    Person other = new Person();
    other.name = "Fred";
    other.dateOfBirth = new Timestamp(1000L);

    objects.assertIsEqualToComparingFieldByFieldRecursively(someInfo(), actual, other, noFieldComparators(),
                                                            defaultTypeComparators());
  }

  @Test
  public void should_treat_timestamp_as_equal_to_date_when_registering_a_Date_symmetric_comparator() {
    Person actual = new Person();
    actual.name = "Fred";
    actual.dateOfBirth = new Timestamp(1000L);

    Person other = new Person();
    other.name = "Fred";
    other.dateOfBirth = new Date(1000L);

    TypeComparators typeComparators = new TypeComparators();
    typeComparators.put(Timestamp.class, SYMMETRIC_DATE_COMPARATOR);

    objects.assertIsEqualToComparingFieldByFieldRecursively(someInfo(), actual, other, noFieldComparators(),
                                                            typeComparators);
    objects.assertIsEqualToComparingFieldByFieldRecursively(someInfo(), other, actual, noFieldComparators(),
                                                            typeComparators);
  }

  @Test
  public void should_treat_timestamp_as_equal_to_date_when_registering_a_Date_symmetric_comparator_for_field() {
    Person actual = new Person();
    actual.name = "Fred";
    actual.dateOfBirth = new Timestamp(1000L);

    Person other = new Person();
    other.name = "Fred";
    other.dateOfBirth = new Date(1000L);

    Map<String, Comparator<?>> fieldComparators = new HashMap<>();
    fieldComparators.put("dateOfBirth", SYMMETRIC_DATE_COMPARATOR);
    objects.assertIsEqualToComparingFieldByFieldRecursively(someInfo(), actual, other, fieldComparators,
                                                            defaultTypeComparators());
  }

  public static class WithMap<K, V> {
    public Map<K, V> map;

    public WithMap(Map<K, V> map) {
      this.map = map;
    }

    @Override
    public String toString() {
      return String.format("WithMap [map=%s]", map);
    }

  }

  public static class WithCollection<E> {
    public Collection<E> collection;

    public WithCollection(Collection<E> collection) {
      this.collection = collection;
    }

    @Override
    public String toString() {
      return String.format("WithCollection [collection=%s]", collection);
    }

  }

  public static class Person {
    public Date dateOfBirth;
    public String name;
    public Home home = new Home();
    public Person neighbour;

    @Override
    public String toString() {
      return "Person [name=" + name + ", home=" + home + "]";
    }
  }

  public static class Home {
    public Address address = new Address();

    @Override
    public String toString() {
      return "Home [address=" + address + "]";
    }
  }

  public static class Address {
    public int number = 1;

    @Override
    public String toString() {
      return "Address [number=" + number + "]";
    }
  }

  public static class Human extends Person {
  }

  public static class Giant extends Person {
    public double height = 3.0;
  }

  public static class EqualPerson extends Person {

    @Override
    public boolean equals(Object o) {
      return true;
    }
  }

  public static class FriendlyPerson extends Person {
    public List<FriendlyPerson> friends = new ArrayList<>();
  }
}


text:
#ifndef CCB_ENGCMD_FACTORY_HH
#define CCB_ENGCMD_FACTORY_HH

#include "com/centreon/broker/io/endpoint.hh"
#include "com/centreon/broker/io/factory.hh"
#include "com/centreon/broker/namespace.hh"

CCB_BEGIN()

namespace neb {
namespace engcmd {
/**
 *  @class factory factory.hh "com/centreon/broker/engcmd/factory.hh"
 *  @brief Engine command factory.
 *
 *  Build engine command endpoints.
 */
class factory : public io::factory {
 public:
  factory() = default;
  factory(factory const& other) = delete;
  ~factory() = default;
  factory& operator=(factory const& other) = delete;
  bool has_endpoint(config::endpoint& cfg);
  io::endpoint* new_endpoint(config::endpoint& cfg,
                             bool& is_acceptor,
                             std::shared_ptr<persistent_cache> cache =
                                 std::shared_ptr<persistent_cache>()) const;
};
}  // namespace engcmd
}  // namespace neb

CCB_END()

#endif  // !CCB_ENGCMD_FACTORY_HH


text:
<?php

namespace RFY\JsonApi\Authenticator\Tests\Unit\Controller;

use Neos\Flow\Tests\UnitTestCase;

class TokenControllerTest extends UnitTestCase
{

    /**
     * @test
     */
    public function testIfAnFlashMessageAndRedirectAreExecutedOnException()
    {
        $this->markTestSkipped('Skip');
    }
}


text:
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem218.py
#
# Perfect right-angled triangles
# ==============================
# Published on Saturday, 22nd November 2008, 01:00 am
#
# Consider the right angled triangle with sides a=7, b=24 and c=25.  The area
# of this triangle is 84, which is divisible by the perfect numbers 6 and 28.
# Moreover it is a primitive right angled triangle as gcd(a,b)=1 and
# gcd(b,c)=1.  Also c is a perfect square. We will call a right angled triangle
# perfect if  -it is a primitive right angled triangle  -its hypotenuse is a
# perfect square We will call a right angled triangle super-perfect if  -it is
# a perfect right angled triangle and  -its area is a multiple of the perfect
# numbers 6 and 28.   How many perfect right-angled triangles with c1016 exist
# that are not super-perfect?

import projecteuler as pe

def main():
    pass

if __name__ == "__main__":
    main()


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycoscience 41(6): 545 (2000)

#### Original name
Mycena brevicapillata Har. Takah.

### Remarks
null


text:
title: all -
---
//[Kotlin utilities](../../index.html)/[it.czerwinski.kotlin.util](../index.html)/[RightProjection](index.html)/[all](all.html)

# all
[common]
Brief description

Returns the result of applying the predicate to the value if this is [Right](../-right/index.html) or true if this is [Left](../-left/index.html).

#### Return

The result of applying the predicate to the value if this is [Right](../-right/index.html) or true if this is [Left](../-left/index.html).

## Parameters

common

|  Name|  Summary|
|---|---|
| predicate|

Predicate function.

Content
inline fun [all](all.html)(predicate: ([R](index.html)) -> [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)


text:
var AudioContext = require('../sound/AudioContext');
var MathUtils = require('../math/MathUtils');

function OscillatorSound() {
	// Settings
	this.id = null;
	this._volume = 1.0;
	this._frequency = 440;
	this._type = 'sine';

	// Nodes
	this._outNode = AudioContext.getContext().createGain();

	this.connectTo();
}

OscillatorSound.prototype.stop = function () {
	this._oscNode.stop();
	this._oscNode = null;
};

OscillatorSound.prototype.play = function () {
	this._oscNode = AudioContext.getContext().createOscillator();
	this._oscNode.connect(this._outNode);
	this._oscNode.frequency.value = this._frequency;
	this._oscNode.type = this._type;

	this._oscNode.start();
};

OscillatorSound.prototype.update = function (config) {
	if (config.volume !== undefined) {
		this._volume = MathUtils.clamp(config.volume, 0, 1);
		this._outNode.gain.value = this._volume;
	}
	if (config.frequency !== undefined) {
		this._frequency = config.frequency;
		if (this._oscNode) {
			this._oscNode.frequency.value = this._frequency;
		}
	}
	if (config.type !== undefined && OscillatorSound.TYPES.indexOf(config.type) !== -1) {
		this._type = config.type;
		if (this._oscNode) {
			this._oscNode.type = this._type;
		}
	}
};

/**
 * Connect output of sound to audionodes
 * @param {(Array<AudioNode> | AudioNode)} nodes
 */
OscillatorSound.prototype.connectTo = function (nodes) {
	if (!AudioContext.isSupported()) {
		console.warn('WebAudio not supported');
		return;
	}
	this._outNode.disconnect();
	if (!nodes) {
		return;
	}
	if (!(nodes instanceof Array)) {
		nodes = [nodes];
	}
	for (var i = 0; i < nodes.length; i++) {
		this._outNode.connect(nodes[i]);
	}
};

OscillatorSound.TYPES = [
	'sine',
	'square',
	'sawtooth',
	'triangle',
	'custom'
];

module.exports = OscillatorSound;


text:
import unittest
import mock
from testfixtures import LogCapture

from ming.orm import ThreadLocalORMSession
from tg import tmpl_context as c

from alluratest.controller import setup_basic_test, setup_global_objects
from allura.scripts.refreshrepo import RefreshRepo
from allura.scripts.refresh_last_commits import RefreshLastCommits
from allura.lib import helpers as h
from allura.tasks import repo_tasks
from allura.tests.decorators import assert_logmsg_and_no_warnings_or_errors
from allura import model as M
from forgegit.tests import with_git
from forgegit.tests.functional.test_controllers import _TestCase as GitRealDataBaseTestCase

class TestGitTasks(unittest.TestCase):

    def setup_method(self, method):
        setup_basic_test()
        self.setup_with_tools()

    @with_git
    def setup_with_tools(self):
        setup_global_objects()
        h.set_context('test', 'src-git', neighborhood='Projects')
        ThreadLocalORMSession.flush_all()
        ThreadLocalORMSession.close_all()

    def test_init(self):
        repo_tasks.init()

    def test_refresh_commit(self):
        repo_tasks.refresh()

    @with_git
    def test_reclone(self):
        ns = M.Notification.query.find().count()
        with mock.patch.object(c.app.repo, 'init_as_clone') as f:
            c.app.config.options['init_from_path'] = 'test_path'
            c.app.config.options['init_from_url'] = 'test_url'
            repo_tasks.reclone_repo(
                prefix='p', shortname='test', mount_point='src-git')
            M.main_orm_session.flush()
            f.assert_called_with('test_path', None, 'test_url')
            assert ns + 1 == M.Notification.query.find().count()

class TestCoreAlluraTasks(GitRealDataBaseTestCase):
    """
    Not git-specific things we are testing, but the git tool is a useful standard repo type to use for it
    """

    def setup_method(self, method):
        super().setup_method(method)
        self.setup_with_tools()

    def test_refreshrepo(self):
        opts = RefreshRepo.parser().parse_args(
            ['--nbhd', '/p/', '--project', 'test', '--clean', '--all', '--repo-types', 'git'])
        with LogCapture() as logs:
            RefreshRepo.execute(opts)
        assert_logmsg_and_no_warnings_or_errors(logs, 'Refreshing ALL commits in ')

        # run again with some different params
        opts = RefreshRepo.parser().parse_args(
            ['--nbhd', '/p/', '--project', 'test', '--clean-after', '2010-01-01T00:00:00'])
        with LogCapture() as logs:
            RefreshRepo.execute(opts)
        assert_logmsg_and_no_warnings_or_errors(logs, 'Refreshing NEW commits in ')

    def test_refresh_last_commits(self):
        repo = c.app.repo
        repo.refresh()

        opts = RefreshLastCommits.parser().parse_args(
            ['--nbhd', '/p/', '--project', 'test', '--clean', '--repo-types', 'git'])
        with LogCapture() as logs:
            RefreshLastCommits.execute(opts)

        assert_logmsg_and_no_warnings_or_errors(logs, 'Refreshing all last commits ')

        # mostly just making sure nothing errored, but here's at least one thing we can assert:
        assert repo.status == 'ready'


text:
<?xml version="1.0" encoding="utf-8"?>
<MapData>
<Details>
<FileName>[340]T16.rmd</FileName>
<FileType>Red Stone Scenario File 6.9 beta</FileType>
<MapName>ロマ村 ビスル</MapName>
<SysWidth>75</SysWidth>
<SysHeight>75</SysHeight>
<TgaWidth>350</TgaWidth>
<TgaHeight>175</TgaHeight>
<MapType>2</MapType>
<isPremiumMap>0</isPremiumMap>
<isPvPMap>0</isPvPMap>
<MapView_Lv>0</MapView_Lv>
<isLocationStrage>0</isLocationStrage>
<P_SubElement1>0</P_SubElement1>
<P_SubElement2>0</P_SubElement2>
<P_SubElement3>0</P_SubElement3>
<P_SubElement4>0</P_SubElement4>
<P_SubElement5>0</P_SubElement5>
<P_SubElement6>0</P_SubElement6>
<M_AddElement1>0</M_AddElement1>
<M_AddElement2>0</M_AddElement2>
<M_AddElement3>0</M_AddElement3>
<M_AddElement4>0</M_AddElement4>
<M_AddElement5>0</M_AddElement5>
<M_AddElement6>0</M_AddElement6>
</Details>
<CharacterData>
<Character id="cUid0">
<CharacterUID>0</CharacterUID>
<CharacterName>クラブシェル</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>38.79</PopPoint_X>
<PopPoint_Y>127.90</PopPoint_Y>
</Character>
<Character id="cUid1">
<CharacterUID>1</CharacterUID>
<CharacterName>クラブシェル</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>0</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>23.04</PopPoint_X>
<PopPoint_Y>137.23</PopPoint_Y>
</Character>
<Character id="cUid2">
<CharacterUID>2</CharacterUID>
<CharacterName>ダイアーウルフ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>1</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>134.68</PopPoint_X>
<PopPoint_Y>153.13</PopPoint_Y>
</Character>
<Character id="cUid3">
<CharacterUID>3</CharacterUID>
<CharacterName>ダイアーウルフ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>1</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>135.55</PopPoint_X>
<PopPoint_Y>164.50</PopPoint_Y>
</Character>
<Character id="cUid4">
<CharacterUID>4</CharacterUID>
<CharacterName>クーン</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>6</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>175.58</PopPoint_X>
<PopPoint_Y>95.45</PopPoint_Y>
</Character>
<Character id="cUid5">
<CharacterUID>5</CharacterUID>
<CharacterName>ウィーブウィドウ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>7</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>266.07</PopPoint_X>
<PopPoint_Y>19.03</PopPoint_Y>
</Character>
<Character id="cUid6">
<CharacterUID>6</CharacterUID>
<CharacterName>カレン</CharacterName>
<CharacterType>11</CharacterType>
<InternalID>5</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>141.53</PopPoint_X>
<PopPoint_Y>149.70</PopPoint_Y>
</Character>
<Character id="cUid7">
<CharacterUID>7</CharacterUID>
<CharacterName>ロマ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>3</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>40.76</PopPoint_X>
<PopPoint_Y>137.52</PopPoint_Y>
</Character>
<Character id="cUid8">
<CharacterUID>8</CharacterUID>
<CharacterName>レイネ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>49.73</PopPoint_X>
<PopPoint_Y>46.08</PopPoint_Y>
</Character>
<Character id="cUid9">
<CharacterUID>9</CharacterUID>
<CharacterName>ロマ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>4</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>72.70</PopPoint_X>
<PopPoint_Y>35.36</PopPoint_Y>
</Character>
<Character id="cUid10">
<CharacterUID>10</CharacterUID>
<CharacterName>レティ</CharacterName>
<CharacterType>11</CharacterType>
<InternalID>3</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>164.79</PopPoint_X>
<PopPoint_Y>28.66</PopPoint_Y>
</Character>
<Character id="cUid11">
<CharacterUID>11</CharacterUID>
<CharacterName>ハンス</CharacterName>
<CharacterType>11</CharacterType>
<InternalID>4</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>336.58</PopPoint_X>
<PopPoint_Y>142.99</PopPoint_Y>
</Character>
<Character id="cUid12">
<CharacterUID>12</CharacterUID>
<CharacterName>ロマ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>5</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>318.14</PopPoint_X>
<PopPoint_Y>138.76</PopPoint_Y>
</Character>
<Character id="cUid13">
<CharacterUID>13</CharacterUID>
<CharacterName>ロマ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>258.56</PopPoint_X>
<PopPoint_Y>63.95</PopPoint_Y>
</Character>
<Character id="cUid14">
<CharacterUID>14</CharacterUID>
<CharacterName>ロマちびっこ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>8</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>242.01</PopPoint_X>
<PopPoint_Y>89.03</PopPoint_Y>
</Character>
<Character id="cUid15">
<CharacterUID>15</CharacterUID>
<CharacterName>ロマちびっこ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>9</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>265.78</PopPoint_X>
<PopPoint_Y>100.19</PopPoint_Y>
</Character>
<Character id="cUid16">
<CharacterUID>16</CharacterUID>
<CharacterName>ロマちびっこ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>11</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>34.85</PopPoint_X>
<PopPoint_Y>139.71</PopPoint_Y>
</Character>
<Character id="cUid17">
<CharacterUID>17</CharacterUID>
<CharacterName>ロマちびっこ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>10</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>108.57</PopPoint_X>
<PopPoint_Y>107.48</PopPoint_Y>
</Character>
<Character id="cUid18">
<CharacterUID>18</CharacterUID>
<CharacterName>ロマちびっこ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>10</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>102.59</PopPoint_X>
<PopPoint_Y>107.92</PopPoint_Y>
</Character>
<Character id="cUid19">
<CharacterUID>19</CharacterUID>
<CharacterName>ベシル</CharacterName>
<CharacterType>11</CharacterType>
<InternalID>3</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>282.19</PopPoint_X>
<PopPoint_Y>36.09</PopPoint_Y>
</Character>
<Character id="cUid20">
<CharacterUID>20</CharacterUID>
<CharacterName>ロマちびっこ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>11</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>272.13</PopPoint_X>
<PopPoint_Y>33.83</PopPoint_Y>
</Character>
<Character id="cUid21">
<CharacterUID>21</CharacterUID>
<CharacterName>ロマちびっこ</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>10</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>280.88</PopPoint_X>
<PopPoint_Y>24.21</PopPoint_Y>
</Character>
<Character id="cUid22">
<CharacterUID>22</CharacterUID>
<CharacterName>サテラ</CharacterName>
<CharacterType>5</CharacterType>
<InternalID>2</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>59.79</PopPoint_X>
<PopPoint_Y>105.00</PopPoint_Y>
</Character>
<Character id="cUid23">
<CharacterUID>23</CharacterUID>
<CharacterName>配達員</CharacterName>
<CharacterType>14</CharacterType>
<InternalID>16</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>220.72</PopPoint_X>
<PopPoint_Y>46.45</PopPoint_Y>
</Character>
<Character id="cUid24">
<CharacterUID>24</CharacterUID>
<CharacterName>協会専属魔法師</CharacterName>
<CharacterType>35</CharacterType>
<InternalID>21</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>117.83</PopPoint_X>
<PopPoint_Y>38.79</PopPoint_Y>
</Character>
<Character id="cUid25">
<CharacterUID>25</CharacterUID>
<CharacterName>ヘルツビンス</CharacterName>
<CharacterType>28</CharacterType>
<InternalID>4</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>294.07</PopPoint_X>
<PopPoint_Y>26.83</PopPoint_Y>
</Character>
<Character id="cUid26">
<CharacterUID>26</CharacterUID>
<CharacterName>ビスティア</CharacterName>
<CharacterType>12</CharacterType>
<InternalID>5</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>12.61</PopPoint_X>
<PopPoint_Y>11.67</PopPoint_Y>
</Character>
<Character id="cUid27">
<CharacterUID>27</CharacterUID>
<CharacterName>メリルダ</CharacterName>
<CharacterType>11</CharacterType>
<InternalID>17</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>290.35</PopPoint_X>
<PopPoint_Y>71.46</PopPoint_Y>
</Character>
<Character id="cUid28">
<CharacterUID>28</CharacterUID>
<CharacterName>ウニエル</CharacterName>
<CharacterType>13</CharacterType>
<InternalID>15</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>285.61</PopPoint_X>
<PopPoint_Y>147.73</PopPoint_Y>
</Character>
<Character id="cUid29">
<CharacterUID>29</CharacterUID>
<CharacterName>詩人ヘセルモニア</CharacterName>
<CharacterType>10</CharacterType>
<InternalID>19</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>142.41</PopPoint_X>
<PopPoint_Y>57.60</PopPoint_Y>
</Character>
<Character id="cUid30">
<CharacterUID>30</CharacterUID>
<CharacterName>アシャス・フェン</CharacterName>
<CharacterType>1</CharacterType>
<InternalID>20</InternalID>
<PopSpeed>120</PopSpeed>
<isPTBoss>0</isPTBoss>
<PopPoint_X>143.72</PopPoint_X>
<PopPoint_Y>82.40</PopPoint_Y>
</Character>
</CharacterData>
<AreaData>
<Area id="aUid0">
<AreaUID>0</AreaUID>
<AreaName>_필드 전체</AreaName>
<AreaType>0</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>0.00</AreaPos_X>
<AreaPos_X2>0.00</AreaPos_X2>
<AreaPos_Y>0.00</AreaPos_Y>
<AreaPos_Y2>0.00</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid1">
<AreaUID>1</AreaUID>
<AreaName>_화면</AreaName>
<AreaType>0</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>0.00</AreaPos_X>
<AreaPos_X2>0.00</AreaPos_X2>
<AreaPos_Y>0.00</AreaPos_Y>
<AreaPos_Y2>0.00</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid2">
<AreaUID>2</AreaUID>
<AreaName>게 딱지</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>15.97</AreaPos_X>
<AreaPos_X2>40.47</AreaPos_X2>
<AreaPos_Y>121.04</AreaPos_Y>
<AreaPos_Y2>136.57</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid3">
<AreaUID>3</AreaUID>
<AreaName>Area 2</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>120.24</AreaPos_X>
<AreaPos_X2>151.74</AreaPos_X2>
<AreaPos_Y>150.65</AreaPos_Y>
<AreaPos_Y2>168.73</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid4">
<AreaUID>4</AreaUID>
<AreaName>Area 3</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>243.83</AreaPos_X>
<AreaPos_X2>279.34</AreaPos_X2>
<AreaPos_Y>16.11</AreaPos_Y>
<AreaPos_Y2>47.18</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid5">
<AreaUID>5</AreaUID>
<AreaName>Area 4</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>35.07</AreaPos_X>
<AreaPos_X2>76.64</AreaPos_X2>
<AreaPos_Y>25.96</AreaPos_Y>
<AreaPos_Y2>57.82</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid6">
<AreaUID>6</AreaUID>
<AreaName>Area 5</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>151.08</AreaPos_X>
<AreaPos_X2>188.34</AreaPos_X2>
<AreaPos_Y>21.95</AreaPos_Y>
<AreaPos_Y2>44.99</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid7">
<AreaUID>7</AreaUID>
<AreaName>Area 6</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>316.60</AreaPos_X>
<AreaPos_X2>339.57</AreaPos_X2>
<AreaPos_Y>132.13</AreaPos_Y>
<AreaPos_Y2>149.63</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid8">
<AreaUID>8</AreaUID>
<AreaName>Area 7</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>242.67</AreaPos_X>
<AreaPos_X2>278.76</AreaPos_X2>
<AreaPos_Y>52.86</AreaPos_Y>
<AreaPos_Y2>75.40</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid9">
<AreaUID>9</AreaUID>
<AreaName>Area 8</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>94.35</AreaPos_X>
<AreaPos_X2>119.22</AreaPos_X2>
<AreaPos_Y>100.55</AreaPos_Y>
<AreaPos_Y2>118.20</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid10">
<AreaUID>10</AreaUID>
<AreaName>Area 9</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>235.08</AreaPos_X>
<AreaPos_X2>275.41</AreaPos_X2>
<AreaPos_Y>85.02</AreaPos_Y>
<AreaPos_Y2>105.88</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid11">
<AreaUID>11</AreaUID>
<AreaName>M24</AreaName>
<AreaType>3</AreaType>
<AccessMap>[281]M24.rmd</AccessMap>
<AccessMapName>ソゴム山脈赤山</AccessMapName>
<AreaPos_X>318.86</AreaPos_X>
<AreaPos_X2>324.33</AreaPos_X2>
<AreaPos_Y>25.16</AreaPos_Y>
<AreaPos_Y2>29.46</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid12">
<AreaUID>12</AreaUID>
<AreaName>시작 영역</AreaName>
<AreaType>5</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>150.94</AreaPos_X>
<AreaPos_X2>185.79</AreaPos_X2>
<AreaPos_Y>101.79</AreaPos_Y>
<AreaPos_Y2>128.70</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid13">
<AreaUID>13</AreaUID>
<AreaName>바람 신수</AreaName>
<AreaType>4</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>282.33</AreaPos_X>
<AreaPos_X2>299.40</AreaPos_X2>
<AreaPos_Y>66.86</AreaPos_Y>
<AreaPos_Y2>82.91</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid14">
<AreaUID>14</AreaUID>
<AreaName>은총 퀘스트 의뢰인</AreaName>
<AreaType>0</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>131.69</AreaPos_X>
<AreaPos_X2>152.54</AreaPos_X2>
<AreaPos_Y>49.00</AreaPos_Y>
<AreaPos_Y2>63.36</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
<Area id="aUid15">
<AreaUID>15</AreaUID>
<AreaName>전생 퀘스트</AreaName>
<AreaType>0</AreaType>
<AccessMap></AccessMap>
<AccessMapName></AccessMapName>
<AreaPos_X>132.78</AreaPos_X>
<AreaPos_X2>153.78</AreaPos_X2>
<AreaPos_Y>72.55</AreaPos_Y>
<AreaPos_Y2>89.76</AreaPos_Y2>
<AreaExpansion>
</AreaExpansion>
</Area>
</AreaData>
</MapData>


text:
<!doctype html public "humiliation">
<title>Transitions Example</title>
<base href="/transitions"/>
<link href="/global.css" rel="stylesheet"/>

React Router Examples / Transitions


text:
This document describes the parts of Theatralia on a high level and shows how
they play together. It is intended for people who know how web applications work
in general, but are not familiar with the specific case of Clojure/ClojureScript
web applications. If you're already familiar with Clojure web development, you
probably don't need to read this. If not, you will hopefully get enough of an
understanding to dive into the source code, where the comments and doc strings
will guide you.

At the moment the system consists of three main parts: the server, the database
and the client running in the browser.

```
+----------+
| Browser: |
| Client   |
+----------+
     ↓↑
+----------+   +----------+
|  Server  | ⇄ | Database |
+----------+   +----------+
```

See the [bottom](#the-components-of-the-server) of the file for a description of
how the server is again divided into multiple parts.

## System stories

In the following I will narrate what is going on when you do various things in
the browser. (Note that I'm not completely sure about what some parts are doing,
so if you find something wrong, please tell me. Also I describe everything as if
it happened in real time. For macros this isn't true, of course.)

### Visiting the Theatralia welcome page

The welcome page is a relict from my early experimentations, so it involves a
lot of server-generated things.

 1. You enter `http://<your-theatralia-server>/` in the browser.

 2. The browser sends

    ```
    GET /
    ```

    to the server.

 3. On the server, an instance of the Jetty HTTP server is running. It
    integrates with the library [Ring](https://github.com/ring-clojure/ring).
    The HTTP server receives the request and Ring wraps it in a format suitable
    for Clojure.

 4. Ring calls a function to handle the request. This function was created by
    `theatralia.routes.make-handler` in
    [src/clj/theatralia/routes.clj](https://github.com/rmoehn/theatralia/blob/master/src/clj/theatralia/routes.clj).
    `make-handler` doesn't create this function directly, but uses `routes` from
    the library [Compojure](https://github.com/weavejester/compojure) for this
    purpose. If you look into `routes.clj`, you will see that `make-handler`
    contains something like a mapping from URLs the client can send requests to
    to the functions that will handle these requests.

 5. We made a GET request to `/`, so `theatralia.welcome-page.index`, defined in
    [src/clj/theatralia/welcome_page.clj](https://github.com/rmoehn/theatralia/blob/master/src/clj/theatralia/welcome_page.clj)
    will be invoked.

 6. `theatralia.welcome-page.index` is a function defined by the macro
    `deftemplate` from the templating library
    [Enlive](https://github.com/cgrand/enlive). It reads the HTML files
    [resources/templates/around.html](https://github.com/rmoehn/theatralia/blob/master/resources/templates/around.html)
    and
    [resource/templates/welcome.html](https://github.com/rmoehn/theatralia/blob/master/resource/templates/welcome.html),
    does some substitutions, puts them together and returns them as HTML.

 7. The server takes the returned HTML and sends it to the browser.

 8. The browser notices that the HTML references a file with the path
    `/main.css`. It sends

    ```
    GET /main.css
    ```

    to the server.

 9. In `make-handler` we've also defined that `theatralia.welcome-page/main-css`
    should be called to handle this request. `main-css` uses
    [Garden](https://github.com/noprompt/garden) to assemble a CSS string from
    the data in `welcome_page.clj`. Again, the server sends it to the browser.

 10. The browser renders the HTML and CSS and displays it to you. But now it
     notices that the CSS references some font files with paths like
     `/fonts/chivo/chivo-regular-webfont.woff`. Suppose for now that it's only
     this file. (The same happens for the other font files.) The browser sends

     ```
     GET /fonts/chivo/chivo-regular-webfont.woff
     ```

     to the server.

 11. In `make-handler` there is no entry for
     `/fonts/chivo/chivo-regular-webfont.woff` explicitly. However, there is the
     entry `(route/resources "/")`, which means: »whenever there is a GET
     request for `x` that hasn't been handled yet, find out whether
     the file `resources/public/x` exists locally and if it does, send it to the
     browser«. `resources/public/fonts/chivo/chivo-regular-webfont.woff` exists
     locally, so the server sends it to the browser. In the following I will
     call files served through this default route *static files*.

 12. The browser receives the font files and re-renders the page with the
     correct font. (Exact behaviour might vary.)

### Visiting the sandbox

The sandbox is generated entirely on the client side and communicates with the
server through XML HTTP requests (XHR). If you haven't read the [previous
story](#visiting-the-theatralia-welcome-page), do it before you start with this.

 1. You enter `http://<your-theatralia-server>/html/try_it_out.html` in the
    browser.

 2. The browser sends

    ```
    GET /html/try_it_out.html
    ```

    to the server.

 3. There is no entry for this in `make-handler`, so it looks for
    [resources/public/html/try_it_out.html](https://github.com/rmoehn/theatralia/tree/master/resources/public/html/try_it_out.html),
    which exists. The server sends it to the browser.

 4. There are many things referenced in the HTML, so the browser will do many
    more GET requests. There are three groups of things requested. I'll go
    through them one by one.

 5. [Bootstrap](http://getbootstrap.com/) is a framework for styling web
    UIs. The browser requests and the server sends `bootstrap.min.css` and
    `bootstrap.min.js` from the static files. Those are responsible for making
    the page look how it does. The Bootstrap JavaScript code requires jQuery,
    which the browser requests from an external server. You use Boostrap mainly
    through CSS by putting HTML elements in classes like `.col-xs-4`.

 6. [React](https://facebook.github.io/react/index.html) is »a JavaScript
    library for building user interfaces«. Described in a short and possibly
    inaccurate way: in a traditional JavaScript application you have some data
    and the user interface and some code, which manipulates the data and the
    user interface through the DOM. With React, you have a data structure and
    kind of a specification how parts of the user interface correspond to this
    data structure. You manipulate only the data structure and React takes care
    of changing the DOM accordingly and in a way that is efficient to render by
    the browser. Later I will describe the exact events in more detail. The
    browser fetches the React library from an external server.

 7. `main.js` is generated by the ClojureScript compiler from our ClojureScript
    sources. ClojureScript relies on the [Google Closure
    Toos](https://developers.google.com/closure/) for JavaScript optimization
    and a large libary of common JavaScript tools. `base.js` is one of them and
    necessary to run our application. This completes the loading of stuff by the
    browser.

 8. `goog.require("theatralia.core")` starts our application, which at the
    moment is contained all in
    [src/cljs/theatralia/core.cljs](https://github.com/rmoehn/theatralia/blob/master/src/cljs/theatralia/core.cljs). Therefore we will continue by looking at what happens in this file.

 9. As with most Clojure files, the direction of reading is bottom to top. We
    call `om.core/root`. [Om](https://github.com/omcljs/om) is »a ClojureScript
    interface to […] React«. So the first two arguments to `om.core/root` are
    the specification of how parts of the user interface correspond to a data
    structure and the data structure itself. The third argument contains options
    of which only `:target` is interesting for now. It causes our application to
    be mounted into the the `div` with ID `app` in `try_it_out.html`.

 10. The `sandbox-view` specifies how the user interface is built and how it gets
    its data. Evaluating it causes the construction of a tree of React objects
    wrappend in Om components. Om components in turn are constructed by applying
    `om.core/build` to objects implementing `om.core/IRender` or
    `om.core/IRenderState`. I can't describe all this in detail, but let's
    follow one branch of the component tree to the tip.

    There are different ways to define a user interface in Om. The basic one is
    to use functions from `om.dom` like `om.dom/div`, `om.dom/ul` and
    `om.dom/li`. You see the resemblance with HTML. On these build libraries
    like [Kioo](https://github.com/ckirkendall/kioo), which I use. It is similar
    to Enlive in that you write templates in HTML and extract, substitute and
    combine different parts of them. When the component from `sandbox-view` is
    rendered, it reads
    [resources/templates/sandbox.html](https://github.com/rmoehn/theatralia/blob/master/resources/templates/sandbox.html)
    and installs the Om component constructed by `search-view` in place of the
    element with ID `search-field`.

    `search-view` has local state, which is covered [below](#doing-a-search).
    When it is rendered, the element with ID `search-field` is extracted from
    `sandbox.html` and used as the basis for the `search-view`. Kioo is used to
    install listeners for the input field and submit button.

 11. The rest of the user interface is constructed in a similar way.

### Doing a search

This picks up where the last section ended.

 1. You've loaded the sandbox. You click on the search input field. (It might
    have been active before.) You hit `f`.

 2. The `onChange` listener of the `searchInput` element fires. It calls
    `handle-change` with the event, the key `:text` and the component owning the
    `searchInput` element.

 3. `handle-change` sets the value of the local state of the owning component at
    `:text` to the value of the input element. The local state now is `{:text
    "f"}`.

 4. Since `set-state!` triggers a re-render, `search-view`'s `render-state` is
    called again. We set the `value` attribute of the `searchInput` element to
    `(:text local-state)`, so the `f` you typed appears in the input field.

 5. You continue typing `o`, `o`, `d` and behind the scenes the local state is
    changed to `{:text "food"}` in the same way as described for the first
    letter..

 6. You hit `Enter`. The `onKeyDown` handler of the `searchInput` element fires
    and calls `process-input` with the owning component as an argument.

 7. `process-input` reads the current value of the input field, which is »food«,
    and sends an XML HTTP request of

    ```
    GET /gq/food
    ```

    to the server. »gq« stands for »general query«.

 8. `make-handler` does have a route for `/gq/`. It extracts the text passed
    in the second component of the path and calls `theatralia.routes/search-for`
    with this text and a reference to the database connection as arguments.

 9. `search-for` asks the database to perform a fulltext search on the material
    titles for »food«. We're using Datomic, so the query is formulated as
    a form of [Datalog](http://docs.datomic.com/query.html).

 9. It finds two titles (from
    [resources/database/sample_data.edn](https://github.com/rmoehn/theatralia/blob/master/resources/database/sample_data.edn)),
    represented as a set of maps. It sorts them alphabetically, wraps them in a
    response map and returns them.

 10. The result is sent to the client as an EDN string. EDN is a format often
     used for serializing Clojure data structures and looks just like regular
     Clojure code.

 11. When the client receives the result, the `:on-complete` function defined in
     `process-input` is called. It puts the data into the `:search-result` part
     of the `app-state`.

 12. Since `result-view` observes the `:search-result` part of `app-state`, it
     gets notified by the change. On re-render, it constructs an Om component
     for every item in the `:search-result` part, so that they get displayed to
     you.

### Adding a material

This is similar to the [previous](#doing-a-search) section in that we have the
ClojureScript client actively communicating with the server. However, this time
we're doing a POST request and the server modifies the database.

 1. You type "Jane Grigson: English Food" into the title input field. You type
    "No pictures, but great recipes!" into the comment input field. The local
    state of the `add-material-view` gets updated (see [above](#doing-a-search))
    and now looks like this:

    ```
    {:title "Jane Grigson: English Food"
     :comments "No pictures, but great recipes!"}
    ```

 2. You click the submit button for adding materials. The `onClick` listener
    fires and calls `process-new-material`.

 3. `process-new-material` takes the local state and sends it to the server in a
    POST request to `/materials`.

 4. The server receives the request with the data encoded as an EDN string. It
    extracts them and gives them to `save-material`.

 5. `save-material` calls some functions with the given material to construct a
    data structure that describes the transaction for adding the material. It
    tries to make the database execute this transaction. Depending on the result
    of the transaction, it signals OK or an error back to the client.

 6. If the client receives an error message from the server, it just prints it
    and leaves the text you wrote in the input fields. If the client receives an
    OK, it empties the local state of the `add-material-view`, causing the input
    fields in the user interface to be emptied as well. Now your new material is
    saved in the database and can be requested through the search.

## The components of the server

The server consist of several parts, which I call components, since they
are taken care of by the framework
[Component](https://github.com/stuartsierra/component). See the links in
[README](https://github.com/rmoehn/theatralia#notes-from-the-start) for more
detailed information.

Currently we have four components:

 0. A logging component. It just sets and resets logging configuration:
    [src/clj/theatralia/logging.clj](https://github.com/rmoehn/theatralia/blob/master/src/clj/theatralia/logging.clj)
 1. The Jetty HTTP server running inside the server process. It is defined in
    [src/clj/theatralia/web_server.clj](https://github.com/rmoehn/theatralia/blob/master/src/clj/theatralia/web_server.clj).
 2. The component responsible for the connection to the database. It is defined
    in
    [src/clj/theatralia/database/component.clj](https://github.com/rmoehn/theatralia/blob/master/src/clj/theatralia/database/component.clj)
 3. A static component for routing. See
    [src/clj/theatralia/routes.clj](https://github.com/rmoehn/theatralia/blob/master/src/clj/theatralia/routes.clj).

For starting and stopping the server during development you run `(go)` and
`(stop)` at the REPL. These are defined in
[dev/user.clj](https://github.com/rmoehn/theatralia/blob/master/dev/user.clj).
`(start)` starts the components in the right order (taking care of dependencies
between components). It first sets the logging configuration straight. Then it
turns on the database component, which sets up the connection to our Datomic
transactor and does further setup steps if necessary. It creates the routing
component, providing it with access to the database component. Finally it
switches on the Jetty HTTP server, giving it a reference to the routing
component. `(stop)` stops the components in the reverse order.

When you have changed some code, you use `(reset)` to stop the system, reload
everything that has changed in the proper way and start it again.