text:
<?php

namespace GeneratorBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * OpusStatusSheet.
 *
 * @ORM\Table(name="opus_sheet_status")
 * @ORM\Entity(repositoryClass="GeneratorBundle\Entity\Repository\OpusSheetStatusRepository")
 */
class OpusSheetStatus
{
    /**
     * @var int
     * @ORM\Column(name="id", type="integer", unique=true)
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="label", type="string", length=255)
     */
    private $label;

    /**
     * @var int
     * @ORM\Id
     * @ORM\Column(name="intCode", type="integer", unique=true)
     * @ORM\GeneratedValue(strategy="NONE")
     */
    private $intCode;

    /**
     * @var string
     *
     * @ORM\Column(name="strCode", type="string", length=255)
     */
    private $strCode;

    /**
     * @ORM\OneToMany(targetEntity="GeneratorBundle\Entity\OpusSheet", mappedBy="status", cascade={"persist"})
     */
    private $opusSheets;

    /**
     * Get id.
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set label.
     *
     * @param string $label
     *
     * @return OpusStatusSheet
     */
    public function setLabel($label)
    {
        $this->label = $label;

        return $this;
    }

    /**
     * Get label.
     *
     * @return string
     */
    public function getLabel()
    {
        return $this->label;
    }

    /**
     * Set intCode.
     *
     * @param int $intCode
     *
     * @return OpusStatusSheet
     */
    public function setIntCode($intCode)
    {
        $this->intCode = $intCode;

        return $this;
    }

    /**
     * Get intCode.
     *
     * @return int
     */
    public function getIntCode()
    {
        return $this->intCode;
    }

    /**
     * Set strCode.
     *
     * @param string $strCode
     *
     * @return OpusStatusSheet
     */
    public function setStrCode($strCode)
    {
        $this->strCode = $strCode;

        return $this;
    }

    /**
     * Get strCode.
     *
     * @return string
     */
    public function getStrCode()
    {
        return $this->strCode;
    }
    /**
     * Constructor.
     */
    public function __construct()
    {
        $this->opusSheets = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add opusSheets.
     *
     * @param \GeneratorBundle\Entity\OpusSheet $opusSheets
     *
     * @return OpusSheetStatus
     */
    public function addOpusSheet(\GeneratorBundle\Entity\OpusSheet $opusSheets)
    {
        $this->opusSheets[] = $opusSheets;

        return $this;
    }

    /**
     * Remove opusSheets.
     *
     * @param \GeneratorBundle\Entity\OpusSheet $opusSheets
     */
    public function removeOpusSheet(\GeneratorBundle\Entity\OpusSheet $opusSheets)
    {
        $this->opusSheets->removeElement($opusSheets);
    }

    /**
     * Get opusSheets.
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getOpusSheets()
    {
        return $this->opusSheets;
    }
}


text:
package com.intellij.openapi.editor.textarea;

import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.event.CaretListener;
import com.intellij.openapi.editor.markup.TextAttributes;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.JTextComponent;
import java.util.Collections;
import java.util.List;

/**
 * @author yole
 */
public class TextComponentCaretModel implements CaretModel {
  private final JTextComponent myTextComponent;
  private final TextComponentEditor myEditor;
  private final Caret myCaret;

  public TextComponentCaretModel(@NotNull JTextComponent textComponent, @NotNull TextComponentEditor editor) {
    myTextComponent = textComponent;
    myEditor = editor;
    myCaret = new TextComponentCaret(editor);
  }

  @Override
  public void moveCaretRelatively(final int columnShift,
                                  final int lineShift,
                                  final boolean withSelection, final boolean blockSelection, final boolean scrollToCaret) {
    throw new UnsupportedOperationException("Not implemented");
  }

  @Override
  public void moveToLogicalPosition(@NotNull final LogicalPosition pos) {
    moveToOffset(myEditor.logicalPositionToOffset(pos), false);
  }

  @Override
  public void moveToVisualPosition(@NotNull final VisualPosition pos) {
    moveToLogicalPosition(myEditor.visualToLogicalPosition(pos));
  }

  @Override
  public void moveToOffset(int offset) {
    moveToOffset(offset, false);
  }

  @Override
  public void moveToOffset(final int offset, boolean locateBeforeSoftWrap) {
    int targetOffset = Math.min(offset, myTextComponent.getText().length());
    int currentPosition = myTextComponent.getCaretPosition();
    // We try to preserve selection, to match EditorImpl behaviour.
    // It's only possible though, if target offset is located at either end of existing selection.
    if (targetOffset != currentPosition) {
      if (targetOffset == myTextComponent.getCaret().getMark()) {
        myTextComponent.setCaretPosition(currentPosition);
        myTextComponent.moveCaretPosition(targetOffset);
      }
      else {
        myTextComponent.setCaretPosition(targetOffset);
      }
    }
  }

  @Override
  public boolean isUpToDate() {
    return true;
  }

  @Override
  @NotNull
  public LogicalPosition getLogicalPosition() {
    int caretPos = myTextComponent.getCaretPosition();
    int line;
    int lineStart;
    if (myTextComponent instanceof JTextArea) {
      final JTextArea textArea = (JTextArea)myTextComponent;
      try {
        line = textArea.getLineOfOffset(caretPos);
        lineStart = textArea.getLineStartOffset(line);
      }
      catch (BadLocationException e) {
        throw new RuntimeException(e);
      }
    }
    else {
      line = 0;
      lineStart = 0;
    }
    return new LogicalPosition(line, caretPos - lineStart);
  }

  @Override
  @NotNull
  public VisualPosition getVisualPosition() {
    LogicalPosition pos = getLogicalPosition();
    return new VisualPosition(pos.line, pos.column);
  }

  @Override
  public int getOffset() {
    return myTextComponent.getCaretPosition();
  }

  @Override
  public void addCaretListener(@NotNull final CaretListener listener) {
    throw new UnsupportedOperationException("Not implemented");
  }

  @Override
  public void removeCaretListener(@NotNull final CaretListener listener) {
    throw new UnsupportedOperationException("Not implemented");
  }

  @Override
  public int getVisualLineStart() {
    return 0;
  }

  @Override
  public int getVisualLineEnd() {
    return 0;
  }

  @Override
  public TextAttributes getTextAttributes() {
    return null;
  }

  @Override
  public boolean supportsMultipleCarets() {
    return false;
  }

  @NotNull
  @Override
  public Caret getCurrentCaret() {
    return myCaret;
  }

  @NotNull
  @Override
  public Caret getPrimaryCaret() {
    return myCaret;
  }

  @Override
  public int getCaretCount() {
    return 1;
  }

  @NotNull
  @Override
  public List<Caret> getAllCarets() {
    return Collections.singletonList(myCaret);
  }

  @Nullable
  @Override
  public Caret getCaretAt(@NotNull VisualPosition pos) {
    return myCaret.getVisualPosition().equals(pos) ? myCaret : null;
  }

  @Nullable
  @Override
  public Caret addCaret(@NotNull VisualPosition pos) {
    return null;
  }

  @Nullable
  @Override
  public Caret addCaret(@NotNull VisualPosition pos, boolean makePrimary) {
    return null;
  }

  @Override
  public boolean removeCaret(@NotNull Caret caret) {
    return false;
  }

  @Override
  public void removeSecondaryCarets() {
  }

  @Override
  public void setCaretsAndSelections(@NotNull List<CaretState> caretStates) {
    if (caretStates.size() != 1) throw new IllegalArgumentException("Exactly one CaretState object must be passed");
    CaretState state = caretStates.get(0);
    if (state != null) {
      if (state.getCaretPosition() != null) moveToLogicalPosition(state.getCaretPosition());
      if (state.getSelectionStart() != null && state.getSelectionEnd() != null) {
        myEditor.getSelectionModel().setSelection(myEditor.logicalPositionToOffset(state.getSelectionStart()),
                                                  myEditor.logicalPositionToOffset(state.getSelectionEnd()));
      }
    }
  }

  @Override
  public void setCaretsAndSelections(@NotNull List<CaretState> caretStates, boolean updateSystemSelection) {
    setCaretsAndSelections(caretStates);
  }

  @NotNull
  @Override
  public List<CaretState> getCaretsAndSelections() {
    return Collections.singletonList(new CaretState(getLogicalPosition(),
                                                    myEditor.offsetToLogicalPosition(myEditor.getSelectionModel().getSelectionStart()),
                                                    myEditor.offsetToLogicalPosition(myEditor.getSelectionModel().getSelectionEnd())));
  }

  @Override
  public void runForEachCaret(@NotNull CaretAction action) {
    action.perform(myCaret);
  }

  @Override
  public void runForEachCaret(@NotNull CaretAction action, boolean reverseOrder) {
    action.perform(myCaret);
  }

  @Override
  public void runBatchCaretOperation(@NotNull Runnable runnable) {
    runnable.run();
  }
}

redpajama_set_name: RedPajamaGithub


text:
require 'active_return_shipping/return_shipping/carriers/bogus_carrier'
require 'active_return_shipping/return_shipping/carriers/usps'

module ActiveMerchant
  module ReturnShipping
    module Carriers
      class <<self
        def all
          [BogusCarrier, USPS]
        end
      end
    end
  end
end


text:
using static STULib.Types.Generic.Common;

namespace STULib.Types {
    [STU(0x27C6AA11)]
    public class STUAnimationListWrapperBase : STUInstance {
        [STUField(0x63DEDAC0)]
        public uint m_63DEDAC0;
    }
}


text:
'use strict';

var fs = require('fs');
var path = require('path');
var should = require('should');
var Template = require('..');
var template = new Template();

describe('custom delimiters:', function () {
  it('should use custom delimiters defined on a template type:', function (done) {
    var template = new Template();
    template.engine('*', require('engine-lodash'));
    template.create('doc', 'docs', { isRenderable: true , delims: ['<<', '>>']})

    template.doc('foo', {content: '<<= name >>', name: 'Jon Schlinkert'});
    template.docs('bar', {content: '<<= name >>', name: 'Brian Woodward'});

    template.render('foo', function (err, content) {
      if (err) console.log(err);
      content.should.equal('Jon Schlinkert');
    });

    template.render('bar', function (err, content) {
      if (err) console.log(err);
      content.should.equal('Brian Woodward');
    });
    done();
  });

  it('should use custom delimiters defined on an actual template:', function (done) {
    var template = new Template();
    template.engine('*', require('engine-lodash'));
    template.create('doc', 'docs', { isRenderable: true })

    template.doc('foo', {content: '<<= name >>{{= name }}', name: 'Jon Schlinkert'}, {
      delims: ['<<', '>>']
    });
    template.doc('bar', {content: '<<= name >>{{= name }}', name: 'Brian Woodward'}, {
      delims: ['{{', '}}']
    });

    template.render('foo', function (err, content) {
      if (err) console.log(err);
      content.should.equal('Jon Schlinkert{{= name }}');
    });

    template.render('bar', function (err, content) {
      if (err) console.log(err);
      content.should.equal('<<= name >>Brian Woodward');
    });
    done();
  });

  it('should use custom delimiters defined on partials:', function (done) {
    var template = new Template();
    template.engine('*', require('engine-lodash'));
    template.create('doc', 'docs', { isRenderable: true });

    template.partial('xyz.md', 'Yeah! It worked!');
    template.doc('abc', {
      delims: ['<<', '>>'],
      content: '<<= name >> <<= partial("xyz.md") >>',
      name: 'Jon Schlinkert',
    });

    template.render('abc', function (err, content) {
      if (err) console.log(err);
      content.should.equal('Jon Schlinkert Yeah! It worked!');
    });
    done();
  });
});


text:
#ifndef REPLYCALLER_H
#define REPLYCALLER_H

#include <functional>
#include <memory>

#include "joynr/IReplyCaller.h"
#include "joynr/ReplyInterpreter.h"
#include "joynr/exceptions/JoynrException.h"

namespace joynr
{

class BaseReplyCaller : public IReplyCaller
{
public:
    BaseReplyCaller(std::function<void(const std::shared_ptr<exceptions::JoynrException>& error)>&&
                            errorFct)
            : _errorFct(std::move(errorFct)), _hasTimeOutOccurred(false)
    {
    }

    ~BaseReplyCaller() override = default;

    void returnError(const std::shared_ptr<exceptions::JoynrException>& error) override
    {
        _errorFct(error);
    }

    void timeOut() override
    {
        _hasTimeOutOccurred = true;
        _errorFct(std::make_shared<exceptions::JoynrTimeOutException>(
                "timeout waiting for the response"));
    }

protected:
    std::function<void(const std::shared_ptr<exceptions::JoynrException>& error)> _errorFct;
    bool _hasTimeOutOccurred;
};

template <class... Ts>
/**
 * @brief This template class is the implementation for IReplyCaller for all types.
 * T is the desired type that the response should be converted to.
 *
 */
class ReplyCaller : public BaseReplyCaller
{
public:
    ReplyCaller(
            std::function<void(const Ts&...)> callbackFct,
            std::function<void(const std::shared_ptr<exceptions::JoynrException>& error)> errorFct)
            : BaseReplyCaller(std::move(errorFct)), _callbackFct(std::move(callbackFct))
    {
    }

    ~ReplyCaller() override = default;

    void returnValue(const Ts&... payload)
    {
        if (!_hasTimeOutOccurred && _callbackFct) {
            _callbackFct(payload...);
        }
    }

    void execute(Reply&& reply) override
    {
        ReplyInterpreter<Ts...>::execute(*this, std::move(reply));
    }

private:
    std::function<void(const Ts&... returnValue)> _callbackFct;
};

template <>
/**
 * @brief Template specialisation for the void type.
 *
 */
class ReplyCaller<void> : public BaseReplyCaller
{
public:
    ReplyCaller(
            std::function<void()> callbackFct,
            std::function<void(const std::shared_ptr<exceptions::JoynrException>& error)> errorFct)
            : BaseReplyCaller(std::move(errorFct)), _callbackFct(std::move(callbackFct))
    {
    }

    ~ReplyCaller() override = default;

    void returnValue()
    {
        if (!_hasTimeOutOccurred && _callbackFct) {
            _callbackFct();
        }
    }

    void execute(Reply&& reply) override
    {
        ReplyInterpreter<void>::execute(*this, std::move(reply));
    }

private:
    std::function<void()> _callbackFct;
};

} // namespace joynr
#endif // REPLYCALLER_H


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

namespace DevTreks.Extensions
{
    ///<summary>
    ///Purpose:		General rules for health care calculators.
    ///Author:		www.devtreks.org
    ///Date:		2012, November
    ///References:	www.devtreks.org/helptreks/linkedviews/help/linkedview/HelpFile/148
    /// </summary>
    public static class HealthCareRules
    {
    }
}


text:
package org.apache.sshd.client.auth;

import java.io.IOException;
import java.security.PublicKey;
import java.security.interfaces.RSAPublicKey;
import java.util.Iterator;

import org.apache.sshd.agent.SshAgent;
import org.apache.sshd.client.UserAuth;
import org.apache.sshd.client.session.ClientSessionImpl;
import org.apache.sshd.common.KeyPairProvider;
import org.apache.sshd.common.SshConstants;
import org.apache.sshd.common.service.ServiceClient;
import org.apache.sshd.common.util.Buffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Authentication delegating to an SSH agent
 */
public class UserAuthAgent extends AbstractUserAuth implements UserAuth {

    private final SshAgent agent;
    private final Iterator<SshAgent.Pair<PublicKey, String>> keys;

    public UserAuthAgent(ClientSessionImpl session, ServiceClient service, String username) throws IOException {
        super(session, service, username);
        this.agent = session.getFactoryManager().getAgentFactory().createClient(session);
        this.keys = agent.getIdentities().iterator();
        if (session.getFactoryManager().getAgentFactory() == null) {
            throw new IllegalStateException("No ssh agent factory has been configured");
        }
    }

    public String getUsername() {
        return username;
    }

    protected void sendNextKey(PublicKey key) throws IOException {
        try {
            log.info("Send SSH_MSG_USERAUTH_REQUEST for publickey and service {}", serviceName);
            Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_USERAUTH_REQUEST, 0);
            int pos1 = buffer.wpos() - 1;
            buffer.putString(username);
            buffer.putString(serviceName);
            buffer.putString("publickey");
            buffer.putByte((byte) 1);
            buffer.putString((key instanceof RSAPublicKey) ? KeyPairProvider.SSH_RSA : KeyPairProvider.SSH_DSS);
            int pos2 = buffer.wpos();
            buffer.putPublicKey(key);

            Buffer bs = new Buffer();
            bs.putString(session.getKex().getH());
            bs.putCommand(SshConstants.Message.SSH_MSG_USERAUTH_REQUEST);
            bs.putString(username);
            bs.putString(serviceName);
            bs.putString("publickey");
            bs.putByte((byte) 1);
            bs.putString((key instanceof RSAPublicKey) ? KeyPairProvider.SSH_RSA : KeyPairProvider.SSH_DSS);
            bs.putPublicKey(key);

            Buffer bs2 = new Buffer();
            bs2.putString((key instanceof RSAPublicKey) ? KeyPairProvider.SSH_RSA : KeyPairProvider.SSH_DSS);
            bs2.putBytes(agent.sign(key, bs.getCompactData()));
            buffer.putBytes(bs2.array(), bs2.rpos(), bs2.available());

            session.writePacket(buffer);
        } catch (IOException e) {
            throw e;
        } catch (Exception e) {
            throw (IOException) new IOException("Error performing public key authentication").initCause(e);
        }
    }

    public Result next(Buffer buffer) throws IOException {
        if (buffer == null) {
            if (keys.hasNext()) {
                sendNextKey(keys.next().getFirst());
                return Result.Continued;
            } else {
                agent.close();
                return Result.Failure;
            }
        } else {
            SshConstants.Message cmd = buffer.getCommand();
            log.info("Received {}", cmd);
            if (cmd == SshConstants.Message.SSH_MSG_USERAUTH_SUCCESS) {
                agent.close();
                return Result.Success;
            } if (cmd == SshConstants.Message.SSH_MSG_USERAUTH_FAILURE) {
                if (keys.hasNext()) {
                    sendNextKey(keys.next().getFirst());
                    return Result.Continued;
                } else {
                    agent.close();
                    return Result.Failure;
                }
            } else {
                // TODO: check packets
                return Result.Continued;
            }
        }
    }
}


text:
<!--
 Copyright (C) 2014 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:height="76dp"
        android:width="76dp"
        android:viewportHeight="76"
        android:viewportWidth="76"
        android:tint="?attr/colorControlActivated">

    <group
        android:name="root"
        android:translateX="38.0"
        android:translateY="38.0" >
        <path
            android:name="progressBar"
            android:fillColor="#00000000"
            android:pathData="M0, 0 m 0, -29 a 29,29 0 1,1 0,58 a 29,29 0 1,1 0,-58"
            android:strokeColor="@color/white"
            android:strokeLineCap="square"
            android:strokeLineJoin="miter"
            android:strokeWidth="6"
            android:trimPathEnd="0"
            android:trimPathOffset="0"
            android:trimPathStart="0" />
    </group>

</vector>


text:
#ifndef INCLUDE_M1_AGENT_H_
#define INCLUDE_M1_AGENT_H_

#include <nx_api.h>
#include <nx_dns.h>
#include <m1.h>

/*
 * Description:
 * 		Establishes a MQTT connection to Medium One using the provided credentials. If device::user_id
 * 		has a non-zero length, device credentials are used when attempting to connect to the Medium One
 * 		MQTT broker. If the credentials are rejected, and registration credentials are provided, the
 * 		connection will be re-attempted with registration credentials. If the connection is successful
 * 		with registration credentials, enrollment will be initiated to obtain credentials for this device.
 * 		Enrollment is dependent on the device having a unique_id provided by FMI. If successful, the new
 * 		credentials will be returned in device.
 *
 * 		A dedicated M1 agent thread is created, if it does not already exist. During m1_auto_enroll_connect(),
 * 		if connection is successful, the following data is transmitted to
 * 		the Medium One "raw" datastream:
 * 			"connected": true
 * 			"ip_address": <WAN_IP>
 * 			"unique_id": <Unique ID> (from FMI)
 * 			"product_name": <Product Name> (from FMI)
 * 			"product_market": <Product Marking> (from FMI)
 * 			"mask_revision": <Mask Revision> (from FMI)
 * 			"quality_code": <Quality Code> (from FMI)
 * 			"ssp_version": <SSP Version> (ssp_version_t) (from FMI)
 * 			"mac_address": <mac address> (if available) (from NetX)
 * 			"lan_address": <lan_address> (if available) (from NetX)
 * 		Finally a subscription is made to the Medium One subscription topics for the specified user.
 * 		The dedicated agent thread maintains and monitors the MQTT connection. If the connection drops,
 * 		the agent will continuously try to reconnect, with a delay of 5 seconds between attempts.
 * 		This is a blocking call.
 * Parameters:
 * 		mqtt_url: 		MQTT broker
 * 		mqtt_port: 		MQTT port
 * 		project:		MQTT project ID (provided by docs) and project API key
 * 		registration: 	optional MQTT user ID and password for API registration user
 * 		device: 		MQTT user ID and password for API basic user
 * 		device_id:		device identifier, maximum 60 characters
 * 		retry_limit: 	The number of times to retry (recommend 5 times)
 * 		retry_delay: 	The time delay (seconds) between retry (recommend 5 seconds)
 * 		mqtt_heart_beat:period (seconds) between MQTT ping (recommended 300 seconds)
 * 		tls_enabled: 	1 to use TLS
 *		ssl_mem:		optional pointer to start of contiguous memory block to be used by SSL.
 *						should be ~35k for successful TLS connections. if not specified, memory is allocated from heap
 *		ssl_mem_size:	optional size of contiguous memory block pointed to by ssl_mem
 *		p_ppool:		pointer to NX_PACKET_POOL instance to use
 *		p_ip:			pointer to NX_IP instance to use
 *		p_dns:			pointer to NX_DNS instance to use
 * Errors:
 * 		M1_ERROR_INVALID_URL -			must end with "mediumone.com"
 * 		M1_ERROR_UNABLE_TO_CONNECT - 	returned if a fatal error occurs. fatal errors include:
 *									 		- Network unavailable
 *                                          - Incorrect MQTT broker URL or port
 *                                          - Using TLS with non-TLS port, or vice-versa
 *		M1_ERROR_ALREADY_CONNECTED -	returned if already connected
 *		M1_ERROR_BAD_CREDENTIALS - 		returned if
 *		                                    - device is NULL
 *                                          - device credentials are incorrect and registration is NULL
 *                                          - device credentials are incorrect and registration credentials are incorrect
 *
 * Success:
 * 		return 0
 */
int m1_auto_enroll_connect(const char * mqtt_url,
			 			   	int mqtt_port,
			                const project_credentials_t * project,
			                const user_credentials_t * registration,
			                user_credentials_t * device,
							const char * device_id,
							int retry_limit,
							int retry_delay,
							int mqtt_heart_beat,
							int tls_enabled,
							void * ssl_mem,
							int ssl_mem_size,
			                NX_PACKET_POOL * p_ppool,
			                NX_IP * p_ip,
			                NX_DNS * p_dns);
int m1_auto_enroll_connect_2(m1_connect_params * params);

/*
 *
 * ***DEPRECATED***: This API will be removed in a future version.
 * Use m1_auto_enroll_connect instead.
 * This API dynamically allocates ~30k from the heap. Please make sure your heap
 * is sized large enough to accomodate this.
 *
 * Description:
 *      Establishes a MQTT connection to Medium One using the provided credentials.
 * 		A dedicated M1 agent thread is created, if it does not already exist. During m1_connect(),
 * 		if connection is successful, the following data is transmitted to
 * 		the Medium One "raw" datastream:
 * 			"connected": true
 * 			"ip_address": <WAN_IP>
 * 			"unique_id": <Unique ID> (from FMI)
 * 			"product_name": <Product Name> (from FMI)
 * 			"product_market": <Product Marking> (from FMI)
 * 			"mask_revision": <Mask Revision> (from FMI)
 * 			"quality_code": <Quality Code> (from FMI)
 * 			"ssp_version": <SSP Version> (ssp_version_t) (from FMI)
 * 			"mac_address": <mac address> (if available) (from NetX)
 * 			"lan_address": <lan_address> (if available) (from NetX)
 * 		Finally a subscription is made to the Medium One subscription topics for the specified user.
 * 		The dedicated agent thread maintains and monitors the MQTT connection. If the connection drops,
 * 		the agent will continuously try to reconnect, with a delay of 5 seconds between attempts.
 * 		This is a blocking call.
 * Parameters:
 * 		mqtt_url: 		MQTT broker
 * 		mqtt_port: 		MQTT port
 *		mqtt_user_id: 	MQTT user ID (provided by docs)
 *		password: 		API user password
 *		mqtt_project_id:MQTT project ID (provided by docs)
 *		api_key:		API key
 * 		device: 		MQTT user ID and password for API basic user
 * 		device_id:		device identifier, maximum 60 characters
 * 		retry_limit: 	The number of times to retry (recommend 5 times)
 * 		retry_delay: 	The time delay (seconds) between retry (recommend 5 seconds)
 * 		mqtt_heart_beat:period (seconds) between MQTT ping (recommended 300 seconds)
 * 		tls_enabled: 	1 to use TLS
 *		p_ppool:		pointer to NX_PACKET_POOL instance to use
 *		p_ip:			pointer to NX_IP instance to use
 *		p_dns:			pointer to NX_DNS instance to use
 * Errors:
 * 		M1_ERROR_INVALID_URL -			must end with "mediumone.com"
 * 		M1_ERROR_UNABLE_TO_CONNECT - 	returned if a fatal error occurs. fatal errors include:
 *									 		- Network unavailable
 *									 		- Incorrect MQTT broker URL or port
 *									 		- Using TLS with non-TLS port, or vice-versa
 *		M1_ERROR_ALREADY_CONNECTED -	returned if already connected
 *		M1_ERROR_BAD_CREDENTIALS - 		returned if any of mqtt_user_id, password, mqtt_project_id, or api_key are incorrect
 *
 * Success:
 * 		return 0
 */
__attribute__((__deprecated__))
int m1_connect(const char * mqtt_url,
				int mqtt_port,
				char * mqtt_user_id,
				char * password,
				char * mqtt_project_id,
				char * api_key,
				const char * device_id,
				int retry_limit,
				int retry_delay,
				int mqtt_heart_beat,
				int tls_enabled);

/*
 * Description:
 * 		Disconnects from Medium One MQTT broker. This is a blocking call.
 */
void m1_disconnect();

/*
 * Description:
 * 		This sends a json event to Medium One. This is a non-blocking call.
 * Parameters:
 * 		json_payload: serialized JSON object to send to Medium One
 * 			eg. "{\"my_key\": 12345}"
 * 		observed_at: ISO8601-format datetime string. If NULL, not included in event
 * 		(observed_at generated by M1 broker on reception)
 * 			eg. "2016-08-29T16:03:12.794925-07:00"
 * Errors:
 * 		M1_ERROR_NOT_CONNECTED
 * 		M1_ERROR_NULL_PAYLOAD
 * 		M1_ERROR_UNABLE_TO_PUBLISH
 * Success:
 * 		return 0
 */
int m1_publish_event(char * json_payload, char * observed_at);

/*
 * 	Description:
 * 		This function registers a callback function which is called when a message is received from Medium One.
 * 	Parameters:
 * 		subscription_callback: function pointer to callback
 * 			Callback function parameters:
 * 				type: type of message received (1 - cloud to device; 2 - cloud to group)
 * 				topic: full topic identifier for received message (null-terminated string)
 * 				msg: message content
 * 				length: message length
 * 	Errors:
 * 		M1_ERROR_NULL_CALLBACK
 * 	Success:
 * 		return 0
 */
int m1_register_subscription_callback(void (* subscription_callback)(int type, char * topic, char * msg, int length));

#endif /* INCLUDE_M1_AGENT_H_ */


text:
The request was denied due to an invalid or missing client authentication / authorisation.

Example:

```
HTTP/1.1 401 Unauthorized

{
  "error"             : "invalid_client",
  "error_description" : "Client authentication failed: Missing client authentication / token"
}```


text:
/// **************************************************************************
///
/// $Id: MatrixBasedTransformException.java,v 1.1 2002/07/25 14:56:49 grosbois Exp $
///
/// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
/// $Date $
/// ***************************************************************************
///
using System;
namespace CSJ2K.Icc.Lut
{

	///  Thrown by MatrixBasedTransformTosRGB
	///
	///
	/// <seealso cref="jj2000.j2k.icc.lut.MatrixBasedTransformTosRGB">
	/// </seealso>
	/// <version> 	1.0
	/// </version>
	/// <author> 	Bruce A. Kern
	/// </author>

	[Serializable]
	public class MatrixBasedTransformException:System.Exception
	{

		///  Contruct with message
		/// <param name="msg">returned by getMessage()
		/// </param>
		internal MatrixBasedTransformException(System.String msg):base(msg)
		{
		}

		///  Empty constructor
		internal MatrixBasedTransformException()
		{
		}

		/* end class MatrixBasedTransformException */
	}
}


text:
/*
  Notes:
  - This controls the flow and manages all states involved with creating a new wallet
  - Manages: walletCreateName, walletCreateBackup
*/
angular.module('BitGo.Wallet.WalletCreateController', [])

.controller('WalletCreateController', ['$scope', '$rootScope', '$location', 'AnalyticsProxy',
  function($scope, $rootScope, $location, AnalyticsProxy) {
    // view states for the user settings area
    $scope.viewStates = ['label', 'backupkey', 'passcode', 'activate', 'insure'];
    // the current view state
    $scope.state = null;
    // template source for the current view
    $scope.createFlowTemplateSource = null;
    // the data model used by the ui-inputs during wallet creation
    $scope.inputs = null;
    // Additional properties that will be generated by steps in the process
    $scope.generated = null;

    // takes the user out of the wallet create flow
    // Accessible by all scopes inheriting this controller
    $scope.cancel = function() {
      // track the cancel
      AnalyticsProxy.track('CreateWalletCanceled');

      // Note: this redirect will also wipe all of the state that's been built up
      $location.path('/enterprise/' + $rootScope.enterprises.current.id + '/wallets');
    };

    // returns the view current view template (based on the $scope's current state)
    function getTemplate() {
      if (!$scope.state || _.indexOf($scope.viewStates, $scope.state) === -1) {
        throw new Error('Expect $scope.state to be defined when setting template for wallet create flow');
      }
      var tpl;
      switch ($scope.state) {
        case 'label':
          tpl = 'wallet/templates/wallet-create-partial-label.html';
          break;
        case 'backupkey':
          tpl = 'wallet/templates/wallet-create-partial-backupkey.html';
          break;
        case 'passcode':
          tpl = 'wallet/templates/wallet-create-partial-passcode.html';
          break;
        case 'activate':
          tpl = 'wallet/templates/wallet-create-partial-activate.html';
          break;
        case 'insure':
          tpl = 'wallet/templates/wallet-create-partial-insure.html';
          break;
      }
      return tpl;
    }

    // Event listeners
    var killStateWatch = $scope.$watch('state', function(state) {
      $scope.createFlowTemplateSource = getTemplate();
    });

    // Listener cleanup
    $scope.$on('$destroy', function() {
      killStateWatch();
    });

    function init() {
      $rootScope.setContext('createWallet');

      $scope.state = 'label';

      // All properties we expect the user to enter in creation
      $scope.inputs = {
        walletLabel: null,
        passcode: null,
        // used only when the user wants a wallet-specific password
        passcodeConfirm: null,
        // flag set to true if user provides their own backup
        useOwnBackupKey: false,
        // the xpub if user provides their own backup
        backupPubKey: null,
        activationCodeConfirm: null
      };

      // All properties we expect to possibly be generated during creation
      $scope.generated = {
        // Key/Keychain generated if the user provides their own xpub
        backupKeychain: null,
        backupKey: null,
        // Wallet keychains generated by BitGo to be used for the new wallet
        walletKeychain: null,
        walletBackupKeychain: null,
        bitgoKeychain: null,
        // Code that only gets put on the download to ensure the user
        // actually downloads the backup
        activationCode: null,
        // Code used to encrypt the passcode
        passcodeEncryptionCode: null,
        // The encrypted wallet passcode (used on the backup PDF)
        encryptedWalletPasscode: null,
        // The wallet (once it is created)
        wallet: null
      };
    }
    init();
  }
]);


text:
import cx_Oracle
import jinja2
import time

templateLoader = jinja2.FileSystemLoader(searchpath="templates")
templateEnv = jinja2.Environment(loader=templateLoader)
connection = cx_Oracle.connect('ionut/Passw0rd@192.168.137.174:1521/orcl')

refresh_time = 1000  # miliseconds

while True:
    classes_template = templateEnv.get_template("classes.jinja")
    cursor = connection.cursor()
    cursor.execute('SELECT * FROM Class')
    classes = []
    for row in cursor:
        classes.append({
            'name': row[1],
            'category_count': row[2]
        })
    cursor.close()
    with open("hugo_site/content/Classes.md", 'r') as f:
        content = f.read()
    new_content = classes_template.render(classes=classes)
    if new_content != content:
        with open("hugo_site/content/Classes.md", 'w') as f:
            f.write(new_content)

    categories_template = templateEnv.get_template("categories.jinja")
    cursor = connection.cursor()
    cursor.execute('SELECT * FROM Category')
    categories = []
    for row in cursor:
        categories.append({
            'name': row[1],
            'items_count': row[2]
        })
    cursor.close()
    with open("hugo_site/content/Categories.md", 'r') as f:
        content = f.read()
    new_content = categories_template.render(categories=categories)
    if new_content != content:
        with open("hugo_site/content/Categories.md", 'w') as f:
            f.write(new_content)

    items_template = templateEnv.get_template("items.jinja")
    cursor = connection.cursor()
    cursor.execute('SELECT * FROM Item')
    items = []
    for row in cursor:
        cur_cursor = connection.cursor()
        cur_cursor.execute('SELECT * FROM Category WHERE CID=%s' % row[1])
        category_name = cur_cursor.fetchone()[1]
        items.append({
            'name': row[2],
            'category_name': category_name,
            'description': row[3],
            'stock': row[4]
        })
        cur_cursor.close()
    cursor.close()
    with open("hugo_site/content/Items.md", 'r') as f:
        content = f.read()
    new_content = items_template.render(items=items)
    if new_content != content:
        with open("hugo_site/content/Items.md", 'w') as f:
            f.write(new_content)

    print "Sleeping %s ms before refreshing again." % (refresh_time)
    time.sleep(refresh_time/1000.0)

connection.close()


text:
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using GameResolution;

namespace XTKExample
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        GameResolution.VirtualScreen virtualScreen;
        XTK.WindowManager windowManager = new XTK.WindowManager(640, 480);

        public Game()
        {
            graphics = new GraphicsDeviceManager(this);
            //graphics.IsFullScreen = true;
            Content.RootDirectory = "Content";
        }

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            virtualScreen = new VirtualScreen(640, 480, GraphicsDevice);
            Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged);
            Window.AllowUserResizing = true;
            // TODO: Add your initialization logic here

            base.Initialize();
        }

        void Window_ClientSizeChanged(object sender, EventArgs e)
        {
            virtualScreen.PhysicalResolutionChanged();
        }

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        ///
        XTK.Label lbl;

        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            XTK.Theme Theme = XTK.ThemeIO.Load("./XTK.THX", GraphicsDevice);
            Theme.Font = Content.Load<SpriteFont>("Default");
            Theme.FontBold = Content.Load<SpriteFont>("DefaultBold");

            windowManager.Theme = Theme;

            frmNotes testForm1 = new frmNotes(windowManager) { X = 120, Y = 40, Width = 320, Height = 240, BackColor = new Color(170, 170, 170), Text = "Notes" };
            frmTest testForm2 = new frmTest(windowManager) { X = 15, Y = 10, MinimumWidth = 230, Width = 230, MinimumHeight = 240, Height = 240,
                BackColor = new Color(170, 170, 170), Text = "Window", MaximumWidth = 320, MaximumHeight = 400 };
            frmMixer testForm3 = new frmMixer(windowManager) { X = 260, Y = 30, Width = 185, Height = 160, BackColor = new Color(170, 170, 170), Text = "Mixer", Resizable = false };
            frmListBoxes testForm4 = new frmListBoxes(windowManager)
            {
                X = 105,
                Y = 260,
                MinimumWidth = 230,
                Width = 340,
                MinimumHeight = 130,
                Height = 130,
                BackColor = new Color(170, 170, 170),
                Text = "ListBoxes"
            };

            windowManager.Forms.Add(testForm1);
            windowManager.Forms.Add(testForm2);
            windowManager.Forms.Add(testForm3);
            windowManager.Forms.Add(testForm4);

            // TODO: use this.Content to load your game content here
        }

        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
        {
            // TODO: Unload any non ContentManager content here
        }

        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            virtualScreen.Update();

            windowManager.Update(gameTime, virtualScreen);
            // TODO: Add your update logic here

            base.Update(gameTime);
        }

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            virtualScreen.BeginCapture();
            spriteBatch.Begin(SpriteSortMode.BackToFront, null, SamplerState.PointClamp, null, null);

            GraphicsDevice.Clear(Color.Black);
            // drawing goes here
            windowManager.Draw(GraphicsDevice, spriteBatch);

            spriteBatch.End();
            virtualScreen.EndCapture();

            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin(SpriteSortMode.Immediate, null, SamplerState.PointClamp, null, null);
            virtualScreen.Draw(spriteBatch, Color.White);
            spriteBatch.End();

            base.Draw(gameTime);
        }
    }
}


text:
<?php

namespace NoGlitches;

use ALttP\Item;
use ALttP\World;
use TestCase;

/**
 * @group NoGlitches
 */
class DesertPalaceTest extends TestCase
{
    public function setUp(): void
    {
        parent::setUp();
        $this->world = World::factory('standard', ['difficulty' => 'test_rules', 'logic' => 'NoGlitches']);
        $this->addCollected(['RescueZelda']);
        $this->collected->setChecksForWorld($this->world->id);
    }

    public function tearDown(): void
    {
        parent::tearDown();
        unset($this->world);
    }

    /**
     * @param bool $access
     * @param array $items
     * @param array $except
     *
     * @dataProvider entryPool
     */
    public function testEntry(bool $access, array $items, array $except = [])
    {
        if (count($except)) {
            $this->collected = $this->allItemsExcept($except);
        }

        $this->addCollected($items);

        $this->assertEquals($access, $this->world->getRegion('Desert Palace')
            ->canEnter($this->world->getLocations(), $this->collected));
    }

    public function entryPool()
    {
        return [
            [false, []],
            [true, ['BookOfMudora']],
            [true, ['Flute', 'MagicMirror', 'ProgressiveGlove', 'ProgressiveGlove']],
            [true, ['Flute', 'MagicMirror', 'TitansMitt']],
        ];
    }

    /**
     * @param string $location
     * @param bool $access
     * @param string $item
     * @param array $items
     * @param array $except
     *
     * @dataProvider fillPool
     */
    public function testFillLocation(string $location, bool $access, string $item, array $items = [], array $except = [])
    {
        if (count($except)) {
            $this->collected = $this->allItemsExcept($except);
        }

        $this->addCollected($items);

        $this->assertEquals($access, $this->world->getLocation($location)
            ->fill(Item::get($item, $this->world), $this->collected));
    }

    public function fillPool()
    {
        return [
            ["Desert Palace - Big Key Chest", false, 'KeyP2', [], ['KeyP2']],
            ["Desert Palace - Compass Chest", false, 'KeyP2', [], ['KeyP2']],

            ["Desert Palace - Big Chest", false, 'BigKeyP2', [], ['BigKeyP2']],

            ["Desert Palace - Boss", false, 'BigKeyP2', [], ['BigKeyP2']],
            ["Desert Palace - Boss", false, 'KeyP2', [], ['KeyP2']],
        ];
    }

    /**
     * @param string $location
     * @param bool $access
     * @param array $items
     * @param array $except
     *
     * @dataProvider accessPool
     */
    public function testLocation(string $location, bool $access, array $items, array $except = [])
    {
        if (count($except)) {
            $this->collected = $this->allItemsExcept($except);
        }

        $this->addCollected($items);

        $this->assertEquals($access, $this->world->getLocation($location)
            ->canAccess($this->collected));
    }

    public function accessPool()
    {
        return [
            ["Desert Palace - Map Chest", false, []],
            ["Desert Palace - Map Chest", true, ['BookOfMudora']],
            ["Desert Palace - Map Chest", true, ['Flute', 'MagicMirror', 'ProgressiveGlove', 'ProgressiveGlove']],
            ["Desert Palace - Map Chest", true, ['Flute', 'MagicMirror', 'TitansMitt']],

            ["Desert Palace - Big Chest", false, []],
            ["Desert Palace - Big Chest", true, ['BookOfMudora', 'BigKeyP2']],
            ["Desert Palace - Big Chest", true, ['Flute', 'MagicMirror', 'ProgressiveGlove', 'ProgressiveGlove', 'BigKeyP2']],
            ["Desert Palace - Big Chest", true, ['Flute', 'MagicMirror', 'TitansMitt', 'BigKeyP2']],

            ["Desert Palace - Torch", false, []],
            ["Desert Palace - Torch", false, [], ['PegasusBoots']],
            ["Desert Palace - Torch", true, ['BookOfMudora', 'PegasusBoots']],
            ["Desert Palace - Torch", true, ['Flute', 'MagicMirror', 'ProgressiveGlove', 'ProgressiveGlove', 'PegasusBoots']],
            ["Desert Palace - Torch", true, ['Flute', 'MagicMirror', 'TitansMitt', 'PegasusBoots']],

            ["Desert Palace - Compass Chest", false, []],
            ["Desert Palace - Compass Chest", false, [], ['KeyP2']],
            ["Desert Palace - Compass Chest", true, ['BookOfMudora', 'KeyP2']],
            ["Desert Palace - Compass Chest", true, ['Flute', 'MagicMirror', 'ProgressiveGlove', 'ProgressiveGlove', 'KeyP2']],
            ["Desert Palace - Compass Chest", true, ['Flute', 'MagicMirror', 'TitansMitt', 'KeyP2']],

            ["Desert Palace - Big Key Chest", false, []],
            ["Desert Palace - Big Key Chest", false, [], ['KeyP2']],
            ["Desert Palace - Big Key Chest", true, ['BookOfMudora', 'KeyP2']],
            ["Desert Palace - Big Key Chest", true, ['Flute', 'MagicMirror', 'ProgressiveGlove', 'ProgressiveGlove', 'KeyP2']],
            ["Desert Palace - Big Key Chest", true, ['Flute', 'MagicMirror', 'TitansMitt', 'KeyP2']],

            ["Desert Palace - Boss", false, []],
            ["Desert Palace - Boss", false, [], ['KeyP2']],
            ["Desert Palace - Boss", false, [], ['BigKeyP2']],
            ["Desert Palace - Boss", false, [], ['Gloves']],
            ["Desert Palace - Boss", false, [], ['Lamp', 'FireRod']],
            ["Desert Palace - Boss", true, ['UncleSword', 'KeyP2', 'BookOfMudora', 'Lamp', 'ProgressiveGlove', 'BigKeyP2']],
            ["Desert Palace - Boss", true, ['UncleSword', 'KeyP2', 'BookOfMudora', 'Lamp', 'PowerGlove', 'BigKeyP2']],
            ["Desert Palace - Boss", true, ['UncleSword', 'KeyP2', 'BookOfMudora', 'Lamp', 'TitansMitt', 'BigKeyP2']],
            ["Desert Palace - Boss", true, ['UncleSword', 'KeyP2', 'BookOfMudora', 'FireRod', 'ProgressiveGlove', 'BigKeyP2']],
            ["Desert Palace - Boss", true, ['UncleSword', 'KeyP2', 'BookOfMudora', 'FireRod', 'PowerGlove', 'BigKeyP2']],
            ["Desert Palace - Boss", true, ['UncleSword', 'KeyP2', 'BookOfMudora', 'FireRod', 'TitansMitt', 'BigKeyP2']],
            ["Desert Palace - Boss", true, ['UncleSword', 'KeyP2', 'Flute', 'MagicMirror', 'Lamp', 'ProgressiveGlove', 'ProgressiveGlove', 'BigKeyP2']],
            ["Desert Palace - Boss", true, ['UncleSword', 'KeyP2', 'Flute', 'MagicMirror', 'Lamp', 'TitansMitt', 'BigKeyP2']],
            ["Desert Palace - Boss", true, ['UncleSword', 'KeyP2', 'Flute', 'MagicMirror', 'FireRod', 'ProgressiveGlove', 'ProgressiveGlove', 'BigKeyP2']],
            ["Desert Palace - Boss", true, ['UncleSword', 'KeyP2', 'Flute', 'MagicMirror', 'FireRod', 'TitansMitt', 'BigKeyP2']],
        ];
    }

    /**
     * @dataProvider dungeonItemsPool
     */
    public function testRegionLockedItems(bool $access, string $item_name, bool $free = null, string $config = null)
    {
        if ($config) {
            config([$config => $free]);
        }

        $this->assertEquals($access, $this->world->getRegion('Desert Palace')->canFill(Item::get($item_name, $this->world)));
    }

    public function dungeonItemsPool()
    {
        return [
            [true, 'Key'],
            [false, 'KeyH2'],
            [false, 'KeyH1'],
            [false, 'KeyP1'],
            [true, 'KeyP2'],
            [false, 'KeyA1'],
            [false, 'KeyD2'],
            [false, 'KeyD1'],
            [false, 'KeyD6'],
            [false, 'KeyD3'],
            [false, 'KeyD5'],
            [false, 'KeyP3'],
            [false, 'KeyD4'],
            [false, 'KeyD7'],
            [false, 'KeyA2'],

            [true, 'BigKey'],
            [false, 'BigKeyH2'],
            [false, 'BigKeyH1'],
            [false, 'BigKeyP1'],
            [true, 'BigKeyP2'],
            [false, 'BigKeyA1'],
            [false, 'BigKeyD2'],
            [false, 'BigKeyD1'],
            [false, 'BigKeyD6'],
            [false, 'BigKeyD3'],
            [false, 'BigKeyD5'],
            [false, 'BigKeyP3'],
            [false, 'BigKeyD4'],
            [false, 'BigKeyD7'],
            [false, 'BigKeyA2'],

            [true, 'Map', false, 'region.wildMaps'],
            [true, 'Map', true, 'region.wildMaps'],
            [false, 'MapH2', false, 'region.wildMaps'],
            [true, 'MapH2', true, 'region.wildMaps'],
            [false, 'MapH1', false, 'region.wildMaps'],
            [true, 'MapH1', true, 'region.wildMaps'],
            [false, 'MapP1', false, 'region.wildMaps'],
            [true, 'MapP1', true, 'region.wildMaps'],
            [true, 'MapP2', false, 'region.wildMaps'],
            [true, 'MapP2', true, 'region.wildMaps'],
            [false, 'MapA1', false, 'region.wildMaps'],
            [true, 'MapA1', true, 'region.wildMaps'],
            [false, 'MapD2', false, 'region.wildMaps'],
            [true, 'MapD2', true, 'region.wildMaps'],
            [false, 'MapD1', false, 'region.wildMaps'],
            [true, 'MapD1', true, 'region.wildMaps'],
            [false, 'MapD6', false, 'region.wildMaps'],
            [true, 'MapD6', true, 'region.wildMaps'],
            [false, 'MapD3', false, 'region.wildMaps'],
            [true, 'MapD3', true, 'region.wildMaps'],
            [false, 'MapD5', false, 'region.wildMaps'],
            [true, 'MapD5', true, 'region.wildMaps'],
            [false, 'MapP3', false, 'region.wildMaps'],
            [true, 'MapP3', true, 'region.wildMaps'],
            [false, 'MapD4', false, 'region.wildMaps'],
            [true, 'MapD4', true, 'region.wildMaps'],
            [false, 'MapD7', false, 'region.wildMaps'],
            [true, 'MapD7', true, 'region.wildMaps'],
            [false, 'MapA2', false, 'region.wildMaps'],
            [true, 'MapA2', true, 'region.wildMaps'],

            [true, 'Compass', false, 'region.wildCompasses'],
            [true, 'Compass', true, 'region.wildCompasses'],
            [false, 'CompassH2', false, 'region.wildCompasses'],
            [true, 'CompassH2', true, 'region.wildCompasses'],
            [false, 'CompassH1', false, 'region.wildCompasses'],
            [true, 'CompassH1', true, 'region.wildCompasses'],
            [false, 'CompassP1', false, 'region.wildCompasses'],
            [true, 'CompassP1', true, 'region.wildCompasses'],
            [true, 'CompassP2', false, 'region.wildCompasses'],
            [true, 'CompassP2', true, 'region.wildCompasses'],
            [false, 'CompassA1', false, 'region.wildCompasses'],
            [true, 'CompassA1', true, 'region.wildCompasses'],
            [false, 'CompassD2', false, 'region.wildCompasses'],
            [true, 'CompassD2', true, 'region.wildCompasses'],
            [false, 'CompassD1', false, 'region.wildCompasses'],
            [true, 'CompassD1', true, 'region.wildCompasses'],
            [false, 'CompassD6', false, 'region.wildCompasses'],
            [true, 'CompassD6', true, 'region.wildCompasses'],
            [false, 'CompassD3', false, 'region.wildCompasses'],
            [true, 'CompassD3', true, 'region.wildCompasses'],
            [false, 'CompassD5', false, 'region.wildCompasses'],
            [true, 'CompassD5', true, 'region.wildCompasses'],
            [false, 'CompassP3', false, 'region.wildCompasses'],
            [true, 'CompassP3', true, 'region.wildCompasses'],
            [false, 'CompassD4', false, 'region.wildCompasses'],
            [true, 'CompassD4', true, 'region.wildCompasses'],
            [false, 'CompassD7', false, 'region.wildCompasses'],
            [true, 'CompassD7', true, 'region.wildCompasses'],
            [false, 'CompassA2', false, 'region.wildCompasses'],
            [true, 'CompassA2', true, 'region.wildCompasses'],
        ];
    }
}


text:
const parser = require('ua-parser-js')

const goodBrowsers = [
  'Vivaldi',
  'Yandex',
  'Blazer',
  'Chrome',
  'Chimera',
  'Chromium',
  'Edge',
  'Opera',
  'Firefox',
  'Mozilla'
]

module.exports = (req, res, next) => {
  const ua = parser(req.headers['user-agent'])
  const browser = ua.browser.name

  let good = false
  if (browser) {
    goodBrowsers.forEach(b => {
      if (browser.includes(b)) good = true
    })
  }

  if (good) return next()
  else res.render('bad-browser', { browser: browser || 'Your unknown browser' })
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="WebApp_ID" version="2.5">

	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>

<!--
	<servlet>
		<servlet-name>ThumbnailServlet</servlet-name>
		<servlet-class>com.soulgalore.servlet.ThumbnailServlet</servlet-class>
		<init-param>
		<description>The valid sizez an image can be converted to</description>
   		<param-name>valid-sizes</param-name>
   		<param-value>460x360,220x172,120x94,80x62,800x626</param-value>
	   </init-param>
	   	<init-param>
		<description>The base directory for the thumbnails</description>
   		<param-name>thumbs-dir</param-name>
   		<param-value>thumbs/</param-value>
	   </init-param>
	   <init-param>
		<description>The directory where the original images are located</description>
   		<param-name>originals-dir</param-name>
   		<param-value>originals/</param-value>
	   </init-param>
	    <init-param>
		<description>The name of the parameter used to access the servlet</description>
   		<param-name>image-request-parameter-name</param-name>
   		<param-value>img</param-value>
	   </init-param>
	</servlet>

	<servlet-mapping>
		<servlet-name>ThumbnailServlet</servlet-name>
		<url-pattern>/thumbs</url-pattern>
	</servlet-mapping>

	 -->

</web-app>


text:
package org.apache.spark.input

import scala.collection.JavaConverters._

import org.apache.hadoop.fs.Path
import org.apache.hadoop.mapreduce.InputSplit
import org.apache.hadoop.mapreduce.JobContext
import org.apache.hadoop.mapreduce.lib.input.CombineFileInputFormat
import org.apache.hadoop.mapreduce.RecordReader
import org.apache.hadoop.mapreduce.TaskAttemptContext

/**
 * A [[org.apache.hadoop.mapreduce.lib.input.CombineFileInputFormat CombineFileInputFormat]] for
 * reading whole text files. Each file is read as key-value pair, where the key is the file path and
 * the value is the entire content of file.
 */

private[spark] class WholeTextFileInputFormat
  extends CombineFileInputFormat[String, String] with Configurable {

  override protected def isSplitable(context: JobContext, file: Path): Boolean = false

  override def createRecordReader(
      split: InputSplit,
      context: TaskAttemptContext): RecordReader[String, String] = {

    val reader =
      new ConfigurableCombineFileRecordReader(split, context, classOf[WholeTextFileRecordReader])
    reader.setConf(getConf)
    reader
  }

  /**
   * Allow minPartitions set by end-user in order to keep compatibility with old Hadoop API,
   * which is set through setMaxSplitSize
   */
  def setMinPartitions(context: JobContext, minPartitions: Int) {
    val files = listStatus(context).asScala
    val totalLen = files.map(file => if (file.isDir) 0L else file.getLen).sum
    val maxSplitSize = Math.ceil(totalLen * 1.0 /
      (if (minPartitions == 0) 1 else minPartitions)).toLong
    super.setMaxSplitSize(maxSplitSize)
  }
}


text:
//
//  FEHeaderMenu.h
//  FEHeaderMenu
//
//  Created by wangzhanfeng-PC on 15/6/25.
//  Copyright (c) 2015年 F.E. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "FEHeaderMenuItem.h"

@class FEHeaderMenu;

typedef NSString *(^titleAtIndex)(NSInteger index, BOOL *isStop);
typedef void      (^itemClickAtIndex)(FEHeaderMenu *menu, NSInteger index, NSString *title);

@interface FEHeaderMenu : UIView

@property (copy,   nonatomic) titleAtIndex     iTitleAtIndex; //获取title
@property (copy,   nonatomic) itemClickAtIndex iItemClickAtIndex; //点击item处理
@property (strong, nonatomic) NSMutableArray   *iTitles; //所有title的集合
//@property (assign, nonatomic) NSInteger        maxItemVisible; //能够显示的最大数量,默认值3;多于maxItemVisible的通过滑动显示
@property (assign, nonatomic) NSInteger  currentIndex; //当前选中的item位置
@property (assign, nonatomic) BOOL       didAddConstranit; //是否添加了constranit

@property (strong, nonatomic) UIColor *itemTitleNormalColor UI_APPEARANCE_SELECTOR; //普通状态的title color
@property (strong, nonatomic) UIColor *itemTitleSelectedColor UI_APPEARANCE_SELECTOR; //选中状态的title color
@property (strong, nonatomic) UIColor *markViewColor UI_APPEARANCE_SELECTOR; //
@property (strong, nonatomic) UIColor *warningViewColor UI_APPEARANCE_SELECTOR; //

/**
 * 初始化菜单界面
 * @param titleAtIndex index位置上显示的title
 * @param clickAtIndex 点击index位置上的item
 */
+ (instancetype)menuWithTitleAtIndex:(titleAtIndex)titleAtIndex clickAtIndex:(itemClickAtIndex)clickAtIndex;

/**
 * 重新布局
 */
- (void)reloadItems;

/**
 * 获取index位置上的title
 * @param index 位置
 */
- (NSString *)titleAtIndexPath:(NSInteger)index;

/**
 * 显示index位置的item
 * @param index 要显示的位置
 * @param animation 是否需要动画
 */
- (void)changeItemToIndex:(NSInteger)index animation:(BOOL)animation;

/**
 * 选中index位置上的item
 * @param index 要显示的位置
 * @param animation 是否需要动画
 */
- (void)selectItemAtIndex:(NSInteger)index animation:(BOOL)animation;

/**
 * 在父类中的UIEdgeInsets
 */
@property (assign, nonatomic) UIEdgeInsets edgeInsetsInSuperView; //

/**
 * 显示index位置的"警告view"
 */
@property (strong, nonatomic) NSMutableArray *warningItems; //
- (void)showWarning:(BOOL)showOrNot AtIndex:(NSInteger)index;

@end


text:
package com.intellij.diagnostic;

import com.intellij.CommonBundle;
import com.intellij.errorreport.ErrorReportSender;
import com.intellij.errorreport.bean.ErrorBean;
import com.intellij.errorreport.error.InternalEAPException;
import com.intellij.errorreport.error.NoSuchEAPUserException;
import com.intellij.errorreport.error.UpdateAvailableException;
import com.intellij.ide.DataManager;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManager;
import com.intellij.idea.IdeaLogger;
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.ErrorReportSubmitter;
import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
import com.intellij.openapi.diagnostic.SubmittedReportInfo;
import com.intellij.openapi.extensions.PluginId;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Consumer;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NonNls;

import javax.swing.*;
import java.awt.*;

/**
 * @author max
 */
public class ITNReporter extends ErrorReportSubmitter {
  private static int previousExceptionThreadId = 0;
  private static boolean wasException = false;
  @NonNls private static final String URL_HEADER = "http://www.intellij.net/tracker/idea/viewSCR?publicId=";

  public String getReportActionText() {
    return DiagnosticBundle.message("error.report.to.jetbrains.action");
  }

  public SubmittedReportInfo submit(IdeaLoggingEvent[] events, Component parentComponent) {
    // obsolete API
    return new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED);
  }

  @Override
  public boolean trySubmitAsync(IdeaLoggingEvent[] events,
                          String additionalInfo,
                          Component parentComponent,
                          Consumer<SubmittedReportInfo> consumer) {
    return sendError(events[0], additionalInfo, parentComponent, consumer);
  }

  /**
   * Could be used to enable error reporting even in release versions from non-internal mode.
   * @return false by default.
   */
  @SuppressWarnings({"MethodMayBeStatic", "UnusedParameters"})
  public boolean showErrorInRelease(IdeaLoggingEvent event) {
    return false;
  }

  /**
     * @noinspection ThrowablePrintStackTrace
     */
  private static boolean sendError(IdeaLoggingEvent event,
                                String additionalInfo,
                                final Component parentComponent,
                                final Consumer<SubmittedReportInfo> callback) {
    ErrorBean errorBean = new ErrorBean(event.getThrowable(), IdeaLogger.ourLastActionId);

    return doSubmit(event, parentComponent, callback, errorBean, additionalInfo);
  }

  private static boolean doSubmit(final IdeaLoggingEvent event,
                               final Component parentComponent,
                               final Consumer<SubmittedReportInfo> callback,
                               final ErrorBean errorBean,
                               final String description) {
    final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent);
    final Project project = CommonDataKeys.PROJECT.getData(dataContext);

    final ErrorReportConfigurable errorReportConfigurable = ErrorReportConfigurable.getInstance();
    if (!errorReportConfigurable.KEEP_ITN_PASSWORD &&
        !StringUtil.isEmpty(errorReportConfigurable.ITN_LOGIN) &&
        StringUtil.isEmpty(errorReportConfigurable.getPlainItnPassword())) {
      final JetBrainsAccountDialog dlg = new JetBrainsAccountDialog(parentComponent);
      dlg.show();
      if (!dlg.isOK()) {
        return false;
      }
    }

    errorBean.setDescription(description);
    errorBean.setMessage(event.getMessage());

    if (previousExceptionThreadId != 0) {
      errorBean.setPreviousException(previousExceptionThreadId);
    }

    Throwable t = event.getThrowable();
    if (t != null) {
      final PluginId pluginId = IdeErrorsDialog.findPluginId(t);
      if (pluginId != null) {
        final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId);
        if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) {
          errorBean.setPluginName(ideaPluginDescriptor.getName());
          errorBean.setPluginVersion(ideaPluginDescriptor.getVersion());
        }
      }
    }

    Object data = event.getData();

    if (data instanceof AbstractMessage) {
      errorBean.setAssigneeId(((AbstractMessage)data).getAssigneeId());
    }

    if (data instanceof LogMessageEx) {
      errorBean.setAttachments(((LogMessageEx)data).getAttachments());
    }

    @NonNls String login = errorReportConfigurable.ITN_LOGIN;
    @NonNls String password = errorReportConfigurable.getPlainItnPassword();
    if (login.trim().length() == 0 && password.trim().length() == 0) {
      login = "idea_anonymous";
      password = "guest";
    }

    ErrorReportSender.sendError(project, login, password, errorBean, new Consumer<Integer>() {
      @SuppressWarnings({"AssignmentToStaticFieldFromInstanceMethod"})
      @Override
      public void consume(Integer threadId) {
        previousExceptionThreadId = threadId;
        wasException = true;
        final SubmittedReportInfo reportInfo = new SubmittedReportInfo(URL_HEADER + threadId, String.valueOf(threadId),
                                                        SubmittedReportInfo.SubmissionStatus.NEW_ISSUE);
        callback.consume(reportInfo);
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            StringBuilder text = new StringBuilder();
            final String url = IdeErrorsDialog.getUrl(reportInfo, true);
            IdeErrorsDialog.appendSubmissionInformation(reportInfo, text, url);
            text.append(".");
            if (reportInfo.getStatus() != SubmittedReportInfo.SubmissionStatus.FAILED) {
              text.append("<br/>").append(DiagnosticBundle.message("error.report.gratitude"));
            }

            NotificationType type = reportInfo.getStatus() == SubmittedReportInfo.SubmissionStatus.FAILED
                                    ? NotificationType.ERROR
                                    : NotificationType.INFORMATION;
            NotificationListener listener = url != null ? new NotificationListener.UrlOpeningListener(true) : null;
            ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT,
                                                    XmlStringUtil.wrapInHtml(text),
                                                    type, listener).setImportant(false).notify(project);
          }
        });
      }
    }, new Consumer<Exception>() {
      @Override
      public void consume(final Exception e) {
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            String msg;
            if (e instanceof NoSuchEAPUserException) {
              msg = DiagnosticBundle.message("error.report.authentication.failed");
            }
            else if (e instanceof InternalEAPException) {
              msg = DiagnosticBundle.message("error.report.posting.failed", e.getMessage());
            }
            else {
              msg = DiagnosticBundle.message("error.report.sending.failure");
            }
            if (e instanceof UpdateAvailableException) {
              String message = DiagnosticBundle.message(
                "error.report.new.eap.build.message", e.getMessage());
                showMessageDialog(parentComponent, project, message, CommonBundle.getWarningTitle(), Messages.getWarningIcon());
              callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED));
            }
            else if (showYesNoDialog(parentComponent, project, msg, ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) {
              callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED));
            }
            else {
              if (e instanceof NoSuchEAPUserException) {
                final JetBrainsAccountDialog dialog;
                if (parentComponent.isShowing()) {
                  dialog = new JetBrainsAccountDialog(parentComponent);
                }
                else {
                  dialog = new JetBrainsAccountDialog(project);
                }
                dialog.show();
              }
              ApplicationManager.getApplication().invokeLater(new Runnable() {
                @Override
                public void run() {
                  doSubmit(event, parentComponent, callback, errorBean, description);
                }
              });
            }
          }
        });
      }
    });
    return true;
  }

  private static void showMessageDialog(Component parentComponent, Project project, String message, String title, Icon icon) {
    if (parentComponent.isShowing()) {
      Messages.showMessageDialog(parentComponent, message, title, icon);
    } else {
      Messages.showMessageDialog(project, message, title, icon);
    }
  }

  private static int showYesNoDialog(Component parentComponent, Project project, String message, String title, Icon icon) {
    if (parentComponent.isShowing()) {
      return Messages.showYesNoDialog(parentComponent, message, title, icon);
    } else {
      return Messages.showYesNoDialog(project, message, title, icon);
    }
  }
}


text:
/**
 * Module dependencies.
 */

var log = require('debug')('democracyos:forgotpassword');
var mongoose = require('mongoose');
var api = require('lib/db-api');
var t = require('t-component');
var config = require('lib/config');
var url = require('url');
var notifier = require('notifier-client')(config.notifications);

var Citizen = mongoose.model('Citizen');

/**
 * Creates a forgot password token and sends it to the citizen by email
 *
 * @param {String} email Email of the citizen who forgot his/her password
 * @param {Obehect} meta user's ip, user-agent, etc
 * @param {Function} callback Callback accepting `err` and `citizen`
 * @api public
 */

exports.createToken = function createToken (email, meta, callback) {
  log('password reset token creation requested. email : [%s]', email);

  if (2 === arguments.length) {
    callback = meta;
    meta = {};
  }

  Citizen.findByEmail(email, function (err, citizen){
    if (err) return callback(err);
    if (!citizen) return callback(new Error(t('common.no-user-for-email') + ' ' + email));

    log('Password reset token creation requested for citizen [%s]', citizen.id);

    api.token.createPasswordResetToken(citizen, meta, function (err, token) {
      if (err) return callback(err);

      var resetUrl = url.format({
          protocol: config('protocol')
        , hostname: config('host')
        , port: config('publicPort')
        , pathname: '/forgot/reset/' + token.id
      });

      var event = 'forgot-password';

      if (notifier.enabled()) {
        notifier.notify(event)
          .to(citizen.email)
          .withData( {
            resetUrl: resetUrl
          })
          .send(function (err, data) {
            if (err) {
              log('Error when sending notification for event %s to user %j', event, citizen);
              return callback(err);
            }

            return callback(null, data);
          });
      } else {
        log('Notifier is disabled: unable to send pasword-reset mail to user');
        return callback();
      }
    });
  });
}

/**
 * Verify the token is valid
 *
 * @param {String} token Token id to be validated
 * @param {Function} callback Callback accepting `err` and Token
 * @api public
 */

exports.verifyToken = function verifyToken (tokenId, callback) {
  log('token validation requested. token : [%s]', tokenId);
  api.token.get(tokenId, function (err, token){
    log('Token.findById result err : [%j] token : [%j]', err, token);
    if (err) return callback(err);
    if (!token) {
      return callback(new Error("No token for id " + tokenId));
    }
    return callback(null, token);
  });
}

/**
 * Resets user password if a valid token is provided
 *
 * @param {Object} formData contains password and token
 * @param {Function} callback Callback accepting `err` and `citizen`
 * @api public
 */

exports.resetPassword = function resetPassowrd (formData, callback) {
  log('password reset requested. token : [%s]', formData.token);
  exports.verifyToken(formData.token, function(err, token){
    if (err) return callback(err);
    log('password reset requested. token : [%s]. token verified', formData.token);
    api.citizen.get(token.user, function (err, citizen){
      if (err) return callback(err);
      log('about to reset password. citizen : [%s].', citizen.id);
      citizen.setPassword(formData.password, function(err) {
        if (err) return callback(err);
        log('password reseted, but citizen not saved yet. citizen : [%s].', citizen.id);
        citizen.save(function (err) {
          if (err) return callback(err);
          log('Saved citizen [%s]', citizen.id);
          token.remove(function (err) {
            if (err) return callback(err);
            log('Token removed [%j]', token);
            return callback(err, citizen);
          });
        });
      });
    });
  });
}


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

		<meta http-equiv="content-type" content="text/html;charset=utf-8" />

		<title>iChm File Management</title>

		<form action="/files" enctype="multipart/form-data" method="post" class='upload'>
			Select file:
			<input id="newfile" name="newfile" size="40" type="file" />
			<input name="commit" type="submit" value="Upload" class='button' />
		</form>

Name	Delete


text:
package code.snippet

import _root_.scala.xml.{NodeSeq, Text}
import _root_.net.liftweb.util._
import _root_.net.liftweb.mapper._
import _root_.net.liftweb.common._
import _root_.net.liftweb.http.S
import net.liftweb.http.{S,DispatchSnippet,Paginator,PaginatorSnippet,
  SortedPaginator,SortedPaginatorSnippet}
import net.liftweb.mapper.view.{SortedMapperPaginatorSnippet,SortedMapperPaginator}
import _root_.java.util.Date
import code.lib._
import code.model.Message
import code.model.Recipient
import Helpers._
import S.?

class Messages extends DispatchSnippet {

  override def dispatch = {
    case "count" => count _
    case "all" => all _
    case "top" => top _
    case "paginate" => paginator.paginate _

    case "detail" => detail _
  }

  def count(xhtml: NodeSeq): NodeSeq = Text(Message.count.toString)

  val paginator = new SortedMapperPaginatorSnippet(Message,Message.id, "ID" -> Message.id){
    override def itemsPerPage = 20
    _sort = (0,false)
    override def prevXml: NodeSeq = Text(?("Prev"))
    override def nextXml: NodeSeq = Text(?("Next"))
    override def firstXml: NodeSeq = Text(?("First"))
    override def lastXml: NodeSeq = Text(?("Last"))
  }

  protected def many(messages: List[Message], xhtml: NodeSeq): NodeSeq =
    messages.flatMap(a => single(a,xhtml))

  protected def single(m: Message, xhtml: NodeSeq): NodeSeq = {
    val humanSubject = if (m.subject.is == null || m.subject.is == "") { "(No Subject)" } else { m.subject }
    bind("a", xhtml,
      "recipients" -> m.recipientsPrintable,
      "sender" -> m.sender,
      "subject" -> m.subject,
      "sent" -> {m.sentDate},
      "linkedsubject" -%> {humanSubject}
    )
  }

  // Display all entries the paginator returns
  def all(xhtml: NodeSeq): NodeSeq = many(paginator.page,xhtml)

  // Show pagination links
  def paginate(xhtml: NodeSeq) {
    paginator.paginate(xhtml)
  }

  // Show most recent, no pagination offsets
  def top(xhtml: NodeSeq) = {
    val count = S.attr("count", _.toInt) openOr 20
    many(Message.findAll(MaxRows(count), OrderBy(Message.id, Descending)),xhtml)
  }

  def detail(xhtml: NodeSeq) = {
    val msgid = S.param("msgId") getOrElse {"0"}
    val message : Box[Message] = Message.getMessageById(msgid.toLong)

    message match {
      case Full(m) =>
        bind("message", xhtml,
          "sender" -> m.sender,
          "subject" -> m.subject,
          "sent" -> {m.sentDate},
          "textContent" -> m.textContent,
          "recipients" -> m.recipientsPrintable,
          "headers" -> m.getHeaders(),
          "attachments" -> m.getAttachments().flatMap({x=>x}))
      case _ => {?("Could not find message")}
    }
  }
}


text:
#ifndef	IA32_CPU_INSTRUCTION_FLAG_CTRL_H__
#define	IA32_CPU_INSTRUCTION_FLAG_CTRL_H__

#ifdef __cplusplus
extern "C" {
#endif

void STC(void);
void CLC(void);
void CMC(void);
void CLD(void);
void STD(void);
void LAHF(void);
void SAHF(void);
void PUSHF_Fw(void);
void PUSHFD_Fd(void);
void POPF_Fw(void);
void POPFD_Fd(void);
void STI(void);
void CLI(void);

#ifdef __cplusplus
}
#endif

#endif	/* IA32_CPU_INSTRUCTION_FLAG_CTRL_H__ */


text:
package org.cutyou.ircbot.plugins.github.payloads;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang.builder.ToStringBuilder;

import java.io.Serializable;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class Repository implements Serializable {

    @JsonIgnore
    private final static long serialVersionUID = 5597867829088303763L;

    @JsonProperty("projects")
    private Projects projects;

    @JsonProperty("releases")
    private Releases releases;

    @JsonProperty("refs")
    private Refs refs;

    @JsonProperty("releases")
    public Releases getReleases() {
        return releases;
    }

    @JsonProperty("releases")
    public void setReleases(Releases releases) {
        this.releases = releases;
    }

    public Repository withReleases(Releases releases) {
        this.releases = releases;
        return this;
    }

    @JsonProperty("refs")
    public Refs getRefs() {
        return refs;
    }

    @JsonProperty("refs")
    public void setRefs(Refs refs) {
        this.refs = refs;
    }

    public Repository withRefs(Refs refs) {
        this.refs = refs;
        return this;
    }

    @JsonProperty("object")
    private Object object;

    @JsonProperty("object")
    public Object getObject() {
        return object;
    }

    @JsonProperty("object")
    public void setObject(Object object) {
        this.object = object;
    }

    @JsonProperty("projects")
    public Projects getProjects() {
        return projects;
    }

    @JsonProperty("projects")
    public void setProjects(Projects projects) {
        this.projects = projects;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this).append("projects", projects).append("releases", releases).append("refs", refs).append("object", object).toString();
    }

}


text:
<?php
# MetInfo Enterprise Content Management System
# Copyright (C) MetInfo Co.,Ltd (http://www.metinfo.cn). All rights reserved.
$depth='../';
require_once $depth.'../login/login_check.php';
require_once ROOTPATH.'public/php/searchhtml.inc.php';
$serch_sql=" where lang='$lang' ";
if($readok!="") $serch_sql.=" and readok='$readok' ";
$order_sql=" order by id desc ";
if($customerid) { $serch_sql .= " and customerid='$customerid' "; }
if($search == "detail_search") {
	if($useinfo) { $serch_sql .= " and useinfo like '%$useinfo%' "; }
	$total_count = $db->counter($met_message, "$serch_sql", "*");
} else {
	$total_count = $db->counter($met_message, "$serch_sql", "*");
}
require_once 'include/pager.class.php';
$page = (int)$page;
if($page_input){$page=$page_input;}
$list_num = 20;
$rowset = new Pager($total_count,$list_num,$page);
$from_record = $rowset->_offset();
$query = "SELECT * FROM {$met_message} {$serch_sql} {$order_sql} LIMIT {$from_record}, {$list_num}";
$result = $db->query($query);
while($list= $db->fetch_array($result)){
	$list['customerid']=$list['customerid']=='0'?$lang_feedbackAccess0:$list['customerid'];
	if($met_member_use){
		switch($list['access']){
			case '1':$list['access']=$lang_access1;break;
			case '2':$list['access']=$lang_access2;break;
			case '3':$list['access']=$lang_access3;break;
			default: $list['access']=$lang_access0;break;
		}
	}
	$list[readok] = $list[readok] ? $lang_yes : $lang_no;
	$message_list[]=$list;
}
$messagesName1=$db->get_one("select value from $met_config where name='met_message_fd_class' and lang='$lang'");
$messagesName2=$db->get_one("select value from $met_config where name='met_message_fd_sms' and lang='$lang'");
$messagesName3=$db->get_one("select value from $met_config where name='met_message_fd_email' and lang='$lang'");
for($i=1;$i<4;$i++){
	$messagesName='messagesName'.$i;
	$messagesName=$$messagesName;
	$query="select * from $met_mlist where paraid=$messagesName[value] and lang='$lang' order by listid desc";
	$result=$db->query($query);
	while($list= $db->fetch_array($result)){
		$messagesNames[$i][]=$list;
	}
}
$page_list = $rowset->link("index.php?anyid={$anyid}&search={$search}&readok={$readok}&useinfo={$useinfo}&lang={$lang}&class1=$class1&page=");
$listclass[1]='class="now"';
$css_url=$depth."../templates/".$met_skin."/css";
$img_url=$depth."../templates/".$met_skin."/images";
include template('content/message/message');
footer();
# This program is an open source system, commercial use, please consciously to purchase commercial license.
# Copyright (C) MetInfo Co., Ltd. (http://www.metinfo.cn). All rights reserved.
?>


text:
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

using System;
using System.Collections.Generic;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.Storage.Provider;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace SDKTemplate
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class Scenario4 : Page
    {
        MainPage rootPage = MainPage.Current;

        public Scenario4()
        {
            this.InitializeComponent();
            SaveFileButton.Click += new RoutedEventHandler(SaveFileButton_Click);
        }

        private async void SaveFileButton_Click(object sender, RoutedEventArgs e)
        {
            // Clear previous returned file name, if it exists, between iterations of this scenario
            OutputTextBlock.Text = "";

            FileSavePicker savePicker = new FileSavePicker();
            savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
            // Dropdown of file types the user can save the file as
            savePicker.FileTypeChoices.Add("Plain Text", new List<string>() { ".txt" });
            // Default file name if the user does not type one in or select a file to replace
            savePicker.SuggestedFileName = "New Document";
            StorageFile file = await savePicker.PickSaveFileAsync();
            if (file != null)
            {
                // Prevent updates to the remote version of the file until we finish making changes and call CompleteUpdatesAsync.
                CachedFileManager.DeferUpdates(file);
                // write to file
                await FileIO.WriteTextAsync(file, file.Name);
                // Let Windows know that we're finished changing the file so the other app can update the remote version of the file.
                // Completing updates may require Windows to ask for user input.
                FileUpdateStatus status = await CachedFileManager.CompleteUpdatesAsync(file);
                if (status == FileUpdateStatus.Complete)
                {
                    OutputTextBlock.Text = "File " + file.Name + " was saved.";
                }
                else
                {
                    OutputTextBlock.Text = "File " + file.Name + " couldn't be saved.";
                }
            }
            else
            {
                OutputTextBlock.Text = "Operation cancelled.";
            }
        }
    }
}


text:
package net.sourceforge.pmd.lang.java.symboltable;

import java.io.StringReader;

import net.sourceforge.pmd.lang.LanguageRegistry;
import net.sourceforge.pmd.lang.LanguageVersion;
import net.sourceforge.pmd.lang.LanguageVersionHandler;
import net.sourceforge.pmd.lang.java.JavaLanguageModule;
import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit;
import net.sourceforge.pmd.lang.java.symboltable.SymbolFacade;

public abstract class STBBaseTst {

    protected ASTCompilationUnit acu;
    protected SymbolFacade stb;

    protected void parseCode(String code) {
        parseCode(code, LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("1.4"));
    }

    protected void parseCode15(String code) {
        parseCode(code, LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("1.5"));
    }

    protected void parseCode(String code, LanguageVersion languageVersion) {
   	  LanguageVersionHandler languageVersionHandler = LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getDefaultVersion().getLanguageVersionHandler();
	acu = (ASTCompilationUnit)languageVersionHandler.getParser(languageVersionHandler.getDefaultParserOptions()).parse(null, new StringReader(code));
        stb = new SymbolFacade();
        stb.initializeWith(acu);
    }
}


text:
<?php
declare(strict_types=1);

namespace Rmtram\ArrayQuery\Queries\Operators;

/**
 * Class Nil
 * @package Rmtram\ArrayQuery\Queries\Operators
 */
class Nil implements OperatorInterface
{
    use Findable;

    /**
     * @param Parameter $parameter
     * @param array $item
     * @return bool
     */
    public function evaluate(Parameter $parameter, array $item): bool
    {
        $key = $parameter->getKey();
        $checkExistsKey = $parameter->getVal() === true;
        if ($checkExistsKey) {
            return $this->finder->existsKey($key, $item) && is_null($this->finder->find($key, $item));
        }
        return is_null($this->finder->find($key, $item));
    }
}


text:
set -e
echo $PWD

get_absolute_path () {
    if [[ $1 == /* ]]
    then
        echo $1
    else
        echo "$PWD/${1#./}"
    fi
}

unpack_wheel () {
    local wheel=$1
    local unpack_dir=$(mktemp -dt "tempdir.XXX")
    local packagename=$(python3 -m wheel unpack $wheel -d $unpack_dir | sed -e 's/.*\/\(.*\)...OK/\1/')
    echo $unpack_dir/$packagename
}

extract_lib () {
    local wheel=$1
    local package_path=$(unpack_wheel $wheel)
    echo $package_path/$lib_src_path/$lib_name*.$lib_ext
}

repack_wheel () {
    local wheel=$1
    local lib_path=$2
    local output_dir=$3
    local package_path=$(unpack_wheel $wheel)
    mkdir -p $package_path/$lib_dest_path
    mv $lib_path $package_path/$lib_dest_path/$lib_name.$lib_ext
    mkdir -p $output_dir
    python3 -m wheel pack $package_path -d $output_dir
}

lib_dest_path=snap7/lib
lib_name=libsnap7

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
    lib_src_path=python_snap7.libs/
    lib_ext=so
    ls_pattern=manylinux
else
    lib_src_path=snap7/.dylibs/
    lib_ext=dylib
    ls_pattern=macosx
fi

# set absolute path for directories from args. Default value is current directory
platform_wheel_dir=$(get_absolute_path $1)
pure_wheel_dir=$(get_absolute_path $2)
output_dir=$(get_absolute_path $3)
echo $(ls -la $platform_wheel_dir)

platform_wheel=$(ls $platform_wheel_dir/*.whl | head -n1)
pure_wheel=$(ls $pure_wheel_dir/*.whl | head -n1)

lib_path=$(extract_lib $platform_wheel)
echo $lib_path
repack_wheel $pure_wheel $lib_path $output_dir