text:
<TITLE>Review for Boy Friend, The (1971)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Boy Friend, The (1971)

reviewed by
Shane Burridge

The Boy Friend (1971) 145m.

Ken Russell's delirious, hilarious, visually dazzling version of Sandy
Wilson's stage play is his one film that most critics approve of.
It's at once a homage to and send up of old Hollywood musicals
(especially those by Busby Berkeley): an ingenue is thrown into the
spotlight when the star performer calls in sick; a romance blossoms
between the two leading players; a movie mogul happens to be
talent-spotting during that very performance (this idea was based on
Russell's own experience of viewing the stage production).  It also
has the backstage intrigues of all other 30s-40s musicals, only the
major difference is that Russell allows them to spill onstage as well.
 He piles levels upon levels - it is as a
backstage-plot-within-the-play-within-the film that we, the movie
audience (and not the audience in the movie) are supposed to view
Russell's film.  In Russell's version, the plot of the play serves no
other purpose than to parallel his own storyline unwinding behind the
scenes - he is not interested in a straightforward film adaptation of
the play (it would be impossibly vapid) but a specifically cinematic
reworking of the show's many musical numbers.

The amount of musical set-pieces in this film (especially if you've
seen the full-length version) totals more than any other I can think
of in a film of this type.  Russell, who has always liked
choreographing his imagination to music, at last has the chance to
indulge himself for all he's worth (not that anything's really stopped
him before).  Scene by scene, we are treated to one flamboyant setup
after another - they are obviously well beyond the capabilities of the
run-down theater staging the play, but fit in seamlessly with the
film's several fantasy sequences, which is the main point of this,
and indeed all of the musicals it acknowledges, i.e. to provide
escape into a colourful world of happy endings.

THE BOY FRIEND is probably best known as the debut for 60s model
Twiggy, who had never acted or sung before but was assured by Russell
that she would be perfect for the role.  She pulls off her part
effortlessly and is ably supported by an excellent, high-spirited cast
(who were obviously tuned in to Russell's wavelength).  Having seen
both versions of this film (one cut is 25 minutes shorter) I would
question the inclusion of the Bacchanalia fantasy and a couple of the
less stagy songs.  Wilson's stage follow-up was the relatively unknown
DIVORCE ME, DARLING.  Watch out for cinema screenings in revival
houses - this one really has to be seen in widescreen Panavision.
Cast includes Russell regulars Christopher Gable and Max Adrian.

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
module.exports = function(
  gulp, runSequence
) {
  return function() {
    runSequence(['clean:dev', 'clean:prod']);
  };
};

redpajama_set_name: RedPajamaGithub


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Keratinomyces ajelloi var. nanus J. Kunert & Hejtm., 1964

### Remarks
null


text:
require 'rails/generators'
require 'rails/generators/migration'

module FreeberryAuth
  class InstallGenerator < Rails::Generators::Base
    include Rails::Generators::Migration

    desc "Generates migration for accounts model"

    def self.source_root
      @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
    end

    def self.current_time
      @current_time ||= Time.now
      @current_time += 1.minute
    end

    def self.next_migration_number(dirname)
      current_time.strftime("%Y%m%d%H%M%S")
    end

    def create_migration
      migration_template "create_accounts.rb", File.join('db/migrate', "freeberry_create_accounts.rb")
    end
  end
end


text:
package com.alachisoft.tayzgrid.tools;

import com.alachisoft.tayzgrid.tools.common.ArgumentAttributeAnnontation;

public class StressTestToolParam extends com.alachisoft.tayzgrid.tools.common.CommandLineParamsBase {

    private String _cacheId = null;
    private int _totalLoopCount = 0;
    private int _testCaseIterations = 20;
    private int _testCaseIterationDelay = 0;
    private int _getsPerIteration = 1;
    private int _updatesPerIteration = 1;
    private int _dataSize = 1024;
    private int _expiration = 60;
    private int _threadCount = 1;
    private int _reportingInterval = 5000;

    public StressTestToolParam() {
    }

    @ArgumentAttributeAnnontation(shortNotation = "", fullNotation = "", appendText = "", defaultValue = "")
    public final void setCacheId(String value) {
        this._cacheId = value;
    }

    @ArgumentAttributeAnnontation(shortNotation = "", fullNotation = "", appendText = "", defaultValue = "")
    public final String getCacheId() {
        return this._cacheId;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-n", fullNotation = "--item-count", appendText = "", defaultValue = "")
    public final void setTotalLoopCount(int value) {
        this._totalLoopCount = value;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-n", fullNotation = "--item-count", appendText = "", defaultValue = "")
    public final int getTotalLoopCount() {
        return this._totalLoopCount;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-i", fullNotation = "--test-case-iterations", appendText = "", defaultValue = "")
    public final void setTestCaseIterations(int value) {
        this._testCaseIterations = value;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-i", fullNotation = "--test-case-iterations", appendText = "", defaultValue = "")
    public final int getTestCaseIterations() {
        return this._testCaseIterations;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-d", fullNotation = "--test-case-iteration-delay", appendText = "", defaultValue = "")
    public final void setTestCaseIterationDelay(int value) {
        this._testCaseIterationDelay = value;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-d", fullNotation = "--test-case-iteration-delay", appendText = "", defaultValue = "")
    public final int getTestCaseIterationDelay() {
        return this._testCaseIterationDelay;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-g", fullNotation = "--gets-per-iteration", appendText = "", defaultValue = "")
    public final void setGetsPerIteration(int value) {
        this._getsPerIteration = value;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-g", fullNotation = "--gets-per-iteration", appendText = "", defaultValue = "")
    public final int getGetsPerIteration() {
        return this._getsPerIteration;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-u", fullNotation = "--updates-per-iteration", appendText = "", defaultValue = "")
    public final void setUpdatesPerIteration(int value) {
        this._updatesPerIteration = value;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-u", fullNotation = "--updates-per-iteration", appendText = "", defaultValue = "")
    public final int getUpdatesPerIteration() {
        return this._updatesPerIteration;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-m", fullNotation = "--item-size", appendText = "", defaultValue = "")
    public final void setDataSize(int value) {
        this._dataSize = value;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-m", fullNotation = "--item-size", appendText = "", defaultValue = "")
    public final int getDataSize() {
        return this._dataSize;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-e", fullNotation = "--sliding-expiration", appendText = "", defaultValue = "")
    public final void setExpiration(int value) {
        this._expiration = value;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-e", fullNotation = "--sliding-expiration", appendText = "", defaultValue = "")
    public final int getExpiration() {
        return this._expiration;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-t", fullNotation = "--thread-count", appendText = "", defaultValue = "")
    public final void setThreadCount(int value) {
        this._threadCount = value;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-t", fullNotation = "--thread-count", appendText = "", defaultValue = "")
    public final int getThreadCount() {
        return this._threadCount;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-R", fullNotation = "--reporting-interval", appendText = "", defaultValue = "")
    public final void setReportingInterval(int value) {
        this._reportingInterval = value;
    }

    @ArgumentAttributeAnnontation(shortNotation = "-R", fullNotation = "--reporting-interval", appendText = "", defaultValue = "")
    public final int getReportingInterval() {
        return this._reportingInterval;
    }
}


text:
require 'simply_captcha_helpers'

# Helpers will be available in all controllers
ActionController::Base.send :include, SimplyCaptcha::Helpers

# Helpers will be available in the views
ActionView::Base.send :include, SimplyCaptcha::Helpers

# Before filter (will be run for every action in every controller)
ActionController::Base.send :prepend_before_filter, :initialize_captcha


text:
const DeepMerge = require("deep-merge");

function indexOfDeep(arr: any[], value: any): number {
	for (let i = 0; i < arr.length; i++) {
		if (JSON.stringify(arr[i]) === JSON.stringify(value)) {
			return i;
		}
	}
}

function onlyUnique(value: any, index: number, self: any) {
	return indexOfDeep(self, value) === index;
}

const deepmerge = DeepMerge((target: any, source: any) => {
	const concatenated = [].concat(target, source);
	return concatenated.filter(onlyUnique);
});

export function merge<T>(a: T, b: T): T {
	return deepmerge(a, b);
}


text:
package javax.jms;

/** An XATopicSession provides a regular TopicSession.
  * which can be used to create TopicSubscriber and
  * TopicPublisher objects (optional).
  *
  *
The XATopicSession interface is optional.  JMS providers
  * are not required to support this interface. This interface is for
  * use by JMS providers to support transactional environments.
  * Client programs are strongly encouraged to use the transactional support
  * available in their environment, rather than using these XA
  * interfaces directly.
  *
  * @version     1.1 February 2, 2002
  * @author      Mark Hapner
  * @author      Rich Burridge
  * @author      Kate Stout
  *
  * @see         javax.jms.XASession
  * @see         javax.jms.TopicSession
  */

public interface XATopicSession extends XASession {

    /** Gets the topic session associated with this XATopicSession.
      *
      * @return the topic session object
      *
      * @exception JMSException if an internal error occurs.
      */

    TopicSession
    getTopicSession() throws JMSException;
}


text:
import codecs
import os
import random
import shutil
import string
import tempfile

LOCAL_SETTINGS_PATH = './events/local_settings.py'
LOCAL_SETTINGS_EXAMPLE_PATH = './events/local_settings_example.py'

def main():
    if os.path.exists(LOCAL_SETTINGS_PATH):
        print('ERROR: ' + LOCAL_SETTINGS_PATH +
              ' already exists! Please remove this file manually if you intend to overwrite it.')
        return
    shutil.copyfile(LOCAL_SETTINGS_EXAMPLE_PATH, LOCAL_SETTINGS_PATH)
    secret_key_random = generate_random_secret_key()
    replace(LOCAL_SETTINGS_PATH, "SECRET_KEY = ''", "SECRET_KEY = '" + secret_key_random + "'")

def replace(source_file_path, pattern, substring):
    fh, target_file_path = tempfile.mkstemp()

    with codecs.open(target_file_path, 'w', 'utf-8') as target_file:
        with codecs.open(source_file_path, 'r', 'utf-8') as source_file:
            for line in source_file:
                target_file.write(line.replace(pattern, substring))
    os.remove(source_file_path)
    shutil.move(target_file_path, source_file_path)

def generate_random_secret_key():
    # source: https://gist.github.com/mattseymour/9205591
    # Get ascii Characters numbers and punctuation (minus quote characters as they could terminate string).
    chars = ''.join([string.ascii_letters, string.digits, string.punctuation]).replace('\'', '').replace('"', '').replace('\\', '')
    secret_key = ''.join([random.SystemRandom().choice(chars) for i in range(50)])
    return secret_key

if __name__ == "__main__":
    main()


text:
package org.apache.hadoop.mapred;

import java.io.IOException;

import junit.framework.TestCase;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.mapred.TestRackAwareTaskPlacement;

/**
 * This test checks whether the task caches are created and used properly.
 */
public class TestMultipleLevelCaching extends TestCase {
  private static final int MAX_LEVEL = 5;
  final Path inDir = new Path("/cachetesting");
  final Path outputPath = new Path("/output");

  /**
   * Returns a string representing a rack with level + 1 nodes in the topology
   * for the rack.
   * For id = 2, level = 2 we get /a/b2/c2
   *     id = 1, level = 3 we get /a/b1/c1/d1
   * NOTE There should always be one shared node i.e /a
   * @param id Unique Id for the rack
   * @param level The level in the topology where the separation starts
   */
  private static String getRack(int id, int level) {
    StringBuilder rack = new StringBuilder();
    char alpha = 'a';
    int length = level + 1;
    while (length > level) {
      rack.append("/");
      rack.append(alpha);
      ++alpha;
      --length;
    }
    while (length > 0) {
      rack.append("/");
      rack.append(alpha);
      rack.append(id);
      ++alpha;
      --length;
    }
    return rack.toString();
  }

  public void testMultiLevelCaching() throws IOException {
    for (int i = 1 ; i <= MAX_LEVEL; ++i) {
      testCachingAtLevel(i);
    }
  }

  private void testCachingAtLevel(int level) throws IOException {
    String namenode = null;
    MiniDFSCluster dfs = null;
    MiniMRCluster mr = null;
    FileSystem fileSys = null;
    String testName = "TestMultiLevelCaching";
    try {
      final int taskTrackers = 1;
      // generate the racks
      // use rack1 for data node
      String rack1 = getRack(0, level);
      // use rack2 for task tracker
      String rack2 = getRack(1, level);
      Configuration conf = new Configuration();
      // Run a datanode on host1 under /a/b/c/..../d1/e1/f1
      dfs = new MiniDFSCluster(conf, 1, true, new String[] {rack1},
                               new String[] {"host1.com"});
      dfs.waitActive();
      fileSys = dfs.getFileSystem();
      if (!fileSys.mkdirs(inDir)) {
        throw new IOException("Mkdirs failed to create " + inDir.toString());
      }
      UtilsForTests.writeFile(dfs.getNameNode(), conf,
    		                        new Path(inDir + "/file"), (short)1);
      namenode = (dfs.getFileSystem()).getUri().getHost() + ":" +
                 (dfs.getFileSystem()).getUri().getPort();

      // Run a job with the (only)tasktracker on host2 under diff topology
      // e.g /a/b/c/..../d2/e2/f2.
      JobConf jc = new JobConf();
      // cache-level = level (unshared levels) + 1(topmost shared node i.e /a)
      //               + 1 (for host)
      jc.setInt("mapred.task.cache.levels", level + 2);
      mr = new MiniMRCluster(taskTrackers, namenode, 1, new String[] {rack2},
    		                 new String[] {"host2.com"}, jc);

      /* The job is configured with 1 map for one (non-splittable) file.
       * Since the datanode is running under different subtree, there is no
       * node-level data locality but there should be topological locality.
       */
      TestRackAwareTaskPlacement.launchJobAndTestCounters(
    		  testName, mr, fileSys, inDir, outputPath, 1, 1, 0, 0);
    } finally {
      fileSys.delete(inDir, true);
      fileSys.delete(outputPath, true);
      MiniMRCluster.close(mr);
      MiniDFSCluster.close(dfs);
    }
  }
}


text:
import { InternationalizationMessages } from '@inkline/inkline/i18n';

export const en: InternationalizationMessages = {
    validation: {
        alpha: (params: { allowSpaces: boolean, allowDashes: boolean }) => {
            let context;

            switch (true) {
            case params.allowSpaces && params.allowDashes:
                context = 'letters, spaces, and dashes'; break;
            case params.allowSpaces:
                context = 'letters and spaces'; break;
            case params.allowDashes:
                context = 'letters and dashes'; break;
            default:
                context = 'letters';
            }

            return `Please enter ${context} only.`;
        },
        alphanumeric: (params: { allowSpaces: boolean, allowDashes: boolean }) => {
            let context;

            switch (true) {
            case params.allowSpaces && params.allowDashes:
                context = 'letters, numbers, spaces, and dashes'; break;
            case params.allowSpaces:
                context = 'letters, numbers, and spaces'; break;
            case params.allowDashes:
                context = 'letters, numbers, and dashes'; break;
            default:
                context = 'letters and numbers';
            }

            return `Please enter ${context} only.`;
        },
        number: (params: { allowNegative: boolean, allowDecimal: boolean }) => {
            let context;

            switch (true) {
            case params.allowNegative && params.allowDecimal:
                context = 'positive or negative decimal numbers'; break;
            case params.allowNegative:
                context = 'positive or negative numbers'; break;
            case params.allowDecimal:
                context = 'decimal numbers'; break;
            default:
                context = 'numbers';
            }

            return `Please enter ${context} only.`;
        },
        email: () => 'Please enter a valid email address.',
        max: () => 'Please enter a maximum value of {value}.',
        maxLength: () => 'Please enter up to {value} characters.',
        min: () => 'Please enter a minimum value of {value}.',
        minLength: () => 'Please enter at least {value} characters.',
        required: () => 'Please enter a value for this field.',
        sameAs: () => 'Please make sure that the two values match.',
        custom: () => 'Please enter a correct value for this field.'
    }
};


text:
"""setup script
"""
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand

base_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.append(base_dir)

requires = [
    'Tinkerer',
    'twitter',
    'python-dateutil',
    'pytz',
]
test_requires = [
    'pytest',
]

classifiers = [
    'Programming Language :: Python',
    'License :: OSI Approved :: MIT License',
    'Operating System :: OS Independent',
    'Development Status :: 3 - Alpha',
    'Intended Audience :: Developers',
    'Topic :: Software Development :: Libraries :: Python Modules',
]

entry_points = {
    'console_scripts': [
        'twinker = twinkerer.cmd:main',
    ],
}

with open(os.path.join(base_dir, 'README.rst')) as f:
    readme = f.read()

class PyTest(TestCommand):
    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True
    def run_tests(self):
        import pytest
        pytest.main(self.test_args)

setup(
    name='Twinkerer',
    version='0.1.0',
    description="tinkerer small extension to use twitter api.",
    long_description=readme,
    author='attakei',
    author_email='attakei@gmail.com',
    license='MIT License',
    url='https://github.com/attakei/twinkerer',
    classifiers=classifiers,

    install_requires=requires,
    tests_require=test_requires,

    test_suite='tests',

    packages=find_packages(),
    entry_points=entry_points,

    cmdclass = {'test': PyTest},
)


text:
<?php
    namespace Thin\Html;
    use Thin\File as File;
    use Thin\Html as Html;
    use Thin\Exception as Exception;
    use Thin\Registry as Registry;

    class Pdf
    {
        /**
         * setters / getters properties
         */
        protected $_html = null;
        protected $_url = null;
        protected $_orientation = null;
        protected $_pageSize = null;
        protected $_toc = false;
        protected $_copies = 1;
        protected $_grayscale = false;
        protected $_title = null;
        protected $_xvfb = false;
        protected $_path;               // path to directory where to place files
        protected $_footerHtml;
        protected $_username;
        protected $_password;
        protected $_windowStatus;
        protected $_margins = array('top' => null, 'bottom' => null, 'left' => null, 'right' => null);

        /**
         * path to executable
         */
        protected $_bin = '/usr/bin/wkhtmltopdf';
        protected $_filename = null;                // filename in $path directory

        /**
         * available page orientations
         */
        const ORIENTATION_PORTRAIT = 'Portrait';    // vertical
        const ORIENTATION_LANDSCAPE = 'Landscape';  // horizontal

        /**
         * page sizes
         */
        const SIZE_A4 = 'A4';
        const SIZE_LETTER = 'letter';

        /**
         * file get modes
         */
        const MODE_DOWNLOAD = 0;
        const MODE_STRING = 1;
        const MODE_EMBEDDED = 2;
        const MODE_SAVE = 3;

        /**
         * @param array $options
         */
        public function __construct(array $options = array())
        {
            if (ake('html', $options)) {
                $this->setHtml($options['html']);
            }

            if (ake('orientation', $options)) {
                $this->setOrientation($options['orientation']);
            } else {
                $this->setOrientation(static::ORIENTATION_PORTRAIT);
            }

            if (ake('page_size', $options)) {
                $this->setPageSize($options['page_size']);
            } else {
                $this->setPageSize(static::SIZE_A4);
            }

            if (ake('toc', $options)) {
                $this->setTOC($options['toc']);
            }

            if (ake('margins', $options)) {
                $this->setMargins($options['margins']);
            }

            if (ake('binpath', $options)) {
                $this->setBinPath($options['binpath']);
            }

            if (ake('window-status', $options)) {
                $this->setWindowStatus($options['window-status']);
            }

            if (ake('grayscale', $options)) {
                $this->setGrayscale($options['grayscale']);
            }

            if (ake('title', $options)) {
                $this->setTitle($options['title']);
            }

            if (ake('footer_html', $options)) {
                $this->setFooterHtml($options['footer_html']);
            }

            if (ake('xvfb', $options)) {
                $this->setRunInVirtualX($options['xvfb']);
            }

            if (!ake('path', $options)) {
                throw new Exception("Path to directory where to store files is not set.");
            }

            if (!is_writable($options['path'])) {
                throw new Exception("Path to directory where to store files is not writable.");
            }

            $this->setPath($options['path']);

            $this->_createFile();
        }

        /**
         * creates file to which will be writen html content
         *
         * @return string
         */
        protected function _createFile()
        {
            do {
                $this->_filename = $this->getPath() .  mt_rand() . '.html';
            } while(File::exists($this->_filename));

            /**
             * create an empty file
             */
            File::put($this->_filename, $this->getHtml());
            chmod($this->_filename, 0777);

            return $this->_filename;
        }

        /**
         * returns file path where html content is saved
         *
         * @return string
         */
        public function getFilePath()
        {
            return $this->_filename;
        }

        /**
         * executes command
         *
         * @param string $cmd   command to execute
         * @param string $input other input (not arguments)
         * @return array
         */
        protected function _exec($cmd, $input = "")
        {
            $result = array(
                'stdout' => '',
                'stderr' => '',
                'return' => ''
            );

            $proc = proc_open(
                $cmd,
                array(
                    0 => array(
                        'pipe',
                        'r'
                    ),
                    1 => array(
                        'pipe',
                        'w'
                    ),
                    2 => array(
                        'pipe',
                        'w'
                    )
                ),
                $pipes
            );
            fwrite($pipes[0], $input);
            fclose($pipes[0]);

            $result['stdout'] = stream_get_contents($pipes[1]);
            fclose($pipes[1]);

            $result['stderr'] = stream_get_contents($pipes[2]);
            fclose($pipes[2]);

            $result['return'] = proc_close($proc);

            return $result;
        }

        /**
         * returns help info
         *
         * @return string
         */
        public function getHelp()
        {
            $r = $this->_exec($this->_bin . " --extended-help");
            return $r['stdout'];
        }

        /**
         * Sets the PDF margins
         *
         * @param $margins array<position => value> The margins.
         *   * Possible <position> :
         *     * top    : sets the margin on the top of the PDF
         *     * bottom : sets the margin on the bottom of the PDF
         *     * left   : sets the margin on the left of the PDF
         *     * right  : sets the margin on the right of the PDF
         *   * Value : size of the margin (positive integer). Null to leave the default one.
         * @return Wkhtmltopdf $this
         */
        public function setMargins($margins)
        {
            $this->_margins = array_merge($this->_margins, $margins);
            return $this;
        }

        /**
         * Sets the PDF margins
         *
         * @return array See $this->setMargins()
         * @see $this->setMargins()
         */
        public function getMargins()
        {
            return $this->_margins;
        }

        /**
         * set WKHtmlToPdf to wait when `windiw.status` on selected page changes to setted status, and after that render PDF
         *
         * @param string $windowStatus  -we add a `--window-status {$windowStatus}` for execution to `$this->_bin`
         * @return Wkthmltopdf
         */
        public function setWindowStatus($windowStatus)
        {
            $this->_windowStatus = (string) $windowStatus;
            return $this;
        }

        /**
         * Sets the PDF margins
         *
         * @return string See $this->setWindowStatus()
         * @see $this->setWindowStatus()
         */
        public function getWindowStatus()
        {
            return $this->_windowStatus;
        }

        /**
         * set HTML content to render
         *
         * @param string $html
         * @return Wkthmltopdf
         */
        public function setHtml($html)
        {
            $this->_html = (string) $html;
            return $this;
        }

        /**
         * returns HTML content
         *
         * @return string
         */
        public function getHtml()
        {
            return $this->_html;
        }

        /**
         * set URL to render
         *
         * @param string $html
         * @return Wkthmltopdf
         */
        public function setUrl($url)
        {
            $this->_url = (string) $url;
            return $this;
        }

        /**
         * returns URL
         *
         * @return string
         */
        public function getUrl()
        {
            return $this->_url;
        }

        /**
         * Absolute path where to store files
         *
         * @throws Exception
         * @param string $path
         * @return Wkthmltopdf
         */
        public function setPath($path)
        {
            if (realpath($path) === false) {
                throw new Exception("Path must be absolute.");
            }

            $this->_path = realpath($path) . DS;
            return $this;
        }

        /**
         * returns path where to store saved files
         *
         * @return string
         */
        public function getPath()
        {
            return $this->_path;
        }

        /**
         * set page orientation
         *
         * @param string $orientation
         * @return Wkthmltopdf
         */
        public function setOrientation($orientation)
        {
            $this->_orientation = (string) $orientation;
            return $this;
        }

        /**
         * returns page orientation
         *
         * @return string
         */
        public function getOrientation()
        {
            return $this->_orientation;
        }

        /**
         * @param string $size
         * @return Wkthmltopdf
         */
        public function setPageSize($size)
        {
            $this->_pageSize = (string) $size;
            return $this;
        }

        /**
         * returns page size
         *
         * @return int
         */
        public function getPageSize()
        {
            return $this->_pageSize;
        }

        /**
         * enable / disable generation Table Of Contents
         * @param boolean $toc
         * @return Wkhtmltopdf
         */
        public function setTOC($toc = true)
        {
            $this->_toc = (boolean) $toc;
            return $this;
        }

        /**
         * returns value is enabled Table Of Contents generation or not
         *
         * @return boolean
         */
        public function getTOC()
        {
            return $this->_toc;
        }

        /**
         * returns bin path
         *
         * @return string
         */
        public function getBinPath()
        {
            return $this->_bin;
        }

        /**
         * returns bin path
         *
         * @return string
         */
        public function setBinPath($path)
        {
            if (file_exists($path)) {
                $this->_bin = (string) $path;
            }

            return $this;
        }

        /**
         * set number of copies
         * @param int $copies
         * @return Wkthmltopdf
         */
        public function setCopies($copies)
        {
            $this->_copies = (int) $copies;
            return $this;
        }

        /**
         * returns  number of copies to make
         *
         * @return int
         */
        public function getCopies()
        {
            return $this->_copies;
        }

        /**
         * whether to print in grayscale or not
         * @param boolean $mode
         * @return Wkthmltopdf
         */
        public function setGrayscale($mode)
        {
            $this->_grayscale = (boolean) $mode;
            return $this;
        }

        /**
         * returns is page will be printed in grayscale format
         *
         * @return boolean
         */
        public function getGrayscale()
        {
            return $this->_grayscale;
        }

        /**
         * If TRUE, runs wkhtmltopdf in a virtual X session.
         *
         * @param bool $xvfb
         * @return Wkthmltopdf
         */
        public function setRunInVirtualX($xvfb)
        {
            $this->_xvfb = (bool) $xvfb;
            return $this;
        }

        /**
         * If TRUE, runs wkhtmltopdf in a virtual X session.
         *
         * @return bool
         */
        public function getRunInVirtualX()
        {
            if ($this->_xvfb) {
                return $this->_xvfb;
            }
        }

        /**
         * PDF title
         * @param string $title
         * @return Wkthmltopdf
         */
        public function setTitle($title)
        {
            $this->_title = (string) $title;
            return $this;
        }

        /**
         * returns PDF document title
         *
         * @throws Exception
         * @return string
         */
        public function getTitle()
        {
            if ($this->_title) {
                return $this->_title;
            }

        }

        /**
         *  set footer html
         *
         * @param string $footer
         * @return Wkthmltopdf
         */
        public function setFooterHtml($footer)
        {
            $this->_footerHtml = (string) $footer;
            return $this;
        }

        /**
         * get footer html
         *
         * @return string
         */
        public function getFooterHtml()
        {
            return $this->_footerHtml;
        }

        /**
         * set http username
         *
         * @param string $username
         * @return Wkthmltopdf
         */
        public function setUsername($username)
        {
            $this->_username = (string) $username;
            return $this;
        }

        /**
         * get http username
         *
         * @return string
         */
        public function getUsername()
        {
            return $this->_username;
        }

        /**
         * set http password
         *
         * @param string $password
         * @return Wkthmltopdf
         */
        public function setPassword($password)
        {
            $this->_password = (string) $password;
            return $this;
        }

        /**
         * get http password
         *
         * @return string
         */
        public function getPassword()
        {
            return $this->_password;
        }

        /**
         * returns command to execute
         *
         * @return string
         */
        protected function _getCommand()
        {
            $command = $this->_bin;

            $command .= ($this->getCopies() > 1) ? " --copies " . $this->getCopies() : "";
            $command .= " --orientation " . $this->getOrientation();
            $command .= " --page-size " . $this->getPageSize();

            foreach($this->getMargins() as $position => $margin) {
                $command .= (false === is_null($margin)) ? sprintf(' --margin-%s %s', $position, $margin) : '';
            }

            $command .= ($this->getWindowStatus()) ? " --window-status ".$this->getWindowStatus()."" : "";
            $command .= ($this->getTOC()) ? " --toc" : "";
            $command .= ($this->getGrayscale()) ? " --grayscale" : "";
            $command .= (mb_strlen($this->getPassword()) > 0)
            ? " --password " . $this->getPassword() . ""
            : "";
            $command .= (mb_strlen($this->getUsername()) > 0)
            ? " --username " . $this->getUsername() . ""
            : "";
            $command .= (mb_strlen($this->getFooterHtml()) > 0)
            ? " --margin-bottom 20 --footer-html \"" . $this->getFooterHtml() . "\""
            : "";
            $command .= ($this->getTitle())
            ? ' --title "' . $this->getTitle() . '"'
            : '';

            $command .= ' "%input%"';
            $command .= " -";
            if ($this->getRunInVirtualX()) {
                $command = 'xvfb-run ' . $command;
            }
            return $command;
        }

        /**
         * @todo use file cache
         *
         * @throws Exception
         * @return string
         */
        protected function _render()
        {
            if (mb_strlen($this->_html, 'utf-8') === 0 && empty($this->_url))
                throw new Exception("HTML content or source URL not set.");

            if ($this->getUrl()) {
                $input = $this->getUrl();
            } else {
                File::put($this->getFilePath(), $this->getHtml());
                $input = $this->getFilePath();
            }

            $content = $this->_exec(repl('%input%', $input, $this->_getCommand()));

            if (strpos(i::lower($content['stderr']), 'error'))
                    throw new Exception("System error <pre>" . $content['stderr'] . "</pre>");

            if (mb_strlen($content['stdout'], 'utf-8') === 0)
                   throw new Exception("WKHTMLTOPDF didn't return any data.");

            if ((int)$content['return'] > 1)
                throw new Exception("Shell error, return code : " . (int)$content['return']);

            return $content['stdout'];
        }

        /**
         * @param int $mode
         * @param string $filename
         */
        public function output($mode, $filename)
        {
            switch ($mode) {
                case static::MODE_DOWNLOAD:
                    if (!headers_sent()) {
                        $result = $this->_render();
                        header("Content-Description: File Transfer");
                        header("Cache-Control: public; must-revalidate, max-age=0");
                        header("Pragma: public");
                        header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
                        header("Last-Modified: " . gmdate('D, d m Y H:i:s') . " GMT");
                        header("Content-Type: application/force-download");
                        header("Content-Type: application/octec-stream", false);
                        header("Content-Type: application/download", false);
                        header("Content-Type: application/pdf", false);
                        header('Content-Disposition: attachment; filename="' . basename($filename) . '";');
                        header("Content-Transfer-Encoding: binary");
                        header("Content-Length: " . strlen($result));
                        echo $result;
                        $filepath = $this->getFilePath();
                        if (!empty($filepath)) {
                            unlink($filepath);
                        }
                        exit();
                    } else {
                        throw new Exception("Headers already sent.");
                    }
                    break;
                case static::MODE_STRING:
                    return $this->_render();
                    break;
                case static::MODE_EMBEDDED:
                    if (!headers_sent()) {
                        $result = $this->_render();
                        header("Content-type: application/pdf");
                        header("Cache-control: public, must-revalidate, max-age=0");
                        header("Pragme: public");
                        header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
                        header("Last-Modified: " . gmdate('D, d m Y H:i:s') . " GMT");
                        header("Content-Length: " . strlen($result));
                        header('Content-Disposition: inline; filename="' . basename($filename) .'";');
                        echo $result;
                        $filepath = $this->getFilePath();
                        if (!empty($filepath)) {
                            unlink($filepath);
                        }
                        exit();
                    } else {
                        throw new Exception("Headers already sent.");
                    }
                    break;
                case static::MODE_SAVE:
                    File::put($this->getPath() . $filename, $this->_render());
                    $filepath = $this->getFilePath();
                    if (!empty($filepath)) {
                        unlink($filepath);
                    }
                    break;
                default:
                    throw new Exception("Mode: " . $mode . " is not supported.");
            }
        }
    }


text:
package com.exxeta.iss.sonar.esql.tree.impl.statement;

import java.util.Iterator;

import com.exxeta.iss.sonar.esql.api.tree.Tree;
import com.exxeta.iss.sonar.esql.api.tree.expression.IdentifierTree;
import com.exxeta.iss.sonar.esql.api.tree.statement.LabelTree;
import com.exxeta.iss.sonar.esql.api.visitors.DoubleDispatchVisitor;
import com.exxeta.iss.sonar.esql.tree.impl.EsqlTree;
import com.google.common.collect.Iterators;

public class LabelTreeImpl extends EsqlTree implements LabelTree {

	private final IdentifierTree name;

	public LabelTreeImpl(IdentifierTree name) {
		this.name = name;
	}

	@Override
	public IdentifierTree name() {
		return name;
	}

	@Override
	public void accept(DoubleDispatchVisitor visitor) {
		visitor.visitLabel(this);

	}

	@Override
	public Kind getKind() {
		return Kind.LABEL;
	}

	@Override
	public Iterator<Tree> childrenIterator() {
		return Iterators.singletonIterator(name);
	}

}


text:
package com.amee.domain;

import org.apache.xerces.dom.DocumentImpl;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Test;
import org.w3c.dom.*;

import java.util.LinkedHashMap;
import java.util.Map;

import static org.junit.Assert.*;

public class AMEEStatusTest {
    // Map of Enum name => label
    // Use a LinkedHashMap so the order is the same as in the Enum.
    private static final Map<String, String> PAIRS = new LinkedHashMap<String, String>() {{
        put("TRASH", "Trash");
        put("ACTIVE", "Active");
        put("DEPRECATED", "Deprecated");
    }};

    @Test
    public void getChoices() {
        assertEquals(PAIRS, AMEEStatus.getChoices());
    }

    @Test
    public void getJSONObject() {
        try {
            JSONObject JsonObject = AMEEStatus.getJSONObject();
            assertJsonObject(PAIRS, JsonObject);
        } catch (JSONException e) {
            fail(e.getMessage());
        }
    }

    private void assertJsonObject(Map<String, String> pairs, JSONObject JsonObject) {
        try {
            for (Map.Entry<String, String> e : pairs.entrySet()) {
                assertEquals("JSON object values differ.", e.getValue(), JsonObject.getString(e.getKey()));
            }
        } catch (JSONException e) {

            // The key wasn't there.
            fail(e.getMessage());
        }
    }

    @Test
    public void getElement() {
        Document dom = new DocumentImpl();
        Element element = AMEEStatus.getElement(dom);
        dom.appendChild(element);
        assertElement(dom);
    }

    private void assertElement(Document dom) {
        //get the root element
        Element docEle = dom.getDocumentElement();

        //get a NodeList of  AMEEStatus elements
        NodeList nl = docEle.getElementsByTagName("Status");
        assertEquals("Number of elements not equal to number of enum values.", AMEEStatus.values().length, nl.getLength());

        // Check we have the correct name, label attributes
        for(int i = 0 ; i < nl.getLength(); i++) {
            Node AMEEStatusNode = nl.item(i);
            assertTrue("AMEEStatus node has no attributes.", AMEEStatusNode.hasAttributes());

            // Check the name/label attributes.
            NamedNodeMap attributes = AMEEStatusNode.getAttributes();
            Node nameNode = attributes.getNamedItem("name");
            Node labelNode = attributes.getNamedItem("label");
            assertEquals(PAIRS.get(nameNode.getNodeValue()), labelNode.getNodeValue());
        }
    }
}


text:
> EM DESENVOLVIMENTO

## Objetivo

Aprender os novos recursos do Javascript disponíveis no padrão ES2015.

## Pré-requisitos:

Para realizar esse curso você deve saber **Javascript intermediário**

## Vídeos

Em breve.

## Ferramentas para testes e praticar

Escolha uma dessas opções para testar os códigos do curso em seu navegador sem precisar instalar nada em seu sistema.

- Babel repl tester: http://babeljs.io/repl/
- JSBin: https://jsbin.com/cugipak/edit?js,console
- esFiddle: http://www.es6fiddle.net/
  - no esFiddle use o console do navegador para ver os erros

## Conteúdo

- [Declaração de variáveis: let e const](1_declaracao_variaveis.md)
- Funções
  - [Function Defaults e Named Parameters](1_declaracao_variaveis.md)
  - [Rest Parameter, Spread Operator](2.2_rest_params_spread_operator.md)
  - [Arrow functions](2.3_arrow_functions.md)
- [Objetos e novos métodos](3_objetos_e_novos_metodos.md)
- [Template strings](4_string_template_strings.md)
- [Arrays, maps e sets](5_arrays_maps_sets.md)
- Classes e Modules
- Promisses, iterator e generators
- Configurando o babel.js (javascript compiler)

## Refêrencias

[Todas as referências no link](links_referencias.md)


text:
class ProductTenMigration < ActiveMigration::Base

  set_active_model 'Product',
                   :mode => :update

  set_legacy_model 'Legacy::Product',
                   :limit => 5,
                   :offset => 3 # This is for specing only, this element will be deleted.

  map              [['name', 'name']]

end


text:
<?php
use wepay\join\demo\common\ConfigUtil;
include '../common/ConfigUtil.php';
?>
<!DOCTYPE html>

    <meta charset="utf-8"/>
    <title>模拟商户--订单支付页面</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=no"/>
    <link rel="stylesheet" href="../static/css/base.css"/>

支付请求

<form method="post" action="../api/WebPaySign.php" id="paySignForm">

            服务URL

                <input type="text" name="serverUrl" value="<?php echo ConfigUtil::get_val_by_key('serverPayUrl');?>" autocomplete="off"
                      maxlength="50" data-callback="input.status"/>
                ×

            接口版本

                <input type="text"  name="version" value="1.0" autocomplete="off"
                         maxlength="18" data-callback="input.status"/>
                ×

            令牌

                <input type="text" class="" name="token" value="" autocomplete="off" placeholder="请输入用户交易令牌"
                        maxlength="50" data-callback="input.status"/>
                ×

            商户号

                <input type="text" class="" name="merchantNum" value="<?php echo ConfigUtil::get_val_by_key('merchantNum');?>" autocomplete="off" placeholder="请输入商户号" minlength="15" maxlength="50" data-callback="input.status"/>
                ×

            商户备注

                <input type="text" class="" name="merchantRemark" value="生产环境-测试商户号" autocomplete="off"
                       placeholder="请输入商户备注"  maxlength="50" data-callback="input.status"/>
                ×

            交易号

                <input type="text" class="" name="tradeNum" value="<?php echo ConfigUtil::get_trade_num();?>" autocomplete="off"
                       placeholder="请输入交易号" maxlength="50" data-callback="input.status"/>
                ×

            交易名称

                <input type="text" class="" name="tradeName" value="交易名称" autocomplete="off"
                       placeholder="请输入交易名称" minlength="15" maxlength="225" data-callback="input.status"/>
                ×

            交易描述

                <input type="text" class="" name="tradeDescription" value="交易描述" autocomplete="off"
                       placeholder="请输入交易描述" minlength="15" maxlength="50" data-callback="input.status"/>
                ×

            交易时间

                <input type="text" class="" name="tradeTime" value="<?php echo date('Y-m-d H:i:s', time());?>" autocomplete="off" placeholder="请输入交易时间" minlength="15" maxlength="50" data-callback="input.status"/>
                ×

            交易金额

                <input type="text" class="" name="tradeAmount" value="1" autocomplete="off"
                       placeholder="请输入交易金额" minlength="15" maxlength="50" data-callback="input.status"/>
                ×

            货币种类

                <input type="text" class="" name="currency" value="CNY" autocomplete="off"
                       placeholder="请输入交易币种" minlength="15" maxlength="50" data-callback="input.status"/>
                ×

            异步通知

                <input type="text" class="" name="notifyUrl" value="<?php echo ConfigUtil::get_val_by_key('notifyUrl');?>"
                       autocomplete="off" placeholder="请输入异步通知地址" minlength="15" maxlength="200"
                       data-callback="input.status"/>
                ×

            成功通知

                <input type="text" class="" name="successCallbackUrl" value="<?php echo ConfigUtil::get_val_by_key('successCallbackUrl');?>"
                       autocomplete="off" placeholder="请输入交易成功通知地址" minlength="15" maxlength="200"
                       data-callback="input.status"/>
                ×

            失败通知

                <input type="text" class="" name="failCallbackUrl" value="<?php echo ConfigUtil::get_val_by_key('failCallbackUrl');?>"
                       autocomplete="off" placeholder="请输入交易失败通知地址" minlength="15" maxlength="200"
                       data-callback="input.status"/>
                ×

            提交

</form>


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.messfuchs.geo.models;

import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

/**
 *
 * @author jurgen
 */
public class LocalCoordinateSet {

    private Set<LocalCoordinate> set = new TreeSet<>(new CompareSorter());

    public boolean add(LocalCoordinate coordinate) {
        return this.set.add(coordinate);
    }

    public LocalCoordinate findLocalCoordinatebyName(String name) {
        Iterator<LocalCoordinate> iterator = set.iterator();
        while(iterator.hasNext()) {
            LocalCoordinate coordinate = iterator.next();
            if (coordinate.getName().equals(name)) {
                return coordinate;
            }
        }
        return null;
    }

    public int size() {
        return this.getSet().size();
    }

    public Set<LocalCoordinate> getSet() {
        return set;
    }
}


text:
<?php
namespace SocalNick\Orchestrate\Exception;

class ClientException extends \RuntimeException {}


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

<title>Uses of Package org.apache.cassandra.db.composites (apache-cassandra API)</title>
<meta name="date" content="2014-11-05">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Package
org.apache.cassandra.db.composites

Packages that use org.apache.cassandra.db.composites

Package
Description

org.apache.cassandra.cache

org.apache.cassandra.config

org.apache.cassandra.cql

org.apache.cassandra.cql3

org.apache.cassandra.cql3.statements

org.apache.cassandra.db

org.apache.cassandra.db.columniterator

org.apache.cassandra.db.composites

org.apache.cassandra.db.filter

org.apache.cassandra.db.index

org.apache.cassandra.db.index.composites

org.apache.cassandra.db.index.keys

org.apache.cassandra.io.sstable

org.apache.cassandra.io.sstable.metadata

org.apache.cassandra.tracing

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.cache

Class and Description

CellName

A CellName is a Composite, but for which, for the sake of CQL3, we
 distinguish different parts: a CellName has first a number of clustering
 components, followed by the CQL3 column name, and then possibly followed by
 a collection element part.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.config

Class and Description

CellName

A CellName is a Composite, but for which, for the sake of CQL3, we
 distinguish different parts: a CellName has first a number of clustering
 components, followed by the CQL3 column name, and then possibly followed by
 a collection element part.

CellNameType

The type of CellNames.

CType

A type for a Composite.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.cql

Class and Description

CellName

A CellName is a Composite, but for which, for the sake of CQL3, we
 distinguish different parts: a CellName has first a number of clustering
 components, followed by the CQL3 column name, and then possibly followed by
 a collection element part.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.cql3

Class and Description

CellName

A CellName is a Composite, but for which, for the sake of CQL3, we
 distinguish different parts: a CellName has first a number of clustering
 components, followed by the CQL3 column name, and then possibly followed by
 a collection element part.

CellNameType

The type of CellNames.

Composite

A composite value.

CType

A type for a Composite.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.cql3.statements

Class and Description

CellNameType

The type of CellNames.

Composite

A composite value.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.db

Class and Description

CellName

A CellName is a Composite, but for which, for the sake of CQL3, we
 distinguish different parts: a CellName has first a number of clustering
 components, followed by the CQL3 column name, and then possibly followed by
 a collection element part.

CellNameType

The type of CellNames.

Composite

A composite value.

Composite.EOC

CType

A type for a Composite.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.db.columniterator

Class and Description

CellName

A CellName is a Composite, but for which, for the sake of CQL3, we
 distinguish different parts: a CellName has first a number of clustering
 components, followed by the CQL3 column name, and then possibly followed by
 a collection element part.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.db.composites

Class and Description

AbstractCellNameType

AbstractComposite

AbstractCompoundCellNameType

AbstractCType

AbstractSimpleCellNameType

CBuilder

A builder of Composite.

CellName

A CellName is a Composite, but for which, for the sake of CQL3, we
 distinguish different parts: a CellName has first a number of clustering
 components, followed by the CQL3 column name, and then possibly followed by
 a collection element part.

CellNameType

The type of CellNames.

CellNameType.Deserializer

Composite

A composite value.

Composite.EOC

CompoundComposite

A "truly-composite" Composite.

CompoundCType

A truly-composite CType.

CompoundSparseCellName

CompoundSparseCellNameType

CType

A type for a Composite.

CType.Serializer

SimpleComposite

A "simple" (not-truly-composite) Composite.

SimpleSparseCellName

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.db.filter

Class and Description

CellName

A CellName is a Composite, but for which, for the sake of CQL3, we
 distinguish different parts: a CellName has first a number of clustering
 components, followed by the CQL3 column name, and then possibly followed by
 a collection element part.

CellNameType

The type of CellNames.

Composite

A composite value.

CType

A type for a Composite.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.db.index

Class and Description

CellName

A CellName is a Composite, but for which, for the sake of CQL3, we
 distinguish different parts: a CellName has first a number of clustering
 components, followed by the CQL3 column name, and then possibly followed by
 a collection element part.

CellNameType

The type of CellNames.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.db.index.composites

Class and Description

CellName

A CellName is a Composite, but for which, for the sake of CQL3, we
 distinguish different parts: a CellName has first a number of clustering
 components, followed by the CQL3 column name, and then possibly followed by
 a collection element part.

CellNameType

The type of CellNames.

Composite

A composite value.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.db.index.keys

Class and Description

CellName

A CellName is a Composite, but for which, for the sake of CQL3, we
 distinguish different parts: a CellName has first a number of clustering
 components, followed by the CQL3 column name, and then possibly followed by
 a collection element part.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.io.sstable

Class and Description

CellNameType

The type of CellNames.

Composite

A composite value.

CType

A type for a Composite.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.io.sstable.metadata

Class and Description

CellNameType

The type of CellNames.

Classes in org.apache.cassandra.db.composites used by org.apache.cassandra.tracing

Class and Description

CellName

A CellName is a Composite, but for which, for the sake of CQL3, we
 distinguish different parts: a CellName has first a number of clustering
 components, followed by the CQL3 column name, and then possibly followed by
 a collection element part.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2014 The Apache Software Foundation


text:
using System.Globalization;

namespace Picums.Search.Azure.KeyWords
{
    public sealed class LocationFilter : IFilter
    {
        private readonly CultureInfo AzureRedableCulture;

        private readonly double Longitude;
        private readonly double Latitude;
        private readonly double distanceInKilometers;
        private readonly string locationField;

        public LocationFilter(double longitude, double latitude, string locationField, int distanceInKilometers = 25)
        {
            this.Longitude = longitude;
            this.Latitude = latitude;
            this.locationField = locationField;
            this.distanceInKilometers = distanceInKilometers;
            this.AzureRedableCulture = new CultureInfo("en-US");
        }

        private string UsFormattedLongitude
            => this.Longitude.ToString(this.AzureRedableCulture);

        private string UsFormattedLatitude
            => this.Latitude.ToString(this.AzureRedableCulture);

        private string ConvertLatAndLongToGeographyPoint
            => $" geography'POINT({this.UsFormattedLongitude} {this.UsFormattedLatitude})'";

        public string GetFilter()
            => $"geo.distance({locationField},{this.ConvertLatAndLongToGeographyPoint}) lt {distanceInKilometers}";
    }
}


text:
$.register_module({
    name: 'og.views.config_forms.futurepricecurvespecification',
    dependencies: [
        'og.api',
        'og.common.util.ui'
    ],
    obj: function () {
        var module = this, Form = og.common.util.ui.Form,
            INDX = '<INDEX>', CRIP = 'curveInstrumentProvider',
            DATA = 'dataFieldName', FUPX = 'futurePrefix', POFX = 'postfix',
            type_map = [
                ['0',                               Form.type.STR],
                [[CRIP, '0'].join('.'),             Form.type.STR],
                [[CRIP, DATA].join('.'),            Form.type.STR],
                [[CRIP, FUPX].join('.'),            Form.type.STR],
                [[CRIP, POFX].join('.'),            Form.type.STR],
                ['name',                            Form.type.STR],
                [['target', '0', INDX].join('.'),   Form.type.STR],
                [['target', 'currency'].join('.'),  Form.type.STR],
            ].reduce(function (acc, val) {return acc[val[0]] = val[1], acc;}, {}),
            constructor;
        constructor = og.views.config_forms['default'].preload({type_map: type_map});
        constructor.type_map = type_map;
        return constructor;
    }
});


text:
package org.apache.reef.javabridge;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.reef.annotations.audience.Interop;
import org.apache.reef.annotations.audience.Private;
import org.apache.reef.driver.evaluator.EvaluatorRequestor;
import org.apache.reef.driver.evaluator.FailedEvaluator;
import org.apache.reef.io.naming.Identifiable;
import org.apache.reef.util.logging.LoggingScopeFactory;

import java.util.logging.Logger;

/**
 * The Java-CLR bridge object for {@link org.apache.reef.driver.evaluator.FailedEvaluator}.
 */
@Private
@Interop(CppFiles = { "FailedEvaluatorClr2Java.cpp" }, CsFiles = { "IFailedEvaluatorClr2Java", "FailedEvaluator" })
public final class FailedEvaluatorBridge extends NativeBridge implements Identifiable {
  private static final Logger LOG = Logger.getLogger(FailedEvaluatorBridge.class.getName());
  private final FailedEvaluator jfailedEvaluator;
  private final EvaluatorRequestorBridge evaluatorRequestorBridge;
  private final String evaluatorId;
  private final ActiveContextBridgeFactory activeContextBridgeFactory;

  public FailedEvaluatorBridge(final FailedEvaluator failedEvaluator,
                               final EvaluatorRequestor evaluatorRequestor,
                               final boolean blockedForAdditionalEvaluator,
                               final LoggingScopeFactory loggingScopeFactory,
                               final ActiveContextBridgeFactory activeContextBridgeFactory) {
    this.jfailedEvaluator = failedEvaluator;
    this.evaluatorId = failedEvaluator.getId();
    this.evaluatorRequestorBridge =
        new EvaluatorRequestorBridge(evaluatorRequestor, blockedForAdditionalEvaluator, loggingScopeFactory);
    this.activeContextBridgeFactory = activeContextBridgeFactory;
  }

  public int getNewlyRequestedEvaluatorNumber() {
    return evaluatorRequestorBridge.getEvaluatorNumber();
  }

  public EvaluatorRequestorBridge getEvaluatorRequestorBridge() {
    return evaluatorRequestorBridge;
  }

  public String getCause() {
    if (jfailedEvaluator.getEvaluatorException() != null) {
      return jfailedEvaluator.getEvaluatorException().getCause().getLocalizedMessage();
    }

    return null;
  }

  public String getStackTrace() {
    if (jfailedEvaluator.getEvaluatorException() != null) {
      return ExceptionUtils.getStackTrace(jfailedEvaluator.getEvaluatorException());
    }

    return null;
  }

  public FailedContextBridge[] getFailedContexts() {
    if (jfailedEvaluator.getFailedContextList() == null) {
      return new FailedContextBridge[0];
    }

    final FailedContextBridge[] failedContextBridges =
        new FailedContextBridge[jfailedEvaluator.getFailedContextList().size()];

    for (int i = 0; i < jfailedEvaluator.getFailedContextList().size(); i++) {
      failedContextBridges[i] = new FailedContextBridge(
          jfailedEvaluator.getFailedContextList().get(i), activeContextBridgeFactory);
    }

    return failedContextBridges;
  }

  public FailedTaskBridge getFailedTask() {
    if (!jfailedEvaluator.getFailedTask().isPresent()) {
      return null;
    }

    return new FailedTaskBridge(jfailedEvaluator.getFailedTask().get(), activeContextBridgeFactory);
  }

  @Override
  public void close() {
  }

  @Override
  public String getId() {
    return evaluatorId;
  }
}


text:
package com.xu.easyweb.report;

import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: gcl
 * Date: 12-9-14
 * Time: 下午2:40
 * To change this template use File | Settings | File Templates.
 */
public class ReportConfig {

    private Map<String, ReportConfigItem> reportItems;

    public void setReportItems(Map<String, ReportConfigItem> reportItems) {
        this.reportItems = reportItems;
    }

    public Map<String, ReportConfigItem> getReportItems() {
        return reportItems;
    }
}


text:
package oracle.ateam.sample.mobile.dt.controller.parser;

import java.security.acl.Group;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

import java.util.List;

import java.util.Map;

import oracle.adf.model.adapter.dataformat.MethodDef;

import oracle.adf.model.adapter.dataformat.MethodReturnDef;

import oracle.adfdt.model.objects.DataControl;

import oracle.ateam.sample.mobile.dt.model.UIDataObjectInfo;

import oracle.binding.meta.AccessorDefinition;
import oracle.binding.meta.AttributeDefinition;
import oracle.binding.meta.DefinitionContainer;
import oracle.binding.meta.NamedDefinition;
import oracle.binding.meta.OperationDefinition;
import oracle.binding.meta.OperationReturnDefinition;
import oracle.binding.meta.ParameterDefinition;
import oracle.binding.meta.StructureDefinition;

public class DataControlUIDataObjectParser
{
  private DataControl dataControl;
  private StructureDefinition dataControlBean;
  private List<UIDataObjectInfo> accessorBeans = new ArrayList<UIDataObjectInfo>();

  public DataControlUIDataObjectParser(DataControl dataControl)
  {
    super();
    this.dataControl = dataControl;
    dataControlBean = dataControl.getRealDataControl().getDataControlDefinition().getStructure();
  }

  public void discoverBeanCollections()
  {
    discoverBeanCollections(dataControlBean, new ArrayList<StructureDefinition>(),null);
  }

  private boolean listContains(List<StructureDefinition> beansProcessed, StructureDefinition currentBean)
  {
    boolean found = false;
    for (StructureDefinition sd : beansProcessed)
    {
      if (sd.getFullName().equals(currentBean.getFullName()))
      {
        found = true;
        break;
      }
    }
    return found;
  }

  public void discoverBeanCollections(StructureDefinition currentBean, List<StructureDefinition> beansProcessed,
                                      UIDataObjectInfo parent)
  {
    if (listContains(beansProcessed,currentBean))
    {
      // can happen with recursive calls
      return;
    }
    beansProcessed.add(currentBean);
    Iterator accessors = currentBean.getAccessorDefinitions().iterator();
    while (accessors.hasNext())
    {
      Object aap = accessors.next();
      AccessorDefinition accessor = (AccessorDefinition) aap;
      StructureDefinition accBean = accessor.getStructure();
      // only add bean when itself when it has attrobutes, otherwise it is
      //a "container" element
      boolean hasAttrs = accBean!=null && accBean.getAttributeDefinitions().iterator().hasNext();
      if (hasAttrs) {
          Iterator it = accBean.getAttributeDefinitions().iterator();
          AttributeDefinition attr = (AttributeDefinition) it.next();
          if (attr.getName().equals("element") && !it.hasNext()) {
              // this is an untyped getList method that we should skip.
              // Somehow in 12.1.3 this shows in the DC palette with one attribute
              // named "element". In 11.1.2.4 this list showed up properly with no attributes and was already skipped
              hasAttrs = false;
          }
      }
      boolean createDoi = hasAttrs && accessor.isCollection() && !"DataSynchAction".equals(accBean.getName());
      if (createDoi)
      {
        UIDataObjectInfo doi = new UIDataObjectInfo(accessor,accBean,parent);
        if (!accessorBeans.contains(doi))
        {
          accessorBeans.add(doi);
          // recursive call
          discoverBeanCollections(accBean,beansProcessed, doi);
        }
      }
    }

  }

  public List<UIDataObjectInfo> getAccessorBeans()
  {
    return accessorBeans;
  }

  public List<UIDataObjectInfo> getRootAccessorBeans()
  {
    List<UIDataObjectInfo> rootBeans = new ArrayList<UIDataObjectInfo>();
    for (UIDataObjectInfo bean : getAccessorBeans())
    {
      if (bean.getParent()==null)
      {
        rootBeans.add(bean);
      }
    }
    return rootBeans;
  }

}


text:
<!DOCTYPE html>

<title>DownloadRequest_extend</title>


text:
HRESULT (STDMETHODCALLTYPE *RealIStreamWrite)(IStream * This,
                                              const void *pv,
                                              ULONG cb,
                                              ULONG *pcbWritten) = NULL;

HRESULT STDMETHODCALLTYPE MineIStreamWrite(IStream * This,
                                           const void *pv,
                                           ULONG cb,
                                           ULONG *pcbWritten)
{
    HRESULT hr;
    ULONG cbWritten = 0;
    if (pcbWritten == NULL) {
        pcbWritten = &cbWritten;
    }

    printf("commem:   %p->IStreamWrite(pv=%p, cb=%ld)\n", This, pv, cb);
    hr = RealIStreamWrite(This, pv, cb, pcbWritten);
    printf("commem:   %p->IStreamWrite -> %08lx (pcbWritten=%ld)\n", This, hr, *pcbWritten);

    return hr;
}

//////////////////////////////////////////////////////////////////////////////
//
int main(int argc, char **argv)
{
    HRESULT hr;

    (void)argc;
    (void)argv;

    LPSTREAM pStream = NULL;
    ULARGE_INTEGER ul;
    LARGE_INTEGER li;

    CoInitialize(NULL);

    hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);

    RealIStreamWrite = pStream->lpVtbl->Write;

    ul.QuadPart = 512;
    hr = pStream->lpVtbl->SetSize(pStream, ul);
    li.QuadPart = 0;
    hr = pStream->lpVtbl->Seek(pStream, li, STREAM_SEEK_SET, NULL);

    printf("commem: Calling Write w/o before attach.\n");

    li.QuadPart = 0;
    hr = pStream->lpVtbl->Write(pStream, &ul, sizeof(ul), NULL);

    DetourTransactionBegin();
    DetourUpdateThread(GetCurrentThread());
    DetourAttach(&(PVOID&)RealIStreamWrite, MineIStreamWrite);
    DetourTransactionCommit();

    printf("commem: Calling Write w/o after attach.\n");

    li.QuadPart = 1;
    hr = pStream->lpVtbl->Write(pStream, &li, sizeof(li), NULL);

    DetourTransactionBegin();
    DetourUpdateThread(GetCurrentThread());
    DetourDetach(&(PVOID&)RealIStreamWrite, MineIStreamWrite);
    DetourTransactionCommit();

    printf("commem: Calling Write w/o after detach.\n");

    li.QuadPart = 2;
    hr = pStream->lpVtbl->Write(pStream, &li, sizeof(li), NULL);

    hr = pStream->lpVtbl->Release(pStream);
    pStream = NULL;

    CoUninitialize();

    return 0;
}


text:
package org.springframework.security.oauth.common.signature;

import static org.junit.Assert.assertEquals;

import javax.crypto.spec.SecretKeySpec;

import org.junit.Test;

/**
 * @author Ryan Heaton
 */
public class HMAC_SHA1SignatureMethodTests {

	/**
	 * Test sign and verify.
	 */
	@Test
	public void testSignAndVerify() throws Exception {
		SecretKeySpec spec = new SecretKeySpec("thisismysharedsecretkeythatidontwanttoshare".getBytes("UTF-8"),
				HMAC_SHA1SignatureMethod.MAC_NAME);
		HMAC_SHA1SignatureMethod signatureMethod = new HMAC_SHA1SignatureMethod(spec);
		String baseString = "thisismysignaturebasestringthatshouldbemuchlongerthanthisbutitdoesnthavetobeandherearesomestrangecharacters!@#$%^&*)(*";
		String signature = signatureMethod.sign(baseString);
		signatureMethod.verify(baseString, signature);
	}

	/**
	 * Test sign and verify.
	 */
	@Test
	public void testSignAndVerify2() throws Exception {
		SecretKeySpec spec = new SecretKeySpec(
				"SHHHHH%21%21%21%21%21%21%21%21%21%21&4NbaOg40gJhUYHOG2GqvDHZ%2FLMCdRYRx8d%2FZuLWhghw85S3qwMpE44VIMeqdP6RhebURCIQTJSzsz%2F1cjtXFFOixdC1QfZjUVsfd4MsyICo%3D"
						.getBytes("UTF-8"), HMAC_SHA1SignatureMethod.MAC_NAME);
		HMAC_SHA1SignatureMethod signatureMethod = new HMAC_SHA1SignatureMethod(spec);
		String baseString = "POST&http%3A%2F%2Flocalhost%3A8080%2Fsparklr%2Fphoto%2F1&oauth_consumer_key%3Dtonr-consumer-key%26oauth_nonce%3D9ed2a59a-f254-4271-95e9-678795ac96f5%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1204899002%26oauth_token%3D0592328d-d03d-4737-905d-c2cccadf32ad%26oauth_version%3D1.0";
		String signature = signatureMethod.sign(baseString);
		signatureMethod.verify(baseString, signature);
	}

	/**
	 * Test sign and verify.
	 */
	@Test
	public void testSignAndVerify3() throws Exception {
		SecretKeySpec spec = new SecretKeySpec("xxxxxx&".getBytes("UTF-8"), HMAC_SHA1SignatureMethod.MAC_NAME);
		HMAC_SHA1SignatureMethod signatureMethod = new HMAC_SHA1SignatureMethod(spec);
		String baseString = "GET&http%3A%2F%2Flocalhost%3A8080%2Fgrailscrowd%2Foauth%2Frequest_token&oauth_consumer_key%3Dtonrconsumerkey%26oauth_nonce%3D1227967049787975000%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1227967049%26oauth_version%3D1.0";
		String signature = "4KaVKEnW6e1a+vwJTpz0VFqIaGU=";
		String otherSignature = signatureMethod.sign(baseString);
		assertEquals(signature, otherSignature);
		signatureMethod.verify(baseString, otherSignature);
	}

}


text:
"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var Rule = /** @class */ (function (_super) {
    tslib_1.__extends(Rule, _super);
    function Rule() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Rule.prototype.apply = function (sourceFile) {
        return this.applyWithFunction(sourceFile, walk);
    };
    /* tslint:disable:object-literal-sort-keys */
    Rule.metadata = {
        ruleName: "prefer-method-signature",
        description: "Prefer `foo(): void` over `foo: () => void` in interfaces and types.",
        hasFix: true,
        optionsDescription: "Not configurable.",
        options: null,
        optionExamples: [true],
        type: "style",
        typescriptOnly: false,
    };
    /* tslint:enable:object-literal-sort-keys */
    Rule.FAILURE_STRING = "Use a method signature instead of a property signature of function type.";
    return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function walk(ctx) {
    return ts.forEachChild(ctx.sourceFile, function cb(node) {
        if (tsutils_1.isPropertySignature(node)) {
            var type = node.type;
            if (type !== undefined && tsutils_1.isFunctionTypeNode(type)) {
                ctx.addFailureAtNode(node.name, Rule.FAILURE_STRING, type.type === undefined ? undefined : [
                    Lint.Replacement.deleteFromTo(type.pos - 1, type.getStart()),
                    Lint.Replacement.replaceFromTo(type.parameters.end + 1, type.type.pos, ":"),
                ]);
            }
        }
        return ts.forEachChild(node, cb);
    });
}


text:
using System;
using FluentAssertions;
using MoneySharp.Contract.Model;
using MoneySharp.Internal.Mapping;
using Moq.AutoMock;
using NUnit.Framework;
using Contact = MoneySharp.Internal.Model.Contact;

namespace MoneySharp.Test.Internal.Mapping
{
    public class ContactMapperTest
    {
        private AutoMocker _mocker;

        private ContactMapper _mapper;

        [SetUp]
        public void Setup()
        {
            _mocker = new AutoMocker();

            _mapper = _mocker.CreateInstance<ContactMapper>();
        }

        [Test]
        public void MapToContract_AddressEmpty_AddressIsNull()
        {
            var contact = new Contact
            {
                send_invoices_to_email = "test@test.nl",
                customer_id = "abc",
                lastname = "lastname"
            };

            var mapped = _mapper.MapToContract(contact);

            mapped.Address.Should().Be(null);
        }

        [Test]
        public void MapToContract_MandateNotActivated_MandateEmpty()
        {
            var contact = new Contact()
            {
                sepa_active = false,
                sepa_mandate_id = "abcd"
            };

            var mapped = _mapper.MapToContract(contact);

            mapped.Mandate.Should().Be(null);
        }

        [Test]
        public void MapToContract_MapAllProperties_Correctly()
        {
            var contact = new Contact()
            {
                id = 123,
                address1 = "street",
                country = "NL",
                city = "city",
                zipcode = "zipcode",
                firstname = "first",
                lastname = "last",
                company_name = "company",
                sepa_bic = "bic",
                sepa_iban = "iban",
                sepa_mandate_date = new DateTime(2016,1,9),
                phone = "0123456789",
                tax_number = "tax",
                chamber_of_commerce = "12345",
                sepa_sequence_type = "first",
                sepa_active = true,
                sepa_mandate_id = "abcd"
            };

            var mapped = _mapper.MapToContract(contact);
            var expectedResult = new Contract.Model.Contact
            {
                Id = contact.id,
                Address = new Address
                {
                    AddressLine = contact.address1,
                    Country = contact.country,
                    Place = contact.city,
                    PostalCode = contact.zipcode,
                },
                Company = contact.company_name,
                ChamberOfCommerce = contact.chamber_of_commerce,
                TaxNumber = contact.tax_number,
                SendInvoicesToEmail = contact.send_invoices_to_email,
                Firstname = contact.firstname,
                Lastname = contact.lastname,
                Mandate =  new Mandate
                {
                    AccountName = contact.sepa_iban_account_name,
                    Bic = contact.sepa_bic,
                    Iban = contact.sepa_iban,
                    Mandatecode = contact.sepa_mandate_id,
                    SequenceType = contact.sepa_sequence_type,
                    SignedMandate = contact.sepa_mandate_date
                }
            };
            mapped.Should().BeEquivalentTo(expectedResult);
        }

        [Test]
        public void MapToApi_AddressEmpty_AddressFieldsEmpty()
        {
            var contact = new Contract.Model.Contact();

            var c =  _mapper.MapToApi(contact, null);

            c.address1.Should().BeNull();
            c.zipcode.Should().BeNull();
            c.city.Should().BeNull();
            c.country.Should().BeNull();
        }

        [Test]
        public void MapToApi_MandateEmpty_MandateFieldsEmpty()
        {
            var contact = new Contract.Model.Contact();

            var c = _mapper.MapToApi(contact, null);

            c.sepa_iban_account_name.Should().BeNull();
            c.sepa_bic.Should().BeNull();
            c.sepa_iban.Should().BeNull();
            c.sepa_mandate_id.Should().BeNull();
            c.sepa_sequence_type.Should().BeNull();
            c.sepa_mandate_date.Should().Be(null);
        }

        [Test]
        public void MapToApi_MapAllProperties_Corretly()
        {
            var contact = new Contract.Model.Contact()
            {
                Id = 1234,
                Company = "company",
                Mandate = new Mandate()
                {
                    Iban = "iban",
                    SignedMandate = new DateTime(2016, 01, 1),
                    Bic = "bic",
                    SequenceType = "first",
                    Mandatecode = "mandate",
                    AccountName = "accountname",
                },
                ChamberOfCommerce = "COC",
                TaxNumber = "TAX",
                SendInvoicesToEmail = "email",
                Firstname = "firstname",
                Lastname = "lastname",
                Address = new Address()
                {
                    PostalCode = "postalcode",
                    Place = "place",
                    AddressLine = "addressLine",
                    Country = "country"
                }
            };

            var mapped = _mapper.MapToApi(contact, null);

            var expected = new Contact()
            {
                id = contact.Id,
                company_name = contact.Company,
                chamber_of_commerce = contact.ChamberOfCommerce,
                tax_number = contact.TaxNumber,
                send_invoices_to_email = contact.SendInvoicesToEmail,
                lastname = contact.Lastname,
                firstname = contact.Firstname,
                zipcode= contact.Address.PostalCode,
                country = contact.Address.Country,
                address1 = contact.Address.AddressLine,
                city = contact.Address.Place,
                sepa_active = true,
                sepa_bic = contact.Mandate.Bic,
                sepa_iban_account_name = contact.Mandate.AccountName,
                sepa_iban = contact.Mandate.Iban,
                sepa_mandate_id = contact.Mandate.Mandatecode,
                sepa_sequence_type= contact.Mandate.SequenceType,
                sepa_mandate_date = contact.Mandate.SignedMandate
            };

            mapped.Should().BeEquivalentTo(expected);
        }
    }
}


text:
package com.vmware.vim25;

/**
* @author Steve Jin (http://www.doublecloud.org)
* @version 5.1
*/

@SuppressWarnings("all")
public class HostNotReachable extends HostCommunication {
}


text:
package com.intrack.type;

import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author intrack
 */
public class LongTypeHandler extends BaseTypeHandler<Long> {

    @Override
    public void setNonNullParameter(PreparedStatement statement, int i, Object parameter, JdbcType jdbcType)
            throws SQLException {
        statement.setLong(i, (Long) parameter);
    }

    @Override
    public Long getNullableResult(ResultSet resultSet, int columnIndex) throws SQLException {
        return resultSet.getLong(columnIndex);
    }

    @Override
    public Long getNullableResult(ResultSet resultSet, String columnName) throws SQLException {
        return resultSet.getLong(columnName);
    }

    @Override
    public Long getNullableResult(CallableStatement statement, int columnIndex) throws SQLException {
        return statement.getLong(columnIndex);
    }

}


text:
package sample.jxls;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

public class Hoge {

    public String publicField = "Public Field";
    protected String protectedField = "Protected Field";
    String packageField = "Package Field";
    private String privateField = "Private Field";

    public String getPublicProperty() {
        return "Public Property";
    }

    protected String getProtectedProperty() {
        return "Protected Property";
    }

    String getPackageProperty() {
        return "Package Property";
    }

    private String getPrivateProperty() {
        return "Private Property";
    }

    public String getNull() {
        return null;
    }

    public int getInt() {
        return 10;
    }

    public long getLong() {
        return 100;
    }

    public float getFloat() {
        return 12.3f;
    }

    public double getDouble() {
        return 45.6d;
    }

    public boolean getBoolean() {
        return true;
    }

    public BigInteger getBigInteger() {
        return new BigInteger("1234");
    }

    public BigDecimal getBigDecimal() {
        return new BigDecimal("345.67");
    }

    public String getString() {
        return "String Value";
    }

    public String getEmptyString() {
        return "";
    }

    public Date getDate() {
        return new Date();
    }

    public LocalDate getLocalDate() {
        return LocalDate.now();
    }

    public String[] getArray() {
        return new String[] {"a", "b", "c"};
    }

    public List<String> getList() {
        return Arrays.asList("A", "B", "C");
    }

    public Map<String, String> getMap() {
        Map<String, String> map = new HashMap<>();
        map.put("foo", "FOO");
        return map;
    }

    public Optional<String> getOptional() {
        return Optional.of("Optional Value");
    }

    public String method() {
        return "Method Value";
    }

    public Fuga getFuga() {
        return new Fuga();
    }
}


text:
package com.hjhrq1991.tool.Util;

import android.app.Activity;
import android.content.Context;
import android.util.DisplayMetrics;

public class DensityUtils
{
	public static int dipTopx(Context context, float dpValue){
		final float scale = context.getResources().getDisplayMetrics().density;
		return (int) (dpValue * scale + 0.5f);
	}

	public static float dipTopxF(Context context, float dpValue){
		final float scale = context.getResources().getDisplayMetrics().density;
		return (dpValue * scale + 0.5f);
	}

	public static int pxTodip(Context context, float pxValue){
		final float scale = context.getResources().getDisplayMetrics().density;
		return (int) (pxValue / scale + 0.5f);
	}
	  /**
     *
     * 功能:获取屏幕密度
     * @param ctx
     * @return
     */
    public static int getScreenDPI(Context ctx){
    	DisplayMetrics metrics = new DisplayMetrics();
    	((Activity) ctx).getWindowManager().getDefaultDisplay().getMetrics(metrics);
    	//xh 320 h 240 m 160 l 120
        return  metrics.densityDpi;
    }

    /**
     *
     * 功能:获取屏幕宽度
     * @param ctx
     * @return
     */
    public static int getScreenWidth(Context ctx){
        return  ((Activity) ctx).getWindowManager().getDefaultDisplay().getWidth();
    }
    /**
     *
     * 功能:获取屏幕高度
     * @param ctx
     * @return
     */
    public static int getScreenHeight(Context ctx){
        return ((Activity) ctx).getWindowManager().getDefaultDisplay().getHeight();
    }
}


text:
<?php

defined('_JEXEC') or die;

// Include the helper functions only once
require_once __DIR__ . '/helper.php';

$input = JFactory::getApplication()->input;

		// Prep for Normal or Dynamic Modes
		$mode = $params->get('mode', 'normal');
		$idbase = null;
		switch($mode)
		{
			case 'dynamic':
				$option = $input->get('option');
				$view = $input->get('view');
				if ($option === 'com_content')
				{
					switch($view)
					{
						case 'category':
							$idbase = $input->getInt('id');
							break;
						case 'categories':
							$idbase = $input->getInt('id');
							break;
						case 'article':
							if ($params->get('show_on_article_page', 1))
							{
								$idbase = $input->getInt('catid');
							}
							break;
					}
				}
				break;
			case 'normal':
			default:
				$idbase = $params->get('catid');
				break;
		}

$cacheid = md5(serialize(array ($idbase, $module->module)));

$cacheparams = new stdClass;
$cacheparams->cachemode = 'id';
$cacheparams->class = 'ModArticlesCategoryHelper';
$cacheparams->method = 'getList';
$cacheparams->methodparams = $params;
$cacheparams->modeparams = $cacheid;

$list = JModuleHelper::moduleCache($module, $params, $cacheparams);

if (!empty($list))
{
	$grouped = false;
	$article_grouping = $params->get('article_grouping', 'none');
	$article_grouping_direction = $params->get('article_grouping_direction', 'ksort');
	$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
	$item_heading = $params->get('item_heading');

	if ($article_grouping !== 'none')
	{
		$grouped = true;
		switch($article_grouping)
		{
			case 'year':
			case 'month_year':
				$list = ModArticlesCategoryHelper::groupByDate($list, $article_grouping, $article_grouping_direction, $params->get('month_year_format', 'F Y'));
				break;
			case 'author':
			case 'category_title':
				$list = ModArticlesCategoryHelper::groupBy($list, $article_grouping, $article_grouping_direction);
				break;
			default:
				break;
		}
	}
	require JModuleHelper::getLayoutPath('mod_articles_category', $params->get('layout', 'default'));
}


text:
yum_repository 'docker-ce-stable' do
    baseurl 'https://download.docker.com/linux/centos/7/$basearch/stable'
    enabled true
    gpgcheck true
    gpgkey 'https://download.docker.com/linux/centos/gpg'
end

package 'docker-ce'

group 'docker' do
  action :modify
  members node['dockerce']['dockerce']['user']
  append true
end

service 'docker' do
    action :start
end


text:
package com.baidubce.util;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.http.annotation.NotThreadSafe;

import com.baidubce.BceClientException;

/**
 * Used to perform length check to ensure the number of bytes read from the underlying input stream is the same as the
 * expected total.
 */
@NotThreadSafe
public class LengthCheckInputStream extends FilterInputStream {
    public static final boolean INCLUDE_SKIPPED_BYTES = true;
    public static final boolean EXCLUDE_SKIPPED_BYTES = false;
    /**
     * Total number of bytes expected to be read from the underlying input stream.
     */
    private final long expectedLength;
    /**
     * True if skipped bytes are to be included as part of the data length; false otherwise.
     */
    private final boolean includeSkipped;
    /**
     * The length of the data read from the underlying input stream so far.
     */
    private long dataLength;
    private long marked; // used for mark-and-reset purposes

    /**
     * Constructs an input stream that performs length check to ensure the number of bytes read from the underlying
     * input stream is the same as the expected total.
     *
     * @param in             the underlying input stream
     * @param expectedLength the total length of the data in bytes expected to be read from the underlying input stream;
     *                       must be non-negative.
     * @param includeSkipped true if bytes skipped are to be considered as part of the data length; false otherwise.
     *                       Typically, this parameter should be set to false for uploading data to BCE,
     *                       but set to true for receiving data from BCE.
     */
    public LengthCheckInputStream(InputStream in, long expectedLength, boolean includeSkipped) {
        super(in);
        if (expectedLength < 0) {
            throw new IllegalArgumentException();
        }
        this.expectedLength = expectedLength;
        this.includeSkipped = includeSkipped;
    }

    /**
     * {@inheritDoc}
     *
     * @throws com.baidubce.BceClientException if the data length read has exceeded the expected total, or if the total
     *                                         data length is not the same as the expected total.
     */
    @Override
    public int read() throws IOException {
        final int c = super.read();
        if (c >= 0) {
            this.dataLength++;
        }
        this.checkLength(c == -1);
        return c;
    }

    /**
     * {@inheritDoc}
     *
     * @throws com.baidubce.BceClientException if the data length read has exceeded the expected total, or if the total
     *                                         data length is not the same as the expected total.
     */
    @Override
    public int read(byte[] b, int off, int len) throws IOException {
        int readLen = super.read(b, off, len);
        this.dataLength += readLen >= 0 ? readLen : 0;
        this.checkLength(readLen == -1);
        return readLen;
    }

    @Override
    public void mark(int readlimit) {
        super.mark(readlimit);
        this.marked = this.dataLength;
    }

    @Override
    public void reset() throws IOException {
        super.reset();
        if (super.markSupported()) {
            this.dataLength = this.marked;
        }
    }

    /**
     * Checks the data length read so far against the expected total.
     *
     * @param eof true if end of stream has been encountered; false otherwise
     * @throws com.baidubce.BceClientException if the data length read has exceeded the expected total, or if the total
     *                                         data length is not the same as the expected total.
     */
    private void checkLength(boolean eof) {
        if (eof) {
            if (this.dataLength != this.expectedLength) {
                throw new BceClientException("Data read (" + this.dataLength +
                        ") has a different length than the expected (" + this.expectedLength +
                        ")");
            }
        } else if (this.dataLength > this.expectedLength) {
            throw new BceClientException("More data read (" + this.dataLength + ") than expected (" +
                    this.expectedLength + ")");
        }
    }

    /**
     * {@inheritDoc}
     *
     * @throws com.baidubce.BceClientException if {@link #includeSkipped} is true and the data length skipped has
     *                                         exceeded the expected total.
     */
    @Override
    public long skip(long n) throws IOException {
        final long skipped = super.skip(n);
        if (this.includeSkipped && skipped > 0) {
            this.dataLength += skipped;
            this.checkLength(false);
        }
        return skipped;
    }
}


text:
function copy(value){
    const el = document.createElement('textarea');
    el.value = value;
    document.body.appendChild(el);
    el.select();
    document.execCommand('copy');
    document.body.removeChild(el);
}

function showTooltip(id){
    var tooltip = document.getElementById(id);
    tooltip.classList.add('show-tooltip');
    setTimeout(function(){
        tooltip.classList.remove('show-tooltip');
    }, 3000);
}

function copyFunction(id){
    // selecting the pre element
    var code = document.getElementById(id);

    // selecting the code element of that pre element
    code = code.childNodes[0]

    // copy
    copy(code.innerText);

    // show tooltip
    showTooltip('tooltip-' + id);
}

(function(){

    // capturing all pre element on the page
    var all_pre = document.getElementsByTagName("pre");

    var i, lang_name, classList, lang_name_div;
    for( i = 0; i < all_pre.length; i++){
        // get the list of class in current pre element
        classList = all_pre[i].classList;
        var id = 'pre-id-' + i;

        // tooltip
        var tooltip = '
Copied!
';

        // template of copy to clipboard icon container
        var copy_to_clipboard = '

<svg class="sm-icon" alt="click to copy"><use xlink:href="#copy-icon"></use></svg>'+ tooltip +'

';

        // extract the code language
        lang_name = classList[classList.length - 1].split('-')[1];

        if( lang_name == undefined ) lang_name = 'JavaScript'

        // if(lang_name != undefined)
            lang_name_div = '

'+ lang_name.toLocaleUpperCase() +'

';
        // else lang_name_div = '';

        // appending everythin to the current pre element
        all_pre[i].innerHTML += lang_name_div + copy_to_clipboard;
        all_pre[i].setAttribute('id', id);

    }
})()


text:
set -e

mkdir -p /opt/stellar/stellar-core/{bin,etc}

cp stellar-core/bin/stellar-core /opt/stellar/stellar-core/bin

peer_pair=`/opt/stellar/stellar-core/bin/stellar-core --genseed`
peer_seed=`echo "${peer_pair}" | grep Secret | cut -d: -f2 | cut -b2-`

validation_pair=`/opt/stellar/stellar-core/bin/stellar-core --genseed`
validation_seed=`echo "${validation_pair}" | grep Secret | cut -d: -f2 | cut -b2-`

cat > /opt/stellar/stellar-core/etc/stellar-core.cfg <<CFG
PEER_PORT=39133
RUN_STANDALONE=false
LOG_FILE_PATH="/var/log/stellar-core.log"

HTTP_PORT=39132
PUBLIC_HTTP_PORT=false

PEER_SEED="${peer_seed}"

VALIDATION_SEED="${validation_seed}"

TARGET_PEER_CONNECTIONS=20

MAX_PEER_CONNECTIONS=30

PREFERRED_PEERS=[
  "core-testnet1.stellar.org",
  "core-testnet2.stellar.org",
  "core-testnet3.stellar.org"
]

KNOWN_PEERS=[]

QUORUM_THRESHOLD=2
QUORUM_SET=[
  "gTDZhQ14WuP8rQ9SrkS1EhWNhZyybv97cHNsGRADKQtBoJpTTk",
  "gsjjWTsQP5C2HpcetiLz4LDa9VECGvZMTyhPUDWi57ZKafV5sA4",
  "gSCB2HML88CvMwt2iryJGdS61gDr2nhMeYFVWF2B4m6w5js73T"
]

DATABASE="postgresql://dbname=stellar"

[HISTORY.vagrant_single]
get="cp /opt/stellar/stellar-core/{0} {1}"
put="cp {0} /opt/stellar/stellar-core/{1}"
mkdir="mkdir -p /opt/stellar/stellar-core/{0}"

[HISTORY.core_testnet1]
get="curl -sf https://s3-eu-west-1.amazonaws.com/history.stellar.org/prd/core-testnet/core-testnet-001/{0} -o {1}"

[HISTORY.core_testnet2]
get="curl -sf https://s3-eu-west-1.amazonaws.com/history.stellar.org/prd/core-testnet/core-testnet-002/{0} -o {1}"

[HISTORY.core_testnet3]
get="curl -sf https://s3-eu-west-1.amazonaws.com/history.stellar.org/prd/core-testnet/core-testnet-003/{0} -o {1}"
CFG
chmod 600 /opt/stellar/stellar-core/etc/stellar-core.cfg

cat > /opt/stellar/stellar-core/bin/start <<CFG
#!/usr/bin/env bash

set -e

APP="/opt/stellar/stellar-core/bin/stellar-core"
OPTS="--conf /opt/stellar/stellar-core/etc/stellar-core.cfg"

# Initialze db if none found
if ! psql -c 'select 1' stellar >/dev/null 2>&1; then
    echo "Initializing database..."
    createdb -O stellar stellar

    psql >/dev/null <<SQL
GRANT CONNECT ON DATABASE stellar to horizon;
\\c stellar
REVOKE ALL ON schema public FROM public;
GRANT ALL ON schema public TO stellar;
GRANT USAGE ON SCHEMA public to horizon;

GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO horizon;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO horizon;

ALTER DEFAULT PRIVILEGES FOR USER stellar IN SCHEMA public GRANT SELECT ON SEQUENCES TO horizon;
ALTER DEFAULT PRIVILEGES FOR USER stellar IN SCHEMA public GRANT SELECT ON TABLES TO horizon;
SQL
    OPTS="\${OPTS} --newdb"
fi

# Allow core dumps
ulimit -c unlimited

# Use newhist if no history available
if ! test -d /opt/stellar/stellar-core/history; then
    OPTS="\${OPTS} --newhist vagrant_single"
fi

exec "\${APP}" \${OPTS} "\$@"
CFG

chmod +x /opt/stellar/stellar-core/bin/start

chown -R stellar:stellar /opt/stellar

touch /var/log/stellar-core.log
chown stellar:stellar /var/log/stellar-core.log

cat > /etc/init/stellar-core.conf <<UPSTART
# THIS FILE IS DEPLOYED VIA PUPPET
start on runlevel [2345]
stop on runlevel [06]

setuid stellar
setgid stellar

limit nofile 8192 10240

respawn

chdir /opt/stellar/home

exec /opt/stellar/stellar-core/bin/start
UPSTART

start stellar-core