text:
using Aspose.Words;
using Aspose.Words.Drawing;
using Aspose.Words.Tables;
using NUnit.Framework;

namespace DocsExamples.Programming_with_Documents
{
    internal class WorkingWithHeadersAndFooters : DocsExamplesBase
    {
        [Test]
        public void CreateHeaderFooter()
        {
            //ExStart:CreateHeaderFooterUsingDocBuilder
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            Section currentSection = builder.CurrentSection;
            PageSetup pageSetup = currentSection.PageSetup;
            // Specify if we want headers/footers of the first page to be different from other pages.
            // You can also use PageSetup.OddAndEvenPagesHeaderFooter property to specify
            // different headers/footers for odd and even pages.
            pageSetup.DifferentFirstPageHeaderFooter = true;
            pageSetup.HeaderDistance = 20;

            builder.MoveToHeaderFooter(HeaderFooterType.HeaderFirst);
            builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;

            builder.Font.Name = "Arial";
            builder.Font.Bold = true;
            builder.Font.Size = 14;

            builder.Write("Aspose.Words Header/Footer Creation Primer - Title Page.");

            pageSetup.HeaderDistance = 20;
            builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);

            // Insert a positioned image into the top/left corner of the header.
            // Distance from the top/left edges of the page is set to 10 points.
            builder.InsertImage(ImagesDir + "Graphics Interchange Format.gif", RelativeHorizontalPosition.Page, 10,
                RelativeVerticalPosition.Page, 10, 50, 50, WrapType.Through);

            builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;

            builder.Write("Aspose.Words Header/Footer Creation Primer.");

            builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);

            // We use a table with two cells to make one part of the text on the line (with page numbering).
            // To be aligned left, and the other part of the text (with copyright) to be aligned right.
            builder.StartTable();

            builder.CellFormat.ClearFormatting();

            builder.InsertCell();

            builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(100 / 3);

            // It uses PAGE and NUMPAGES fields to auto calculate the current page number and many pages.
            builder.Write("Page ");
            builder.InsertField("PAGE", "");
            builder.Write(" of ");
            builder.InsertField("NUMPAGES", "");

            builder.CurrentParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Left;

            builder.InsertCell();

            builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(100 * 2 / 3);

            builder.Write("(C) 2001 Aspose Pty Ltd. All rights reserved.");

            builder.CurrentParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Right;

            builder.EndRow();
            builder.EndTable();

            builder.MoveToDocumentEnd();

            // Make a page break to create a second page on which the primary headers/footers will be seen.
            builder.InsertBreak(BreakType.PageBreak);
            builder.InsertBreak(BreakType.SectionBreakNewPage);

            currentSection = builder.CurrentSection;
            pageSetup = currentSection.PageSetup;
            pageSetup.Orientation = Orientation.Landscape;
            // This section does not need a different first-page header/footer we need only one title page in the document,
            // and the header/footer for this page has already been defined in the previous section.
            pageSetup.DifferentFirstPageHeaderFooter = false;

            // This section displays headers/footers from the previous section
            // by default call currentSection.HeadersFooters.LinkToPrevious(false) to cancel this page width
            // is different for the new section, and therefore we need to set different cell widths for a footer table.
            currentSection.HeadersFooters.LinkToPrevious(false);

            // If we want to use the already existing header/footer set for this section.
            // But with some minor modifications, then it may be expedient to copy headers/footers
            // from the previous section and apply the necessary modifications where we want them.
            CopyHeadersFootersFromPreviousSection(currentSection);

            HeaderFooter primaryFooter = currentSection.HeadersFooters[HeaderFooterType.FooterPrimary];

            Row row = primaryFooter.Tables[0].FirstRow;
            row.FirstCell.CellFormat.PreferredWidth = PreferredWidth.FromPercent(100 / 3);
            row.LastCell.CellFormat.PreferredWidth = PreferredWidth.FromPercent(100 * 2 / 3);

            doc.Save(ArtifactsDir + "WorkingWithHeadersAndFooters.CreateHeaderFooter.docx");
            //ExEnd:CreateHeaderFooterUsingDocBuilder
        }

        //ExStart:CopyHeadersFootersFromPreviousSection
        /// <summary>
        /// Clones and copies headers/footers form the previous section to the specified section.
        /// </summary>
        private void CopyHeadersFootersFromPreviousSection(Section section)
        {
            Section previousSection = (Section)section.PreviousSibling;

            if (previousSection == null)
                return;

            section.HeadersFooters.Clear();

            foreach (HeaderFooter headerFooter in previousSection.HeadersFooters)
                section.HeadersFooters.Add(headerFooter.Clone(true));
        }
        //ExEnd:CopyHeadersFootersFromPreviousSection
    }
}


text:
package org.bitcoins.testkit.chain

import org.bitcoins.chain.models.{BlockHeaderDb, BlockHeaderDbHelper}
import org.bitcoins.core.crypto
import org.bitcoins.core.crypto.DoubleSha256DigestBE
import org.bitcoins.core.protocol.blockchain.{
  BlockHeader,
  MainNetChainParams,
  RegTestNetChainParams
}
import org.bitcoins.rpc.client.common.BitcoindRpcClient

import scala.concurrent.{ExecutionContext, Future}

sealed abstract class ChainTestUtil {
  lazy val regTestChainParams: RegTestNetChainParams.type =
    RegTestNetChainParams
  lazy val regTestHeader: BlockHeader =
    regTestChainParams.genesisBlock.blockHeader
  lazy val regTestGenesisHeaderDb: BlockHeaderDb = {
    BlockHeaderDbHelper.fromBlockHeader(height = 0, bh = regTestHeader)
  }

  lazy val mainnetChainParam: MainNetChainParams.type = MainNetChainParams

  lazy val blockHeader562375 = BlockHeader.fromHex(
    "0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c")

  lazy val blockHeader562462 = BlockHeader.fromHex(
    "0100000053fb045b4d3ca149faca8e7ea53cdb3168bc58b875e47196b3a6b3f100000000406468307c915485a9c9eabe31cc853e68311176e07e71475c3e26888fb7b7ed30846949ffff001d2b740f74")

  lazy val blockHeader562463 = BlockHeader.fromHex(
    "010000003ce6c27ae14022e4b6ea0a5c3633d156e3e3a47509c1adf085371ba300000000f01258747019514aa5c475cddd59a309347280ead98d19d8df8f9f99eb56757938866949ffff001d18bcb4f8")

  lazy val blockHeader562464 = BlockHeader.fromHex(
    "010000004bd0b78e90c6b0f361f395535ac170980de0c8214380daefce31fd1100000000282c9db8313817b4835efab229872eae2b8b5011c2e90ed14e57192984da062359896949ffff001d15c6aed8")

  /** Contains block headers where a proof of work change is valid */
  object ValidPOWChange {

    //this is the first block in the 2016 block proof of work difficulty change interval
    //https://blockstream.info/block/0000000000000000002567dc317da20ddb0d7ef922fe1f9c2375671654f9006c
    lazy val blockHeader564480 = BlockHeader.fromHex(
      "000000200cd536b3eb1cd9c028e081f1455006276b293467c3e5170000000000000000007bc1b27489db01c85d38a4bc6d2280611e9804f506d83ad00d2a33ebd663992f76c7725c505b2e174fb90f55")

    lazy val blockHeaderDb564480 =
      BlockHeaderDbHelper.fromBlockHeader(564480, blockHeader564480)

    lazy val blockHeader566494 = BlockHeader.fromHex(
      "00000020ea2cb07d670ddb7a158e72ddfcfd9e1b9bf4459278bb240000000000000000004fb33054d79de69bb84b4d5c7dd87d80473c416320427a882c72108f7e43fd0c3d3e855c505b2e178f328fe2")

    lazy val blockHeaderDb566494 =
      BlockHeaderDbHelper.fromBlockHeader(566594, blockHeader566494)

    lazy val blockHeader566495 = BlockHeader.fromHex(
      "000000202164d8c4e5246ab003fdebe36c697b9418aa454ec4190d00000000000000000059134ad5aaad38a0e75946c7d4cb09b3ad45b459070195dd564cde193cf0ef29c33e855c505b2e17f61af734")

    lazy val blockHeaderDb566495 =
      BlockHeaderDbHelper.fromBlockHeader(566495, blockHeader566495)

    //https://blockstream.info/block/00000000000000000015fea169c62eb0a1161aba36932ca32bc3785cbb3480bf
    lazy val blockHeader566496 = BlockHeader.fromHex(
      "000000201b61e8961710991a47ff8187d946d93e4fb33569c09622000000000000000000d0098658f53531e6e67fc9448986b5a8f994da42d746079eabe10f55e561e243103f855c17612e1735c4afdb")

    lazy val blockHeaderDb566496 =
      BlockHeaderDbHelper.fromBlockHeader(566496, blockHeader566496)
  }

  /** Creates a best block header function for [[org.bitcoins.chain.blockchain.sync.ChainSync.sync() ChainSync.sync]] */
  def bestBlockHashFnRpc(bitcoindF: Future[BitcoindRpcClient])(
      implicit ec: ExecutionContext): () => Future[DoubleSha256DigestBE] = {
    () =>
      bitcoindF.flatMap(_.getBestBlockHash)
  }

  /** Creates a getBlocKHeader function for [[org.bitcoins.chain.blockchain.sync.ChainSync.sync() ChainSync.sync]] */
  def getBlockHeaderFnRpc(bitcoindF: Future[BitcoindRpcClient])(
      implicit ec: ExecutionContext): DoubleSha256DigestBE => Future[
    BlockHeader] = { hash: crypto.DoubleSha256DigestBE =>
    bitcoindF.flatMap(_.getBlockHeader(hash).map(_.blockHeader))
  }
}

object ChainTestUtil extends ChainTestUtil

redpajama_set_name: RedPajamaGithub


text:
TypeScript decorator to conditionally trace method calls via https://github.com/visionmedia/debug

[![Build Status](https://travis-ci.org/kalahari/typescript-debug.svg?branch=master)](https://travis-ci.org/kalahari/typescript-debug)

## usage
Below is a simple usage scenario for the `TraceClass` decorator. The configuration options are not yet documented
but you can find them in `lib/index.ts`.

### Given the input file `trace-example.ts`:
```ts
import {TraceClass} from "typescript-debug";

@TraceClass({ tracePrefix: "example" })
class TraceExample {
	constructor(public abc: string) { }
	public getAbc() {
		return this.abc;
	}
	public combineWithAbc(xyz: string) {
		return this.getAbc() + " and " + xyz;
	}
}

let te = new TraceExample("ABC");
te.combineWithAbc("XYZ");
```

### Trace output would look like this:
```
blake@ignignokt:~/example$ tsc --module commonjs --target es5 --experimentalDecorators trace-example.ts
blake@ignignokt:~/example$ DEBUG=\* node trace-example.js
  example:TraceExample new(ABC) +0ms
  example:TraceExample combineWithAbc(XYZ) +4ms
  example:TraceExample getAbc() +3ms
  example:TraceExample getAbc: ABC +0ms
  example:TraceExample combineWithAbc: ABC and XYZ +0ms
```
> Note that the output is normally colorized in your console by `debug`.


text:
import template from './list.html';

function DestinationsCtrl($scope, $location, toastr, currentUser, Events, Destination) {
  Events.record('view', 'page', 'admin/destinations');

  $scope.destinations = Destination.query();
}

export default function (ngModule) {
  ngModule.controller('DestinationsCtrl', DestinationsCtrl);

  return {
    '/destinations': {
      template,
      controller: 'DestinationsCtrl',
      title: 'Destinations',
    },
  };
}


text:
<Alloy>
	<Window  exitOnClose="false"   navBarHidden="true"  fullscreen="true" layout="vertical">
		<View id="topbar">
			<ImageView id="topbarimage" ></ImageView>
		</View>
		<View id="subbar">
			<View onClick="backHome" left="0" height="Ti.UI.FILL" width="60dp"  >
				<ImageView   id="homeLink"></ImageView>
			</View>

		</View>
		<View id="wrapper">
			<TableView separatorColor="transparent" id="cardview" bottom="89dp"   layout="vertical"  >
				<TableViewRow>
					<View id="cardform" class="whiteblock" bottom="10dp"   layout="vertical" >
						<View id="formdesc" layout="horizontal"  >
							<ImageView id="cardimg"></ImageView>

						</View>
						<View layout="vertical" top="10" height="Ti.UI.SIZE">
							<TextField id="cardNo" softKeyboardOnFocus="Ti.UI.Android.SOFT_KEYBOARD_HIDE_ON_FOCUS"></TextField>
							<ImageView id="cardSubmit" onClick="submitCard"></ImageView>
							<View width="Ti.UI.FILL" height="10dp"></View>
						</View>
					</View>
				</TableViewRow>
				<TableViewRow  layout="vertical">
					<View id="htmlcontent" width="Ti.UI.FILL"   layout="vertical"></View>
				</TableViewRow>
			</TableView>
			<View id="ad" bottom="89dp" width="Ti.UI.FILL"   ></View>
			<View layout="horizontal" id="bottomNav" bottom="0"></View>
		</View>
	</Window>
</Alloy>


text:
import { Component, OnInit } from '@angular/core';

import { Observable } from 'rxjs/Observable';

import { UserService } from '../user.service';
import { User } from '../user';

@Component({
  selector: 'app-user-list',
  templateUrl: './user-list.component.html',
  styleUrls: ['./user-list.component.css']
})
export class UserListComponent implements OnInit {
  public users: Observable<User[]>;

  constructor(private userService: UserService) { }

  ngOnInit() {
    this.users = this.userService.getUsers();
  }

}


text:
import os
from ConfigParser import ConfigParser

class ConfigException(Exception):
    pass

def get_root_dir():
    fpath = os.path.abspath(__file__)
    (cwdir, fname) = os.path.split(fpath)
    rdir = os.path.abspath(os.path.join(cwdir, '..', '..', '..'))
    return rdir

ROOT_DIR = get_root_dir()
SRC_DIR = os.path.join(ROOT_DIR, 'src')
SH_DIR = os.path.join(SRC_DIR, 'sh')
CONF_FILE = os.path.join(ROOT_DIR, 'config.properties')
if not os.path.exists(CONF_FILE):
    raise ConfigException('Cannot find config file %s! Make one.')

config = ConfigParser()
config.read(CONF_FILE)


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

<TITLE>
DataPacketExtension (Smack 3.3.0 Documentation)
</TITLE>

<META NAME="date" CONTENT="2013-05-04">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

Smack

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.jivesoftware.smackx.bytestreams.ibb.packet

Class DataPacketExtension

java.lang.Object
  org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension

All Implemented Interfaces:
PacketExtension

public class DataPacketExtension
extends java.lang.Object
implements PacketExtension

Represents a chunk of data of an In-Band Bytestream within an IQ stanza or a
 message stanza

Author:

Henning Staib

Field Summary

static java.lang.String
ELEMENT_NAME

          The element name of the data packet extension.

Constructor Summary

DataPacketExtension(java.lang.String sessionID,
                    long seq,
                    java.lang.String data)

          Creates a new In-Band Bytestream data packet.

Method Summary

 java.lang.String
getData()

          Returns the data contained in this packet.

 byte[]
getDecodedData()

          Returns the decoded data or null if data could not be decoded.

 java.lang.String
getElementName()

          Returns the root element name.

 java.lang.String
getNamespace()

          Returns the root element XML namespace.

 long
getSeq()

          Returns the sequence of this packet in regard to the other data packets.

 java.lang.String
getSessionID()

          Returns the unique session ID identifying this In-Band Bytestream.

 java.lang.String
toXML()

          Returns the XML representation of the PacketExtension.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

ELEMENT_NAME

public static final java.lang.String ELEMENT_NAME

The element name of the data packet extension.

See Also:
Constant Field Values

Constructor Detail

DataPacketExtension

public DataPacketExtension(java.lang.String sessionID,
                           long seq,
                           java.lang.String data)

Creates a new In-Band Bytestream data packet.

Parameters:
sessionID - unique session ID identifying this In-Band Bytestream
seq - sequence of this packet in regard to the other data packets
data - the base64 encoded data contained in this packet

Method Detail

getSessionID

public java.lang.String getSessionID()

Returns the unique session ID identifying this In-Band Bytestream.

Returns:
the unique session ID identifying this In-Band Bytestream

getSeq

public long getSeq()

Returns the sequence of this packet in regard to the other data packets.

Returns:
the sequence of this packet in regard to the other data packets.

getData

public java.lang.String getData()

Returns the data contained in this packet.

Returns:
the data contained in this packet.

getDecodedData

public byte[] getDecodedData()

Returns the decoded data or null if data could not be decoded.

 The encoded data is invalid if it contains bad Base64 input characters or
 if it contains the pad ('=') character on a position other than the last
 character(s) of the data. See XEP-0047 Section
 6.

Returns:
the decoded data

getElementName

public java.lang.String getElementName()

Description copied from interface: PacketExtension

Returns the root element name.

Specified by:
getElementName in interface PacketExtension

Returns:
the element name.

getNamespace

public java.lang.String getNamespace()

Description copied from interface: PacketExtension

Returns the root element XML namespace.

Specified by:
getNamespace in interface PacketExtension

Returns:
the namespace.

toXML

public java.lang.String toXML()

Description copied from interface: PacketExtension

Returns the XML representation of the PacketExtension.

Specified by:
toXML in interface PacketExtension

Returns:
the packet extension as XML.

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

Smack

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2007 Jive Software.


text:
#ifndef PARTICLE_HPP
#define PARTICLE_HPP

#include <iostream>
#include <memory>
#include <glm/glm.hpp>
/**
 * @brief Represent a particle affected by physics
 *
 * This class is used to model particles in a dynamic system.
 * A particle has  mass, a velocity and a position.
 * This particle is affected by forces that will change
 * both its position and its velocity. This particle can be fixed,
 * making its position constant and its velocity null, or be
 * a 'phantom' particle
 */

class Particle;
typedef std::shared_ptr<Particle> ParticlePtr;

class Particle
{
public:
    /**
     * @brief Instantiate a dynamic particle
     *
     * Initial positions and velocity are kept to reset the animation
     *
     * @param position The initial position
     * @param velocity The initial speed
     * @param mass The particle mass
     */
    Particle(
	     const glm::vec3& position,
	     const glm::vec3& velocity,
	     const float& mass);
    ~Particle();

    /**@brief Access to this particle's position.
     *
     * Get the position of this particle.
     * @return The particle's position.
     */
    const glm::vec3& getPosition() const;

    glm::vec3 & getPosition();

    /**@brief Access to this particle's velocity.
     *
     * Get the velocity of this particle.
     * @return The particle's velocity.
     */
    const glm::vec3& getVelocity() const;
    /**@brief Access to this particle's applied force.
     *
     * Get the force applied to this particle.
     * @return The particle's applied force.
     */
    const glm::vec3& getForce() const;
    /**@brief Access to this particle's mass.
     *
     * Get the mass of this particle.
     * @return The particle's mass.
     */
    float getMass() const;

    /**@brief Check if this particle is fixed.
     *
     * Check if this particle is fixed.
     * @return True if the particle is fixed.
     */
    bool isFixed() const;

    /**@brief Set the particle's position.
     *
     * Set the position of this particle.
     * @param pos The new position of this particle.
     */
    void setPosition(const glm::vec3 &pos);
    /**@brief Set the particle's velocity.
     *
     * Set the velocity of this particle.
     * @param vel The new velocity of this particle.
     */
    void setVelocity(const glm::vec3 &vel);
    /**@brief Set the particle's applied force.
     *
     * Set the force applied to this particle.
     * @param force The new force applied to this particle.
     */
    void setForce(const glm::vec3 &force);
    /**@brief Set the particle's fixed flag.
     *
     * Set the fixed flag of this particle.
     * @param isFixed The new value of the fixed flag.
     */
    void setFixed(bool isFixed);

    /**@brief Increment the particle's position.
     *
     * Increment the position of this particle.
     * @param pos The position to add to this particle's position,
     * i.e. m_position += pos.
     */
    void incrPosition(const glm::vec3 &pos);
    /**@brief Increment the particle's velocity.
     *
     * Increment the velocity of this particle.
     * @param vel The velocity to add to this particle's velocity,
     * i.e. m_velocity += vel.
     */
    void incrVelocity(const glm::vec3 &vel);
    /**@brief Increment the particle's applied force.
     *
     * Increment the force applied to this particle.
     * @param force The force to add to this particle's applied force,
     * i.e. m_force += force.
     */
    void incrForce(const glm::vec3 &force);

    /**@brief Restart the particle.
     *
     * Set the particle's position and velocity to their initial values.
     */
    void restart();

    /**
     *@brief Check if this particle is dragged.
     *
     * @return True if the particle is dragged.
     */
    bool isDragged() const;
    /**
     * @brief Set the particle's dragged flag.
     */
    void setDragged(bool isDragged);

    /**
     * @brief Function called by the viewer to tell the particle
     * it's been followed
     */
    void setIsFollowedCamera(bool val);
    /**
     * @brief Functions to call to recompute the position of the camera
     * For now, the parameters to compute those parameters are constants
     * in the code, but they later should be passed as arguments
     */
    void recomputeCamera();
    /**
     * @brief Functions to get the camera parameters
     */
    glm::vec3 getCameraPosition();
    glm::vec3 getCameraTarget();

    /**
     * @brief Functions to know how to downcast
     */
    bool isRounded();
    bool isAStick();
    bool isABox();

protected:
    /**@brief The initial particle's position.
     *
     * The initial position of this particle, stored to be set at restart.
     */
    const glm::vec3 m_initialPosition;

    /**@brief The particle's position.
     *
     * The position of this particle.
     */
    glm::vec3 m_position;

    /**@brief The initial particle's velocity.
     *
     * The initial velocity of this particle, stored to be set at restart.
     */
    const glm::vec3 m_initialVelocity;

    /**@brief The particle's velocity.
     *
     * The position of this particle.
     */
    glm::vec3 m_velocity;

    /**@brief The particle's applied force.
     *
     * The force applied to this particle.
     */
    glm::vec3 m_force;

    /**@brief The particle's mass.
     *
     * The mass of this particle.
     */
    float m_mass;

    /**@brief The particle's fixed flag.
     *
     * A flag that tells if this particle is fixed. If set to true,
     * the position should be constant and the velocity null in simulation steps.
     */
    bool m_isFixed = false;

    /**
     * @brief Fields to know how to downcast
     */
    bool m_isRounded = false;
    bool m_isAStick = false;
    bool m_isABox = false;

    /**
     * @brief Fields to set the parameters for the camera to follow the particle
     */
    bool m_isFollowed = false;
    glm::vec3 m_cameraPosition = glm::vec3(0.0, 0.0, 10.0);
    glm::vec3 m_cameraDirection = glm::vec3(1.0, 0.0, 0.0);
    glm::vec3 m_cameraTarget = glm::vec3(0.0, 0.0, 0.0);
    // Boolean used to have a smooth camera
    bool m_initCamera = false;
    glm::vec3 m_oldPosition = glm::vec3(0.0, 0.0, 0.0);
};

/**
 * \brief output stream operator, as non-member
 */
std::ostream& operator<<(std::ostream& os, const ParticlePtr& p);

#endif


text:
require 'cucumber'
require 'cucumber/runtime'
#require 'cucumber/multiline_argument'

module Tzatziki
  class Mappings

    def initialize(features = nil, runtime = nil)
      @features = features || "features"
      @runtime = runtime
    end

    def test_step(step, mapper)
      step_match = runtime.step_match(step.name)
      if step.multiline_arg.kind_of? Cucumber::Core::Ast::EmptyMultilineArgument
        multiline_arg = nil
      else
        multiline_arg = Cucumber::Core::Ast::MultilineArgument.from(step.multiline_arg, step.location)
      end
       mapper.map { step_match.invoke(multiline_arg) }
    rescue Cucumber::Undefined
    end

    def test_case(test_case, mapper)
      scenario = Source.new(test_case).build_scenario
      mapper.before do
        ruby.begin_rb_scenario(scenario)
      end
      ruby.hooks_for(:before, scenario).each do |hook|
        mapper.before do
          hook.invoke('Before', scenario)
        end
      end
      ruby.hooks_for(:after, scenario).each do |hook|
        mapper.after do
          hook.invoke('After', scenario)
        end
      end
      ruby.hooks_for(:around, scenario).each do |hook|
        mapper.around do |run_scenario|
          hook.invoke('Around', scenario, &run_scenario)
        end
      end
    end

    def runtime
      return @runtime if @runtime
      result = Cucumber::Runtime.new

      #Attempt 1
      result.load_programming_language('rb')
      support_files.each do |support_file|
        p "loading #{support_file}"
        load File.expand_path(support_file)
      end
      @runtime = result
    end

    private

    def ruby
      @ruby ||= runtime.load_programming_language('rb')
    end

    def support_files
      Dir["#{@features}/**/*.rb"]
    end

    # adapts our test_case to look like the Cucumber Runtime's Scenario
    class TestCase
      def initialize(test_case, feature)
        @test_case = test_case
        @feature = feature
      end

      def accept_hook?(hook)
        hook.tag_expressions.all? { |expression| @test_case.match_tags?(expression) }
      end

      def language
        @test_case.language
      end

      def feature
        @feature
      end

      def name
        @test_case.name
      end
    end

    class Scenario < TestCase
    end

    class ScenarioOutlineExample < TestCase
      def scenario_outline
        self
      end
    end

    class Source
      def initialize(test_case)
        @test_case = test_case
        test_case.describe_source_to(self)
      end

      def feature(feature)
        @feature = feature
      end

      def scenario(scenario)
        @factory = Scenario
      end

      def scenario_outline(scenario)
        @factory = ScenarioOutlineExample
      end

      def examples_table(examples_table)
      end

      def examples_table_row(row)
      end

      def build_scenario
        @factory.new(@test_case, Feature.new(@feature.name))
      end
    end

    Feature = Struct.new(:name)
  end
end


text:
from yvhai.demo.http.client import HttpRequester
from yvhai.demo.http.proxy import ProxyDemo

if __name__ == "__main__":
    # HttpRequester.demo()
    ProxyDemo.demo()
    print(__file__, 'done')


text:
\documentclass{beamer}

\usepackage{framed}
\usepackage{graphicx}
\usepackage{listings}

\begin{document}

\title[Structs]{Organizing Data with Structs}
\author[Z. Latta]{Zach Latta}
\date[November 2013]{November 20, 2013}

\frame{\titlepage}

\begin{frame}
  \frametitle{Doge}
  \includegraphics[height=3.0in]{doge}
\end{frame}

\begin{frame}
  \frametitle{Doge}
  \includegraphics[height=3.0in]{doge_cage}
\end{frame}

\begin{frame}
  \frametitle{Doge}
  \begin{columns}[c]
    \column{1.5in}
    \begin{itemize}
      \item Such name
      \item Many words
      \item Wow
    \end{itemize}

    \column{1.5in}
    \includegraphics[width=2.0in]{doge}
  \end{columns}
\end{frame}

\begin{frame}[fragile]
  \frametitle{Doge}
  \begin{columns}[c]
    \column{1.5in}
    \begin{itemize}
      \item Two doge
      \item Print name with words
    \end{itemize}

    \column{1.5in}
    Expected output:
    \begin{lstlisting}
    John:
    Such wow
    Many word

    Jane:
    So firetruck
    Many coffee
    \end{lstlisting}

  \end{columns}
\end{frame}

\begin{frame}[fragile]
  \frametitle{The Easy Way Out}

  \begin{lstlisting}[language=go]
  doge1Name := "John"
  doge1Phrases := []string{"Such wow", "Many word"}

  fmt.Println(doge1Name + ":")
  for i := 0; i < len(doge1Phrases); i++ {
    fmt.Println(doge1Phrases[i])
  }
  \end{lstlisting}
\end{frame}

\begin{frame}
  \frametitle{Structs}

  \begin{itemize}
    \item Such encapsulate
      \begin{itemize}
        \item Bundle data together
      \end{itemize}
  \end{itemize}

  \begin{framed}
    \textbf{Doge}

    \begin{itemize}
      \item Name
      \item Phrases
    \end{itemize}
  \end{framed}
\end{frame}

\begin{frame}[fragile]
  \frametitle{Structs}

  \begin{lstlisting}[language=go]
  type Doge struct {
    Name string
    Phrases []string
  }

  func main() {
    doge := Doge{
      Name: "John",
      Phrases: []string{"Such wow", "Many word"},
    }
    fmt.Println(doge.Name)

    for i := 0; i < len(doge.Phrases); i++ {
      fmt.Println(doge.Phrases[i])
    }
  }
  \end{lstlisting}
\end{frame}

\begin{frame}[fragile]
  \frametitle{Structs Scale}

  \begin{itemize}
    \item Structs = Doge++
      \begin{itemize}
        \item Many doge!
      \end{itemize}
    \item Structs make code \textbf{obvious}.
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Exercise}

  \textbf{Create a Doge}

  \begin{itemize}
    \item Attributes
      \begin{itemize}
        \item Name
        \item Phrases
        \item Whether or note the doge is angry.
      \end{itemize}
    \item Make 5 doges and print out their attributes.
  \end{itemize}
\end{frame}

\end{document}


text:
#ifndef Debug_h
#define Debug_h

#include "monosat/core/SolverTypes.h"
#include "PbSolver.h"
#include "monosat/pb/ADTs/FEnv.h"

//=================================================================================================
namespace Monosat {
namespace PB {

extern vec<cchar*>* debug_names;

void dump(Int num);

void dump(Lit p);

void dump(Formula f);

void dump(const vec<Lit>& ps, const vec<Int>& Cs);

void dump(const vec<Lit>& ps, const vec<Int>& Cs, const vec<int>& assigns);

void dump(const vec<Formula>& ps, const vec<Int>& Cs);

void dump(const Linear& pb, const vec<int>& assigns);

void dump(const Linear& pb);

macro void dump(Linear* pb){dump(*pb);}
}
}

//=================================================================================================
#endif


text:
package org.museautomation.builtins.condition;

import org.museautomation.core.*;
import org.museautomation.core.resource.*;
import org.museautomation.core.values.*;
import org.museautomation.core.values.descriptor.*;

import java.util.*;

/**
 * @author Christopher L Merrill (see LICENSE.txt for license details)
 */
@MuseTypeId("equals")
@MuseValueSourceName("Equals (==)")
@MuseValueSourceTypeGroup("Math")
@MuseValueSourceShortDescription("Compare two sources for equality")
@MuseValueSourceLongDescription("Compare two sources, return true if equal. Object.equals() is used for the comparison.")
@MuseStringExpressionSupportImplementation(EqualityCondition.StringExpressionSupport.class)
@MuseSubsourceDescriptor(displayName = "Left", description = "Left operand", type = SubsourceDescriptor.Type.Named, name = BinaryCondition.LEFT_PARAM, defaultValue = "true")
@MuseSubsourceDescriptor(displayName = "Right", description = "Right operand", type = SubsourceDescriptor.Type.Named, name = BinaryCondition.RIGHT_PARAM, defaultValue = "false")
public class EqualityCondition extends BinaryCondition
    {
    @SuppressWarnings("unused")  // used via reflection
    public EqualityCondition(ValueSourceConfiguration config, MuseProject project) throws MuseInstantiationException
        {
        super(config, project);
        }

    @Override
    public Boolean resolveValue(MuseExecutionContext context) throws ValueSourceResolutionError
        {
        Object value1 = _left.resolveValue(context);
        Object value2 = _right.resolveValue(context);

        if (value1 == null || value2 == null)  // if either is null
            return value1 == null && value2 == null;  // equal only if both are null

        boolean result;
        if (value1 instanceof Number || value2 instanceof Number)
            result = compareNumeric(value1, value2);
        else
            result = Objects.equals(value1, value2);

        context.raiseEvent(ConditionEvaluatedEventType.create(String.format("Condition (%s == %s) is %b", value1, value2, result)));
        return result;
        }

    private boolean compareNumeric(Object value1, Object value2)
        {
        try
            {
            Number number1 = convertToNumber(value1);
            Number number2 = convertToNumber(value2);
            return number1.doubleValue() == number2.doubleValue();
            }
        catch (NumberFormatException e)
            {
            return false;
            }
        }

    private Number convertToNumber(Object value)
        {
        if (value instanceof Number)
            return (Number) value;
        else
            return Double.parseDouble(value.toString());
        }

    public final static String TYPE_ID = EqualityCondition.class.getAnnotation(MuseTypeId.class).value();

    @SuppressWarnings("WeakerAccess")  // needs public static access to be discovered and instantiated via reflection
    public static class StringExpressionSupport extends BinaryConditionStringExpressionSupport
        {
        @Override
        public String getOperator()
            {
            return "==";
            }

        @Override
        public String getSourceType()
            {
            return EqualityCondition.TYPE_ID;
            }
        }
    }


text:
package org.opensingular.requirement.module.admin.healthsystem.docs;

import org.apache.commons.collections4.CollectionUtils;
import org.opensingular.form.SType;
import org.opensingular.form.STypes;
import org.opensingular.form.view.Block;
import org.opensingular.form.view.SView;
import org.opensingular.form.view.SViewByBlock;
import org.opensingular.form.view.SViewTab;
import org.opensingular.form.view.ViewResolver;
import org.opensingular.form.view.list.SViewListByMasterDetail;
import org.opensingular.lib.commons.lambda.IBiFunction;
import org.opensingular.requirement.module.admin.healthsystem.DocumentationMetadataUtil;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Responsible for collect metadata for SType documentation
 * Reads information from attributes, validators, and views.
 * <p>
 * The documentation metadata is represented by three classes:
 * - {@link DocTable}: Form documentation is separated in tables: 1 table for each tab ({@link SViewTab}), 1 table for each master detail (#{@link SViewListByMasterDetail}) and 1 table for the root type if it is not already included by the previous rules
 * - {@link DocBlock}: Each table is further subdivided in blocks: 1 block for each block from view by block ({@link SViewByBlock}), 1 "anonymous" block gathering all types not related to any block in a table.
 * - {@link DocFieldMetadata}: Each block is inspected for STypes that directly represents fields in a HTML according to the method {@link DocumentationFieldMetadataBuilder#isFormInputField()}
 */
public class DocumentationMetadataBuilder {

    private Map<SType<?>, SView> viewsMap = new HashMap<>();
    private Map<String, SType<?>> typeByNameCache = new HashMap<>();
    private LinkedHashSet<DocTable> tableRoots;

    private void initTypeByNameCache(SType<?> rootStype) {
        STypes
                .streamDescendants(rootStype, true)
                .forEach(s -> typeByNameCache.put(s.getName(), s));
    }

    public DocumentationMetadataBuilder(SType<?> rootStype) {
        initTypeByNameCache(rootStype);
        tableRoots = identifyTablesRoots(rootStype);
        LinkedHashSet<SType<?>> tableRootsSTypes = tableRoots.stream().flatMap(d -> d.getRootSTypes().stream()).collect(LinkedHashSet::new, LinkedHashSet::add, LinkedHashSet::addAll);
        for (DocTable docTable : tableRoots) {
            LinkedHashSet<DocBlock> docBlocks = identifyBlocks(docTable.getRootSTypes(), tableRootsSTypes);
            docTable.addAllDocBlocks(docBlocks);
            LinkedHashSet<SType<?>> allTypesAssociatedToBlocks = gatherAllSTypesAssociatedToBlocks(docBlocks);
            allTypesAssociatedToBlocks.addAll(tableRootsSTypes);
            for (DocBlock docBlock : docBlocks) {
                LinkedHashSet<DocFieldMetadata> docFieldMetadata = identifyFields(rootStype, docBlock, CollectionUtils.subtract(allTypesAssociatedToBlocks, docBlock.getBlockTypes()));
                docBlock.addAllFieldsMetadata(docFieldMetadata);
            }
        }
    }

    private LinkedHashSet<DocFieldMetadata> identifyFields(SType<?> rootStype, DocBlock docBlock, Collection<SType<?>> excludedTypes) {
        LinkedHashSet<DocFieldMetadata> fields = new LinkedHashSet<>();
        for (SType<?> sType : docBlock.getBlockTypes()) {
            if (excludedTypes.contains(sType)) {
                continue;
            }
            DocumentationFieldMetadataBuilder docFieldMetadataBuilder = new DocumentationFieldMetadataBuilder(rootStype, sType);
            if (docFieldMetadataBuilder.isFormInputField()) {
                fields.add(docFieldMetadataBuilder.getDocFieldMetadata());
                excludedTypes.add(sType);
                continue;
            }
            fields.addAll(identifyFieldsRecursiveIteration(sType, rootStype, excludedTypes));
        }
        return fields;
    }

    private LinkedHashSet<DocFieldMetadata> identifyFieldsRecursiveIteration(SType<?> toIterate, SType<?> rootStype, Collection<SType<?>> excludedTypes) {
        LinkedHashSet<DocFieldMetadata> fields = new LinkedHashSet<>();
        for (SType<?> sType : STypes.containedTypes(toIterate)) {
            if (excludedTypes.contains(sType)) {
                continue;
            }
            DocumentationFieldMetadataBuilder docFieldMetadataBuilder = new DocumentationFieldMetadataBuilder(rootStype, sType);
            if (docFieldMetadataBuilder.isFormInputField()) {
                fields.add(docFieldMetadataBuilder.getDocFieldMetadata());
                excludedTypes.add(sType);
                continue;
            }
            fields.addAll(identifyFieldsRecursiveIteration(sType, rootStype, excludedTypes));
        }
        return fields;
    }

    private LinkedHashSet<DocBlock> identifyBlocks(List<SType<?>> rootTypes, LinkedHashSet<SType<?>> tableRootsSTypes) {
        LinkedHashSet<DocBlock> blocks = new LinkedHashSet<>();
        for (SType<?> type : rootTypes) {
            blocks.addAll(recursiveIteration(type, tableRootsSTypes, this::toStypeToBlockStream));
        }
        identifyOrphanTypesBlock(rootTypes, tableRootsSTypes, gatherAllSTypesAssociatedToBlocks(blocks)).ifPresent(blocks::add);
        return blocks;
    }

    private LinkedHashSet<SType<?>> gatherAllSTypesAssociatedToBlocks(LinkedHashSet<DocBlock> blocks) {
        return blocks.stream().flatMap(b -> b.getBlockTypes().stream()).collect(LinkedHashSet::new, LinkedHashSet::add, LinkedHashSet::addAll);
    }

    private <X> LinkedHashSet<X> recursiveIteration(SType<?> toIterate, LinkedHashSet<SType<?>> excludedTypes, IBiFunction<SType<?>, LinkedHashSet<SType<?>>, Stream<X>> function) {
        LinkedHashSet<X> blocks = new LinkedHashSet<>();
        if (isDocumentationRelated(toIterate)) {
            function.apply(toIterate, excludedTypes).forEach(blocks::add);
            for (SType<?> contained : STypes.containedTypes(toIterate)) {
                if (excludedTypes.contains(contained)) {
                    continue;
                }
                function.apply(contained, excludedTypes).forEach(blocks::add);
                blocks.addAll(recursiveIteration(contained, excludedTypes, function));
            }
        }
        return blocks;
    }

    private Optional<DocBlock> identifyOrphanTypesBlock(List<SType<?>> rootTypes, LinkedHashSet<SType<?>> tableRootsSTypes, LinkedHashSet<SType<?>> typesAssociatedToBlocks) {
        List<SType<?>> orphans = new ArrayList<>();
        LinkedHashSet<SType<?>> excludedTypes = new LinkedHashSet<>();
        excludedTypes.addAll(tableRootsSTypes);
        excludedTypes.addAll(typesAssociatedToBlocks);
        excludedTypes.removeAll(rootTypes);
        for (SType<?> type : rootTypes) {
            if (isDocumentationRelated(type)) {
                if (excludedTypes.contains(type)) {
                    continue;
                }
                orphans.add(type);
                orphans.addAll(recursiveIteration(type, excludedTypes, (s, e) -> e.contains(s) ? Stream.empty() : Stream.of(s)));
            }
        }
        if (orphans.isEmpty()) {
            return Optional.empty();
        } else {
            return Optional.of(new DocBlock(null, orphans, true));
        }
    }

    @SuppressWarnings("unchecked")
    private Stream<DocBlock> toStypeToBlockStream(SType<?> sType, LinkedHashSet<SType<?>> excludedTypes) {
        SView view = getViewFor(sType);
        if (view instanceof SViewByBlock) {
            SViewByBlock byBlock = (SViewByBlock) view;
            List<DocBlock> docBlockList = new ArrayList<>();
            for (Block b : byBlock.getBlocks()) {
                List<SType<?>> list = retrieveSTypeListFromRelativeTypeName(sType, b.getTypes());
                list.removeAll(excludedTypes);
                docBlockList.add(new DocBlock(b.getName(), list, false));
            }
            return docBlockList.stream();
        }
        return Stream.empty();
    }

    private List<SType<?>> retrieveSTypeListFromRelativeTypeName(SType<?> sType, List<String> types) {
        return types.stream().map(s -> typeByNameCache.get(sType.getName() + "." + s)).collect(Collectors.toList());
    }

    private LinkedHashSet<DocTable> identifyTablesRoots(SType<?> rootType) {
        LinkedHashSet<DocTable> roots = new LinkedHashSet<>();
        roots.addAll(collectTableRoots(rootType));
        roots.addAll(identifyTablesRecursion(rootType));
        if (roots.stream().map(DocTable::getRootSTypes).flatMap(List::stream).noneMatch(rootType::equals)) {
            roots.add(new DocTable(DocumentationMetadataUtil.getLabelForType(rootType), rootType));

        }
        return roots;
    }

    private LinkedHashSet<DocTable> identifyTablesRecursion(SType<?> toIterate) {
        LinkedHashSet<DocTable> roots = new LinkedHashSet<>();
        for (SType<?> contained : STypes.containedTypes(toIterate)) {
            roots.addAll(collectTableRoots(contained));
            roots.addAll(identifyTablesRecursion(contained));
        }
        return roots;
    }

    private LinkedHashSet<DocTable> collectTableRoots(SType<?> sType) {
        LinkedHashSet<DocTable> roots = new LinkedHashSet<DocTable>();
        if (isDocumentationRelated(sType)) {
            SView view = getViewFor(sType);
            if (view instanceof SViewTab) {
                SViewTab viewTab = (SViewTab) view;
                for (SViewTab.STab t : viewTab.getTabs()) {
                    roots.add(new DocTable(DocumentationMetadataUtil.getLabelForType(t.getTitle(), sType), retrieveSTypeListFromRelativeTypeName(sType, t.getTypesNames()).toArray(new SType[0])));
                }
            } else if (view instanceof SViewListByMasterDetail) {
                roots.add(new DocTable(DocumentationMetadataUtil.getLabelForType(sType), sType));
            }
        }
        return roots;
    }

    private boolean isDocumentationRelated(SType<?> sType) {
        return !DocumentationMetadataUtil.isHiddenForDocumentation(sType);
    }

    private SView getViewFor(SType<?> s) {
        SView view = viewsMap.get(s);
        if (view == null) {
            view = Optional.ofNullable(ViewResolver.resolveView(s)).orElse(NULLVIEW);
            viewsMap.put(s, view);
        }
        if (view == NULLVIEW) {
            view = null;
        }
        return view;
    }

    private static SView NULLVIEW = new SView() {
    };

    /**
     * Return all metadata information organized in the way it is described in this class javadoc {@link DocumentationMetadataBuilder}
     *
     * @return
     */
    public LinkedHashSet<DocTable> getMetadata() {
        return tableRoots;
    }

}


text:
package org.apache.maven.repository.internal;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.maven.artifact.repository.metadata.Metadata;
import org.apache.maven.artifact.repository.metadata.Snapshot;
import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
import org.apache.maven.artifact.repository.metadata.Versioning;
import org.sonatype.aether.artifact.Artifact;

/**
 * @author Benjamin Bentmann
 */
final class LocalSnapshotMetadata
    extends MavenMetadata
{

    private final Collection<Artifact> artifacts = new ArrayList<Artifact>();

    private final boolean legacyFormat;

    public LocalSnapshotMetadata( Artifact artifact, boolean legacyFormat )
    {
        super( createMetadata( artifact, legacyFormat ), null );
        this.legacyFormat = legacyFormat;
    }

    public LocalSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
    {
        super( metadata, file );
        this.legacyFormat = legacyFormat;
    }

    private static Metadata createMetadata( Artifact artifact, boolean legacyFormat )
    {
        Snapshot snapshot = new Snapshot();
        snapshot.setLocalCopy( true );
        Versioning versioning = new Versioning();
        versioning.setSnapshot( snapshot );

        Metadata metadata = new Metadata();
        metadata.setVersioning( versioning );
        metadata.setGroupId( artifact.getGroupId() );
        metadata.setArtifactId( artifact.getArtifactId() );
        metadata.setVersion( artifact.getBaseVersion() );

        if ( !legacyFormat )
        {
            metadata.setModelVersion( "1.1.0" );
        }

        return metadata;
    }

    public void bind( Artifact artifact )
    {
        artifacts.add( artifact );
    }

    public MavenMetadata setFile( File file )
    {
        return new LocalSnapshotMetadata( metadata, file, legacyFormat );
    }

    public Object getKey()
    {
        return getGroupId() + ':' + getArtifactId() + ':' + getVersion();
    }

    public static Object getKey( Artifact artifact )
    {
        return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion();
    }

    @Override
    protected void merge( Metadata recessive )
    {
        metadata.getVersioning().updateTimestamp();

        if ( !legacyFormat )
        {
            String lastUpdated = metadata.getVersioning().getLastUpdated();

            Map<String, SnapshotVersion> versions = new LinkedHashMap<String, SnapshotVersion>();

            for ( Artifact artifact : artifacts )
            {
                SnapshotVersion sv = new SnapshotVersion();
                sv.setClassifier( artifact.getClassifier() );
                sv.setExtension( artifact.getExtension() );
                sv.setVersion( getVersion() );
                sv.setUpdated( lastUpdated );
                versions.put( getKey( sv.getClassifier(), sv.getExtension() ), sv );
            }

            Versioning versioning = recessive.getVersioning();
            if ( versioning != null )
            {
                for ( SnapshotVersion sv : versioning.getSnapshotVersions() )
                {
                    String key = getKey( sv.getClassifier(), sv.getExtension() );
                    if ( !versions.containsKey( key ) )
                    {
                        versions.put( key, sv );
                    }
                }
            }

            metadata.getVersioning().setSnapshotVersions( new ArrayList<SnapshotVersion>( versions.values() ) );
        }

        artifacts.clear();
    }

    private String getKey( String classifier, String extension )
    {
        return classifier + ':' + extension;
    }

    public String getGroupId()
    {
        return metadata.getGroupId();
    }

    public String getArtifactId()
    {
        return metadata.getArtifactId();
    }

    public String getVersion()
    {
        return metadata.getVersion();
    }

    public Nature getNature()
    {
        return Nature.SNAPSHOT;
    }

}


text:
package dcd.ui;

import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.io.File;
import java.util.List;

import javax.swing.JComponent;
import javax.swing.TransferHandler;

/**
 * Classe de gestion du drag and drop de fichiers depuis l'explorateur windows.
 * @author evernat
 */
class FileTransferHandler extends TransferHandler {
	private static final long serialVersionUID = 1L;

	private final FileTableModel fileTableModel;

	/**
	 * Constructeur.
	 * @param fileTableModel FileTableModel.
	 */
	FileTransferHandler(FileTableModel fileTableModel) {
		super();
		this.fileTableModel = fileTableModel;
	}

	/** {@inheritDoc} */
	@Override
	public boolean importData(JComponent comp, Transferable t) {
		if (!t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
			return false;
		}

		try {
			@SuppressWarnings("unchecked")
			final List<File> files = (List<File>) t.getTransferData(DataFlavor.javaFileListFlavor);
			// importation
			fileTableModel.addFiles(files);
			return true;
		} catch (final Exception e) {
			DcdUiHelper.printStackTrace(e);
		}
		return false;
	}

	/** {@inheritDoc} */
	@Override
	public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
		// We only support file lists
		for (final DataFlavor transferFlavor : transferFlavors) {
			if (!DataFlavor.javaFileListFlavor.equals(transferFlavor)) {
				return false;
			}
		}
		return true;
	}
}


text:
Stupidly simple method of preloading javascript files in development

## Usage

### Reference require.js before all other script tags in your HEAD

    <!DOCTYPE html>
    <html>
    <head>
      <title>Simple Require</title>
      <script type="text/javascript" src="js/vendor/require.js"></script>
      <script type="text/javascript" src="js/app.js"></script>
    </head>
    <body>

    </body>
    </html>

### Require your javascript files in the order you'd like them to be loaded

    // JAVASCRIPT_ROOT = 'javascript/'; // Optional path to your javascript files (default is 'js/')

    require('base.js', 'events.js');

    window.onload = function() {
      console.log('DOM', 'loaded');
    }


text:
#ifndef OPENSSL_HEADER_PEM_H
#define OPENSSL_HEADER_PEM_H

#include <openssl/base64.h>
#include <openssl/bio.h>
#include <openssl/cipher.h>
#include <openssl/digest.h>
#include <openssl/evp.h>
#include <openssl/stack.h>
#include <openssl/pkcs7.h>
#include <openssl/x509.h>

/* For compatibility with open-iscsi, which assumes that it can get
 * |OPENSSL_malloc| from pem.h or err.h */
#include <openssl/crypto.h>

#ifdef  __cplusplus
extern "C" {
#endif

#define PEM_BUFSIZE		1024

#define PEM_STRING_X509_OLD	"X509 CERTIFICATE"
#define PEM_STRING_X509		"CERTIFICATE"
#define PEM_STRING_X509_PAIR	"CERTIFICATE PAIR"
#define PEM_STRING_X509_TRUSTED	"TRUSTED CERTIFICATE"
#define PEM_STRING_X509_REQ_OLD	"NEW CERTIFICATE REQUEST"
#define PEM_STRING_X509_REQ	"CERTIFICATE REQUEST"
#define PEM_STRING_X509_CRL	"X509 CRL"
#define PEM_STRING_EVP_PKEY	"ANY PRIVATE KEY"
#define PEM_STRING_PUBLIC	"PUBLIC KEY"
#define PEM_STRING_RSA		"RSA PRIVATE KEY"
#define PEM_STRING_RSA_PUBLIC	"RSA PUBLIC KEY"
#define PEM_STRING_DSA		"DSA PRIVATE KEY"
#define PEM_STRING_DSA_PUBLIC	"DSA PUBLIC KEY"
#define PEM_STRING_EC "EC PRIVATE KEY"
#define PEM_STRING_PKCS7	"PKCS7"
#define PEM_STRING_PKCS7_SIGNED	"PKCS #7 SIGNED DATA"
#define PEM_STRING_PKCS8	"ENCRYPTED PRIVATE KEY"
#define PEM_STRING_PKCS8INF	"PRIVATE KEY"
#define PEM_STRING_DHPARAMS	"DH PARAMETERS"
#define PEM_STRING_SSL_SESSION	"SSL SESSION PARAMETERS"
#define PEM_STRING_DSAPARAMS	"DSA PARAMETERS"
#define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY"
#define PEM_STRING_ECPRIVATEKEY	"EC PRIVATE KEY"
#define PEM_STRING_CMS		"CMS"

/* enc_type is one off */
#define PEM_TYPE_ENCRYPTED      10
#define PEM_TYPE_MIC_ONLY       20
#define PEM_TYPE_MIC_CLEAR      30
#define PEM_TYPE_CLEAR		40

/* These macros make the PEM_read/PEM_write functions easier to maintain and
 * write. Now they are all implemented with either:
 * IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...)
 */

#ifdef OPENSSL_NO_FP_API

#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/
#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/
#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/
#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/
#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/

#else

#define IMPLEMENT_PEM_read_fp(name, type, str, asn1)                         \
  static void *pem_read_##name##_d2i(void **x, const unsigned char **inp,    \
                                     long len) {                             \
    return d2i_##asn1((type **)x, inp, len);                                 \
  }                                                                          \
  OPENSSL_EXPORT type *PEM_read_##name(FILE *fp, type **x,                   \
                                       pem_password_cb *cb, void *u) {       \
    return (type *)PEM_ASN1_read(pem_read_##name##_d2i, str, fp, (void **)x, \
                                 cb, u);                                     \
  }

#define IMPLEMENT_PEM_write_fp(name, type, str, asn1)                        \
  static int pem_write_##name##_i2d(const void *x, unsigned char **outp) {   \
    return i2d_##asn1((type *)x, outp);                                      \
  }                                                                          \
  OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x) {                   \
    return PEM_ASN1_write(pem_write_##name##_i2d, str, fp, x, NULL, NULL, 0, \
                          NULL, NULL);                                       \
  }

#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1)                 \
  static int pem_write_##name##_i2d(const void *x, unsigned char **outp) {  \
    return i2d_##asn1((const type *)x, outp);                               \
  }                                                                         \
  OPENSSL_EXPORT int PEM_write_##name(FILE *fp, const type *x) {            \
    return PEM_ASN1_write(pem_write_##name##_i2d, str, fp, (void *)x, NULL, \
                          NULL, 0, NULL, NULL);                             \
  }

#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1)                       \
  static int pem_write_##name##_i2d(const void *x, unsigned char **outp) {     \
    return i2d_##asn1((type *)x, outp);                                        \
  }                                                                            \
  OPENSSL_EXPORT int PEM_write_##name(                                         \
      FILE *fp, type *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, \
      pem_password_cb *cb, void *u) {                                          \
    return PEM_ASN1_write(pem_write_##name##_i2d, str, fp, x, enc, kstr, klen, \
                          cb, u);                                              \
  }

#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1)                 \
  static int pem_write_##name##_i2d(const void *x, unsigned char **outp) {     \
    return i2d_##asn1((const type *)x, outp);                                  \
  }                                                                            \
  OPENSSL_EXPORT int PEM_write_##name(                                         \
      FILE *fp, type *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, \
      pem_password_cb *cb, void *u) {                                          \
    return PEM_ASN1_write(pem_write_##name##_i2d, str, fp, x, enc, kstr, klen, \
                          cb, u);                                              \
  }

#endif

#define IMPLEMENT_PEM_read_bio(name, type, str, asn1)                         \
  static void *pem_read_bio_##name##_d2i(void **x, const unsigned char **inp, \
                                         long len) {                          \
    return d2i_##asn1((type **)x, inp, len);                                  \
  }                                                                           \
  OPENSSL_EXPORT type *PEM_read_bio_##name(BIO *bp, type **x,                 \
                                           pem_password_cb *cb, void *u) {    \
    return (type *)PEM_ASN1_read_bio(pem_read_bio_##name##_d2i, str, bp,      \
                                     (void **)x, cb, u);                      \
  }

#define IMPLEMENT_PEM_write_bio(name, type, str, asn1)                         \
  static int pem_write_bio_##name##_i2d(const void *x, unsigned char **outp) { \
    return i2d_##asn1((type *)x, outp);                                        \
  }                                                                            \
  OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x) {                  \
    return PEM_ASN1_write_bio(pem_write_bio_##name##_i2d, str, bp, x, NULL,    \
                              NULL, 0, NULL, NULL);                            \
  }

#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1)                   \
  static int pem_write_bio_##name##_i2d(const void *x, unsigned char **outp) { \
    return i2d_##asn1((const type *)x, outp);                                  \
  }                                                                            \
  OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, const type *x) {            \
    return PEM_ASN1_write_bio(pem_write_bio_##name##_i2d, str, bp, (void *)x,  \
                              NULL, NULL, 0, NULL, NULL);                      \
  }

#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1)                      \
  static int pem_write_bio_##name##_i2d(const void *x, unsigned char **outp) { \
    return i2d_##asn1((type *)x, outp);                                        \
  }                                                                            \
  OPENSSL_EXPORT int PEM_write_bio_##name(                                     \
      BIO *bp, type *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen,  \
      pem_password_cb *cb, void *u) {                                          \
    return PEM_ASN1_write_bio(pem_write_bio_##name##_i2d, str, bp, x, enc,     \
                              kstr, klen, cb, u);                              \
  }

#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1)                \
  static int pem_write_bio_##name##_i2d(const void *x, unsigned char **outp) { \
    return i2d_##asn1((const type *)x, outp);                                  \
  }                                                                            \
  OPENSSL_EXPORT int PEM_write_bio_##name(                                     \
      BIO *bp, type *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen,  \
      pem_password_cb *cb, void *u) {                                          \
    return PEM_ASN1_write_bio(pem_write_bio_##name##_i2d, str, bp, (void *)x,  \
                              enc, kstr, klen, cb, u);                         \
  }

#define IMPLEMENT_PEM_write(name, type, str, asn1) \
	IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
	IMPLEMENT_PEM_write_fp(name, type, str, asn1)

#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \
	IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
	IMPLEMENT_PEM_write_fp_const(name, type, str, asn1)

#define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \
	IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
	IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1)

#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \
	IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
	IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1)

#define IMPLEMENT_PEM_read(name, type, str, asn1) \
	IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
	IMPLEMENT_PEM_read_fp(name, type, str, asn1)

#define IMPLEMENT_PEM_rw(name, type, str, asn1) \
	IMPLEMENT_PEM_read(name, type, str, asn1) \
	IMPLEMENT_PEM_write(name, type, str, asn1)

#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \
	IMPLEMENT_PEM_read(name, type, str, asn1) \
	IMPLEMENT_PEM_write_const(name, type, str, asn1)

#define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \
	IMPLEMENT_PEM_read(name, type, str, asn1) \
	IMPLEMENT_PEM_write_cb(name, type, str, asn1)

/* These are the same except they are for the declarations */

#if defined(OPENSSL_NO_FP_API)

#define DECLARE_PEM_read_fp(name, type) /**/
#define DECLARE_PEM_write_fp(name, type) /**/
#define DECLARE_PEM_write_cb_fp(name, type) /**/

#else

#define DECLARE_PEM_read_fp(name, type) \
	OPENSSL_EXPORT type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u);

#define DECLARE_PEM_write_fp(name, type) \
	OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x);

#define DECLARE_PEM_write_fp_const(name, type) \
	OPENSSL_EXPORT int PEM_write_##name(FILE *fp, const type *x);

#define DECLARE_PEM_write_cb_fp(name, type) \
	OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
	     unsigned char *kstr, int klen, pem_password_cb *cb, void *u);

#endif

#define DECLARE_PEM_read_bio(name, type) \
	OPENSSL_EXPORT type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u);

#define DECLARE_PEM_write_bio(name, type) \
	OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x);

#define DECLARE_PEM_write_bio_const(name, type) \
	OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, const type *x);

#define DECLARE_PEM_write_cb_bio(name, type) \
	OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
	     unsigned char *kstr, int klen, pem_password_cb *cb, void *u);

#define DECLARE_PEM_write(name, type) \
	DECLARE_PEM_write_bio(name, type) \
	DECLARE_PEM_write_fp(name, type)

#define DECLARE_PEM_write_const(name, type) \
	DECLARE_PEM_write_bio_const(name, type) \
	DECLARE_PEM_write_fp_const(name, type)

#define DECLARE_PEM_write_cb(name, type) \
	DECLARE_PEM_write_cb_bio(name, type) \
	DECLARE_PEM_write_cb_fp(name, type)

#define DECLARE_PEM_read(name, type) \
	DECLARE_PEM_read_bio(name, type) \
	DECLARE_PEM_read_fp(name, type)

#define DECLARE_PEM_rw(name, type) \
	DECLARE_PEM_read(name, type) \
	DECLARE_PEM_write(name, type)

#define DECLARE_PEM_rw_const(name, type) \
	DECLARE_PEM_read(name, type) \
	DECLARE_PEM_write_const(name, type)

#define DECLARE_PEM_rw_cb(name, type) \
	DECLARE_PEM_read(name, type) \
	DECLARE_PEM_write_cb(name, type)

/* "userdata": new with OpenSSL 0.9.4 */
typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata);

OPENSSL_EXPORT int	PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
OPENSSL_EXPORT int	PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, pem_password_cb *callback,void *u);

OPENSSL_EXPORT int	PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data,long *len);
OPENSSL_EXPORT int	PEM_write_bio(BIO *bp,const char *name, const char *hdr, const unsigned char *data, long len);
OPENSSL_EXPORT int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp, pem_password_cb *cb, void *u);
OPENSSL_EXPORT void *	PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, pem_password_cb *cb, void *u);
OPENSSL_EXPORT int	PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp, void *x, const EVP_CIPHER *enc,unsigned char *kstr,int klen, pem_password_cb *cb, void *u);

OPENSSL_EXPORT STACK_OF(X509_INFO) *	PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
OPENSSL_EXPORT int	PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cd, void *u);

OPENSSL_EXPORT int	PEM_read(FILE *fp, char **name, char **header, unsigned char **data,long *len);
OPENSSL_EXPORT int	PEM_write(FILE *fp, const char *name, const char *hdr, const unsigned char *data, long len);
OPENSSL_EXPORT void *  PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, pem_password_cb *cb, void *u);
OPENSSL_EXPORT int	PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp, void *x,const EVP_CIPHER *enc,unsigned char *kstr, int klen,pem_password_cb *callback, void *u);
OPENSSL_EXPORT STACK_OF(X509_INFO) *	PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);

/* PEM_def_callback treats |userdata| as a string and copies it into |buf|,
 * assuming its |size| is sufficient. Returns the length of the string, or 0
 * if there is not enough room. If either |buf| or |userdata| is NULL, 0 is
 * returned. Note that this is different from OpenSSL, which prompts for a
 * password. */
OPENSSL_EXPORT int	PEM_def_callback(char *buf, int size, int rwflag, void *userdata);
OPENSSL_EXPORT void	PEM_proc_type(char *buf, int type);
OPENSSL_EXPORT void	PEM_dek_info(char *buf, const char *type, int len, char *str);

DECLARE_PEM_rw(X509, X509)

DECLARE_PEM_rw(X509_AUX, X509)

DECLARE_PEM_rw(X509_REQ, X509_REQ)
DECLARE_PEM_write(X509_REQ_NEW, X509_REQ)

DECLARE_PEM_rw(X509_CRL, X509_CRL)

DECLARE_PEM_rw(PKCS7, PKCS7)
DECLARE_PEM_rw(PKCS8, X509_SIG)

DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)

DECLARE_PEM_rw_cb(RSAPrivateKey, RSA)

DECLARE_PEM_rw_const(RSAPublicKey, RSA)
DECLARE_PEM_rw(RSA_PUBKEY, RSA)

#ifndef OPENSSL_NO_DSA

DECLARE_PEM_rw_cb(DSAPrivateKey, DSA)

DECLARE_PEM_rw(DSA_PUBKEY, DSA)

DECLARE_PEM_rw_const(DSAparams, DSA)

#endif

DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY)
DECLARE_PEM_rw(EC_PUBKEY, EC_KEY)

DECLARE_PEM_rw_const(DHparams, DH)

DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY)

DECLARE_PEM_rw(PUBKEY, EVP_PKEY)

OPENSSL_EXPORT int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u);
OPENSSL_EXPORT int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, char *, int, pem_password_cb *, void *);
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u);
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u);
OPENSSL_EXPORT EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);

OPENSSL_EXPORT int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u);
OPENSSL_EXPORT int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u);
OPENSSL_EXPORT int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u);

OPENSSL_EXPORT EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u);

OPENSSL_EXPORT int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc, char *kstr,int klen, pem_password_cb *cd, void *u);

#ifdef  __cplusplus
}
#endif

#define PEM_R_BAD_BASE64_DECODE 100
#define PEM_R_BAD_DECRYPT 101
#define PEM_R_BAD_END_LINE 102
#define PEM_R_BAD_IV_CHARS 103
#define PEM_R_BAD_PASSWORD_READ 104
#define PEM_R_CIPHER_IS_NULL 105
#define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 106
#define PEM_R_NOT_DEK_INFO 107
#define PEM_R_NOT_ENCRYPTED 108
#define PEM_R_NOT_PROC_TYPE 109
#define PEM_R_NO_START_LINE 110
#define PEM_R_READ_KEY 111
#define PEM_R_SHORT_HEADER 112
#define PEM_R_UNSUPPORTED_CIPHER 113
#define PEM_R_UNSUPPORTED_ENCRYPTION 114

#endif  /* OPENSSL_HEADER_PEM_H */


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:id="@+id/txtAlias"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_margin="5dp"
        android:gravity="center"
        android:text="@string/alias"
        android:textSize="32sp"
        android:textStyle="bold" />

    <Button
        android:id="@+id/btnSubmit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_margin="5dp"
        android:text="@string/btn_submit" />

    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/btnSubmit"
        android:layout_below="@id/txtAlias"/>

</RelativeLayout>