text:
namespace tinker{

template<typename T>
class LockQueue : public noncopyable{
 private:
  mutable std::mutex mtx;
  std::queue<T> data_queue;
  std::condition_variable data_cond;
 public:
  LockQueue() = default;

  void Push(const T& new_value) {
    std::lock_guard<std::mutex> lk(mtx);
    data_queue.push(new_value);
    data_cond.notify_one();
  }

  T WaitAndPop() {
    std::unique_lock<std::mutex> lk(mtx);
    data_cond.wait(lk, [this]{ return !data_queue.empty(); });
    T res = std::move(data_queue.front());
    data_queue.pop();
    return std::move(res);
  }

  bool TryPop(T& value) {
    std::lock_guard<std::mutex> lk(mtx);
    if (data_queue.empty())
      return false;
    value = std::move(data_queue.front());
    data_queue.pop();
    return true;
  }

  bool IsEmpty() const {
    std::lock_guard<std::mutex> lk(mtx);
    return data_queue.empty();
  }

  size_t Size() const{
    std::lock_guard<std::mutex> lk(mtx);
    return data_queue.size();
  }
};

}//!namespace tinker

#endif //TINKER_LOCK_QUEUE_H


text:
layout: default
title: Blog
type: page
permalink: /blog/
---

Blog d'Interiorisme

Estigues al dia de la feina que faig i de les novetats en interiorisme que trobo interessants

 {% assign posts = site.posts | where: "type","posts" %}
    {% for post in posts %}

        {% if post.img %}

        {% endif %}

          {{ post.title }}

{{ post.date | date_to_long_string }}

 {{ post.content | strip_html | truncatewords: 50 }}

    {% endfor %}

redpajama_set_name: RedPajamaGithub


text:
import { gql } from 'react-apollo'

export default gql`
  mutation createMemoryComment(
    $memoryId: Int!,
    $name: String!,
    $email: String!,
    $comment: String!,
  ) {
    createMemoryComment(input: {
      memoryComment: {
        memoryId: $memoryId,
        name: $name,
        email: $email,
        comment: $comment,
      }
    }) {
      memoryComment {
        id,
        memoryId,
        name,
        email,
        comment,
      }
    }
  }
`


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.compute.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The ScheduledEventsProfile model. */
@Fluent
public final class ScheduledEventsProfile {
    /*
     * Specifies Terminate Scheduled Event related configurations.
     */
    @JsonProperty(value = "terminateNotificationProfile")
    private TerminateNotificationProfile terminateNotificationProfile;

    /** Creates an instance of ScheduledEventsProfile class. */
    public ScheduledEventsProfile() {
    }

    /**
     * Get the terminateNotificationProfile property: Specifies Terminate Scheduled Event related configurations.
     *
     * @return the terminateNotificationProfile value.
     */
    public TerminateNotificationProfile terminateNotificationProfile() {
        return this.terminateNotificationProfile;
    }

    /**
     * Set the terminateNotificationProfile property: Specifies Terminate Scheduled Event related configurations.
     *
     * @param terminateNotificationProfile the terminateNotificationProfile value to set.
     * @return the ScheduledEventsProfile object itself.
     */
    public ScheduledEventsProfile withTerminateNotificationProfile(
        TerminateNotificationProfile terminateNotificationProfile) {
        this.terminateNotificationProfile = terminateNotificationProfile;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (terminateNotificationProfile() != null) {
            terminateNotificationProfile().validate();
        }
    }
}


text:
package com.commercetools.sunrise.framework.viewmodels.content.breadcrumbs;

import com.commercetools.sunrise.framework.viewmodels.ViewModel;

import java.util.List;

public class BreadcrumbViewModel extends ViewModel {

    private List<BreadcrumbLinkViewModel> links;

    public BreadcrumbViewModel() {
    }

    public List<BreadcrumbLinkViewModel> getLinks() {
        return links;
    }

    public void setLinks(final List<BreadcrumbLinkViewModel> links) {
        this.links = links;
    }
}


text:
Simulates passengers and elevators. Passengers call elevators at random intervals, board the elevator when it arrives, enter the elevator and select a floor, then exit the elevator when it has reached their selected floor.

## Directions to Run ##

**Install Browserify**

```shell
npm install -g browserify
```

**Fetch dependencies**

```shell
npm install
```

**Compile .ts files**

Either enter the following command

```shell
node node_modules/typescript/bin/tsc.js
```

or use the `tsc` script from our `package.json` with

```shell
npm run tsc
```

**Run Browserify**

Either enter the following command

```shell
browserify src/app.js -o bundle.js -s app
```

or use the `browserify` script from our `package.json` with

```shell
npm run browserify

```

**Start http-server**

Either enter the following command

```shell
node node_modules/http-server/bin/http-server -o
```

or use the `listen` script from our `package.json` with

```
npm run listen
```

By default http-server listens on port `8080`.
If this port is taken, use '-p ####' to specify a free port, where `####` is the available port.

**Shortcut for running all steps in a batch**

```
npm run all
```


text:
<?php
/**
 * Do not edit this file. Edit the config files found in the config/ dir instead.
 * This file is required in the root directory so WordPress can find it.
 * WP is hardcoded to look in its own directory or one directory up for wp-config.php.
 */
require_once(dirname(__DIR__) . '/vendor/autoload.php');
require_once(dirname(__DIR__) . '/config/application.php');
require_once(ABSPATH . 'wp-settings.php');

// /*** code from greg for fixing web form errors ***/
// ini_set('display_errors','Off');
// ini_set('error_reporting', E_ALL );
// define('WP_DEBUG', false);
// define('WP_DEBUG_DISPLAY', false);
//
// /*** code from greg for fixing web form errors ***/


text:
// // //-------------------------------------------------------------------------------------------------
// // // <copyright file="APZoneResolver.cs" company="stephbu">
// // // Copyright (c) Steve Butler. All rights reserved.
// // // </copyright>
// // //-------------------------------------------------------------------------------------------------

namespace Dns
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Threading;

    public class SmartZoneResolver : IObserver<Zone>, IDnsResolver
    {
        private long _hits;
        private long _misses;
        private long _queries;
        private IDisposable _subscription;
        private Zone _zone;
        private Dictionary<string, IAddressDispenser> _zoneMap;
        private DateTime _zoneReload = DateTime.MinValue;

        public string GetZoneName()
        {
            return this.Zone.Suffix;
        }

        public uint GetZoneSerial()
        {
            return this._zone.Serial;
        }

        public Zone Zone
        {
            get { return this._zone; }
            set
            {
                if(value == null) throw new ArgumentNullException("value");

                this._zone = value;
                this._zoneReload = DateTime.Now;
                this._zoneMap = this._zone.ToDictionary(GenerateKey, zoneRecord => new SmartAddressDispenser(zoneRecord) as IAddressDispenser, StringComparer.CurrentCultureIgnoreCase);
                Console.WriteLine("Zone reloaded");
            }
        }

        public DateTime LastZoneReload
        {
            get { return _zoneReload; }
        }

        void IObserver<Zone>.OnCompleted()
        {
            throw new NotImplementedException();
        }

        void IObserver<Zone>.OnError(Exception error)
        {
            throw new NotImplementedException();
        }

        void IObserver<Zone>.OnNext(Zone value)
        {
            this.Zone = value;
        }

        public void DumpHtml(TextWriter writer)
        {
            writer.WriteLine("Type:{0}
", this.GetType().Name);
            writer.WriteLine("Queries:{0}
", this._queries);
            writer.WriteLine("Hits:{0}
", this._hits);
            writer.WriteLine("Misses:{0}
", this._misses);

            writer.WriteLine("
");
            writer.WriteLine("
Key	Value
");
            foreach (string key in _zoneMap.Keys)
            {
                writer.WriteLine("
");
                writer.WriteLine(key);
                writer.WriteLine("	");
                _zoneMap[key].DumpHtml(writer);
                writer.WriteLine("
");
            }
            writer.WriteLine("
");
        }

        public bool TryGetHostEntry(string hostName, ResourceClass resClass, ResourceType resType, out IPHostEntry entry)
        {
            if (hostName == null) throw new ArgumentNullException("hostName");
            if (hostName.Length > 126) throw new ArgumentOutOfRangeException("hostName");

            entry = null;

            Interlocked.Increment(ref this._queries);

            // fail fasts
            if (!this.IsZoneLoaded()) return false;
            if (!hostName.EndsWith(this._zone.Suffix)) return false;

            // lookup locally
            string key = GenerateKey(hostName, resClass, resType);
            IAddressDispenser dispenser;
            if (_zoneMap.TryGetValue(key, out dispenser))
            {
                Interlocked.Increment(ref this._hits);
                entry = new IPHostEntry {AddressList = dispenser.GetAddresses().ToArray(), Aliases = new string[] {}, HostName = hostName};
                return true;
            }

            Interlocked.Increment(ref this._misses);
            return false;
        }

        public bool IsZoneLoaded()
        {
            return _zone != null;
        }

        /// Subscribe to specified zone provider
        /// <param name="zoneProvider"></param>
        public void SubscribeTo(IObservable<Zone> zoneProvider)
        {
            // release previous subscription
            if (this._subscription != null)
            {
                this._subscription.Dispose();
                this._subscription = null;
            }

            this._subscription = zoneProvider.Subscribe(this);
        }

        private string GenerateKey(ZoneRecord record)
        {
            return GenerateKey(record.Host, record.Class, record.Type);
        }

        private string GenerateKey(string host, ResourceClass resClass, ResourceType resType)
        {
            return string.Format("{0}|{1}|{2}", host, resClass, resType);
        }
    }
}


text:
/*
 * constants.h - constant objects
 */

#ifndef BOOST_JAM_CONSTANTS_H
#define BOOST_JAM_CONSTANTS_H

#include "object.h"

void constants_init( void );
void constants_done( void );

extern OBJECT * constant_empty;             /* "" */
extern OBJECT * constant_dot;               /* "." */
extern OBJECT * constant_percent;           /* "%" */
extern OBJECT * constant_plus;              /* "+" */
extern OBJECT * constant_star;              /* "*" */
extern OBJECT * constant_question_mark;     /* "?" */
extern OBJECT * constant_ok;                /* "ok" */
extern OBJECT * constant_true;              /* "true" */
extern OBJECT * constant_name;              /* "__name__" */
extern OBJECT * constant_bases;             /* "__bases__" */
extern OBJECT * constant_typecheck;         /* ".typecheck" */
extern OBJECT * constant_builtin;           /* "(builtin)" */
extern OBJECT * constant_HCACHEFILE;        /* "HCACHEFILE" */
extern OBJECT * constant_HCACHEMAXAGE;      /* "HCACHEMAXAGE" */
extern OBJECT * constant_HDRSCAN;           /* "HDRSCAN" */
extern OBJECT * constant_HDRRULE;           /* "HDRRULE" */
extern OBJECT * constant_BINDRULE;          /* "BINDRULE" */
extern OBJECT * constant_LOCATE;            /* "LOCATE" */
extern OBJECT * constant_SEARCH;            /* "SEARCH" */
extern OBJECT * constant_JAM_SEMAPHORE;     /* "JAM_SEMAPHORE" */
extern OBJECT * constant_TIMING_RULE;       /* "__TIMING_RULE__" */
extern OBJECT * constant_ACTION_RULE;       /* "__ACTION_RULE__" */
extern OBJECT * constant_JAMSHELL;          /* "JAMSHELL" */
extern OBJECT * constant_TMPDIR;            /* "TMPDIR" */
extern OBJECT * constant_TMPNAME;           /* "TMPNAME" */
extern OBJECT * constant_TMPFILE;           /* "TMPFILE" */
extern OBJECT * constant_STDOUT;            /* "STDOUT" */
extern OBJECT * constant_STDERR;            /* "STDERR" */
extern OBJECT * constant_JAMDATE;           /* "JAMDATE" */
extern OBJECT * constant_JAM_VERSION;       /* "JAM_VERSION" */
extern OBJECT * constant_JAMUNAME;          /* "JAMUNAME" */
extern OBJECT * constant_ENVIRON;           /* ".ENVIRON" */
extern OBJECT * constant_ARGV;              /* "ARGV" */
extern OBJECT * constant_all;               /* "all" */
extern OBJECT * constant_PARALLELISM;       /* "PARALLELISM" */
extern OBJECT * constant_KEEP_GOING;        /* "KEEP_GOING" */
extern OBJECT * constant_other;             /* "[OTHER]" */
extern OBJECT * constant_total;             /* "[TOTAL]" */
extern OBJECT * constant_FILE_DIRSCAN;      /* "FILE_DIRSCAN" */
extern OBJECT * constant_MAIN;              /* "MAIN" */
extern OBJECT * constant_MAIN_MAKE;         /* "MAIN_MAKE" */
extern OBJECT * constant_MAKE_MAKE0;        /* "MAKE_MAKE0" */
extern OBJECT * constant_MAKE_MAKE1;        /* "MAKE_MAKE1" */
extern OBJECT * constant_MAKE_MAKE0SORT;    /* "MAKE_MAKE0SORT" */
extern OBJECT * constant_BINDMODULE;        /* "BINDMODULE" */
extern OBJECT * constant_IMPORT_MODULE;     /* "IMPORT_MODULE" */
extern OBJECT * constant_BUILTIN_GLOB_BACK; /* "BUILTIN_GLOB_BACK" */
extern OBJECT * constant_timestamp;         /* "timestamp" */
extern OBJECT * constant_python;            /* "__python__" */
extern OBJECT * constant_python_interface;  /* "python_interface" */
extern OBJECT * constant_extra_pythonpath;  /* "EXTRA_PYTHONPATH" */
extern OBJECT * constant_MAIN_PYTHON;       /* "MAIN_PYTHON" */

#endif


text:
        <title>Browser tests for PouchDB component...</title>

        <link rel="stylesheet" href="/node_modules/infusion/tests/lib/qunit/css/qunit.css"/>

PouchDB Component Tests


text:
<query id="updatePublishedStatus" action="update">
    <tables>
        <table name="comments" />
    </tables>
    <columns>
        <column name="status" var="status" notnull="notnull" />
    </columns>
    <conditions>
        <condition operation="in" column="comment_srl" var="comment_srls_list" notnull="notnull" pipe="or" />
        <condition operation="in" column="parent_srl" var="comment_srls_list" notnull="notnull" pipe="or" />
    </conditions>
</query>


text:
import React, { PropTypes, Component } from 'react';
import { createStyleSheet } from 'jss-theme-reactor';
import { LinearProgress } from 'material-ui/Progress';

const styleSheet = createStyleSheet('LinearBuffer', () => ({
  root: {
    width: '100%',
    marginTop: 30,
  },
}));

export default class LinearBuffer extends Component {
  state = {
    completed: 0,
    buffer: 10,
  }

  componentDidMount() {
    this.timer = setInterval(this.progress, 500);
  }

  componentWillUnmount() {
    clearInterval(this.timer);
  }

  timer: number

  progress = () => {
    const { completed } = this.state;
    if (completed > 100) {
      this.setState({ completed: 0, buffer: 10 });
    } else {
      const diff = Math.random() * 10;
      const diff2 = Math.random() * 10;
      this.setState({ completed: completed + diff, buffer: completed + diff + diff2 });
    }
  }

  render() {
    const classes = this.context.styleManager.render(styleSheet);
    const { completed, buffer } = this.state;
    return (
      <div className={classes.root}>
        <LinearProgress mode="buffer" value={completed} valueBuffer={buffer} />
      </div>
    );
  }
}

LinearBuffer.contextTypes = {
  styleManager: PropTypes.object.isRequired,
};


text:
from main import create_tables, define_do
import sys
from lib.login import soupinfo
from Queue import Queue
from lib.db_cancel import id_cancel
from lib.db_info import id_info
from lib.db_news import id_news
import lib.settings
from logging import StreamHandler, DEBUG
import argparse

def main():
    q = Queue()
    parser = argparse.ArgumentParser(
        description="Automatically collect the lecture information of Kyoto Institute of Technology, and tweet its updates.")
    parser.add_argument("-v",
                        "--verbose",
                        dest="verbose",
                        default=False,
                        help="Debug on CLI. Show more information on console window.",
                        action="store_true"
                        )

    parser.add_argument("-n",
                        "--no-tweet",
                        dest="notweet",
                        default=False,
                        help="Only update database and show result of that on CLI. In this option, Qkou_kit don't tweet any.",
                        action="store_true"
                        )

    parser.add_argument("-c",
                        "--create-table",
                        dest="create",
                        default=False,
                        help="Creating table. If your MySQL server doesn't have the table you should use this option.",
                        action="store_true"
                        )

    group = parser.add_argument_group(
        'Show information', 'This option is showing the information of lecture and news by id.')
    group.add_argument("-i",
                       "--id",
                       dest="info_id",
                       default="",
                       type=str,
                       nargs="*",
                       help="To show information of some lectures, input their id numbers."
                       )

    group.add_argument("-d",
                       "--db_name",
                       dest="db_name",
                       default='info',
                       type=str,
                       nargs="?",
                       choices=['info', 'cancel', 'news'],
                       help="Choose the database to use."
                       )

    ids = parser.parse_args().info_id
    name = parser.parse_args().db_name
    nodata = u"お問い合わせされた情報は現在存在しません。"

    if parser.parse_args().verbose is True:
        log = lib.settings.log
        shandler = StreamHandler()
        shandler.setLevel(DEBUG)
        log.addHandler(shandler)
    else:
        pass

    if len(ids) > 0:
        # -i,-dが設定されている時
        for id in ids:
            if name == 'info':
                info = id_info(id)
            elif name == 'cancel':
                info = id_cancel(id)
            else:
                info = id_news(id)
            if info is 0:
                print nodata
            else:
                print info
        else:
            # 全てprintしたら終了
            sys.exit()
    else:
        pass
    htmls = soupinfo(*lib.settings.urls)
    if parser.parse_args().create is True:
        # -cが指定されている時。テーブル作成のみ
        create_tables(q, *htmls)
    else:
        define_do(q, parser.parse_args().notweet, *htmls)

if __name__ == "__main__":
    main()


text:
package storm.trident.operation.impl;

import backtype.storm.tuple.Fields;
import java.util.List;
import java.util.Map;
import storm.trident.operation.Aggregator;
import storm.trident.operation.TridentCollector;
import storm.trident.operation.TridentOperationContext;
import storm.trident.tuple.ComboList;
import storm.trident.tuple.TridentTuple;
import storm.trident.tuple.TridentTupleView;
import storm.trident.tuple.TridentTupleView.ProjectionFactory;

public class ChainedAggregatorImpl implements Aggregator<ChainedResult> {
    Aggregator[] _aggs;
    ProjectionFactory[] _inputFactories;
    ComboList.Factory _fact;
    Fields[] _inputFields;

    public ChainedAggregatorImpl(Aggregator[] aggs, Fields[] inputFields, ComboList.Factory fact) {
        _aggs = aggs;
        _inputFields = inputFields;
        _fact = fact;
        if (_aggs.length != _inputFields.length) {
            throw new IllegalArgumentException("Require input fields for each aggregator");
        }
    }

    public void prepare(Map conf, TridentOperationContext context) {
        _inputFactories = new ProjectionFactory[_inputFields.length];
        for (int i = 0; i < _inputFields.length; i++) {
            _inputFactories[i] = context.makeProjectionFactory(_inputFields[i]);
            _aggs[i].prepare(conf, new TridentOperationContext(context, _inputFactories[i]));
        }
    }

    public ChainedResult init(Object batchId, TridentCollector collector) {
        ChainedResult initted = new ChainedResult(collector, _aggs.length);
        for (int i = 0; i < _aggs.length; i++) {
            initted.objs[i] = _aggs[i].init(batchId, initted.collectors[i]);
        }
        return initted;
    }

    public void aggregate(ChainedResult val, TridentTuple tuple, TridentCollector collector) {
        val.setFollowThroughCollector(collector);
        for (int i = 0; i < _aggs.length; i++) {
            TridentTuple projected = _inputFactories[i].create((TridentTupleView) tuple);
            _aggs[i].aggregate(val.objs[i], projected, val.collectors[i]);
        }
    }

    public void complete(ChainedResult val, TridentCollector collector) {
        val.setFollowThroughCollector(collector);
        for (int i = 0; i < _aggs.length; i++) {
            _aggs[i].complete(val.objs[i], val.collectors[i]);
        }
        if (_aggs.length > 1) { // otherwise, tuples were emitted directly
            int[] indices = new int[val.collectors.length];
            for (int i = 0; i < indices.length; i++) {
                indices[i] = 0;
            }
            boolean keepGoing = true;
            // emit cross-join of all emitted tuples
            while (keepGoing) {
                List[] combined = new List[_aggs.length];
                for (int i = 0; i < _aggs.length; i++) {
                    CaptureCollector capturer = (CaptureCollector) val.collectors[i];
                    combined[i] = capturer.captured.get(indices[i]);
                }
                collector.emit(_fact.create(combined));
                keepGoing = increment(val.collectors, indices, indices.length - 1);
            }
        }
    }

    // return false if can't increment anymore
    private boolean increment(TridentCollector[] lengths, int[] indices, int j) {
        if (j == -1)
            return false;
        indices[j]++;
        CaptureCollector capturer = (CaptureCollector) lengths[j];
        if (indices[j] >= capturer.captured.size()) {
            indices[j] = 0;
            return increment(lengths, indices, j - 1);
        }
        return true;
    }

    public void cleanup() {
        for (Aggregator a : _aggs) {
            a.cleanup();
        }
    }
}


text:
import argparse
import sys
import numpy as np
import pandas as pd
import warnings
from clusterpluck.scripts.cluster_dictionary import build_cluster_map
from clusterpluck.scripts.orfs_in_common import generate_index_list
from clusterpluck.scripts.orfs_in_common import pick_a_cluster

# The arg parser
def make_arg_parser():
	parser = argparse.ArgumentParser(description='collapse the ORF x ORF matrix into a scored cluster x cluster matrix')
	parser.add_argument('-i', '--input', help='Input is the ORF matrix CSV file.', default='-')
	parser.add_argument('-m', '--mpfa', help='The multi-protein fasta file (.mpfa) from which to build the dictionary')
	parser.add_argument('-b', '--bread', help='Where to find the cluster information in the header for the sequence (default="ref|,|")', default='ref|,|')
	parser.add_argument('-o', '--output', help='Where to save the output csv; default to screen', required=False, default='-')
	parser.add_argument('-p', '--pieces', help='Read the input CSV in pieces, useful for very large (>5GB) files', action='store_true', required=False, default=False)
	return parser

def cluster_by_cluster(cluster_map, in_csv):
	mx = pd.read_csv(in_csv, sep=',', header=0, index_col=0)
	c_list = list(cluster_map.keys())  # list of all clusters
	ct = len(c_list)
	mat = np.zeros((ct, ct))  # initializes an array to fit results from all clusters
	j = 0
	for cluster in cluster_map:
		# subsets the matrix by columns belonging to one cluster
		mx_csub = mx.filter(like=cluster)
		i = 0
		for cluster2 in cluster_map:
			# subsets the smaller matrix by rows belonging to one cluster
			mx_dubsub = mx_csub.filter(like=cluster2, axis=0)
			# finds the mean of the cells in the cluster x cluster2 matrix
			with warnings.catch_warnings():
				warnings.simplefilter('ignore', category=RuntimeWarning)  # np doesn't like taking mean of empty slices
				cc_mean = np.nanmean(mx_dubsub.values, dtype='float64')
			# saves this ratio into the pre-existing array at the (cluster, cluster2) location
			mat[i, j] = cc_mean
			i += 1
		j += 1
	outdf = pd.DataFrame(mat, dtype=float)
	outdf.columns = c_list  # names the columns (and index, next line) according to clusters in the order they were processed
	outdf.index = c_list
	outdf.sort_index(axis=0, inplace=True)
	outdf.sort_index(axis=1, inplace=True)
	# print(score_mean)
	return outdf
	# Check if a matrix is symmetric
	# arr = df.values
	# print((arr.transpose() == -arr).all())

def big_cluster_by_cluster(grab, inkey, c_list, inf3, mat, j):
	mx = pd.read_csv(inf3, sep=',', header=0, usecols=grab, engine='c')
	mx.index = inkey
	# how many orfs in the full cluster
	i = 0
	for cluster2 in c_list:
		# subsets the smaller matrix by rows belonging to one cluster
		mx_dubsub = mx.filter(like=cluster2, axis=0)
		# finds the mean of the cells in the cluster x cluster2 matrix
		with warnings.catch_warnings():
			warnings.simplefilter('ignore', category=RuntimeWarning)  # np doesn't like taking mean of empty slices
			cc_mean = np.nanmean(mx_dubsub.values, dtype='float64')
		# saves this ratio into the pre-existing array at the (cluster, cluster2) location
		mat[i, j] = cc_mean
		i += 1
	# DEBUG - will print the progress every 50 clusters (across the slower dimension).
	if j % 50:
		pass
	elif j == 0:
		print('Processed first cluster... moving on!')
	elif j == 1:
		print('Worry not, second cluster has been processed...')
	else:
		print('Processed %d clusters' % j)
	del mx
	return mat

def main():
	parser = make_arg_parser()
	args = parser.parse_args()
	# Parse command line
	with open(args.mpfa, 'r') as inf:
		# Generates dictionary with each unique 'refseq_cluster' as keys, ORFs as values
		cluster_map = build_cluster_map(inf, bread=args.bread)
	with open(args.input, 'r') as in_csv, open(args.output, 'w') if args.output != '-' else sys.stdout as outf:
		if not args.pieces:
			outdf = cluster_by_cluster(cluster_map, in_csv)
			outdf = outdf.round(decimals=2)
			outdf.to_csv(outf)
		else:
			print('\nOk, processing input file in pieces...\n')
			inkey = generate_index_list(in_csv)
			c_list = list(cluster_map.keys())
			ct = len(c_list)
			print('Found %d clusters...' % ct)
			mat = np.zeros((ct, ct))  # initializes an array of the dimensions necessary to fit all cluster results
			j = 0
			for cluster in c_list:
				grab = pick_a_cluster(inkey, cluster)
				# print(grab)
				with open(args.input, 'r') as inf3:
					mat = big_cluster_by_cluster(grab, inkey, c_list, inf3, mat, j)
				# print(mat)
				j += 1
			print('File processing complete; writing output file...\n')
			outdf = pd.DataFrame(mat, dtype=float)
			outdf.columns = c_list  # names the columns (and index, next line) according to clusters in the order they were processed
			outdf.index = c_list
			outdf.sort_index(axis=0, inplace=True)
			outdf.sort_index(axis=1, inplace=True)
			outdf = outdf.round(decimals=2)
			outdf.to_csv(outf)

if __name__ == '__main__':
	main()


text:
<?
/**
 * Register.php
 *
 * Displays the registration form if the user needs to sign-up,
 * or lets the user know, if he's already logged in, that he
 * can't register another name.
 *
 * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
 * Last Updated: August 19, 2004
 */
require_once("include/session.php");
$userInfo = $session->linkInfo($_GET["link"]);
$linked = false;
if ($_REQUEST["link"]>0) $linked = true;

?>

        <? if (!$_REQUEST["link"]) {?>

Login

         <? }?>

<?

/**
 * The user is already logged in, not allowed to register.
 */
if($session->logged_in){

   echo "
Registered
";
   echo "
We're sorry $session->username, but you've already registered. "
       ."Main.
";
}
/**
 * The user has submitted the registration form and the
 * results have been processed.
 */
else if(isset($_SESSION['regsuccess'])){
   /* Registration was successful */
   if($_SESSION['regsuccess']){
      echo "
Registered!
";
      echo "
Thank you ".$_SESSION['reguname'].", your information has been added to the database, "
          ."you may now log in.
";
   }
   /* Registration failed */
   else{
      echo "
Registration Failed
";
      echo "
We're sorry, but an error has occurred and your registration for the username ".$_SESSION['reguname'].", "
          ."could not be completed.
Please try again at a later time.
";
   }
   unset($_SESSION['regsuccess']);
   unset($_SESSION['reguname']);
}
/**
 * The user has not filled out the registration form yet.
 * Below is the page with the sign-up form, the names
 * of the input fields are important and should not
 * be changed.
 */
else{
?>

<? if ($linked) { ?>

Welcome, <?= $firstName?>.

<? } else { ?>

Register

<? } ?>

<? if ($regerror ==1 ) { ?>

This user is already in the system.

<? } ?>

  <?
  if($form->num_errors > 0){
     echo "".$form->num_errors." error(s) found";
  }
  ?>

Victors Experience

  Sign Up Now

    Customize this website to filter through the amazing work being done by Michigan Engineers, who are stepping up to tackle the world's greatest problems.

Preview the site →

What is a Victor for Michigan?   ↓

Sign up and get started

        ..or.. create an account directly.

        <form action="process.php" method="POST">

Email:<input type="text" name="email" maxlength="50" value="<? echo $form->value("email"); ?>"><? echo $form->error("email"); ?>

Password:<input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"><? echo $form->error("pass"); ?>

First Name:<input type="text" name="first" maxlength="30" value="<? echo $form->value("first"); ?>"><? echo $form->error("first"); ?>

Last Name:<input type="text" name="last" maxlength="30" value="<? echo $form->value("last"); ?>"><? echo $form->error("last"); ?>

            <input type="hidden" name="subjoin" value="1">
            <?php if ($_GET["link"] > 0) {
              $lnk = mysql_real_escape_string($_GET["link"]);
            ?>
            <input type="hidden" name="link" value="<?= $lnk?>">
            <? }?>
            <input type="submit" value="Join!">

        </form>

Features

Use the Victors Experience website as a powerful information pipeline to stay informed about work the College is doing to address the world's grand challenges.

Customize the content by telling the site what topics you care most about and it will remember to show you related stories and videos.

Create a favorites list and share stories you like on Facebook, Twitter, Pinterest and other social media sites.

Use Explore to see all the stories and videos about work being done across the College by students, faculty and alumni.

Sign up to get started

Victors
for Michigan

    The world is facing challenges, the likes of which it has never faced before. Problems that only engineers can solve. Because we are Michigan Engineering, we are stepping up to tackle these great challenges and make breakthrough solutions.

» Watch the video

» Learn more about the campaign

Sign up to get started

  <?
  }
  ?>


text:
ContentrDefaultParagraphs::Engine.routes.draw do
end


text:
from binary import Struct, Magic, Format, Offset, Seek, Array, FixedString, String, Pointer

class MDL(Struct):
    def fields(self):
        self.F("magic", Magic("IDST"))
        self.F("version", Format("I"))
        self.F("checksum", Format("I"))
        self.F("name", FixedString(64))
        self.F("datalength", Format("I"))

        self.F("eyepos", Format("3f"))
        self.F("illum", Format("3f"))
        self.F("hull_min", Format("3f"))
        self.F("hull_max", Format("3f"))
        self.F("view_bbmin", Format("3f"))
        self.F("view_bbmax", Format("3f"))

        self.F("flags", Format("I"))

        self.F("bone", Format("II"))
        self.F("bonecontroller", Format("II"))
        self.F("hitbox", Format("II"))

        self.F("numlocalanim", Format("I"))
        self.F("localanimoffset", Format("I"))

        self.F("numlocalsequence", Format("I"))
        self.F("localsequenceoffset", Format("I"))

        self.F("texture", Format("II"))
        self.F("cdtexture", Format("II"))

        self.F("unknown", Format("II"))

        self.F("numskinref", Format("I"))
        self.F("numskinfamilies", Format("I"))
        self.F("skinindex", Format("I"))

        self.F("bodypart", Format("II"))
        self.F("localattachment", Format("II"))

        self.F("numlocalnodes", Format("I"))
        self.F("localnodeindex", Format("I"))
        self.F("localnodenameindex", Format("I"))

        self.F("flexdesc", Format("II"))
        self.F("flexcontroller", Format("II"))
        self.F("flexrule", Format("II"))
        self.F("ikchain", Format("II"))
        self.F("mouth", Format("II"))

        self.F("localposeparameters", Format("II"))
        self.F("surfacepropindex", Format("I"))

        self.F("keyvalueindex", Format("I"))
        self.F("keyvaluesize", Format("I"))

        # pointed fields
        # self.F("localanim", Pointer(self["localanimoffset"].data, Array(self["numlocalanim"].data, LocalAnim)))
        self.F("localsequence", Pointer(self["localsequenceoffset"].data, Array(self["numlocalsequence"].data, LocalSequence)))
        self.F("skin",
            Pointer(self["skinindex"].data,
                Array(self["numskinfamilies"].data,
                    lambda: Array(self["numskinref"].data,
                        lambda: Format("h")))))
        self.F("keyvalue", Pointer(self["keyvalueindex"].data, FixedString(self["keyvaluesize"].data)))

        # here be dragons
        return

        self.F("localikautoplaylock", Format("II"))

        self.F("mass", Format("f"))
        self.F("contents", Format("I"))

        self.F("includemodels", Format("II"))

        self.F("bonetablebynameindex", Format("I"))
        self.F("vertexbase", Format("I"))
        self.F("indexbase", Format("I"))
        self.F("constdirectionallightdot", Format("B"))
        self.F("rootLOD", Format("B"))
        self.F("numAllowedRootLODs", Format("B"))
        self.F("unused", Format("B"))
        self.F("unused4", Format("I"))

        self.F("flexcontrollerui", Format("II"))

        self.F("unused3", Format("2I"))
        self.F("studiohdr2index", Format("I"))
        self.F("unused2", Format("1I"))

class BasePointer(Format):
    def __init__(self, fmt):
        Format.__init__(self, fmt)

    def unpack_data(self, s):
        this = s.tell()
        data = Format.unpack_data(self, s)
        assert data == -this
        return data

    def pack(self, s):
        self.data = -s.tell()
        Format.pack(self, s)

class Relative(Format):
    def __init__(self, field, fmt):
        self.field = field
        Format.__init__(self, fmt)

    def unpack_data(self, s):
        data = Format.unpack_data(self, s)
        if data != 0:
            data += self.field.data
        return data

    def pack_data(self, s, data):
        if data != 0:
            data -= self.field.data
        Format.pack_data(self, s, data)

class RelativeString(Relative):
    def unpack_data(self, s):
        data = Relative.unpack_data(self, s)
        with Seek(s, data):
            string = String().unpack_data(s)
        return [data, string]

    def pack_data(self, s, data):
        data = data[0]
        Relative.pack_data(self, s, data)

class LocalAnim(Struct):
    def fields(self):
        base = self.F("base", Offset())
        self.F("baseptr", BasePointer("i"))
        self.F("nameindex", RelativeString(base, "i"))
        self.F("fps", Format("f"))
        self.F("flags", Format("I"))
        self.F("numframes", Format("I"))
        self.F("nummovements", Format("I"))
        self.F("movementindex", Relative(base, "i"))
        self.F("unused", Format("6I"))
        self.F("animblock", Format("i"))
        self.F("animindex", Relative(base, "i"))
        self.F("numikrules", Format("I"))
        self.F("ikruleindex",Relative(base, "i"))
        self.F("animblockikruleindex", Relative(base, "i"))
        self.F("numlocalhierarchy", Format("I"))
        self.F("localhierarchyindex", Relative(base, "i"))
        self.F("sectionindex", Relative(base, "i"))
        self.F("sectionframes", Format("I"))
        self.F("zeroframespan", Format("h"))
        self.F("zeroframecount", Format("h"))
        self.F("zeroframeindex", Relative(base, "i"))
        self.F("zeroframestalltime", Format("f"))

class LocalSequence(Struct):
    def fields(self):
        base = self.F("base", Offset())
        self.F("baseptr", BasePointer("i"))
        self.F("labelindex", RelativeString(base, "i"))
        self.F("activitynameindex", RelativeString(base, "i"))
        self.F("flags", Format("I"))
        self.F("activity", Format("i"))
        self.F("actweight", Format("I"))
        self.F("numevents", Format("I"))
        self.F("eventindex", Relative(base, "i"))
        self.F("bbmin", Format("3f"))
        self.F("bbmax", Format("3f"))
        self.F("numblends", Format("I"))
        self.F("animindex", Relative(base, "i"))
        self.F("movementindex", Relative(base, "i"))
        self.F("groupsize", Format("2I"))
        self.F("paramindex", Format("2i"))
        self.F("paramstart", Format("2f"))
        self.F("paramend", Format("2f"))
        self.F("paremparent", Format("I"))
        self.F("fadeintime", Format("f"))
        self.F("fadeouttime", Format("f"))
        self.F("localentrynode", Format("I"))
        self.F("localexitnode", Format("I"))
        self.F("nodeflags", Format("I"))
        self.F("entryphase", Format("f"))
        self.F("exitphase", Format("f"))
        self.F("lastframe", Format("f"))
        self.F("nextseg", Format("I"))
        self.F("pose", Format("I"))
        self.F("numikrules", Format("I"))
        self.F("numautolayers", Format("I"))
        self.F("autolayerindex", Relative(base, "i"))
        self.F("weightlistindex", Relative(base, "i"))
        self.F("posekeyindex", Relative(base, "i"))
        self.F("numiklocks", Format("I"))
        self.F("iklockindex", Format("I"))
        self.F("keyvalueindex", Relative(base, "i"))
        self.F("keyvaluesize", Format("I"))
        self.F("cycleposeindex", Relative(base, "i"))
        self.F("activitymodifierindex", Relative(base, "i"))
        self.F("numactivitymodifier", Format("I"))
        self.F("unused", Format("5I"))

        # self.F("event", Pointer(self["eventindex"].data, Array(self["numevents"].data, Event)))
        self.F("activitymodifier", Pointer(self["activitymodifierindex"].data, Array(self["numactivitymodifier"].data, ActivityModifier)))

class ActivityModifier(Struct):
    def fields(self):
        base = self.F("base", Offset())
        self.F("szindex", RelativeString(base, "i"))

class Event(Struct):
    def fields(self):
        base = self.F("base", Offset())
        self.F("cycle", Format("f"))
        self.F("event", Format("I"))
        self.F("type", Format("I"))
        self.F("options", FixedString(64))
        self.F("szeventindex", RelativeString(base, "i"))


text:
package eu.dnetlib.iis.wf.affmatching;

import com.beust.jcommander.DynamicParameter;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import eu.dnetlib.iis.common.java.io.HdfsUtils;
import eu.dnetlib.iis.common.spark.JavaSparkContextFactory;
import eu.dnetlib.iis.wf.affmatching.match.AffOrgMatcher;
import eu.dnetlib.iis.wf.affmatching.orgalternativenames.AffMatchOrganizationAltNameFiller;
import eu.dnetlib.iis.wf.affmatching.orgalternativenames.CsvOrganizationAltNamesDictionaryFactory;
import eu.dnetlib.iis.wf.affmatching.orgalternativenames.OrganizationAltNameConst;
import eu.dnetlib.iis.wf.affmatching.read.AffiliationReader;
import eu.dnetlib.iis.wf.affmatching.read.AffiliationReaderFactory;
import eu.dnetlib.iis.wf.affmatching.read.IisAffiliationReader;
import eu.dnetlib.iis.wf.affmatching.read.IisOrganizationReader;
import eu.dnetlib.iis.wf.affmatching.write.IisAffMatchResultWriter;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;

import java.io.IOException;
import java.util.*;

import static com.google.common.collect.ImmutableList.of;
import static eu.dnetlib.iis.wf.affmatching.match.DocOrgRelationMatcherFactory.createDocOrgRelationMatcher;
import static eu.dnetlib.iis.wf.affmatching.match.FirstWordsHashBucketMatcherFactory.createNameFirstWordsHashBucketMatcher;
import static eu.dnetlib.iis.wf.affmatching.match.MainSectionHashBucketMatcherFactory.*;

/**
 * Job matching affiliations with organizations.
 *
 * @param inputAvroOrgPath path to directory with avro files containing organizations
 *
 * @author Łukasz Dumiszewski
 */
public class AffMatchingJob {

    public static final String PARAM_AFF_MATCHING_SERVICE_AFFILIATION_READER_FACTORY_CLASSNAME =
            "aff_matching_service_affiliation_reader_factory_classname";

    private static CsvOrganizationAltNamesDictionaryFactory alternativeNamesFactory = new CsvOrganizationAltNamesDictionaryFactory();

    //------------------------ LOGIC --------------------------

    public static void main(String[] args) throws Exception {
        AffMatchingJobParameters params = new AffMatchingJobParameters();
        JCommander jcommander = new JCommander(params);
        jcommander.parse(args);

        try (JavaSparkContext sc = JavaSparkContextFactory.withConfAndKryo(new SparkConf())) {
            HdfsUtils.remove(sc.hadoopConfiguration(), params.outputAvroPath);
            HdfsUtils.remove(sc.hadoopConfiguration(), params.outputAvroReportPath);

            AffMatchingService affMatchingService = createAffMatchingService(sc, params);

            affMatchingService
                    .matchAffiliations(sc,
                            params.inputAvroAffPath,
                            params.inputAvroOrgPath,
                            params.outputAvroPath,
                            params.outputAvroReportPath);
        }
    }

    //------------------------ PRIVATE --------------------------

    @Parameters(separators = "=")
    private static class AffMatchingJobParameters {

        @Parameter(names = "-inputAvroOrgPath", required = true, description="path to directory with avro files containing organizations")
        private String inputAvroOrgPath;

        @Parameter(names = "-inputAvroAffPath", required = true, description="path to directory with avro files containing affiliations")
        private String inputAvroAffPath;

        @Parameter(names = "-inputAvroInferredDocProjPath", required = true, description="path to directory with avro files containing inferred document to project relations")
        private String inputAvroInferredDocProjPath;

        @Parameter(names = "-inputAvroDocProjPath", required = true, description="path to directory with avro files containing document to project relations")
        private String inputAvroDocProjPath;

        @Parameter(names = "-inputDocProjConfidenceThreshold", description="minimal confidence level for document to project relations (no limit by default)")
        private Float inputDocProjConfidenceThreshold = null;

        @Parameter(names = "-inputAvroProjOrgPath", required = true, description="path to directory with avro files containing project to organization relations")
        private String inputAvroProjOrgPath;

        @Parameter(names = "-numberOfEmittedFiles", required = true)
        private int numberOfEmittedFiles;

        @Parameter(names = "-outputAvroPath", required = true)
        private String outputAvroPath;

        @Parameter(names = "-outputAvroReportPath", required = true, description="path to a directory with the execution result report")
        private String outputAvroReportPath;

        @DynamicParameter(names = "-D", description = "dynamic parameters related to quality tests")
        private Map<String, String> parameters = new HashMap<>();
    }

    private static AffMatchingService createAffMatchingService(JavaSparkContext sparkContext, AffMatchingJobParameters params) throws Exception {
        AffMatchingService affMatchingService = new AffMatchingService();
        affMatchingService.setNumberOfEmittedFiles(params.numberOfEmittedFiles);

        // readers
        affMatchingService.setAffiliationReader(createAffiliationReader(params));
        affMatchingService.setOrganizationReader(new IisOrganizationReader());

        // writer
        affMatchingService.setAffMatchResultWriter(new IisAffMatchResultWriter());

        // matchers
        AffOrgMatcher docOrgRelationMatcher =
                createDocOrgRelationMatcher(sparkContext, params.inputAvroDocProjPath, params.inputAvroInferredDocProjPath, params.inputAvroProjOrgPath, params.inputDocProjConfidenceThreshold);
        AffOrgMatcher mainSectionHashBucketMatcher = createNameMainSectionHashBucketMatcher();
        AffOrgMatcher alternativeNameMainSectionHashBucketMatcher = createAlternativeNameMainSectionHashBucketMatcher();
        AffOrgMatcher shortNameMainSectionHashBucketMatcher = createShortNameMainSectionHashBucketMatcher();
        AffOrgMatcher firstWordsHashBucketMatcher = createNameFirstWordsHashBucketMatcher();

        affMatchingService.setAffOrgMatchers(of(docOrgRelationMatcher, mainSectionHashBucketMatcher, alternativeNameMainSectionHashBucketMatcher, shortNameMainSectionHashBucketMatcher, firstWordsHashBucketMatcher));

        AffMatchOrganizationAltNameFiller altNameFiller = createAffMatchOrganizationAltNameFiller();
        affMatchingService.setAffMatchOrganizationAltNameFiller(altNameFiller);

        return affMatchingService;
    }

    private static AffiliationReader createAffiliationReader(AffMatchingJobParameters params) throws Exception {
        String className = params.parameters.get(PARAM_AFF_MATCHING_SERVICE_AFFILIATION_READER_FACTORY_CLASSNAME);
        if (Objects.isNull(className)) {
            return new IisAffiliationReader();
        }
        return ((AffiliationReaderFactory) Class.forName(className).getConstructor().newInstance()).create();
    }

    private static AffMatchOrganizationAltNameFiller createAffMatchOrganizationAltNameFiller() throws IOException {
        AffMatchOrganizationAltNameFiller altNameFiller = new AffMatchOrganizationAltNameFiller();

        List<Set<String>> alternativeNamesDictionary = alternativeNamesFactory.createAlternativeNamesDictionary(OrganizationAltNameConst.CLASSPATH_ALTERNATIVE_NAMES_CSV_FILES);
        altNameFiller.setAlternativeNamesDictionary(alternativeNamesDictionary);

        return altNameFiller;
    }
}


text:
import glob
import logging
import os

from datetime import timedelta
from subprocess import check_call, check_output, CalledProcessError

# local
from ona_service.service import Service
from ona_service.utils import utcnow, utcoffset, get_ip

FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT)

DATA_TYPE = 'logs'
UPDATE_INTERVAL_SECONDS = 600
MANAGE_SCRIPT = '/opt/suricata/manage.sh'
SURICATA_LOGDIR = '/opt/suricata/logs'
SURICATA_LOGNAME = 'eve.json'
SURICATA_RULE_PATH = '/opt/suricata/rules/downloaded.rules'

def _compress_log(file_path):
    try:
        check_call(['gzip', '-f', file_path])
    except CalledProcessError:
        logging.error('Could not compress %s', file_path)
    else:
        file_path = '{}.gz'.format(file_path)

    return file_path

def _signal_suricata(action):
    '''
    Calls out to the suricata-service's manage.sh script.
    '''
    try:
        check_output(['sudo', '-u', 'suricata', MANAGE_SCRIPT, action])
    except CalledProcessError as e:
        logging.error('Error with suricata manage script ({}), {}'.format(
            e.returncode, action))

class SuricataAlertWatcher(Service):
    def __init__(self, *args, **kwargs):
        kwargs.update({
            'poll_seconds': UPDATE_INTERVAL_SECONDS,
        })
        super().__init__(*args, **kwargs)
        self.log_dir = kwargs.get('log_dir', SURICATA_LOGDIR)
        self.log_type = 'suricata'

    def _rotate_logs(self):
        _signal_suricata('rotate-logs')

    def _upload(self, now, compress=False):
        '''
        Upload log files. Hopefully just one, but maybe the last one failed
        so we need to pick it up too...
        '''
        pattern = os.path.join(
            self.log_dir, '{}.*.archived'.format(SURICATA_LOGNAME)
        )
        for file_path in glob.iglob(pattern):
            if compress:
                file_path = _compress_log(file_path)
            path = self.api.send_file(DATA_TYPE, file_path, now,
                                      suffix=self.log_type)
            if path is not None:
                data = {
                    'path': path,
                    'log_type': self.log_type,
                    'utcoffset': utcoffset(),
                    'ip': get_ip(),
                }
                self.api.send_signal(DATA_TYPE, data)
            os.remove(file_path)

    def _update_rules(self):
        res = self.api.get_data('suricata-rules')
        with open(SURICATA_RULE_PATH, 'wb') as f:
            for chunk in res.iter_content(8192):
                f.write(chunk)
        _signal_suricata('reload-config')

    def execute(self, now=None):
        logging.info('Checking for Suricata alerts')
        self._rotate_logs()
        self._upload(now, compress=True)

        # ideally we'll update this to use the e-tag, for more responsive
        # config updates. But for now, do it at the start of every day.
        # we call utcnow() again to avoid the race condition where we miss
        # midnight.
        next_time = utcnow() + timedelta(seconds=UPDATE_INTERVAL_SECONDS)
        should_update = (now and next_time.date() > now.date())
        if (not os.path.exists(os.path.dirname(SURICATA_RULE_PATH))):
            logging.error(
                'Rule directory does not exist. Is Suricata installed?'
            )
        elif (not os.path.exists(SURICATA_RULE_PATH)) or should_update:
            logging.info('Updating Suricata rules')
            self._update_rules()
            logging.info('Finished updating Suricata rules')

if __name__ == '__main__':
    watcher = SuricataAlertWatcher()
    watcher.run()


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
        <meta name="format-detection" content="telephone=no">
        <title>FrozenUI Demo</title>

        <link rel="stylesheet" href="../css/frozen.css">
        <link rel="stylesheet" href="demo.css">

轮播组件 slider
<button class="ui-btn">回首页</button>

基础样式

UI组件

JS插件

轮播组件

            内容


text:
package org.diorite.impl.permissions;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

public abstract class PermissionContainerImpl
{
    private PermissionContainerImpl parent;

    public PermissionContainerImpl()
    {
    }

    public PermissionContainerImpl(final PermissionContainerImpl parent)
    {
        this.parent = parent;
    }

    public void setParent(final PermissionContainerImpl parent)
    {
        this.parent = parent;
    }

    public boolean hasPermission(final String permission)
    {
        // TODO;
        return false;
    }

    public boolean hasPermission(final String pattern, final String permission)
    {
        // TODO;
        return false;
    }

    @Override
    public String toString()
    {
        return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).appendSuper(super.toString()).append("parent", this.parent).toString();
    }
}


text:
This is a console-based version of Tetris written in Go.

![alt text][logo]
[logo]: https://raw.githubusercontent.com/jjinux/gotetris/master/screen_shot.png "Screen shot"

## Working on the Code

See [How to Write Go Code](https://golang.org/doc/code.html).

Setup your Go workspace:

	mkdir -p gotetris/src/github.com/jjinux
	cd gotetris
	(cd src/github.com/jjinux &&
	  git clone https://github.com/jjinux/gotetris.git)
	echo "See src/github.com/jjinux/gotetris/README." > README

	# Do this each time to work on the code from the top-level
	# gotetris directory.
	export GOPATH=`pwd`
	export PATH=$PATH:$GOPATH/bin

	# Install dependencies.
	go get -u github.com/nsf/termbox-go

Build:

	go install github.com/jjinux/gotetris

Execute:

	gotetris

## Credits

gotetris is built on top of the excellent
[termbox-go](https://github.com/nsf/termbox-go) library.

It was inspired by [Alexei Kourbatov](http://www.javascripter.net) as
well as my port of [Tetris to Dart](http://code.google.com/p/tetris-in-dart/).


text:
/* eslint-env node, es6 */
module.exports = require("./dist/embed-box-custom-target")


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.WebSockets;
using System.Net.Sockets;

namespace neon2d.Networking
{
    public class Server
    {

        public async void Start(string httpListenerPrefix)
        {
            HttpListener listener = new HttpListener();
            listener.Prefixes.Add(httpListenerPrefix);
            listener.Start();

            while (true)
            {
                HttpListenerContext context = await listener.GetContextAsync();
                if (context.Request.IsWebSocketRequest)
                {
                    ProcessRequest(context);
                }
                else
                {
                    context.Response.StatusCode = 400;
                    context.Response.Close();
                }
            }
        }

        public async void ProcessRequest(HttpListenerContext context)
        {
            WebSocketContext socketContext = null;
            try
            {
                socketContext = await context.AcceptWebSocketAsync(subProtocol: null);
                string ipAddress = context.Request.RemoteEndPoint.Address.ToString();
            }
            catch(Exception e)
            {
                context.Response.StatusCode = 500;
                context.Response.Close();
                neon2d.Message.log("Exception: " + e);
                return;
            }

            WebSocket socket = socketContext.WebSocket;
            try
            {
                byte[] receiveBuffer = new byte[1024];
                while (socket.State == WebSocketState.Open)
                {
                    WebSocketReceiveResult result = await socket.ReceiveAsync(new ArraySegment<byte>(receiveBuffer), System.Threading.CancellationToken.None);
                    if(result.MessageType == WebSocketMessageType.Close)
                    {
                        await socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "", System.Threading.CancellationToken.None);
                    }
                    else
                    {
                        await socket.SendAsync(new ArraySegment<byte>(receiveBuffer, 0, result.Count), WebSocketMessageType.Binary, result.EndOfMessage, System.Threading.CancellationToken.None);
                    }
                }

            }
            catch (Exception e)
            {
                neon2d.Message.log("Exception: " + e);
            }
            finally
            {
                if(socket != null)
                {
                    socket.Dispose();
                }
            }
        }

    }

    public class Client
    {

        private static UTF8Encoding encoding = new UTF8Encoding();

        public static string data;

        public void Join(string url)
        {
            Connect(url).Wait();
        }

        public static async Task Connect(string url)
        {

            System.Threading.Thread.Sleep(1000);

            ClientWebSocket socket = null;

            try
            {
                socket = new ClientWebSocket();
                await socket.ConnectAsync(new Uri(url), System.Threading.CancellationToken.None);
                await Task.WhenAll(Receive(socket), Send(socket, "ayy lmao"));
            }
            catch (Exception ex)
            {
                neon2d.Message.log("Exception: " + ex);
            }
            finally
            {
                if(socket != null)
                {
                    socket.Dispose();
                }
            }

        }

        public static async Task Send(ClientWebSocket socket, string content)
        {
            while(socket.State == WebSocketState.Open)
            {
                byte[] buffer = encoding.GetBytes(content);

                await socket.SendAsync(new ArraySegment<byte>(buffer), WebSocketMessageType.Binary, false, System.Threading.CancellationToken.None);

                await Task.Delay(1000);
            }
        }

        public static async Task Receive(ClientWebSocket socket)
        {
            byte[] buffer = new byte[1024];
            while(socket.State == WebSocketState.Open)
            {
                var result = await socket.ReceiveAsync(new ArraySegment<byte>(buffer), System.Threading.CancellationToken.None);
                if(result.MessageType == WebSocketMessageType.Close)
                {
                    await socket.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, System.Threading.CancellationToken.None);
                }
                else
                {
                    data = Encoding.UTF8.GetString(buffer).TrimEnd('\0');
                }
            }
        }

        public string getData()
        {
            return data;
        }

    }

}


text:
package com.timaar.tiimspot.web.rest;

import com.codahale.metrics.annotation.Timed;
import com.timaar.tiimspot.domain.PersoonEvent;
import com.timaar.tiimspot.repository.PersoonEventRepository;
import com.timaar.tiimspot.repository.search.PersoonEventSearchRepository;
import com.timaar.tiimspot.web.rest.util.HeaderUtil;
import com.timaar.tiimspot.web.rest.util.PaginationUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.inject.Inject;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import static org.elasticsearch.index.query.QueryBuilders.*;

/**
 * REST controller for managing PersoonEvent.
 */
@RestController
@RequestMapping("/api")
public class PersoonEventResource {

    private final Logger log = LoggerFactory.getLogger(PersoonEventResource.class);

    @Inject
    private PersoonEventRepository persoonEventRepository;

    @Inject
    private PersoonEventSearchRepository persoonEventSearchRepository;

    /**
     * POST  /persoonEvents -> Create a new persoonEvent.
     */
    @RequestMapping(value = "/persoonEvents",
        method = RequestMethod.POST,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    public ResponseEntity<PersoonEvent> createPersoonEvent(@Valid @RequestBody PersoonEvent persoonEvent) throws URISyntaxException {
        log.debug("REST request to save PersoonEvent : {}", persoonEvent);
        if (persoonEvent.getId() != null) {
            return ResponseEntity.badRequest().header("Failure", "A new persoonEvent cannot already have an ID").body(null);
        }
        PersoonEvent result = persoonEventRepository.save(persoonEvent);
        persoonEventSearchRepository.save(result);
        return ResponseEntity.created(new URI("/api/persoonEvents/" + result.getId()))
            .headers(HeaderUtil.createEntityCreationAlert("persoonEvent", result.getId().toString()))
            .body(result);
    }

    /**
     * PUT  /persoonEvents -> Updates an existing persoonEvent.
     */
    @RequestMapping(value = "/persoonEvents",
        method = RequestMethod.PUT,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    public ResponseEntity<PersoonEvent> updatePersoonEvent(@Valid @RequestBody PersoonEvent persoonEvent) throws URISyntaxException {
        log.debug("REST request to update PersoonEvent : {}", persoonEvent);
        if (persoonEvent.getId() == null) {
            return createPersoonEvent(persoonEvent);
        }
        PersoonEvent result = persoonEventRepository.save(persoonEvent);
        persoonEventSearchRepository.save(persoonEvent);
        return ResponseEntity.ok()
            .headers(HeaderUtil.createEntityUpdateAlert("persoonEvent", persoonEvent.getId().toString()))
            .body(result);
    }

    /**
     * GET  /persoonEvents -> get all the persoonEvents.
     */
    @RequestMapping(value = "/persoonEvents",
        method = RequestMethod.GET,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    public ResponseEntity<List<PersoonEvent>> getAllPersoonEvents(Pageable pageable)
        throws URISyntaxException {
        Page<PersoonEvent> page = persoonEventRepository.findAll(pageable);
        HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/persoonEvents");
        return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
    }

    /**
     * GET  /persoonEvents/:id -> get the "id" persoonEvent.
     */
    @RequestMapping(value = "/persoonEvents/{id}",
        method = RequestMethod.GET,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    public ResponseEntity<PersoonEvent> getPersoonEvent(@PathVariable Long id) {
        log.debug("REST request to get PersoonEvent : {}", id);
        return Optional.ofNullable(persoonEventRepository.findOne(id))
            .map(persoonEvent -> new ResponseEntity<>(
                persoonEvent,
                HttpStatus.OK))
            .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
    }

    /**
     * DELETE  /persoonEvents/:id -> delete the "id" persoonEvent.
     */
    @RequestMapping(value = "/persoonEvents/{id}",
        method = RequestMethod.DELETE,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    public ResponseEntity<Void> deletePersoonEvent(@PathVariable Long id) {
        log.debug("REST request to delete PersoonEvent : {}", id);
        persoonEventRepository.delete(id);
        persoonEventSearchRepository.delete(id);
        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert("persoonEvent", id.toString())).build();
    }

    /**
     * SEARCH  /_search/persoonEvents/:query -> search for the persoonEvent corresponding
     * to the query.
     */
    @RequestMapping(value = "/_search/persoonEvents/{query}",
        method = RequestMethod.GET,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    public List<PersoonEvent> searchPersoonEvents(@PathVariable String query) {
        return StreamSupport
            .stream(persoonEventSearchRepository.search(queryStringQuery(query)).spliterator(), false)
            .collect(Collectors.toList());
    }
}


text:
package org.ucombinator.jaam.visualizer.state;

import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import org.ucombinator.jaam.visualizer.controllers.MainTabController;
import org.ucombinator.jaam.visualizer.graph.GraphTransform;
import org.ucombinator.jaam.visualizer.graph.GraphUtils;
import org.ucombinator.jaam.visualizer.layout.AbstractLayoutVertex;
import org.ucombinator.jaam.visualizer.layout.LayoutAlgorithm;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

public class StateRootVertex extends StateVertex {

    private static final Color defaultColor = Color.WHITE;

    public StateRootVertex() {
        super("root", AbstractLayoutVertex.VertexType.ROOT, false);
        this.color = defaultColor;
    }

    @Override
    public StateRootVertex copy() {
        StateRootVertex r = new StateRootVertex();
        r.color = this.color;
        r.setExpanded(this.isExpanded());
        r.setEdgeVisible(this.isEdgeVisible());
        return new StateRootVertex();
    }

    @Override
    public void onMouseClick(MouseEvent event) {}

    public GraphTransform<StateRootVertex, StateVertex> constructVisibleGraphExcept(Set<StateVertex> verticesToHide) {
        return GraphUtils.constructVisibleGraph(this, (StateVertex v) -> !verticesToHide.contains(v), StateEdge::new);
    }

    public String getRightPanelContent() {
        return "Root vertex";
    }

    public boolean searchByMethod(String query, MainTabController mainTab) {
        boolean found = false;
        for(StateVertex v : this.getInnerGraph().getVertices()) {
            found = v.searchByMethod(query, mainTab) || found;
        }

        if(found) {
            this.setHighlighted(true);
            mainTab.getStateHighlighted().add(this);
        }

        return found;
    }

    @Override
    public LayoutAlgorithm.LAYOUT_ALGORITHM getPreferredLayout() {
        return LayoutAlgorithm.LAYOUT_ALGORITHM.BFS;
    }

    public List<StateVertex> expand() {
        List<StateVertex> expandedVertices = new ArrayList<>();
        for (StateVertex v : this.getInnerGraph().getVertices()) {
            expandedVertices.addAll(v.expand());
        }
        return expandedVertices;
    }
}


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

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * An answer of the question.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Answer implements Serializable, Cloneable, StructuredPojo {

    private String questionId;

    private String pillarId;

    private String questionTitle;

    private String questionDescription;

    private String improvementPlanUrl;

    private String helpfulResourceUrl;
    /**
     *

     * The helpful resource text to be displayed.
     *

     */
    private String helpfulResourceDisplayText;

    private java.util.List<Choice> choices;

    private java.util.List<String> selectedChoices;
    /**
     *

     * A list of selected choices to a question in your workload.
     *

     */
    private java.util.List<ChoiceAnswer> choiceAnswers;

    private Boolean isApplicable;

    private String risk;

    private String notes;
    /**
     *

     * The reason why the question is not applicable to your workload.
     *

     */
    private String reason;

    /**
     * @param questionId
     */

    public void setQuestionId(String questionId) {
        this.questionId = questionId;
    }

    /**
     * @return
     */

    public String getQuestionId() {
        return this.questionId;
    }

    /**
     * @param questionId
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withQuestionId(String questionId) {
        setQuestionId(questionId);
        return this;
    }

    /**
     * @param pillarId
     */

    public void setPillarId(String pillarId) {
        this.pillarId = pillarId;
    }

    /**
     * @return
     */

    public String getPillarId() {
        return this.pillarId;
    }

    /**
     * @param pillarId
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withPillarId(String pillarId) {
        setPillarId(pillarId);
        return this;
    }

    /**
     * @param questionTitle
     */

    public void setQuestionTitle(String questionTitle) {
        this.questionTitle = questionTitle;
    }

    /**
     * @return
     */

    public String getQuestionTitle() {
        return this.questionTitle;
    }

    /**
     * @param questionTitle
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withQuestionTitle(String questionTitle) {
        setQuestionTitle(questionTitle);
        return this;
    }

    /**
     * @param questionDescription
     */

    public void setQuestionDescription(String questionDescription) {
        this.questionDescription = questionDescription;
    }

    /**
     * @return
     */

    public String getQuestionDescription() {
        return this.questionDescription;
    }

    /**
     * @param questionDescription
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withQuestionDescription(String questionDescription) {
        setQuestionDescription(questionDescription);
        return this;
    }

    /**
     * @param improvementPlanUrl
     */

    public void setImprovementPlanUrl(String improvementPlanUrl) {
        this.improvementPlanUrl = improvementPlanUrl;
    }

    /**
     * @return
     */

    public String getImprovementPlanUrl() {
        return this.improvementPlanUrl;
    }

    /**
     * @param improvementPlanUrl
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withImprovementPlanUrl(String improvementPlanUrl) {
        setImprovementPlanUrl(improvementPlanUrl);
        return this;
    }

    /**
     * @param helpfulResourceUrl
     */

    public void setHelpfulResourceUrl(String helpfulResourceUrl) {
        this.helpfulResourceUrl = helpfulResourceUrl;
    }

    /**
     * @return
     */

    public String getHelpfulResourceUrl() {
        return this.helpfulResourceUrl;
    }

    /**
     * @param helpfulResourceUrl
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withHelpfulResourceUrl(String helpfulResourceUrl) {
        setHelpfulResourceUrl(helpfulResourceUrl);
        return this;
    }

    /**
     *

     * The helpful resource text to be displayed.
     *

     *
     * @param helpfulResourceDisplayText
     *        The helpful resource text to be displayed.
     */

    public void setHelpfulResourceDisplayText(String helpfulResourceDisplayText) {
        this.helpfulResourceDisplayText = helpfulResourceDisplayText;
    }

    /**
     *

     * The helpful resource text to be displayed.
     *

     *
     * @return The helpful resource text to be displayed.
     */

    public String getHelpfulResourceDisplayText() {
        return this.helpfulResourceDisplayText;
    }

    /**
     *

     * The helpful resource text to be displayed.
     *

     *
     * @param helpfulResourceDisplayText
     *        The helpful resource text to be displayed.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withHelpfulResourceDisplayText(String helpfulResourceDisplayText) {
        setHelpfulResourceDisplayText(helpfulResourceDisplayText);
        return this;
    }

    /**
     * @return
     */

    public java.util.List<Choice> getChoices() {
        return choices;
    }

    /**
     * @param choices
     */

    public void setChoices(java.util.Collection<Choice> choices) {
        if (choices == null) {
            this.choices = null;
            return;
        }

        this.choices = new java.util.ArrayList<Choice>(choices);
    }

    /**
     *

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

     *
     * @param choices
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withChoices(Choice... choices) {
        if (this.choices == null) {
            setChoices(new java.util.ArrayList<Choice>(choices.length));
        }
        for (Choice ele : choices) {
            this.choices.add(ele);
        }
        return this;
    }

    /**
     * @param choices
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withChoices(java.util.Collection<Choice> choices) {
        setChoices(choices);
        return this;
    }

    /**
     * @return
     */

    public java.util.List<String> getSelectedChoices() {
        return selectedChoices;
    }

    /**
     * @param selectedChoices
     */

    public void setSelectedChoices(java.util.Collection<String> selectedChoices) {
        if (selectedChoices == null) {
            this.selectedChoices = null;
            return;
        }

        this.selectedChoices = new java.util.ArrayList<String>(selectedChoices);
    }

    /**
     *

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

     *
     * @param selectedChoices
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withSelectedChoices(String... selectedChoices) {
        if (this.selectedChoices == null) {
            setSelectedChoices(new java.util.ArrayList<String>(selectedChoices.length));
        }
        for (String ele : selectedChoices) {
            this.selectedChoices.add(ele);
        }
        return this;
    }

    /**
     * @param selectedChoices
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withSelectedChoices(java.util.Collection<String> selectedChoices) {
        setSelectedChoices(selectedChoices);
        return this;
    }

    /**
     *

     * A list of selected choices to a question in your workload.
     *

     *
     * @return A list of selected choices to a question in your workload.
     */

    public java.util.List<ChoiceAnswer> getChoiceAnswers() {
        return choiceAnswers;
    }

    /**
     *

     * A list of selected choices to a question in your workload.
     *

     *
     * @param choiceAnswers
     *        A list of selected choices to a question in your workload.
     */

    public void setChoiceAnswers(java.util.Collection<ChoiceAnswer> choiceAnswers) {
        if (choiceAnswers == null) {
            this.choiceAnswers = null;
            return;
        }

        this.choiceAnswers = new java.util.ArrayList<ChoiceAnswer>(choiceAnswers);
    }

    /**
     *

     * A list of selected choices to a question in your workload.
     *

     *

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

     *
     * @param choiceAnswers
     *        A list of selected choices to a question in your workload.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withChoiceAnswers(ChoiceAnswer... choiceAnswers) {
        if (this.choiceAnswers == null) {
            setChoiceAnswers(new java.util.ArrayList<ChoiceAnswer>(choiceAnswers.length));
        }
        for (ChoiceAnswer ele : choiceAnswers) {
            this.choiceAnswers.add(ele);
        }
        return this;
    }

    /**
     *

     * A list of selected choices to a question in your workload.
     *

     *
     * @param choiceAnswers
     *        A list of selected choices to a question in your workload.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withChoiceAnswers(java.util.Collection<ChoiceAnswer> choiceAnswers) {
        setChoiceAnswers(choiceAnswers);
        return this;
    }

    /**
     * @param isApplicable
     */

    public void setIsApplicable(Boolean isApplicable) {
        this.isApplicable = isApplicable;
    }

    /**
     * @return
     */

    public Boolean getIsApplicable() {
        return this.isApplicable;
    }

    /**
     * @param isApplicable
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withIsApplicable(Boolean isApplicable) {
        setIsApplicable(isApplicable);
        return this;
    }

    /**
     * @return
     */

    public Boolean isApplicable() {
        return this.isApplicable;
    }

    /**
     * @param risk
     * @see Risk
     */

    public void setRisk(String risk) {
        this.risk = risk;
    }

    /**
     * @return
     * @see Risk
     */

    public String getRisk() {
        return this.risk;
    }

    /**
     * @param risk
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see Risk
     */

    public Answer withRisk(String risk) {
        setRisk(risk);
        return this;
    }

    /**
     * @param risk
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see Risk
     */

    public Answer withRisk(Risk risk) {
        this.risk = risk.toString();
        return this;
    }

    /**
     * @param notes
     */

    public void setNotes(String notes) {
        this.notes = notes;
    }

    /**
     * @return
     */

    public String getNotes() {
        return this.notes;
    }

    /**
     * @param notes
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Answer withNotes(String notes) {
        setNotes(notes);
        return this;
    }

    /**
     *

     * The reason why the question is not applicable to your workload.
     *

     *
     * @param reason
     *        The reason why the question is not applicable to your workload.
     * @see AnswerReason
     */

    public void setReason(String reason) {
        this.reason = reason;
    }

    /**
     *

     * The reason why the question is not applicable to your workload.
     *

     *
     * @return The reason why the question is not applicable to your workload.
     * @see AnswerReason
     */

    public String getReason() {
        return this.reason;
    }

    /**
     *

     * The reason why the question is not applicable to your workload.
     *

     *
     * @param reason
     *        The reason why the question is not applicable to your workload.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see AnswerReason
     */

    public Answer withReason(String reason) {
        setReason(reason);
        return this;
    }

    /**
     *

     * The reason why the question is not applicable to your workload.
     *

     *
     * @param reason
     *        The reason why the question is not applicable to your workload.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see AnswerReason
     */

    public Answer withReason(AnswerReason reason) {
        this.reason = reason.toString();
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getQuestionId() != null)
            sb.append("QuestionId: ").append(getQuestionId()).append(",");
        if (getPillarId() != null)
            sb.append("PillarId: ").append(getPillarId()).append(",");
        if (getQuestionTitle() != null)
            sb.append("QuestionTitle: ").append(getQuestionTitle()).append(",");
        if (getQuestionDescription() != null)
            sb.append("QuestionDescription: ").append(getQuestionDescription()).append(",");
        if (getImprovementPlanUrl() != null)
            sb.append("ImprovementPlanUrl: ").append(getImprovementPlanUrl()).append(",");
        if (getHelpfulResourceUrl() != null)
            sb.append("HelpfulResourceUrl: ").append(getHelpfulResourceUrl()).append(",");
        if (getHelpfulResourceDisplayText() != null)
            sb.append("HelpfulResourceDisplayText: ").append(getHelpfulResourceDisplayText()).append(",");
        if (getChoices() != null)
            sb.append("Choices: ").append(getChoices()).append(",");
        if (getSelectedChoices() != null)
            sb.append("SelectedChoices: ").append(getSelectedChoices()).append(",");
        if (getChoiceAnswers() != null)
            sb.append("ChoiceAnswers: ").append(getChoiceAnswers()).append(",");
        if (getIsApplicable() != null)
            sb.append("IsApplicable: ").append(getIsApplicable()).append(",");
        if (getRisk() != null)
            sb.append("Risk: ").append(getRisk()).append(",");
        if (getNotes() != null)
            sb.append("Notes: ").append(getNotes()).append(",");
        if (getReason() != null)
            sb.append("Reason: ").append(getReason());
        sb.append("}");
        return sb.toString();
    }

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

        if (obj instanceof Answer == false)
            return false;
        Answer other = (Answer) obj;
        if (other.getQuestionId() == null ^ this.getQuestionId() == null)
            return false;
        if (other.getQuestionId() != null && other.getQuestionId().equals(this.getQuestionId()) == false)
            return false;
        if (other.getPillarId() == null ^ this.getPillarId() == null)
            return false;
        if (other.getPillarId() != null && other.getPillarId().equals(this.getPillarId()) == false)
            return false;
        if (other.getQuestionTitle() == null ^ this.getQuestionTitle() == null)
            return false;
        if (other.getQuestionTitle() != null && other.getQuestionTitle().equals(this.getQuestionTitle()) == false)
            return false;
        if (other.getQuestionDescription() == null ^ this.getQuestionDescription() == null)
            return false;
        if (other.getQuestionDescription() != null && other.getQuestionDescription().equals(this.getQuestionDescription()) == false)
            return false;
        if (other.getImprovementPlanUrl() == null ^ this.getImprovementPlanUrl() == null)
            return false;
        if (other.getImprovementPlanUrl() != null && other.getImprovementPlanUrl().equals(this.getImprovementPlanUrl()) == false)
            return false;
        if (other.getHelpfulResourceUrl() == null ^ this.getHelpfulResourceUrl() == null)
            return false;
        if (other.getHelpfulResourceUrl() != null && other.getHelpfulResourceUrl().equals(this.getHelpfulResourceUrl()) == false)
            return false;
        if (other.getHelpfulResourceDisplayText() == null ^ this.getHelpfulResourceDisplayText() == null)
            return false;
        if (other.getHelpfulResourceDisplayText() != null && other.getHelpfulResourceDisplayText().equals(this.getHelpfulResourceDisplayText()) == false)
            return false;
        if (other.getChoices() == null ^ this.getChoices() == null)
            return false;
        if (other.getChoices() != null && other.getChoices().equals(this.getChoices()) == false)
            return false;
        if (other.getSelectedChoices() == null ^ this.getSelectedChoices() == null)
            return false;
        if (other.getSelectedChoices() != null && other.getSelectedChoices().equals(this.getSelectedChoices()) == false)
            return false;
        if (other.getChoiceAnswers() == null ^ this.getChoiceAnswers() == null)
            return false;
        if (other.getChoiceAnswers() != null && other.getChoiceAnswers().equals(this.getChoiceAnswers()) == false)
            return false;
        if (other.getIsApplicable() == null ^ this.getIsApplicable() == null)
            return false;
        if (other.getIsApplicable() != null && other.getIsApplicable().equals(this.getIsApplicable()) == false)
            return false;
        if (other.getRisk() == null ^ this.getRisk() == null)
            return false;
        if (other.getRisk() != null && other.getRisk().equals(this.getRisk()) == false)
            return false;
        if (other.getNotes() == null ^ this.getNotes() == null)
            return false;
        if (other.getNotes() != null && other.getNotes().equals(this.getNotes()) == false)
            return false;
        if (other.getReason() == null ^ this.getReason() == null)
            return false;
        if (other.getReason() != null && other.getReason().equals(this.getReason()) == false)
            return false;
        return true;
    }

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

        hashCode = prime * hashCode + ((getQuestionId() == null) ? 0 : getQuestionId().hashCode());
        hashCode = prime * hashCode + ((getPillarId() == null) ? 0 : getPillarId().hashCode());
        hashCode = prime * hashCode + ((getQuestionTitle() == null) ? 0 : getQuestionTitle().hashCode());
        hashCode = prime * hashCode + ((getQuestionDescription() == null) ? 0 : getQuestionDescription().hashCode());
        hashCode = prime * hashCode + ((getImprovementPlanUrl() == null) ? 0 : getImprovementPlanUrl().hashCode());
        hashCode = prime * hashCode + ((getHelpfulResourceUrl() == null) ? 0 : getHelpfulResourceUrl().hashCode());
        hashCode = prime * hashCode + ((getHelpfulResourceDisplayText() == null) ? 0 : getHelpfulResourceDisplayText().hashCode());
        hashCode = prime * hashCode + ((getChoices() == null) ? 0 : getChoices().hashCode());
        hashCode = prime * hashCode + ((getSelectedChoices() == null) ? 0 : getSelectedChoices().hashCode());
        hashCode = prime * hashCode + ((getChoiceAnswers() == null) ? 0 : getChoiceAnswers().hashCode());
        hashCode = prime * hashCode + ((getIsApplicable() == null) ? 0 : getIsApplicable().hashCode());
        hashCode = prime * hashCode + ((getRisk() == null) ? 0 : getRisk().hashCode());
        hashCode = prime * hashCode + ((getNotes() == null) ? 0 : getNotes().hashCode());
        hashCode = prime * hashCode + ((getReason() == null) ? 0 : getReason().hashCode());
        return hashCode;
    }

    @Override
    public Answer clone() {
        try {
            return (Answer) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.wellarchitected.model.transform.AnswerMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
//
//  Generated by the J2ObjC translator.  DO NOT EDIT!
//  source: android/libcore/luni/src/main/java/org/xml/sax/ext/EntityResolver2.java
//

#ifndef _OrgXmlSaxExtEntityResolver2_H_
#define _OrgXmlSaxExtEntityResolver2_H_

#include "J2ObjC_header.h"
#include "org/xml/sax/EntityResolver.h"

@class OrgXmlSaxInputSource;

/*!
 @brief Extended interface for mapping external entity references to input
 sources, or providing a missing external subset.
 The
 XMLReader.setEntityResolver() method
 is used to provide implementations of this interface to parsers.
 When a parser uses the methods in this interface, the
 EntityResolver2.resolveEntity()
 method (in this interface) is used instead of the older (SAX 1.0)
 EntityResolver.resolveEntity() method.

 This module, both source code and documentation, is in the
 Public Domain, and comes with NO WARRANTY.

If a SAX application requires the customized handling which this
 interface defines for external entities, it must ensure that it uses
 an XMLReader with the
 http://xml.org/sax/features/use-entity-resolver2 feature flag
 set to true (which is its default value when the feature is
 recognized).  If that flag is unrecognized, or its value is false,
 or the resolver does not implement this interface, then only the
 EntityResolver method will be used.

That supports three categories of application that modify entity
 resolution.  Old Style applications won't know about this interface;
 they will provide an EntityResolver.
 Transitional Mode provide an EntityResolver2 and automatically
 get the benefit of its methods in any systems (parsers or other tools)
 supporting it, due to polymorphism.
 Both Old Style and Transitional Mode applications will
 work with any SAX2 parser.
 New style applications will fail to run except on SAX2 parsers
 that support this particular feature.
 They will insist that feature flag have a value of "true", and the
 EntityResolver2 implementation they provide  might throw an exception
 if the original SAX 1.0 style entity resolution method is invoked.

 @since SAX 2.0 (extensions 1.1 alpha)
 @author David Brownell
 @version TBD
 */
@protocol OrgXmlSaxExtEntityResolver2 < OrgXmlSaxEntityResolver, NSObject, JavaObject >

/*!
 @brief Allows applications to provide an external subset for documents
 that don't explicitly define one.
 Documents with DOCTYPE declarations
 that omit an external subset can thus augment the declarations
 available for validation, entity processing, and attribute processing
 (normalization, defaulting, and reporting types including ID).
 This augmentation is reported
 through the startDTD() method as if
 the document text had originally included the external subset;
 this callback is made before any internal subset data or errors
 are reported.

This method can also be used with documents that have no DOCTYPE
 declaration.  When the root element is encountered,
 but no DOCTYPE declaration has been seen, this method is
 invoked.  If it returns a value for the external subset, that root
 element is declared to be the root element, giving the effect of
 splicing a DOCTYPE declaration at the end the prolog of a document
 that could not otherwise be valid.  The sequence of parser callbacks
 in that case logically resembles this:

 @code

  ... comments and PIs from the prolog (as usual)
  startDTD ("rootName", source.getPublicId (), source.getSystemId ());
  startEntity ("[dtd]");
  ... declarations, comments, and PIs from the external subset
  endEntity ("[dtd]");
  endDTD ();
  ... then the rest of the document (as usual)
  startElement (..., "rootName", ...);

@endcode

Note that the InputSource gets no further resolution.
 Implementations of this method may wish to invoke
 resolveEntity() to gain benefits such as use
 of local caches of DTD entities.  Also, this method will never be
 used by a (non-validating) processor that is not including external
 parameter entities.

Uses for this method include facilitating data validation when
 interoperating with XML processors that would always require
 undesirable network accesses for external entities, or which for
 other reasons adopt a "no DTDs" policy.
 Non-validation motives include forcing documents to include DTDs so
 that attributes are handled consistently.
 For example, an XPath processor needs to know which attibutes have
 type "ID" before it can process a widely used type of reference.

Warning: Returning an external subset modifies
 the input document.  By providing definitions for general entities,
 it can make a malformed document appear to be well formed.

 @param name Identifies the document root element.  This name comes
 from a DOCTYPE declaration (where available) or from the actual
 root element.
 @param baseURI The document's base URI, serving as an additional
 hint for selecting the external subset.  This is always an absolute
 URI, unless it is null because the XMLReader was given an InputSource
 without one.
 @return An InputSource object describing the new external subset
 to be used by the parser, or null to indicate that no external
 subset is provided.
 @exception SAXException Any SAX exception, possibly wrapping
 another exception.
 @exception IOException Probably indicating a failure to create
 a new InputStream or Reader, or an illegal URL.
 */
- (OrgXmlSaxInputSource *)getExternalSubsetWithNSString:(NSString *)name
                                           withNSString:(NSString *)baseURI;

/*!
 @brief Allows applications to map references to external entities into input
 sources, or tell the parser it should use conventional URI resolution.
 This method is only called for external entities which have been
 properly declared.
 This method provides more flexibility than the EntityResolver
 interface, supporting implementations of more complex catalogue
 schemes such as the one defined by the OASIS XML Catalogs specification.

Parsers configured to use this resolver method will call it
 to determine the input source to use for any external entity
 being included because of a reference in the XML text.
 That excludes the document entity, and any external entity returned
 by getExternalSubset().
 When a (non-validating) processor is configured not to include
 a class of entities (parameter or general) through use of feature
 flags, this method is not invoked for such entities.

Note that the entity naming scheme used here is the same one
 used in the LexicalHandler, or in the ContentHandler.skippedEntity()
 method.

 @param name Identifies the external entity being resolved.
 Either "[dtd]" for the external subset, or a name starting
 with "%" to indicate a parameter entity, or else the name of
 a general entity.  This is never null when invoked by a SAX2
 parser.
 @param publicId The public identifier of the external entity being
 referenced (normalized as required by the XML specification), or
 null if none was supplied.
 @param baseURI The URI with respect to which relative systemIDs
 are interpreted.  This is always an absolute URI, unless it is
 null (likely because the XMLReader was given an InputSource without
 one).  This URI is defined by the XML specification to be the one
 associated with the "<" starting the relevant declaration.
 @param systemId The system identifier of the external entity
 being referenced; either a relative or absolute URI.
 This is never null when invoked by a SAX2 parser; only declared
 entities, and any external subset, are resolved by such parsers.
 @return An InputSource object describing the new input source to
 be used by the parser.  Returning null directs the parser to
 resolve the system ID against the base URI and open a connection
 to resulting URI.
 @exception SAXException Any SAX exception, possibly wrapping
 another exception.
 @exception IOException Probably indicating a failure to create
 a new InputStream or Reader, or an illegal URL.
 */
- (OrgXmlSaxInputSource *)resolveEntityWithNSString:(NSString *)name
                                       withNSString:(NSString *)publicId
                                       withNSString:(NSString *)baseURI
                                       withNSString:(NSString *)systemId;

@end

J2OBJC_EMPTY_STATIC_INIT(OrgXmlSaxExtEntityResolver2)

J2OBJC_TYPE_LITERAL_HEADER(OrgXmlSaxExtEntityResolver2)

#endif // _OrgXmlSaxExtEntityResolver2_H_


text:
package org.apache.avro.tool;

import java.io.InputStream;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;

import org.apache.trevni.Input;
import org.apache.trevni.avro.HadoopInput;
import org.apache.trevni.InputFile;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

/** Static utility methods for tools. */
class TrevniUtil {

  static Input input(String filename) throws IOException {
    if (filename.startsWith("hdfs://")) {
      return new HadoopInput(new Path(filename), new Configuration());
    } else {
      return new InputFile(new File(filename));
    }
  }

  /**
   * Returns stdin if filename is "-", else opens the local or HDFS file
   * and returns an InputStream for it.
   * @throws IOException
   */
  static InputStream input(String filename, InputStream stdin)
    throws IOException {
    if (filename.equals("-"))
      return new BufferedInputStream(stdin);
    else if (filename.startsWith("hdfs://")) {
      FileSystem fs = FileSystem.get(URI.create(filename), new Configuration());
      return new BufferedInputStream(fs.open(new Path(filename)));
    } else {
      return new BufferedInputStream(new FileInputStream(new File(filename)));
    }
  }

  /**
   * Returns stdout if filename is "-", else opens the local or HDFS file
   * and returns an OutputStream for it.
   * @throws IOException
   */
  static OutputStream output(String filename, OutputStream stdout)
    throws IOException {
    if (filename.equals("-"))
      return new BufferedOutputStream(stdout);
    else if (filename.startsWith("hdfs://")) {
      FileSystem fs = FileSystem.get(URI.create(filename), new Configuration());
      return new BufferedOutputStream(fs.create(new Path(filename)));
    } else {
      return new BufferedOutputStream(new FileOutputStream(new File(filename)));
    }
  }

}


text:
#ifndef	__XEN_CLOCK_UTIL_H__
#define	__XEN_CLOCK_UTIL_H__

extern void xen_fetch_wallclock(struct timespec *ts);
extern void xen_fetch_uptime(struct timespec *ts);

#endif	/* __XEN_CLOCK_UTIL_H__ */