text:
package com.tupilabs.pbs.model;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

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

/**
 * A PBS job. This job can be submitted to the PBS cluster, but its state is always detached. The information in a Job
 * object is updated as you call service methods.
 *
 * @author Bruno P. Kinoshita
 * @since 0.1
 */
public class Job implements Serializable {

    private static final long serialVersionUID = -8705011705872768446L;

    /**
     * Number used to index a job in a queue (used by qnodes).
     */
    private int queueIndex;

    /**
     * Job ID. Usually a sequential identification number followed by a . (dot) and the computer name (eg:
     * 23434.thunder.mackenzie.br).
     */
    private String id;

    /**
     * Job name. Assigned by the user.
     */
    private String name;

    /**
     * Job owner.
     */
    private String owner;

    /**
     * Resources used by the job.
     */
    private Map<String, String> resourcesUsed;

    /**
     * State of the job.
     */
    private String state;

    /**
     * Job queue name.
     */
    private String queue;

    /**
     * PBS server name.
     */
    private String server;

    private String checkpoint;

    private String ctime;

    private String errorPath;

    private String execHost;

    private String execPort;

    private String holdTypes;

    private String joinPath;

    private String keepFiles;

    private String mailPoints;

    private String mailUsers;

    private String mtime;

    /**
     * Job output path.
     */
    private String outputPath;

    /**
     * Job priority.
     */
    private int priority;

    private String qtime;

    /**
     * Whether a job can be rescheduled.
     */
    private boolean rerunable;

    /**
     * List of resources used by the job.
     */
    private Map<String, String> resourceList;

    private int sessionId;

    private int substate;

    private Map<String, String> variableList;

    private String euser;

    private String egroup;

    private String hashName;

    private int queueRank;

    /**
     * Job queue type.
     */
    private String queueType;

    /**
     * Job comment.
     */
    private String comment;

    private String etime;

    /**
     * Job exit status.
     */
    private int exitStatus;

    /**
     * Submit args. Usually a shell script, but can include too other command line parameters.
     */
    private String submitArgs;

    /**
     * Start time.
     */
    private String startTime;

    private int startCount;

    private int jobArrayId;

    /**
     * Whether the job is fault-tolerant or not.
     */
    private boolean faultTolerant;

    private String compTime;

    private int radix;

    /**
     * Job total runtime.
     */
    private double totalRuntime;

    /**
     * Host that submitted the job.
     */
    private String submitHost;

    private long walltimeRemaining;

    /**
     * Default constructor.
     */
    public Job() {
        super();

        this.resourceList = new HashMap<String, String>();
        this.resourcesUsed = new HashMap<String, String>();
        this.variableList = new HashMap<String, String>();
    }

    /**
     * @return the queueIndex
     */
    public int getQueueIndex() {
        return queueIndex;
    }

    /**
     * @param queueIndex the queueIndex to set
     */
    public void setQueueIndex(int queueIndex) {
        this.queueIndex = queueIndex;
    }

    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the owner
     */
    public String getOwner() {
        return owner;
    }

    /**
     * @param owner the owner to set
     */
    public void setOwner(String owner) {
        this.owner = owner;
    }

    /**
     * @return the resourcesUsed
     */
    public Map<String, String> getResourcesUsed() {
        return resourcesUsed;
    }

    /**
     * @param resourcesUsed the resourcesUsed to set
     */
    public void setResourcesUsed(Map<String, String> resourcesUsed) {
        this.resourcesUsed = resourcesUsed;
    }

    /**
     * @return the state
     */
    public String getState() {
        return state;
    }

    /**
     * @param state the state to set
     */
    public void setState(String state) {
        this.state = state;
    }

    /**
     * @return the queue
     */
    public String getQueue() {
        return queue;
    }

    /**
     * @param queue the queue to set
     */
    public void setQueue(String queue) {
        this.queue = queue;
    }

    /**
     * @return the server
     */
    public String getServer() {
        return server;
    }

    /**
     * @param server the server to set
     */
    public void setServer(String server) {
        this.server = server;
    }

    /**
     * @return the checkpoint
     */
    public String getCheckpoint() {
        return checkpoint;
    }

    /**
     * @param checkpoint the checkpoint to set
     */
    public void setCheckpoint(String checkpoint) {
        this.checkpoint = checkpoint;
    }

    /**
     * @return the ctime
     */
    public String getCtime() {
        return ctime;
    }

    /**
     * @param ctime the ctime to set
     */
    public void setCtime(String ctime) {
        this.ctime = ctime;
    }

    /**
     * @return the errorPath
     */
    public String getErrorPath() {
        return errorPath;
    }

    /**
     * @param errorPath the errorPath to set
     */
    public void setErrorPath(String errorPath) {
        this.errorPath = errorPath;
    }

    /**
     * @return the execHost
     */
    public String getExecHost() {
        return execHost;
    }

    /**
     * @param execHost the execHost to set
     */
    public void setExecHost(String execHost) {
        this.execHost = execHost;
    }

    /**
     * @return the execPort
     */
    public String getExecPort() {
        return execPort;
    }

    /**
     * @param execPort the execPort to set
     */
    public void setExecPort(String execPort) {
        this.execPort = execPort;
    }

    /**
     * @return the holdTypes
     */
    public String getHoldTypes() {
        return holdTypes;
    }

    /**
     * @param holdTypes the holdTypes to set
     */
    public void setHoldTypes(String holdTypes) {
        this.holdTypes = holdTypes;
    }

    /**
     * @return the joinPath
     */
    public String getJoinPath() {
        return joinPath;
    }

    /**
     * @param joinPath the joinPath to set
     */
    public void setJoinPath(String joinPath) {
        this.joinPath = joinPath;
    }

    /**
     * @return the keepFiles
     */
    public String getKeepFiles() {
        return keepFiles;
    }

    /**
     * @param keepFiles the keepFiles to set
     */
    public void setKeepFiles(String keepFiles) {
        this.keepFiles = keepFiles;
    }

    /**
     * @return the mailPoints
     */
    public String getMailPoints() {
        return mailPoints;
    }

    /**
     * @param mailPoints the mailPoints to set
     */
    public void setMailPoints(String mailPoints) {
        this.mailPoints = mailPoints;
    }

    /**
     * @return the mailUsers
     */
    public String getMailUsers() {
        return mailUsers;
    }

    /**
     * @param mailUsers the mailUsers to set
     */
    public void setMailUsers(String mailUsers) {
        this.mailUsers = mailUsers;
    }

    /**
     * @return the mtime
     */
    public String getMtime() {
        return mtime;
    }

    /**
     * @param mtime the mtime to set
     */
    public void setMtime(String mtime) {
        this.mtime = mtime;
    }

    /**
     * @return the outputPath
     */
    public String getOutputPath() {
        return outputPath;
    }

    /**
     * @param outputPath the outputPath to set
     */
    public void setOutputPath(String outputPath) {
        this.outputPath = outputPath;
    }

    /**
     * @return the priority
     */
    public int getPriority() {
        return priority;
    }

    /**
     * @param priority the priority to set
     */
    public void setPriority(int priority) {
        this.priority = priority;
    }

    /**
     * @return the qtime
     */
    public String getQtime() {
        return qtime;
    }

    /**
     * @param qtime the qtime to set
     */
    public void setQtime(String qtime) {
        this.qtime = qtime;
    }

    /**
     * @return the rerunable
     */
    public boolean isRerunable() {
        return rerunable;
    }

    /**
     * @param rerunable the rerunable to set
     */
    public void setRerunable(boolean rerunable) {
        this.rerunable = rerunable;
    }

    /**
     * @return the resourceList
     */
    public Map<String, String> getResourceList() {
        return resourceList;
    }

    /**
     * @param resourceList the resourceList to set
     */
    public void setResourceList(Map<String, String> resourceList) {
        this.resourceList = resourceList;
    }

    /**
     * @return the sessionId
     */
    public int getSessionId() {
        return sessionId;
    }

    /**
     * @param sessionId the sessionId to set
     */
    public void setSessionId(int sessionId) {
        this.sessionId = sessionId;
    }

    /**
     * @return the substate
     */
    public int getSubstate() {
        return substate;
    }

    /**
     * @param substate the substate to set
     */
    public void setSubstate(int substate) {
        this.substate = substate;
    }

    /**
     * @return the variableList
     */
    public Map<String, String> getVariableList() {
        return variableList;
    }

    /**
     * @param variableList the variableList to set
     */
    public void setVariableList(Map<String, String> variableList) {
        this.variableList = variableList;
    }

    /**
     * @return the euser
     */
    public String getEuser() {
        return euser;
    }

    /**
     * @param euser the euser to set
     */
    public void setEuser(String euser) {
        this.euser = euser;
    }

    /**
     * @return the egroup
     */
    public String getEgroup() {
        return egroup;
    }

    /**
     * @param egroup the egroup to set
     */
    public void setEgroup(String egroup) {
        this.egroup = egroup;
    }

    /**
     * @return the hashName
     */
    public String getHashName() {
        return hashName;
    }

    /**
     * @param hashName the hashName to set
     */
    public void setHashName(String hashName) {
        this.hashName = hashName;
    }

    /**
     * @return the queueRank
     */
    public int getQueueRank() {
        return queueRank;
    }

    /**
     * @param queueRank the queueRank to set
     */
    public void setQueueRank(int queueRank) {
        this.queueRank = queueRank;
    }

    /**
     * @return the queueType
     */
    public String getQueueType() {
        return queueType;
    }

    /**
     * @param queueType the queueType to set
     */
    public void setQueueType(String queueType) {
        this.queueType = queueType;
    }

    /**
     * @return the comment
     */
    public String getComment() {
        return comment;
    }

    /**
     * @param comment the comment to set
     */
    public void setComment(String comment) {
        this.comment = comment;
    }

    /**
     * @return the etime
     */
    public String getEtime() {
        return etime;
    }

    /**
     * @param etime the etime to set
     */
    public void setEtime(String etime) {
        this.etime = etime;
    }

    /**
     * @return the exitStatus
     */
    public int getExitStatus() {
        return exitStatus;
    }

    /**
     * @param exitStatus the exitStatus to set
     */
    public void setExitStatus(int exitStatus) {
        this.exitStatus = exitStatus;
    }

    /**
     * @return the submitArgs
     */
    public String getSubmitArgs() {
        return submitArgs;
    }

    /**
     * @param submitArgs the submitArgs to set
     */
    public void setSubmitArgs(String submitArgs) {
        this.submitArgs = submitArgs;
    }

    /**
     * @return the startTime
     */
    public String getStartTime() {
        return startTime;
    }

    /**
     * @param startTime the startTime to set
     */
    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    /**
     * @return the startCount
     */
    public int getStartCount() {
        return startCount;
    }

    /**
     * @param startCount the startCount to set
     */
    public void setStartCount(int startCount) {
        this.startCount = startCount;
    }

    /**
     * @return the faultTolerant
     */
    public boolean isFaultTolerant() {
        return faultTolerant;
    }

    /**
     * @param faultTolerant the faultTolerant to set
     */
    public void setFaultTolerant(boolean faultTolerant) {
        this.faultTolerant = faultTolerant;
    }

    /**
     * @return the compTime
     */
    public String getCompTime() {
        return compTime;
    }

    /**
     * @param compTime the compTime to set
     */
    public void setCompTime(String compTime) {
        this.compTime = compTime;
    }

    /**
     * @return the radix
     */
    public int getRadix() {
        return radix;
    }

    /**
     * @param radix the radix to set
     */
    public void setRadix(int radix) {
        this.radix = radix;
    }

    /**
     * @return the totalRuntime
     */
    public double getTotalRuntime() {
        return totalRuntime;
    }

    /**
     * @param totalRuntime the totalRuntime to set
     */
    public void setTotalRuntime(double totalRuntime) {
        this.totalRuntime = totalRuntime;
    }

    /**
     * @return the submitHost
     */
    public String getSubmitHost() {
        return submitHost;
    }

    /**
     * @param submitHost the submitHost to set
     */
    public void setSubmitHost(String submitHost) {
        this.submitHost = submitHost;
    }

    /**
     * @return the walltimeRemaining
     */
    public long getWalltimeRemaining() {
        return this.walltimeRemaining;
    }

    /**
     * @param walltimeRemaining the walltimeRemaining
     */
    public void setWalltimeRemaining(long walltimeRemaining) {
        this.walltimeRemaining = walltimeRemaining;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
    }

    public int getJobArrayId() {
        return jobArrayId;
    }

    public void setJobArrayId(int jobArrayId) {
        this.jobArrayId = jobArrayId;
    }

}


text:
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Xml.Linq;

namespace DocumentFormat.OpenXml.Tests.TimeLine
{
    using Xunit;
    using DocumentFormat.OpenXml.Tests.TaskLibraries;
    using DocumentFormat.OpenXml.Tests.TimelineClass;
    using OxTest;

    /// <summary>
    /// Tests for TimeLine elements
    /// </summary>

    public class TimeLineTest : OpenXmlTestBase
    {
        //private readonly string generateDocumentFile = "TestTimeLineBase.xlsx";
        //private readonly string editeDocumentFile = "EditedTimeLine.xlsx";
        //private readonly string deleteTimelineStyleDocumentFile = "DeletedTimelineStyleTimeLine.xlsx";
        //private readonly string addTimelineStyleDocumentFile = "AddedTimelineStyleTimeLine.xlsx";
        private readonly string generateDocumentFile = Path.Combine(TestUtil.TestResultsDirectory, Guid.NewGuid().ToString() + ".xlsx");
        private readonly string editeDocumentFile = Path.Combine(TestUtil.TestResultsDirectory, Guid.NewGuid().ToString() + ".xlsx");
        private readonly string deleteTimelineStyleDocumentFile = Path.Combine(TestUtil.TestResultsDirectory, Guid.NewGuid().ToString() + ".xlsx");
        private readonly string addTimelineStyleDocumentFile = Path.Combine(TestUtil.TestResultsDirectory, Guid.NewGuid().ToString() + ".xlsx");

        TestEntities testEntities = null;

        #region Constructor
        /// <summary>
        /// Constructor
        /// </summary>
        public TimeLineTest()
        {
        }
        #endregion

        #region Initialize
        /// <summary>
        /// Create is a Excel file, It's test base file.
        /// </summary>
        /// <param name="createFilePath">Create Excel file path</param>
        /// <returns>Excel file path</returns>
        private void Initialize(string createFilePath)
        {
            GeneratedDocument generatedDocument = new GeneratedDocument();
            generatedDocument.CreatePackage(createFilePath);

            this.Log.Pass("Create Excel file. File path=[{0}]", createFilePath);

            this.testEntities = new TestEntities(createFilePath);
        }
        #endregion

        #region Test Methods
        /// <summary>
        /// Creates a base Excel file for the tests
        /// </summary>
        protected override void TestInitializeOnce()
        {
            string generatDocumentFilePath = this.GetTestFilePath(this.generateDocumentFile);

            Initialize(generatDocumentFilePath);
        }

        /// <summary>
        /// Attribute editing test for TimeLine Control"
        /// </summary>
        [Fact]
        public void TimeLine01EditDeleteAddAttribute()
        {
            this.MyTestInitialize(TestContext.GetCurrentMethod());

            string originalFilepath = this.GetTestFilePath(this.generateDocumentFile);
            string editFilePath = this.GetTestFilePath(this.editeDocumentFile);
            string deleteTimelineStyleFilePath = this.GetTestFilePath(this.deleteTimelineStyleDocumentFile);
            string addTimelineStyleFilePath = this.GetTestFilePath(addTimelineStyleDocumentFile);

            System.IO.File.Copy(originalFilepath, editFilePath, true);

            this.testEntities.EditAttributes(editFilePath, this.Log);
            this.testEntities.VerifyEditedAttribute(editFilePath, this.Log);

            System.IO.File.Copy(editFilePath, deleteTimelineStyleFilePath, true);

            this.testEntities.DeleteTimelineStyle(deleteTimelineStyleFilePath, this.Log);
            this.testEntities.VerifyDeletedTimelineStyle(deleteTimelineStyleFilePath, this.Log);

            System.IO.File.Copy(deleteTimelineStyleFilePath, addTimelineStyleFilePath, true);

            this.testEntities.AddTimelineStyle(addTimelineStyleFilePath, this.Log);
            this.testEntities.VerifyAddedTimelineStyle(addTimelineStyleFilePath, this.Log);
        }

        #endregion
    }
}

redpajama_set_name: RedPajamaGithub


text:
if [ `whoami` != "vagrant" ] && [ `whoami` != "travis" ];
then
    echo The command should be executed within the guest OS!
    exit 1
fi

php app/console cache:clear --env=prod
php app/console cache:warmup --env=prod

mysql -u root < 00-extra/db/create-empty-database.sql
php app/console doctrine:schema:update --force

php app/console fos:user:create admin admin@example.net password --super-admin


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

<meta name=Title content="HCatalog Streaming API">
<meta name=Keywords content="HCatalog Streaming ACID">
<meta http-equiv=Content-Type content="text/html; charset=macintosh">
<title>HCatalog Streaming API</title>

HCatalog Streaming API -- high level description

NOTE: The Streaming API feature is provided as a technology
preview. The API may undergo incompatible changes in upcoming
releases.

Traditionally adding new data into hive requires gathering a large
amount of data onto HDFS and then periodically adding a new
partition. This is essentially a batch insertion. Insertion of
new data into an existing partition or table is not done in a way that
gives consistent results to readers. Hive Streaming API allows data to
be pumped continuously into Hive. The incoming data can be
continuously committed in small batches (of records) into a Hive
partition. Once data is committed it becomes immediately visible to
all Hive queries initiated subsequently.

This API is intended for streaming clients such as NiFi, Flume and Storm,
which continuously generate data. Streaming support is built on top of
ACID based insert/update support in Hive.

The classes and interfaces part of the Hive streaming API are broadly
categorized into two. The first set provides support for connection
and transaction management while the second set provides I/O
support. Transactions are managed by the Hive MetaStore.  Writes are
performed to HDFS via Hive wrapper APIs that bypass MetaStore.

Note on packaging: The APIs are defined in the
org.apache.hive.streaming and
org.apache.hive.streaming.transaction Java packages and included as
the hive-streaming jar.

STREAMING REQUIREMENTS

A few things are currently required to use streaming.

 Currently, only ORC storage format is supported. So
    'stored as orc' must be specified during table creation.

 The hive table may be bucketed but must not be sorted.

 User of the client streaming process must have the necessary
    permissions to write to the table or partition and create partitions in
    the table.

 Currently, when issuing queries on streaming tables, query client must set

hive.input.format =
             org.apache.hadoop.hive.ql.io.HiveInputFormat

  The above client settings are a temporary requirement and the intention is to
  drop the need for them in the near future.

 Settings required in hive-site.xml for Metastore:

hive.txn.manager =
	org.apache.hadoop.hive.ql.lockmgr.DbTxnManager

hive.support.concurrency = true

hive.compactor.initiator.on = true

hive.compactor.worker.threads > 0

Note: Streaming to unpartitioned tables is also
supported.

Transaction and Connection management

The class HiveEndPoint is a Hive end
point to connect to. An endpoint is either a Hive table or
partition. An endpoint is cheap to create and does not internally hold
on to any network connections.  Invoking the newConnection method on
it creates a new connection to the Hive MetaStore for streaming
purposes.  It returns a
StreamingConnection
object. Multiple connections can be established on the same
endpoint. StreamingConnection can then be used to initiate new
transactions for performing I/O.

Dynamic Partition Creation:
 It is very likely that a setup in
which data is being streamed continuously (e.g. Flume), it is
desirable to have new partitions created automatically (say on a
hourly basis). In such cases requiring the Hive admin to pre-create
the necessary partitions may not be reasonable.  Consequently the
streaming API allows streaming clients to create partitions as
needed. HiveEndPoind.newConnection() accepts a argument to
indicate if the partition should be auto created. Partition creation
being an atomic action, multiple clients can race to create the
partition, but only one would succeed, so streaming clients need not
synchronize when creating a partition. The user of the client process
needs to be given write permissions on the Hive table in order to
create partitions.

Batching Transactions:
 Transactions are implemented slightly
differently than traditional database systems. Multiple transactions
are grouped into a Transaction Batch and each transaction has
an id. Data from each transaction batch gets a single file on HDFS,
which eventually gets compacted with other files into a larger file
automatically for efficiency.

Basic Steps:
 After connection is established, a streaming
client first requests for a new batch of transactions. In response it
receives a set of transaction ids that are part of the transaction
batch. Subsequently the client proceeds to consume one transaction at
a time by initiating new transactions. Client will write() one or more
records per transactions and either commit or abort the current
transaction before switching to the next one. Each
TransactionBatch.write() invocation automatically associates
the I/O attempt with the current transaction id. The user of the
streaming client needs to have write permissions to the partition or
table.

Concurrency Note: I/O can be performed on multiple
TransactionBatchs concurrently. However the transactions within a
transaction batch much be consumed sequentially.

Writing Data

These classes and interfaces provide support for writing the data to
Hive within a transaction.
RecordWriter is the interface
implemented by all writers. A writer is responsible for taking a
record in the form of a byte[] containing data in a known
format (e.g. CSV) and writing it out in the format supported by Hive
streaming. A RecordWriter may reorder or drop fields from the incoming
record if necessary to map them to the corresponding columns in the
Hive Table. A streaming client will instantiate an appropriate
RecordWriter type and pass it to
StreamingConnection.fetchTransactionBatch().  The streaming client
does not directly interact with the RecordWriter therafter, but
relies on the TransactionBatch to do so.

Currently, out of the box, the streaming API provides two
implementations of the RecordWriter interface. One handles delimited
input data (such as CSV, tab separated, etc.  and the other for JSON
(strict syntax). Support for other input formats can be provided by
additional implementations of the RecordWriter interface.

 DelimitedInputWriter
- Delimited text input.

 StrictJsonWriter
- JSON text input.

 StrictRegexWriter
    - text input with regex.

Performance, Concurrency, Etc.

  Each StreamingConnection is writing data at the rate the underlying
  FileSystem can accept it.  If that is not sufficient, multiple StreamingConnection objects can
  be created concurrently.

  Each StreamingConnection can have at most 1 outstanding TransactionBatch and each TransactionBatch
  may have at most 2 threads operaing on it.
  See TransactionBatch


text:
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

using IdentityServer4.Extensions;
using IdentityServer4.Models;
using IdentityServer4.Services;
using Microsoft.Extensions.Logging;
using System.Linq;
using System.Threading.Tasks;

namespace IdentityServer4.Test
{
    /// <summary>
    /// Profile service for test users
    /// </summary>
    /// <seealso cref="IdentityServer4.Services.IProfileService" />
    public class TestUserProfileService : IProfileService
    {
        /// <summary>
        /// The logger
        /// </summary>
        protected readonly ILogger Logger;

        /// <summary>
        /// The users
        /// </summary>
        protected readonly TestUserStore Users;

        /// <summary>
        /// Initializes a new instance of the <see cref="TestUserProfileService"/> class.
        /// </summary>
        /// <param name="users">The users.</param>
        /// <param name="logger">The logger.</param>
        public TestUserProfileService(TestUserStore users, ILogger<TestUserProfileService> logger)
        {
            Users = users;
            Logger = logger;
        }

        /// <summary>
        /// This method is called whenever claims about the user are requested (e.g. during token creation or via the userinfo endpoint)
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public virtual Task GetProfileDataAsync(ProfileDataRequestContext context)
        {
            context.LogProfileRequest(Logger);

            if (context.RequestedClaimTypes.Any())
            {
                var user = Users.FindBySubjectId(context.Subject.GetSubjectId());
                if (user != null)
                {
                    context.AddRequestedClaims(user.Claims);
                }
            }

            context.LogIssuedClaims(Logger);

            return Task.FromResult(0);
        }

        /// <summary>
        /// This method gets called whenever identity server needs to determine if the user is valid or active (e.g. if the user's account has been deactivated since they logged in).
        /// (e.g. during token issuance or validation).
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public virtual Task IsActiveAsync(IsActiveContext context)
        {
            var user = Users.FindBySubjectId(context.Subject.GetSubjectId());
            context.IsActive = user != null;

            return Task.FromResult(0);
        }
    }
}


text:
"""
Copyright and license
---------------------

Copyright 2012 Smartling, Inc.

This code was taken from https://github.com/Smartling/api-sdk-python/blob/master/example/SmartlingApiExample.py
"""

import os
import sys
import settings
from smartlingApiSdk.SmartlingFileApi import SmartlingFileApiFactory
from smartlingApiSdk.SmartlingDirective import SmartlingDirective
from smartlingApiSdk.UploadData import UploadData

class SmartlingApi:
    MY_API_KEY = settings.SMARTLING_API_KEY
    MY_PROJECT_ID = settings.SMARTLING_PROJECT_ID

    def __init__(self, useSandbox, uploadData, locale, new_name):
        self.getCredentials()
        if useSandbox:
            self.fapi = SmartlingFileApiFactory().getSmartlingTranslationApi(False, self.MY_API_KEY, self.MY_PROJECT_ID)
        else:
            self.fapi = SmartlingFileApiFactory().getSmartlingTranslationApiProd(self.MY_API_KEY, self.MY_PROJECT_ID)
        self.uploadData = uploadData
        self.locale = locale
        self.new_name = new_name

    def getCredentials(self):
        """ get api key and project id from environment variables
            to set environment variables use command : export SL_API_KEY=******* ; export SL_PROJECT_ID=****** """
        self.MY_API_KEY = os.environ.get('SL_API_KEY', self.MY_API_KEY)
        self.MY_PROJECT_ID = os.environ.get('SL_PROJECT_ID', self.MY_PROJECT_ID)

def get_smartling_file(fname, locale='de-DE'):
    useSandbox = False
    example = SmartlingApi(useSandbox, None, locale, '')
    content = example.fapi.get(fname, locale)
    return content

def upload_smartling_file(filepath, filename, locale='de-DE', file_type='json'):
    uploadDataUtf16 = UploadData(filepath, filename, file_type)
    uploadDataUtf16.setApproveContent("true")
    uploadDataUtf16.setCallbackUrl(settings.SMARTLING_CALLBACK_URL)
    useSandbox = False
    example = SmartlingApi(useSandbox, uploadDataUtf16, locale, filename)
    example.fapi.upload(example.uploadData)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Security.Cryptography;
using System.IO;

namespace YUTPLAT.Helpers.Filters
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
    public class EncryptedActionParameterAttribute : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            Dictionary<string, object> decryptedParameters = new Dictionary<string, object>();
            if (HttpContext.Current.Request.QueryString.Get("q") != null)
            {
                string encryptedQueryString = HttpContext.Current.Request.QueryString.Get("q");
                string decrptedString = Decrypt(encryptedQueryString.ToString());
                string[] paramsArrs = decrptedString.Split('?');

                for (int i = 0; i < paramsArrs.Length; i++)
                {
                    string[] paramArr = paramsArrs[i].Split('=');
                    decryptedParameters.Add(paramArr[0], paramArr[1]);
                }
            }
            for (int i = 0; i < decryptedParameters.Count; i++)
            {
                filterContext.ActionParameters[decryptedParameters.Keys.ElementAt(i)] = decryptedParameters.Values.ElementAt(i);
            }
            base.OnActionExecuting(filterContext);

        }

        private string Decrypt(string encryptedText)
        {
            string key = "jdsg432387#";
            byte[] DecryptKey = { };
            byte[] IV = { 55, 34, 87, 64, 87, 195, 54, 21 };
            byte[] inputByte = new byte[encryptedText.Length];

            DecryptKey = System.Text.Encoding.UTF8.GetBytes(key.Substring(0, 8));
            DESCryptoServiceProvider des = new DESCryptoServiceProvider();
            inputByte = Convert.FromBase64String(encryptedText);
            MemoryStream ms = new MemoryStream();
            CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(DecryptKey, IV), CryptoStreamMode.Write);
            cs.Write(inputByte, 0, inputByte.Length);
            cs.FlushFinalBlock();
            System.Text.Encoding encoding = System.Text.Encoding.UTF8;
            return encoding.GetString(ms.ToArray());
        }
    }
}


text:
import Backbone from "backbone";
import moment from "moment";

export default Backbone.Model.extend({

    parse: function(response) {
        var attributes = response;
        attributes.start_date = moment(attributes.start_date);
        attributes.end_date = moment(attributes.end_date);
        return attributes;
    }

});


text:
package com.microsoft.azure.management.recoveryservices.backup.v2016_12_01;

import rx.Completable;
import com.microsoft.azure.management.recoveryservices.backup.v2016_12_01.implementation.JobCancellationsInner;
import com.microsoft.azure.arm.model.HasInner;

/**
 * Type representing JobCancellations.
 */
public interface JobCancellations extends HasInner<JobCancellationsInner> {
    /**
     * Cancels a job. This is an asynchronous operation. To know the status of the cancellation, call GetCancelOperationResult API.
     *
     * @param vaultName The name of the recovery services vault.
     * @param resourceGroupName The name of the resource group where the recovery services vault is present.
     * @param jobName Name of the job to cancel.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
    Completable triggerAsync(String vaultName, String resourceGroupName, String jobName);

}


text:
using System;

public class CharacterItem {
	public string id;
	public string itemId;
	public string characterName;

	public CharacterItem(){

	}

	public CharacterItem(string id, string itemId, string characterName){
		this.id = id;
		this.itemId = itemId;
		this.characterName = characterName;
	}
}


text:
Template.shareit_facebook.onRendered(function() {
  if (!this.data) {
    return;
  }
  this.autorun(function() {
    var base, data, description, href, ref, summary, img, template, title, url;
    template = Template.instance();
    data = Template.currentData();
    description = ((ref = data.facebook) != null ? ref.description : void 0) || data.excerpt || data.description || data.summary;
    url = data.url || location.origin + location.pathname;
    title = data.title;
    if (data.thumbnail) {
      if (typeof data.thumbnail === "function") {
        img = data.thumbnail();
      } else {
        img = data.thumbnail;
      }
    }
    if (data.image) {
      if (typeof data.image === "function") {
        img = data.image();
      } else {
        img = data.image;
      }
    }
    if (img) {
      if (!/^http(s?):\/\/+/.test(img)) {
        img = location.origin + img;
      }
    }
    ShareIt.facebookMeta(description, url, title, img);
    appId = ShareIt.settings.sites.facebook.appId;
    if (ShareIt.settings.sites.facebook.popup != null) {
      return template.$('.fb-share').click(function(e) {
        e.preventDefault();
        return FB.ui({
          method: 'feed',
          display: 'popup',
          app_id: appId,
          link: url,
          name: title,
          description: summary,
          picture: img,
          redirect_uri: url
        }, function(response) {});
      });
    } else {
      url = encodeURIComponent(url);
      base = "https://www.facebook.com/dialog/feed";
      title = encodeURIComponent(title);
      summary = encodeURIComponent(description);
      href = base + "?app_id=" + appId + "&link=" + url + "&name=" + title + "&description=" + summary + "&redirect_uri=" + url;
      if (img)
        href = href + "&picture=" + img;
      return template.$(".fb-share").attr("href", href);
    }
  });
});

Template.shareit_facebook.helpers(ShareIt.helpers);


text:
package org.springframework.boot.actuate.autoconfigure;

import java.util.Collection;
import java.util.Collections;
import java.util.Map;

import org.junit.After;
import org.junit.Test;
import org.springframework.boot.actuate.endpoint.AutoConfigurationReportEndpoint;
import org.springframework.boot.actuate.endpoint.BeansEndpoint;
import org.springframework.boot.actuate.endpoint.DumpEndpoint;
import org.springframework.boot.actuate.endpoint.EnvironmentEndpoint;
import org.springframework.boot.actuate.endpoint.FlywayEndpoint;
import org.springframework.boot.actuate.endpoint.HealthEndpoint;
import org.springframework.boot.actuate.endpoint.InfoEndpoint;
import org.springframework.boot.actuate.endpoint.LiquibaseEndpoint;
import org.springframework.boot.actuate.endpoint.MetricsEndpoint;
import org.springframework.boot.actuate.endpoint.PublicMetrics;
import org.springframework.boot.actuate.endpoint.RequestMappingEndpoint;
import org.springframework.boot.actuate.endpoint.ShutdownEndpoint;
import org.springframework.boot.actuate.endpoint.TraceEndpoint;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.metrics.Metric;
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

/**
 * Tests for {@link EndpointAutoConfiguration}.
 *
 * @author Dave Syer
 * @author Phillip Webb
 * @author Greg Turnquist
 * @author Christian Dupuis
 * @author Stephane Nicoll
 * @author Eddú Meléndez
 */
public class EndpointAutoConfigurationTests {

	private AnnotationConfigApplicationContext context;

	@After
	public void close() {
		if (this.context != null) {
			this.context.close();
		}
	}

	@Test
	public void endpoints() throws Exception {
		load(EndpointAutoConfiguration.class);
		assertNotNull(this.context.getBean(BeansEndpoint.class));
		assertNotNull(this.context.getBean(DumpEndpoint.class));
		assertNotNull(this.context.getBean(EnvironmentEndpoint.class));
		assertNotNull(this.context.getBean(HealthEndpoint.class));
		assertNotNull(this.context.getBean(InfoEndpoint.class));
		assertNotNull(this.context.getBean(MetricsEndpoint.class));
		assertNotNull(this.context.getBean(ShutdownEndpoint.class));
		assertNotNull(this.context.getBean(TraceEndpoint.class));
		assertNotNull(this.context.getBean(RequestMappingEndpoint.class));
	}

	@Test
	public void healthEndpoint() {
		load(EmbeddedDataSourceConfiguration.class, EndpointAutoConfiguration.class,
				HealthIndicatorAutoConfiguration.class);
		HealthEndpoint bean = this.context.getBean(HealthEndpoint.class);
		assertNotNull(bean);
		Health result = bean.invoke();
		assertNotNull(result);
		assertTrue("Wrong result: " + result, result.getDetails().containsKey("db"));
	}

	@Test
	public void healthEndpointWithDefaultHealthIndicator() {
		load(EndpointAutoConfiguration.class, HealthIndicatorAutoConfiguration.class);
		HealthEndpoint bean = this.context.getBean(HealthEndpoint.class);
		assertNotNull(bean);
		Health result = bean.invoke();
		assertNotNull(result);
	}

	@Test
	public void metricEndpointsHasSystemMetricsByDefault() {
		load(PublicMetricsAutoConfiguration.class, EndpointAutoConfiguration.class);
		MetricsEndpoint endpoint = this.context.getBean(MetricsEndpoint.class);
		Map<String, Object> metrics = endpoint.invoke();
		assertTrue(metrics.containsKey("mem"));
		assertTrue(metrics.containsKey("heap.used"));
	}

	@Test
	public void metricEndpointCustomPublicMetrics() {
		load(CustomPublicMetricsConfig.class, PublicMetricsAutoConfiguration.class,
				EndpointAutoConfiguration.class);
		MetricsEndpoint endpoint = this.context.getBean(MetricsEndpoint.class);
		Map<String, Object> metrics = endpoint.invoke();

		// Custom metrics
		assertTrue(metrics.containsKey("foo"));

		// System metrics still available
		assertTrue(metrics.containsKey("mem"));
		assertTrue(metrics.containsKey("heap.used"));

	}

	@Test
	public void autoConfigurationAuditEndpoints() {
		load(EndpointAutoConfiguration.class, ConditionEvaluationReport.class);
		assertNotNull(this.context.getBean(AutoConfigurationReportEndpoint.class));
	}

	@Test
	public void testInfoEndpointConfiguration() throws Exception {
		this.context = new AnnotationConfigApplicationContext();
		EnvironmentTestUtils.addEnvironment(this.context, "info.foo:bar");
		this.context.register(EndpointAutoConfiguration.class);
		this.context.refresh();
		InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class);
		assertNotNull(endpoint);
		assertNotNull(endpoint.invoke().get("git"));
		assertEquals("bar", endpoint.invoke().get("foo"));
	}

	@Test
	public void testNoGitProperties() throws Exception {
		this.context = new AnnotationConfigApplicationContext();
		EnvironmentTestUtils.addEnvironment(this.context,
				"spring.git.properties:classpath:nonexistent");
		this.context.register(EndpointAutoConfiguration.class);
		this.context.refresh();
		InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class);
		assertNotNull(endpoint);
		assertNull(endpoint.invoke().get("git"));
	}

	@Test
	public void testFlywayEndpoint() {
		this.context = new AnnotationConfigApplicationContext();
		this.context.register(EmbeddedDataSourceConfiguration.class,
				FlywayAutoConfiguration.class, EndpointAutoConfiguration.class);
		this.context.refresh();
		FlywayEndpoint endpoint = this.context.getBean(FlywayEndpoint.class);
		assertNotNull(endpoint);
		assertEquals(1, endpoint.invoke().size());
	}

	@Test
	public void testLiquibaseEndpoint() {
		this.context = new AnnotationConfigApplicationContext();
		this.context.register(EmbeddedDataSourceConfiguration.class,
				LiquibaseAutoConfiguration.class, EndpointAutoConfiguration.class);
		this.context.refresh();
		LiquibaseEndpoint endpoint = this.context.getBean(LiquibaseEndpoint.class);
		assertNotNull(endpoint);
		assertEquals(1, endpoint.invoke().size());
	}

	private void load(Class<?>... config) {
		this.context = new AnnotationConfigApplicationContext();
		this.context.register(config);
		this.context.refresh();
	}

	@Configuration
	static class CustomPublicMetricsConfig {

		@Bean
		PublicMetrics customPublicMetrics() {
			return new PublicMetrics() {
				@Override
				public Collection<Metric<?>> metrics() {
					Metric<Integer> metric = new Metric<Integer>("foo", 1);
					return Collections.<Metric<?>> singleton(metric);
				}
			};
		}

	}
}


text:
import React, { Component } from "react";
import PropTypes from "prop-types";

import {
	isNotDefined,
	isDefined,
	noop,
	functor,
	identity,
} from "./utils";

const aliases = {
	mouseleave: "mousemove", // to draw interactive after mouse exit
	panend: "pan",
	pinchzoom: "pan",
	mousedown: "mousemove",
	click: "mousemove",
	contextmenu: "mousemove",
	dblclick: "mousemove",
	dragstart: "drag",
	dragend: "drag",
	dragcancel: "drag",
};

class GenericComponent extends Component {
	constructor(props, context) {
		super(props, context);
		this.drawOnCanvas = this.drawOnCanvas.bind(this);
		this.getMoreProps = this.getMoreProps.bind(this);
		this.listener = this.listener.bind(this);
		this.draw = this.draw.bind(this);
		this.updateMoreProps = this.updateMoreProps.bind(this);
		this.evaluateType = this.evaluateType.bind(this);
		this.isHover = this.isHover.bind(this);
		this.preCanvasDraw = this.preCanvasDraw.bind(this);
		this.postCanvasDraw = this.postCanvasDraw.bind(this);
		this.getPanConditions = this.getPanConditions.bind(this);
		this.shouldTypeProceed = this.shouldTypeProceed.bind(this);
		this.preEvaluate = this.preEvaluate.bind(this);

		const { generateSubscriptionId } = context;
		this.suscriberId = generateSubscriptionId();

		this.moreProps = {};

		this.state = {
			updateCount: 0,
		};
	}
	updateMoreProps(moreProps) {
		Object.keys(moreProps).forEach(key => {
			this.moreProps[key] = moreProps[key];
		});
	}
	shouldTypeProceed() {
		return true;
	}
	preEvaluate() {
	}
	listener(type, moreProps, state, e) {
		// console.log(e.shiftKey)
		if (isDefined(moreProps)) {
			this.updateMoreProps(moreProps);
		}
		this.evaluationInProgress = true;
		this.evaluateType(type, e);
		this.evaluationInProgress = false;
	}
	evaluateType(type, e) {
		const newType = aliases[type] || type;
		const proceed = this.props.drawOn.indexOf(newType) > -1;

		// console.log("type ->", type, proceed);

		if (!proceed) return;
		// const moreProps = this.getMoreProps();
		this.preEvaluate(type, this.moreProps, e);
		if (!this.shouldTypeProceed(type, this.moreProps)) return;

		switch (type) {
			case "zoom":
			case "mouseenter":
			// DO NOT DRAW FOR THESE EVENTS
				break;
			case "mouseleave": {
				this.moreProps.hovering = false;
				const moreProps = this.getMoreProps();

				if (this.props.onUnHover) {
					this.props.onUnHover(moreProps, e);
				}
				break;
			}
			case "contextmenu": {
				if (this.props.onContextMenu) {
					this.props.onContextMenu(this.getMoreProps(), e);
				}
				if (
					this.moreProps.hovering
				&& this.props.onContextMenuWhenHover
				) {
					this.props.onContextMenuWhenHover(this.getMoreProps(), e);
				}
				break;
			}
			case "mousedown": {
				if (this.props.onMouseDown) {
					this.props.onMouseDown(this.getMoreProps(), e);
				}
				break;
			}
			case "click": {
				const moreProps = this.getMoreProps();
				if (this.moreProps.hovering) {
				// console.error("TODO use this only for SAR, Line series")
					this.props.onClickWhenHover(moreProps, e);
				} else {
					this.props.onClickOutside(moreProps, e);
				}
				if (this.props.onClick) {
					this.props.onClick(moreProps, e);
				}
				break;
			}
			case "mousemove": {

				const prevHover = this.moreProps.hovering;
				this.moreProps.hovering = this.isHover(e);

				const { amIOnTop, setCursorClass } = this.context;

				if (this.moreProps.hovering
					&& !this.props.selected
					/* && !prevHover */
					&& amIOnTop(this.suscriberId)
					&& isDefined(this.props.onHover)) {
					setCursorClass("react-stockcharts-pointer-cursor");
					this.iSetTheCursorClass = true;
				} else if (this.moreProps.hovering
					&& this.props.selected
					&& amIOnTop(this.suscriberId)) {
					setCursorClass(this.props.interactiveCursorClass);
					this.iSetTheCursorClass = true;
				} else if (prevHover
					&& !this.moreProps.hovering
					&& this.iSetTheCursorClass) {
					this.iSetTheCursorClass = false;
					setCursorClass(null);
				}
				const moreProps = this.getMoreProps();

				if (this.moreProps.hovering && !prevHover) {
					if (this.props.onHover) {
						this.props.onHover(moreProps, e);
					}
				}
				if (prevHover && !this.moreProps.hovering) {
					if (this.props.onUnHover) {
						this.props.onUnHover(moreProps, e);
					}
				}

				if (this.props.onMouseMove) {
					this.props.onMouseMove(moreProps, e);
				}
				break;
			}
			case "dblclick": {
				const moreProps = this.getMoreProps();

				if (this.props.onDoubleClick) {
					this.props.onDoubleClick(moreProps, e);
				}
				if (
					this.moreProps.hovering
				&& this.props.onDoubleClickWhenHover
				) {
					this.props.onDoubleClickWhenHover(moreProps, e);
				}
				break;
			}
			case "pan": {
				this.moreProps.hovering = false;
				if (this.props.onPan) {
					this.props.onPan(this.getMoreProps(), e);
				}
				break;
			}
			case "panend": {
				if (this.props.onPanEnd) {
					this.props.onPanEnd(this.getMoreProps(), e);
				}
				break;
			}
			case "dragstart": {
				if (this.getPanConditions().draggable) {
					const { amIOnTop } = this.context;
					if (amIOnTop(this.suscriberId)) {
						this.dragInProgress = true;
						this.props.onDragStart(this.getMoreProps(), e);
					}
				}
				this.someDragInProgress = true;
				break;
			}
			case "drag": {
				if (this.dragInProgress && this.props.onDrag) {
					this.props.onDrag(this.getMoreProps(), e);
				}
				break;
			}
			case "dragend": {
				if (this.dragInProgress && this.props.onDragComplete) {
					this.props.onDragComplete(this.getMoreProps(), e);
				}
				this.dragInProgress = false;
				this.someDragInProgress = false;
				break;
			}
			case "dragcancel": {
				if (this.dragInProgress || this.iSetTheCursorClass) {
					const { setCursorClass } = this.context;
					setCursorClass(null);
				}
				break;
			}
		}
	}
	isHover(e) {
		return isDefined(this.props.isHover)
			? this.props.isHover(this.getMoreProps(), e)
			: false;
	}
	getPanConditions() {
		const draggable = (
			!!(this.props.selected && this.moreProps.hovering)
			|| (this.props.enableDragOnHover && this.moreProps.hovering)
		);

		return {
			draggable,
			panEnabled: !this.props.disablePan,
		};
	}
	draw({ trigger, force } = { force: false }) {
		const type = aliases[trigger] || trigger;
		const proceed = this.props.drawOn.indexOf(type) > -1;

		if (proceed
			|| this.props.selected /* this is to draw as soon as you select */
			|| force
		) {
			const { chartCanvasType } = this.context;
			const { canvasDraw } = this.props;

			if (isNotDefined(canvasDraw) || chartCanvasType === "svg") {
				const { updateCount } = this.state;
				this.setState({
					updateCount: updateCount + 1,
				});
			} else {
				this.drawOnCanvas();
			}
		}
	}
	componentWillMount() {
		const { subscribe, chartId } = this.context;
		const { clip, edgeClip } = this.props;

		subscribe(this.suscriberId,
			{
				chartId, clip, edgeClip,
				listener: this.listener,
				draw: this.draw,
				getPanConditions: this.getPanConditions,
			}
		);
		this.componentWillReceiveProps(this.props, this.context);
	}
	componentWillUnmount() {
		const { unsubscribe } = this.context;
		unsubscribe(this.suscriberId);
		if (this.iSetTheCursorClass) {
			const { setCursorClass } = this.context;
			setCursorClass(null);
		}
	}
	componentDidMount() {
		this.componentDidUpdate(this.props);
	}
	componentDidUpdate(prevProps) {
		const { chartCanvasType } = this.context;
		const { canvasDraw, selected, interactiveCursorClass } = this.props;

		if (prevProps.selected !== selected) {
			const { setCursorClass } = this.context;
			if (selected && this.moreProps.hovering) {
				this.iSetTheCursorClass = true;
				setCursorClass(interactiveCursorClass);
			} else {
				this.iSetTheCursorClass = false;
				setCursorClass(null);
			}
		}
		if (isDefined(canvasDraw)
				&& !this.evaluationInProgress
				// && !(this.someDragInProgress && this.props.selected)
				/*
				prevent double draw of interactive elements
				during dragging / hover / click etc.
				*/
				&& chartCanvasType !== "svg") {

			this.updateMoreProps(this.moreProps);
			this.drawOnCanvas();
		}
	}
	componentWillReceiveProps(nextProps, nextContext) {
		const { xScale, plotData, chartConfig, getMutableState } = nextContext;

		this.props.debug(nextContext);
		this.moreProps = {
			...this.moreProps,
			...getMutableState(),
			/*
			^ this is so
			mouseXY, currentCharts, currentItem are available to
			newly created components like MouseHoverText which
			is created right after a new interactive object is drawn
			*/
			xScale, plotData, chartConfig
		};
	}
	getMoreProps() {
		const {
			xScale,
			plotData,
			chartConfig,
			morePropsDecorator,
			xAccessor,
			displayXAccessor,
			width,
			height,
		} = this.context;

		const { chartId, fullData } = this.context;

		const moreProps = {
			xScale, plotData, chartConfig,
			xAccessor, displayXAccessor,
			width, height,
			chartId,
			fullData,
			...this.moreProps,
		};

		return (morePropsDecorator || identity)(moreProps);
	}
	preCanvasDraw() {
		// do nothing
	}
	postCanvasDraw() {
	}
	drawOnCanvas() {
		const { canvasDraw, canvasToDraw } = this.props;
		const { getCanvasContexts } = this.context;

		const moreProps = this.getMoreProps();

		const ctx = canvasToDraw(getCanvasContexts());

		this.preCanvasDraw(ctx, moreProps);
		canvasDraw(ctx, moreProps);
		this.postCanvasDraw(ctx, moreProps);
	}
	render() {
		const { chartCanvasType, chartId } = this.context;
		const { canvasDraw, clip, svgDraw } = this.props;

		if (isDefined(canvasDraw) && chartCanvasType !== "svg") {
			return null;
		}

		const suffix = isDefined(chartId) ? "-" + chartId : "";

		const style = clip ? { "clipPath": `url(#chart-area-clip${suffix})` } : null;

		return <g style={style}>{svgDraw(this.getMoreProps())}</g>;
	}
}

GenericComponent.propTypes = {
	svgDraw: PropTypes.func.isRequired,
	canvasDraw: PropTypes.func,

	drawOn: PropTypes.array.isRequired,

	clip: PropTypes.bool.isRequired,
	edgeClip: PropTypes.bool.isRequired,
	interactiveCursorClass: PropTypes.string,

	selected: PropTypes.bool.isRequired,
	enableDragOnHover: PropTypes.bool.isRequired,
	disablePan: PropTypes.bool.isRequired,

	canvasToDraw: PropTypes.func.isRequired,

	isHover: PropTypes.func,

	onClick: PropTypes.func,
	onClickWhenHover: PropTypes.func,
	onClickOutside: PropTypes.func,

	onPan: PropTypes.func,
	onPanEnd: PropTypes.func,
	onDragStart: PropTypes.func,
	onDrag: PropTypes.func,
	onDragComplete: PropTypes.func,
	onDoubleClick: PropTypes.func,
	onDoubleClickWhenHover: PropTypes.func,
	onContextMenu: PropTypes.func,
	onContextMenuWhenHover: PropTypes.func,
	onMouseMove: PropTypes.func,
	onMouseDown: PropTypes.func,
	onHover: PropTypes.func,
	onUnHover: PropTypes.func,

	debug: PropTypes.func,
	// owner: PropTypes.string.isRequired,
};

GenericComponent.defaultProps = {
	svgDraw: functor(null),
	draw: [],
	canvasToDraw: contexts => contexts.mouseCoord,
	clip: true,
	edgeClip: false,
	selected: false,
	disablePan: false,
	enableDragOnHover: false,

	onClickWhenHover: noop,
	onClickOutside: noop,
	onDragStart: noop,
	onMouseMove: noop,
	onMouseDown: noop,
	debug: noop,
};

GenericComponent.contextTypes = {
	width: PropTypes.number.isRequired,
	height: PropTypes.number.isRequired,
	margin: PropTypes.object.isRequired,
	chartId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
	getCanvasContexts: PropTypes.func,

	chartCanvasType: PropTypes.string,
	xScale: PropTypes.func.isRequired,
	xAccessor: PropTypes.func.isRequired,
	displayXAccessor: PropTypes.func.isRequired,
	plotData: PropTypes.array.isRequired,
	fullData: PropTypes.array.isRequired,

	chartConfig: PropTypes.oneOfType([
		PropTypes.array,
		PropTypes.object,
	]).isRequired,

	morePropsDecorator: PropTypes.func,
	generateSubscriptionId: PropTypes.func,
	getMutableState: PropTypes.func.isRequired,

	amIOnTop: PropTypes.func.isRequired,
	subscribe: PropTypes.func.isRequired,
	unsubscribe: PropTypes.func.isRequired,
	setCursorClass: PropTypes.func.isRequired,
};

export default GenericComponent;

export function getAxisCanvas(contexts) {
	return contexts.axes;
}

export function getMouseCanvas(contexts) {
	return contexts.mouseCoord;
}


text:
module Atom
  class File
    include Native
    attr_accessor :filepath, :fs, :pathwatcher

    def initialize(filepath)
      @filepath = filepath
      @fs = Native(`require("fs-plus")`)
      @pathwatcher = `require("pathwatcher")`
      super(`new #{@pathwatcher}.File(#{@filepath})`)
    end

    alias_native :base_name, :getBaseName
    alias_native :digest, :getDigest
    alias_native :path, :getPath
    alias_native :real_path_sync, :getRealPathSync
    alias_native :directory?, :isDirectory
    alias_native :file?, :isFile
    alias_native :read
    alias_native :write

  end
end


text:
layout: post_notitle
title: What We Do
section: what we do
sub-section: index
---

Collaboration in progress at SRCCON 2015. (photo/Erik Westra)

{{ page.title }}

At OpenNews, we are building an ecosystem of programs and tools in support of the global community of journalists and coders who are creating the open technologies and processes journalism needs to thrive.

### [Conferences](conferences/)

In 2014, we hosted [the inaugural SRCCON](conferences/srccon), a conference for hackers and data nerds working in and near newsrooms. Our second SRCCON was held last June, and we're returning for a third year in the summer of 2016. We also run the [Journalism](conferences/mozfest) track at the Mozilla Festival, a multi-day celebration of making and the open internet held annually in London. [Learn more about the kinds of sessions we run and how to attend.](conferences/)

### [Code & Community Support](community/)

In collaboration with writers and developers in newsrooms around the world, we publish [Source, a community site](community/source) focused on open technology projects and process in journalism. From features that explore the context behind the code to targeted job listings that help the community expand, Source presents the people, projects, and insights behind journalism code.

Several times a year, we host [code convenings](community/convenings), focused events in which small teams from newsrooms gather to complete last-mile code and documentation for open-source projects they've been working on. We also hold biweekly open [community calls](community/calls) where newsroom data and apps teams can share their work, announce job openings, and find collaborators. In addition, we [sponsor hack days and journalism code events](community/eventsupport) around the globe to build community, code, and momentum for solving the problems working journalists face. [Learn more about our community support programs.](community/)

### [Get Involved](/getinvolved/)

Everything we do is built around the needs of the sprawling community of people who code (and crunch data, and design interactive tools) in and around newsrooms. Whether you're an old hand or just curious about the field, [there's a way for you to get involved](/getinvolved/).

### [Support for OpenNews](/what/supporters)

OpenNews is made possible by a grant from the Knight Foundation and the support of the Mozilla Foundation. In addition, OpenNews receives support for its conference [SRCCON](http://srccon.org) through sponsorship.


text:
require 'spec_helper'

describe 'puppet_audit' do
  on_supported_os.each do |os, os_facts|
    context "on #{os}" do
      let(:facts) { os_facts }

      it { is_expected.to compile }
    end
  end
end


text:
package org.gradle.ide.xcode.internal.xcodeproj;

import com.dd.plist.NSArray;
import com.dd.plist.NSDictionary;
import com.dd.plist.NSObject;
import com.dd.plist.NSString;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;

import javax.annotation.concurrent.NotThreadSafe;
import java.util.List;

/**
 * Serializer that handles conversion of an in-memory object graph representation of an xcode
 * project (instances of {@link PBXObject}) into an Apple property list.
 *
 * Serialization proceeds from the root object, a ${link PBXProject} instance, to all of its
 * referenced objects. Each object being visited calls back into this class ({@link #addField}) to
 * populate the plist representation with its fields.
 */
@NotThreadSafe
public class XcodeprojSerializer {
    private static final Logger LOG = Logging.getLogger(XcodeprojSerializer.class);

    private final PBXProject rootObject;
    private final NSDictionary objects;
    private final GidGenerator gidGenerator;
    private NSDictionary currentObject;

    public XcodeprojSerializer(GidGenerator gidGenerator, PBXProject project) {
        rootObject = project;
        objects = new NSDictionary();
        this.gidGenerator = gidGenerator;
    }

    /**
     * Generate a plist serialization of project bound to this serializer.
     */
    public NSDictionary toPlist() {
        serializeObject(rootObject);

        NSDictionary root = new NSDictionary();
        root.put("archiveVersion", "1");
        root.put("classes", new NSDictionary());
        root.put("objectVersion", "46");
        root.put("objects", objects);
        root.put("rootObject", rootObject.getGlobalID());

        return root;
    }

    /**
     * Serialize a {@link PBXObject} and its recursive descendants into the object dictionary.
     *
     * @return the GID of the serialized object
     * @see PBXObject#serializeInto
     */
    private String serializeObject(PBXObject obj) {
        if (obj.getGlobalID() == null) {
            obj.setGlobalID(obj.generateGid(gidGenerator));
            LOG.trace("Set new object GID: %s", obj);
        } else {
            // Check that the object has already been serialized.
            NSObject object = objects.get(obj.getGlobalID());
            if (object != null) {
                LOG.trace("Object %s found, returning existing object %s", obj, object);
                return obj.getGlobalID();
            } else {
                LOG.trace("Object already had GID set: %s", obj);
            }
        }

        // Save the existing object being deserialized.
        NSDictionary stack = currentObject;

        currentObject = new NSDictionary();
        currentObject.put("isa", obj.isa());
        obj.serializeInto(this);
        objects.put(obj.getGlobalID(), currentObject);

        // Restore the existing object being deserialized.
        currentObject = stack;
        return obj.getGlobalID();
    }

    public void addField(String name, PBXObject obj) {
        if (obj != null) {
            String gid = serializeObject(obj);
            currentObject.put(name, gid);
        }
    }

    public void addField(String name, int val) {
        currentObject.put(name, val);
    }

    public void addField(String name, String val) {
        if (val != null) {
            currentObject.put(name, val);
        }
    }

    public void addField(String name, boolean val) {
        currentObject.put(name, val);
    }

    public void addField(String name, List<? extends PBXObject> objectList) {
        NSArray array = new NSArray(objectList.size());
        for (int i = 0; i < objectList.size(); i++) {
            String gid = serializeObject(objectList.get(i));
            array.setValue(i, new NSString(gid));
        }
        currentObject.put(name, array);
    }

    public void addField(String name, NSObject v) {
        if (v != null) {
            currentObject.put(name, v);
        }
    }
}


text:
import os
import rapidxml

def test_unparse(init_rapidxml):
    assert init_rapidxml.unparse() == ('<root><test attr1="one" attr2="two" attr3="three"/>'
                                       '<test2><node id="1"/><node id="2"/><node id="3"/></test2>'
                                       '<test>some text</test></root>')
    assert init_rapidxml.unparse() == repr(init_rapidxml)
    assert init_rapidxml.unparse(False, False) == repr(init_rapidxml)
    assert init_rapidxml.unparse(raw=False) == repr(init_rapidxml)
    assert init_rapidxml.unparse(pretty=False) == repr(init_rapidxml)
    assert init_rapidxml.unparse(pretty=False, raw=False) == repr(init_rapidxml)
    assert init_rapidxml.unparse(True) == str(init_rapidxml)
    assert init_rapidxml.unparse(True, False) == str(init_rapidxml)
    assert init_rapidxml.unparse(pretty=True) == str(init_rapidxml)
    assert init_rapidxml.unparse(pretty=True, raw=False) == str(init_rapidxml)
    assert init_rapidxml.unparse(True, raw=False) == str(init_rapidxml)

def test_parse(init_rapidxml):
    r = rapidxml.RapidXml()
    try:
        data = init_rapidxml.unparse().encode('utf-8')
    except UnicodeDecodeError:
        data = init_rapidxml.unparse()
    r.parse(data)
    assert str(r) == str(init_rapidxml)

def test_parse_from_file(init_rapidxml, tmpdir):
    f = tmpdir.join("dump.xml")
    f.write(init_rapidxml.unparse())
    r = rapidxml.RapidXml(str(f), from_file=True)
    assert str(r) == str(init_rapidxml)

def test_equals(init_rapidxml):
    assert init_rapidxml == init_rapidxml
    root = init_rapidxml.first_node()
    assert root == root
    assert root == init_rapidxml.first_node()
    assert root.first_node() != root.first_node("test2")
    assert (root != root) == (not (root == root))

def test_parent(init_rapidxml):
    assert init_rapidxml.parent is None
    assert init_rapidxml.first_node().parent == init_rapidxml

def test_assign(init_rapidxml):
    root = init_rapidxml.first_node()
    root.name = "new_root"
    assert root.name == "new_root"
    test = root.first_node()
    test.name = "new_test"
    test.first_attribute().name = "new_attr1"
    test.first_attribute().next_attribute().value = "new_two"
    test = root.first_node("test")
    test.value = "some new text"
    assert test.value == "some new text"
    assert init_rapidxml.unparse() == ('<new_root><new_test new_attr1="one" attr2="new_two" attr3="three"/>'
                                       '<test2><node id="1"/><node id="2"/><node id="3"/></test2>'
                                       '<test>some new text</test></new_root>')

def test_init_cdata(init_rapidxml_with_CDADA):
    datra_str =('<root><test attr1="one" attr2="two" attr3="three"/>'
                '<test2><node id="1"/><node id="2"/><node id="3"/></test2>'
                '<test>some text</test>'
                "<ns2:AdditionalData><ns2:Data TID=\"AD_1\">"
                "<![CDATA[{\"Cart\":{\"expirationTime\":\"2017-04-22T09:40\","
                "\"id\":\"b469df3b-f626-4fe3-898c-825373e546a2\",\"products\":[\"1223\"],"
                "\"creationTime\":\"2017-04-21T09:40\",\"totalPrice\":"
                "{\"currencyCode\":\"EUR\",\"amount\":\"138.000\"}}}]]>"
                "</ns2:Data></ns2:AdditionalData></root>")
    assert init_rapidxml_with_CDADA.unparse() == rapidxml.RapidXml(datra_str,
                                                                   from_file=False,
                                                                   attribute_prefix='@',
                                                                   cdata_key='#text',
                                                                   always_aslist=False,
                                                                   parse_cdata=True).unparse()
    assert init_rapidxml_with_CDADA.unparse() == repr(init_rapidxml_with_CDADA)
    assert init_rapidxml_with_CDADA.unparse(True) == str(init_rapidxml_with_CDADA)

def test_parse_cdata(init_rapidxml_with_CDADA):
    r = rapidxml.RapidXml()
    try:
        data = init_rapidxml_with_CDADA.unparse().encode('utf-8')
    except UnicodeDecodeError:
        data = init_rapidxml_with_CDADA.unparse()
    r.parse(data, from_file=False, parse_cdata=True)
    assert str(r) == str(init_rapidxml_with_CDADA)

def test_parse_from_file_cdata(init_rapidxml_with_CDADA, tmpdir):
    f = tmpdir.join("dump.xml")
    f.write(init_rapidxml_with_CDADA.unparse())
    r = rapidxml.RapidXml(str(f), from_file=True, parse_cdata=True)
    assert str(r) == str(init_rapidxml_with_CDADA)

def test_equals_cdata(init_rapidxml_with_CDADA):
    assert init_rapidxml_with_CDADA == init_rapidxml_with_CDADA
    root = init_rapidxml_with_CDADA.first_node()
    assert root == root
    assert root == init_rapidxml_with_CDADA.first_node()
    assert root.first_node() != root.first_node("test2")
    assert (root != root) == (not (root == root))

def test_parent_cdata(init_rapidxml_with_CDADA):
    assert init_rapidxml_with_CDADA.parent is None
    assert init_rapidxml_with_CDADA.first_node().parent == init_rapidxml_with_CDADA

def test_assign_cdata(init_rapidxml_with_CDADA):
    root = init_rapidxml_with_CDADA.first_node()
    root.name = "new_root"
    assert root.name == "new_root"
    test = root.first_node()
    test.name = "new_test"
    test.first_attribute().name = "new_attr1"
    test.first_attribute().next_attribute().value = "new_two"
    test = root.first_node("test")
    test.value = "some new text"
    assert test.value == "some new text"


text:
SROOK_NESTED_NAMESPACE(srook, tmpl, vt) {
SROOK_INLINE_NAMESPACE(v1)

template <class... Ts>
struct reverse
    : public type_constant<SROOK_DEDUCED_TYPENAME detail::Reverse<Ts...>::type::rebind_packer> {};

template <class... Ts>
struct reverse<packer<Ts...>> : public reverse<Ts...> {};

#if SROOK_CPP_ALIAS_TEMPLATES
template <class... Ts>
using reverse_t = SROOK_DEDUCED_TYPENAME reverse<Ts...>::type;
#endif

SROOK_INLINE_NAMESPACE_END
} SROOK_NESTED_NAMESPACE_END(vt, tmpl, srook)

#endif


text:
namespace Microsoft.Azure.Management.Media.Models
{
    using Newtonsoft.Json;

    using System.Reflection;

    /// <summary>
    /// Defines values for StreamingLocatorContentKeyType.
    /// </summary>
    public sealed class StreamingLocatorContentKeyTypeConverter : JsonConverter
    {

        /// <summary>
        /// Returns if objectType can be converted to
        /// StreamingLocatorContentKeyType by the converter.
        /// </summary>
        public override bool CanConvert(System.Type objectType)
        {
            return typeof(StreamingLocatorContentKeyType).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
        }

        /// <summary>
        /// Overrides ReadJson and converts token to
        /// StreamingLocatorContentKeyType.
        /// </summary>
        public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == Newtonsoft.Json.JsonToken.Null)
            {
                return null;
            }
            return (StreamingLocatorContentKeyType)serializer.Deserialize<string>(reader);
        }

        /// <summary>
        /// Overriding WriteJson for StreamingLocatorContentKeyType for
        /// serialization.
        /// </summary>
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            writer.WriteValue(value.ToString());
        }

    }
}


text:
A basic dog owner registration site. Users can have admin role. Users are called owners from their dogs perspective.

Dogs can be registered for the following periods and costs:

* 3 months : $25
* 6 months : $65
* 12 months : $85


text:
title:	"Effective negotiating"
author: "Wojciech Adam Koszek"
description: >
  This was useful for better negotiating skills.
address: "Menlo Park, CA"
klayout: book
tags:
- books
auth:	Chester L Karrass
read:	2013-09-28
ads:
- <iframe src="https://rcm-na.amazon-adsystem.com/e/cm?lt1=_blank&bc1=FFFFFF&IS2=1&bg1=FFFFFF&fc1=000000&lc1=FF0000&t=wkoszek08-20&o=1&p=8&l=as4&m=amazon&f=ifr&ref=ss_til&asins=B000J3JPVI" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
---
Effective negotiating is something I felt would be worthwhile to study,
since the whole subject was relatively new to me.

Once you first meet the US car salesman you just KNOW negotiating is
something you must improve.

Letting other person go first is probably the most essential thing derived
from this book. Very helpful in salary negotiations.

Getting to win-win is Covey's passage which is also forwarded to the reader
in this thing.

Partnerships are discussed and the idea of not directing negotiations
towards win/loose, but "mutual win" with long term benefits.

I'd qualify this position to a must for a day-to-day business operation.


text:
package org.nanes.slideset.dm.write;

import org.nanes.slideset.dm.DoubleElement;

/**
 *
 * @author Benjamin Nanes
 */
@ElementWriterMetadata(
        name = "Numeric value",
        elementType = DoubleElement.class,
        processedType = Double.class)
public class DoubleToDoubleWriter implements
        ElementWriter<DoubleElement, Double> {

    public void write(Double data, DoubleElement elementToWrite) {
        elementToWrite.setUnderlying(data);
    }

}


text:
import copy

from jacket.api.compute.openstack import common

def get_view_builder(req):
    base_url = req.application_url
    return ViewBuilder(base_url)

class ViewBuilder(common.ViewBuilder):

    def __init__(self, base_url):
        """:param base_url: url of the root wsgi application."""
        self.prefix = self._update_compute_link_prefix(base_url)
        self.base_url = base_url

    def build_choices(self, VERSIONS, req):
        version_objs = []
        for version in sorted(VERSIONS):
            version = VERSIONS[version]
            version_objs.append({
                "id": version['id'],
                "status": version['status'],
                "links": [
                    {
                        "rel": "self",
                        "href": self.generate_href(version['id'], req.path),
                    },
                ],
                "media-types": version['media-types'],
            })

        return dict(choices=version_objs)

    def build_versions(self, versions):
        version_objs = []
        for version in sorted(versions.keys()):
            version = versions[version]
            version_objs.append({
                "id": version['id'],
                "status": version['status'],
                "version": version['version'],
                "min_version": version['min_version'],
                "updated": version['updated'],
                "links": self._build_links(version),
            })

        return dict(versions=version_objs)

    def build_version(self, version):
        reval = copy.deepcopy(version)
        reval['links'].insert(0, {
            "rel": "self",
            "href": self.prefix.rstrip('/') + '/',
        })
        return dict(version=reval)

    def _build_links(self, version_data):
        """Generate a container of links that refer to the provided version."""
        href = self.generate_href(version_data['id'])

        links = [
            {
                "rel": "self",
                "href": href,
            },
        ]

        return links

    def generate_href(self, version, path=None):
        """Create an url that refers to a specific version_number."""
        if version.find('v2.1') == 0:
            version_number = 'v2.1'
        else:
            version_number = 'v2'

        path = path or ''
        return common.url_join(self.prefix, version_number, path)


text:
//
//  MCParkListViewController.m
//  CityOutdoors
//
//  Created by Marius Ciocanel on 18/10/2012.
//  Copyright (c) 2012 Marius Ciocanel. All rights reserved.
//

#import "MCParkListViewController.h"

@interface MCParkListViewController ()
@property (strong, nonatomic) IBOutlet UIBarButtonItem *parkMapButton;
@end

@implementation MCParkListViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	[self setupUIComponents];
	[self refresh];
}

- (void)loadListElements {
    NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:[MCCollectionItem entityName]];
	[fetchRequest setPredicate:[NSPredicate predicateWithFormat:@"collection.collectionID = %d", 1]];
	[fetchRequest setReturnsDistinctResults:YES];
    [fetchRequest setFetchBatchSize:30];
    NSSortDescriptor *sortByName = [NSSortDescriptor sortDescriptorWithKey:@"title" ascending:YES];
    [fetchRequest setSortDescriptors:[NSArray arrayWithObject:sortByName]];

	NSManagedObjectContext *fetchMOC = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
	fetchMOC.persistentStoreCoordinator = [[MCAppDataModel sharedDataModel] persistentStoreCoordinator];

    self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
                                                                    managedObjectContext:fetchMOC
                                                                      sectionNameKeyPath:nil
                                                                               cacheName:nil];
	NSError *_error;
	if (![self.fetchedResultsController performFetch:&_error]) {
		DLog(@"Unresolved error %@, %@", _error, [_error userInfo]);
	}

}

- (void)refreshFromRemoteData {
	NSManagedObjectContext *remoteMOC = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
	remoteMOC.persistentStoreCoordinator = [[MCAppDataModel sharedDataModel] persistentStoreCoordinator];
	[MCDataUpdater updateCollectionWithID:@(1) usingManagedObjectContext:remoteMOC];
}

- (void)viewDidUnload{
    [super viewDidUnload];
}

- (void)viewWillAppear:(BOOL)animated {
	[super viewWillAppear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    id<NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];
	NSInteger rows = [sectionInfo numberOfObjects];
    return rows;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier = @"ParkCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

	MCCollectionItem *item = [self.fetchedResultsController objectAtIndexPath:indexPath];

	cell.textLabel.text = item.title;
	NSURL *iconURL = [NSURL URLWithString:item.collection.iconURL];
    [cell.imageView setImageWithURL:iconURL placeholderImage:[UIImage imageNamed:@"appIcon.png"]];
    return cell;
}

#pragma mark - private methods
- (void)setupUIComponents {
/*
	self.parkMapButton = [[UIBarButtonItem alloc] initWithTitle:@"Map"
														   style:UIBarButtonItemStyleBordered
														  target:self
														  action:@selector(showMapView)];
	self.navigationItem.rightBarButtonItem = self.parkMapButton;
 */
}

- (void)showMapView {
	DLog(@"Show Park map");
	UIStoryboard *parkScreensStoryboard = [UIStoryboard storyboardWithName:@"MCParkScreens" bundle:nil];
	UIViewController *mapViewController = [parkScreensStoryboard instantiateViewControllerWithIdentifier:@"MCParkMapViewController"];

	self.sidePanelController.centerPanel = [[UINavigationController alloc] initWithRootViewController:mapViewController];
}

@end


text:
@interface HomeCViewController : BaseViewController

@end


text:
title: Rapson Family Photos
created: 1902
added: 2010-01-01
tags:
    - Mr Cox
    - Luckett
archivist: Caroline Vulliamy
---

These images were digitised in 2010.

![](../M-Coxs-grandfather.jpg)

![](../M-Coxs-grandfather-back.jpg)


text:
import { CustomEmptyContentTemplateDirective } from '@alfresco/adf-core';
import { AfterContentInit, Component, EventEmitter, Input, OnInit, Output, ContentChild } from '@angular/core';
import { Observable, of, Subject } from 'rxjs';
import { AppsProcessCloudService } from '../services/apps-process-cloud.service';
import { ApplicationInstanceModel } from '../models/application-instance.model';
import { catchError } from 'rxjs/operators';

export const LAYOUT_LIST: string = 'LIST';
export const LAYOUT_GRID: string = 'GRID';
export const RUNNING_STATUS: string = 'RUNNING';

@Component({
    selector: 'adf-cloud-app-list',
    templateUrl: './app-list-cloud.component.html',
    styleUrls: ['./app-list-cloud.component.scss']
})
export class AppListCloudComponent implements OnInit, AfterContentInit {
    @ContentChild(CustomEmptyContentTemplateDirective)
    emptyCustomContent: CustomEmptyContentTemplateDirective;

    /** (**required**) Defines the layout of the apps. There are two possible
     * values, "GRID" and "LIST".
     */
    @Input()
    layoutType: string = LAYOUT_GRID;

    /** Emitted when an app entry is clicked. */
    @Output()
    appClick = new EventEmitter<ApplicationInstanceModel>();

    apps$: Observable<any>;
    loadingError$ = new Subject<boolean>();
    hasEmptyCustomContentTemplate: boolean = false;

    constructor(private appsProcessCloudService: AppsProcessCloudService) { }

    ngOnInit() {
        if (!this.isValidType()) {
            this.setDefaultLayoutType();
        }

        this.apps$ = this.appsProcessCloudService.getDeployedApplicationsByStatus(RUNNING_STATUS)
            .pipe(
                catchError(() => {
                    this.loadingError$.next(true);
                    return of();
                })
            );
    }

    ngAfterContentInit() {
        if (this.emptyCustomContent) {
            this.hasEmptyCustomContentTemplate = true;
        }
    }

    onSelectApp(app: ApplicationInstanceModel): void {
        this.appClick.emit(app);
    }

    /**
     * Check if the value of the layoutType property is an allowed value
     */
    isValidType(): boolean {
        if (this.layoutType && (this.layoutType === LAYOUT_LIST || this.layoutType === LAYOUT_GRID)) {
            return true;
        }
        return false;
    }

    /**
     * Assign the default value to LayoutType
     */
    setDefaultLayoutType(): void {
        this.layoutType = LAYOUT_GRID;
    }

    /**
     * Return true if the layout type is LIST
     */
    isList(): boolean {
        return this.layoutType === LAYOUT_LIST;
    }

    /**
     * Return true if the layout type is GRID
     */
    isGrid(): boolean {
        return this.layoutType === LAYOUT_GRID;
    }
}


text:
macro(find_vulkan use_vulkan)
  set(__use_vulkan ${use_vulkan})
  if(IS_DIRECTORY ${__use_vulkan})
    set(__vulkan_sdk ${__use_vulkan})
    message(STATUS "Custom Vulkan SDK PATH=" ${__use_vulkan})
   elseif(IS_DIRECTORY $ENV{VULKAN_SDK})
     set(__vulkan_sdk $ENV{VULKAN_SDK})
   else()
     set(__vulkan_sdk "")
   endif()

   if(__vulkan_sdk)
     set(Vulkan_INCLUDE_DIRS ${__vulkan_sdk}/include)
     find_library(Vulkan_LIBRARY NAMES vulkan vulkan-1 PATHS ${__vulkan_sdk}/lib)
     if(Vulkan_LIBRARY)
       set(Vulkan_FOUND TRUE)
     endif()
   endif(__vulkan_sdk)

   # resort to find vulkan of option is on
   if(NOT Vulkan_FOUND)
     if(${__use_vulkan} MATCHES ${IS_TRUE_PATTERN})
       find_package(Vulkan QUIET)
     endif()
   endif()
   # additional libraries

  if(Vulkan_FOUND)
    get_filename_component(VULKAN_LIBRARY_PATH ${Vulkan_LIBRARY} DIRECTORY)
    find_library(Vulkan_SPIRV_TOOLS_LIBRARY SPIRV-Tools
        HINTS ${VULKAN_LIBRARY_PATH} ${VULKAN_LIBRARY_PATH}/spirv-tools ${VULKAN_SDK}/lib)

    find_path(_libspirv libspirv.h HINTS ${Vulkan_INCLUDE_DIRS} PATH_SUFFIXES vulkan spirv-tools)
    find_path(_spirv spirv.hpp HINTS ${Vulkan_INCLUDE_DIRS} PATH_SUFFIXES vulkan SPIRV spirv/unified1 spirv-headers)
    find_path(_glsl_std GLSL.std.450.h HINTS ${Vulkan_INCLUDE_DIRS} PATH_SUFFIXES vulkan SPIRV spirv/unified1 spirv-headers)
    list(APPEND Vulkan_INCLUDE_DIRS ${_libspirv} ${_spirv} ${_glsl_std})
    message(STATUS "Vulkan_INCLUDE_DIRS=" ${Vulkan_INCLUDE_DIRS})
    message(STATUS "Vulkan_LIBRARY=" ${Vulkan_LIBRARY})
    message(STATUS "Vulkan_SPIRV_TOOLS_LIBRARY=" ${Vulkan_SPIRV_TOOLS_LIBRARY})
  endif(Vulkan_FOUND)
endmacro(find_vulkan)


text:
/**
 * User: hudbrog (hudbrog@gmail.com)
 * Date: 10/21/12
 * Time: 7:31 AM
 */

GCODE.gCodeReader = (function(){
// ***** PRIVATE ******
    var gcode, lines;
    var z_heights = {};
    var model = [];
    var max = {x: undefined, y: undefined, z: undefined};
    var min = {x: undefined, y: undefined, z: undefined};
    var modelSize = {x: undefined, y: undefined, z: undefined};
    var filamentByLayer = {};
    var printTimeByLayer;
    var totalFilament=0;
    var printTime=0;
    var speeds = {};
    var speedsByLayer = {};
    var gCodeOptions = {
        sortLayers: false,
        purgeEmptyLayers: true,
        analyzeModel: false
    };

    var percentageTree = undefined;

    var prepareGCode = function(totalSize){
        if(!lines)return;
        gcode = [];
        var i, tmp, byteCount;

        byteCount = 0;
        for(i=0;i<lines.length;i++){
            byteCount += lines[i].length + 1; // line length + \n
            tmp = lines[i].indexOf(";");
            if(tmp > 1 || tmp === -1) {
                gcode.push({line: lines[i], percentage: byteCount * 100 / totalSize});
            }
        }
        lines = [];
    };

    var sortLayers = function(){
        var sortedZ = [];
        var tmpModel = [];

        for(var layer in z_heights){
            sortedZ[z_heights[layer]] = layer;
        }

        sortedZ.sort(function(a,b){
            return a-b;
        });

        for(var i=0;i<sortedZ.length;i++){
            if(typeof(z_heights[sortedZ[i]]) === 'undefined')continue;
            tmpModel[i] = model[z_heights[sortedZ[i]]];
        }
        model = tmpModel;
        delete tmpModel;
    };

    var prepareLinesIndex = function(){
        percentageTree = undefined;

        for (var l in model) {
            for (var i=0; i< model[l].length; i++) {
                var percentage = model[l][i].percentage;
                var value = {layer: l, cmd: i};
                if (!percentageTree) {
                    percentageTree = new AVLTree({key: percentage, value: value}, "key");
                } else {
                    percentageTree.add({key: percentage, value: value});
                }
            }
        }
    };

    var searchInPercentageTree = function(key) {
        if (percentageTree === undefined) {
            return undefined;
        }

        var elements = percentageTree.findBest(key);
        if (elements.length == 0) {
            return undefined;
        }

        return elements[0];
    };

    var purgeLayers = function(){
        var purge=true;
        if(!model){
            console.log("Something terribly wring just happened.");
            return;
        }
        for(var i=0;i<model.length;i++){
            purge=true;
            if(typeof(model[i])==='undefined')purge=true;
            else {
                for(var j=0;j<model[i].length;j++){
                    if(model[i][j].extrude)purge=false;
                }
            }
            if(purge){
                model.splice(i,1);
                i--;
            }
        }
    };

// ***** PUBLIC *******
    return {

        loadFile: function(reader){
            model = [];
            z_heights = [];

            var totalSize = reader.target.result.length;
            lines = reader.target.result.split(/\n/);
            reader.target.result = null;
            prepareGCode(totalSize);

            worker.postMessage({
                    "cmd":"parseGCode",
                    "msg":{
                        gcode: gcode,
                        options: {
                            firstReport: 5
                        }
                    }
                }
            );
            delete lines;
            delete gcode;
        },
        setOption: function(options){
            for(var opt in options){
                gCodeOptions[opt] = options[opt];
            }
        },
        passDataToRenderer: function(){
            if(gCodeOptions["sortLayers"])sortLayers();
            if(gCodeOptions["purgeEmptyLayers"])purgeLayers();
            prepareLinesIndex();
            GCODE.renderer.doRender(model, 0);

        },
        processLayerFromWorker: function(msg){
            model[msg.layerNum] = msg.cmds;
            z_heights[msg.zHeightObject.zValue] = msg.zHeightObject.layer;
        },
        processMultiLayerFromWorker: function(msg){
            for(var i=0;i<msg.layerNum.length;i++){
                model[msg.layerNum[i]] = msg.model[msg.layerNum[i]];
                z_heights[msg.zHeightObject.zValue[i]] = msg.layerNum[i];
            }
        },
        processAnalyzeModelDone: function(msg){
            min = msg.min;
            max = msg.max;
            modelSize = msg.modelSize;
            totalFilament = msg.totalFilament;
            filamentByLayer = msg.filamentByLayer;
            speeds = msg.speeds;
            speedsByLayer = msg.speedsByLayer;
            printTime = msg.printTime;
            printTimeByLayer = msg.printTimeByLayer;
        },
        getLayerFilament: function(z){
            return filamentByLayer[z];
        },
        getLayerSpeeds: function(z){
          return speedsByLayer[z]?speedsByLayer[z]:{};
        },
        getModelInfo: function(){
            return {
                min: min,
                max: max,
                modelSize: modelSize,
                totalFilament: totalFilament,
                speeds: speeds,
                speedsByLayer: speedsByLayer,
                printTime: printTime,
                printTimeByLayer: printTimeByLayer
            };
        },
        getGCodeLines: function(layer, fromSegments, toSegments){
            var i=0;
            var result = {first: model[layer][fromSegments].gcodeLine, last: model[layer][toSegments].gcodeLine};
            return result;
        },
        getCmdIndexForPercentage: function(percentage) {
            var command = searchInPercentageTree(percentage);
            if (command === undefined) {
                return undefined
            } else {
                return command.value;
            }
        }
    }
}());


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="AutoFitRecyclerGridView">
        <attr name="columnWidth" format="dimension" />
        <attr name="horizontalSpacing" format="dimension" />
        <attr name="verticalSpacing" format="dimension" />
    </declare-styleable>
</resources>


text:
import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const novel = () => import('comp/novel/novel')
const community = () => import('comp/community/community')
const discover = () => import('comp/discover/discover')
const search = () => import('comp/search/search')
const reader = () => import('comp/reader/reader')
const srclist = () => import('comp/srclist/srclist')

const routes = [
  {
    path: '/',
    redirect: '/novel'
  },
  {
    path: '/novel',
    component: novel
  },
  {
    path: '/community',
    component: community
  },
  {
    path: '/discover',
    component: discover
  },
  {
    path: '/search',
    component: search
  },
  {
    path: '/reader',
    component: reader
  },
  {
    path: '/srclist',
    component: srclist
  }
]

export default new Router({
  routes,
  linkActiveClass: 'active'
})


text:
/*
 * Conseil national de recherche Canada 2006/
 * National Research Council Canada 2006
 *
 * Créé le / Created on Feb 7, 2006
 * par / by Benoit Farley
 *
 */
package html;

import java.io.UnsupportedEncodingException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.w3c.tidy.EntityTable;

public final class HtmlEntities {

    public static Pattern pEntity = Pattern.compile("(&[^;]+?);");
    static Pattern pEnt = Pattern.compile("&[^;]+?;");
    public static EntityTable et = EntityTable.getDefaultEntityTable();
    public static Pattern pHtmlEntity = Pattern.compile("&((#[xX]?[a-fA-F0-9]+)|([a-zA-Z0-9]+))");

    /*
     * Note: The functions in EntityTable.class do not take the final ';' into
     * consideration.
     */

    /*
     * Replace the HTML entities with their corresponding characters.
     */
    static public String entityToChar(String str) {
        Matcher mpEntity;
        int pos = 0;
        int limit = str.length();
        StringBuffer sb = new StringBuffer();
        mpEntity = pHtmlEntity.matcher(str);
        while (pos < limit) {
            if (mpEntity.find(pos)) {
                String ent = new String(mpEntity.group());
                sb.append(str.substring(pos,mpEntity.start()));
                short d = et.entityCode(ent);
                char c = (char)d;
                sb.append(c);
                pos = mpEntity.end();
                // skip ';'
                if (pos < limit && str.charAt(pos)==';')
                    pos++;
            }
            else {
                sb.append(str.charAt(pos++));
            }
            }
        return sb.toString();
        }

    static public String entityToChar(DynamicArrayOfByte bs, String encoding) {
        byte[] bytes = bs.getBytes();
        String str = null;
        try {
            if (encoding==null)
                str = new String(bytes);
            else
                str = new String(bytes,encoding);
        } catch (UnsupportedEncodingException e) {
        }
        String str1 = entityToChar(str);
        return str1;
    }

    /*
     * Replace the HTML entities corresponding to Unicode syllabic characters
     * with those characters; all other HTML entities are left as is.
     */
    static public String toStringInuktitut(String str) {
        Matcher mpEntity;
        int pos = 0;
        int limit = str.length();
        StringBuffer sb = new StringBuffer();
        while (pos < limit) {
            mpEntity = pHtmlEntity.matcher(str);
            if (mpEntity.find(pos)) {
                String ent = new String(mpEntity.group());
                if (et.entityCode(ent) > 0x1400 && et.entityCode(ent) < 0x167F) {
                    sb.append(str.substring(pos,mpEntity.start()));
                    sb.append((char)et.entityCode(ent));
                    pos = mpEntity.end();
                    // skip ';'
                    if (pos < limit && str.charAt(pos)==';')
                        pos++;
                } else {
                    sb.append(str.substring(pos,mpEntity.start()));
                    sb.append(mpEntity.group());
                    pos = mpEntity.end();
                }
            }
            else
                sb.append(str.charAt(pos++));
            }
        return sb.toString();
        }

    /*
     * Returns a substring of a string that contains html entities; this
     * function considers an html entity as one character/position.
     */
    static public String substring(String str, int startPos) {
        return substring(str,startPos,str.length());
    }

    static public String substring(String str, int startPos, int endPos) {
        Matcher m = pHtmlEntity.matcher(str);
        int pos = 0;
        int cntr = 0;
        String sub = "";
        int limit = str.length();
        while (pos < str.length()) {
            if (m.find(pos) && m.start()==pos) {
                if (cntr >= startPos && cntr < endPos) {
                    sub += str.substring(pos,m.end());
                    if (str.charAt(m.end())==';')
                        sub += ";";
                }
                cntr++;
                pos = m.end();
                // skip ';'
                if (pos < limit && str.charAt(pos)==';') {
                    pos++;
                }
            } else {
                if (cntr >= startPos && cntr < endPos)
                    sub += str.charAt(pos);
                cntr++;
                pos += 1;
            }
        }
        return sub;
    }

    /*
     * Convert from HTML entities to characters.
     */
    public static String fromHTMLEntity(String s) {
        String str = entityToChar(s);
        return str;
    }

    /*
     * Convert from characters to HTML entities.
     */
    public static String toHtmlEntity(String s) {
        StringBuffer sb = new StringBuffer();
        for (int i=0; i<s.length(); i++) {
            sb.append("&#"+Integer.toString((int)s.charAt(i),10)+";");
        }
        return sb.toString();
    }

    }