text:
import java.util.Arrays;

public class PlayerSkeletonAlternative {

    public static boolean DEBUG = false;

    public static boolean PRINT_UTILITY = true;

    public static boolean PRINT_HASH_AFTER_EACH_GAME = true;

    public static boolean PRINT_LINES_CLEARED = true;

    private static final int NOT_HOLE = -1;

    private static final int[][] neighbors =
        {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};

    // Make copies of static variables
    public static final int ORIENT = State.ORIENT;
    public static final int SLOT = State.SLOT;
    public static final int COLS = State.COLS;
    public static final int ROWS = State.ROWS;
    public static final int N_PIECES = State.N_PIECES;
    public static final int[][][] pTop = State.getpTop();
    public static final int[][][] pBottom = State.getpBottom();
    public static final int[][] pWidth = State.getpWidth();
    public static final int[][] pHeight = State.getpHeight();

    // Factor for scaling reward against utility
    private static final double REWARD_FACTOR = 1;

    // Waiting time between consecutive moves
    private static final long WAITING_TIME = 0;

    // Total number of games to be played
    private static int NO_OF_GAMES = 10;

    // Weights
    private static double constant_weight;
    private static double[] absoulte_column_height_weight;
    private static double[] relative_column_height_weight;
    private static double highest_column_height_weight;
    private static double holes_weight;

    // Record the utility and reward values of all moves for printing
    // 22 feature values followed by reward value
    private static double[][] features;

    // Record number of board state printed
    static int number_of_board_states = 1;
    static int MAX_BOARD_STATE = 5000;

	// Implement this function to have a working system
	public int pickMove(State s, int[][] legalMoves) {

        // initialize value array for all moves
        features = new double[legalMoves.length][23];

        // Record the move that produces max utility and reward
        int moveWithMaxUtilityAndReward = 0;
        double maxUtilityAndReward = -9999;

        int[][] currentField = deepCopy2D(s.getField());
        int[] currentColumnHeights = deepCopy(s.getTop());

        int[][] simulatedNextField;
        int[] simulatedColumnHeights;

        for (int i = 0; i < legalMoves.length; i++) {
            simulatedNextField = deepCopy2D(currentField);
            simulatedColumnHeights = deepCopy(currentColumnHeights);
            int rowRemoved = tryMakeMove(legalMoves[i][ORIENT],
                                         legalMoves[i][SLOT],
                                         s, simulatedNextField,
                                         simulatedColumnHeights);

            // The move does not result in end game, we proceed to evaluate
            if (rowRemoved != -1) {
                double reward = rowRemoved * REWARD_FACTOR;

                // Update constant and reward value for the move for printing
                features[i][0] = 1;
                features[i][22] = rowRemoved;

                double utility = evalUtility(i, simulatedNextField,
                                             simulatedColumnHeights);
                utility += constant_weight;

                if (DEBUG) {
                    System.out.println("Eval: Move: " + i + ", Reward: " +
                                       reward +
                                       ", Utility:" + utility);
                }

                if (reward + utility > maxUtilityAndReward) {
                    maxUtilityAndReward = reward + utility;
                    moveWithMaxUtilityAndReward = i;
                }
            }
        }

        // In the case where all moves lead to losing, it will choose the first
        // move with index 0
        if (DEBUG) {
            System.out.println();
            System.out.println("Choice: " + "Move: " +
                               moveWithMaxUtilityAndReward +
                               ", Reward+Utility:"
                               + maxUtilityAndReward);
            System.out.println();
        }

        int pick = moveWithMaxUtilityAndReward;

        // Print the feature and reward values for interfacing with learner
        // Do not print the last state
        if (PRINT_UTILITY && features[pick][0] != 0) {
            number_of_board_states++;

            for (int i = 0; i < features[pick].length; i++) {
                System.out.print(features[pick][i]);
                System.out.print(' ');
            }
            System.out.println();
        }
        return pick;
	}

    private double evalUtility(int move, int[][] field, int[] columnHeights) {
        double utility = 0.0;

        double utility_to_be_added = 0.0;

        // Add utility for absolute column heights
        // The more rows left for each column, the higher the utility
        for (int i = 0; i < columnHeights.length; i++) {
            utility_to_be_added = absoulte_column_height_weight[i] *
                                  columnHeights[i];

            // Update index 1 to 10
            features[move][i + 1] = columnHeights[i];

            utility += utility_to_be_added;
        }

        // Add utility for relative heights for neighboring columns
        int height_diff = 0;
        for (int i = 0; i < columnHeights.length - 1; i++) {
            height_diff = Math.abs(columnHeights[i] - columnHeights[i + 1]);
            utility_to_be_added = relative_column_height_weight[i] *
                                  height_diff;

            // Update index 11 to 19
            features[move][i + 11] = height_diff;

            utility += utility_to_be_added;
        }

        // Add utility for max height of column
        int highest = 0;
        for (int i = 0; i < columnHeights.length; i++) {
            if (columnHeights[i] > highest) {
                highest = columnHeights[i];
            }
        }
        utility_to_be_added = highest_column_height_weight * highest;

        // update index 20
        features[move][20] = highest;

        utility += utility_to_be_added;

        // Add utility for holes
        int no_of_holes = getNumberOfHoles(field);
        utility_to_be_added = holes_weight * no_of_holes;
        if (DEBUG) {
            System.out.println("Move: " + move + ", No of holes: "
                               + no_of_holes
                               + ", utility added for holes:" +
                               utility_to_be_added);
        }

        // Update index 21
        features[move][21] = no_of_holes;

        utility += utility_to_be_added;

        return utility;
    }

    private int getNumberOfHoles(int[][] field) {
        int count = 0;
        int[][] scratch_field = new int[field.length][field[0].length];

        // Copy the the field to another array for scratch work
        for (int i = 0; i < field.length; i++) {
            for (int j = 0; j < field[i].length; j++) {
                scratch_field[i][j] = field[i][j];
            }
        }

        for (int i = 0; i < field[0].length; i++) {
            fillNotHoles(field.length - 1, i, scratch_field);
        }

        for (int i = 0; i < field.length; i++) {
            for (int j = 0; j < field[i].length; j++) {
                if (scratch_field[i][j] == 0) {
                    count++;
                }
            }
        }

        return count;
    }

    private void fillNotHoles(int r, int c, int[][] field) {
        if (r < 0 || r >= field.length || c < 0 || c >= field[0].length) {
            return;
        }

        if (field[r][c] != 0) {
            return;
        }

        field[r][c] = NOT_HOLE;

        for (int i = 0; i < neighbors.length; i++) {
            int nr = r + neighbors[i][0];
            int nc = c + neighbors[i][1];

            fillNotHoles(nr, nc, field);
        }
    }

    /**
     * Simulate the effect of making a specific move
     *
     * Modifies simulated next field and height of each column for further
     * evaluation
     *
     * @param orient
     * @param slot
     * @param s
     * @return number of rows removed, -1 if lost
     */
    public int tryMakeMove(int orient, int slot, State s, int[][] field,
            int[] top) {

        // Initialize state-related variables

        int nextPiece = s.getNextPiece();
        int turn = s.getTurnNumber() + 1;

        // Height if the first column makes contact
        int height = top[slot] - pBottom[nextPiece][orient][0];

        // For each column beyond the first in the piece
        for (int c = 1; c < pWidth[nextPiece][orient]; c++) {
            height = Math.max(height,
                              top[slot + c] - pBottom[nextPiece][orient][c]);
        }

        // Check if game ended
        if (height + pHeight[nextPiece][orient] >= ROWS) {
            return -1;
        }

        // For each column in the piece - fill in the appropriate blocks
        for (int i = 0; i < pWidth[nextPiece][orient]; i++) {
            // From bottom to top of brick
            for (int h = height + pBottom[nextPiece][orient][i];
                 h < height + pTop[nextPiece][orient][i];
                 h++) {
                field[h][i + slot] = turn;
            }
        }

        // adjust top
        for (int c = 0; c < pWidth[nextPiece][orient]; c++) {
            top[slot + c] = height + pTop[nextPiece][orient][c];
        }

        int rowsCleared = 0;

        // check for full rows - starting at the top
        for (int r = height + pHeight[nextPiece][orient] - 1;
             r >= height;
             r--) {
            // check all columns in the row
            boolean full = true;
            for (int c = 0; c < COLS; c++) {
                if (field[r][c] == 0) {
                    full = false;
                    break;
                }
            }
            // if the row was full - remove it and slide above stuff down
            if (full) {
                rowsCleared++;
                // for each column
                for (int c = 0; c < COLS; c++) {

                    // slide down all bricks
                    for (int i = r; i < top[c]; i++) {
                        field[i][c] = field[i + 1][c];
                    }
                    // lower the top
                    top[c]--;
                    while (top[c] >= 1 && field[top[c] - 1][c] == 0)
                        top[c]--;
                }
            }
        }

        return rowsCleared;
    }

	public static void main(String[] args) {

        if (args.length == 23) {
            // Take in weights from the command line if present
            NO_OF_GAMES = Integer.parseInt(args[0]);
            initializeWeights(args);
        } else if (args.length > 0) {
            NO_OF_GAMES = Integer.parseInt(args[0]);
            // Parse two arguments into 23 arguments
            if (args.length >= 2) {
                // System.out.println("1st argument: " + args[0]);
                // System.out.println("2nd argument: " + args[1]);
                // System.out.println("2nd argument length: "
                // + args[1].split(" ").length);
                String[] actual_args = new String[23];
                actual_args[0] = args[0];
                for (int i = 1; i < actual_args.length; i++) {
                    actual_args[i] = args[1].split(" ")[i - 1];
                }
                initializeWeights(actual_args);
            } else {
                System.exit(0);
            }
        } else {
            // Use default weights if arguments are not present
            initializeWeights();
        }

        State s;
        TFrame t;
        for (int i = 0; i < NO_OF_GAMES; i++) {

            s = new State();
            t = new TFrame(s);

            PlayerSkeletonAlternative p = new PlayerSkeletonAlternative();

            while(!s.hasLost()) {
                s.makeMove(p.pickMove(s, s.legalMoves()));
                s.draw();
                s.drawNext(0, 0);

                try {
                    Thread.sleep(WAITING_TIME);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

            if (number_of_board_states > MAX_BOARD_STATE) {
                // Do not proceed since we reached the max board state
                if (PRINT_LINES_CLEARED) {
                    System.out.println("You have completed " + s.getRowsCleared()
                            + " rows.");
                }
                t.dispose();
                break;
            }

            // Remove the windows as we finish the game
            if (i < NO_OF_GAMES) {
                t.dispose();
            }

            // Print signal for next game
            if (PRINT_HASH_AFTER_EACH_GAME && i != NO_OF_GAMES - 1) {
                System.out.println("#");
            }

            if (PRINT_LINES_CLEARED) {
                System.out.println("You have completed " + s.getRowsCleared()
                        + " rows.");
            }

        }

	}

    private static void initializeWeights(String[] args) {

        // args[1] for constant
        constant_weight = Double.parseDouble(args[1]);

        // args[2] to args[11] for absolute column heights
        absoulte_column_height_weight = new double[COLS];
        for (int i1 = 0; i1 < absoulte_column_height_weight.length; i1++) {
            absoulte_column_height_weight[i1] = Double
                    .parseDouble(args[2 + i1]);
        }

        // args[12] to args[20] for relative column heights
        relative_column_height_weight = new double[COLS - 1];
        for (int i1 = 0; i1 < relative_column_height_weight.length; i1++) {
            relative_column_height_weight[i1] = Double
                    .parseDouble(args[12 + i1]);
        }

        // args[21] for relative column heights
        highest_column_height_weight = Double.parseDouble(args[21]);

        // args[22] for relative column heights
        holes_weight = Double.parseDouble(args[22]);

        assert (absoulte_column_height_weight.length == 10);
        assert (relative_column_height_weight.length == 9);

    }

    private static void initializeWeights() {
        constant_weight = 1.0;
        absoulte_column_height_weight = new double[COLS];
        for (int i1 = 0; i1 < absoulte_column_height_weight.length; i1++) {
            absoulte_column_height_weight[i1] = -0.05;
        }

        relative_column_height_weight = new double[COLS - 1];
        for (int i1 = 0; i1 < relative_column_height_weight.length; i1++) {
            relative_column_height_weight[i1] = -0.5;
        }

        highest_column_height_weight = -0.5;
        holes_weight = -1.0;

        assert (absoulte_column_height_weight.length == 10);
        assert (relative_column_height_weight.length == 9);
    }

    public static int[][] deepCopy2D(int[][] original) {
        if (original == null) {
            return null;
        }

        final int[][] result = new int[original.length][];
        for (int i = 0; i < original.length; i++) {
            result[i] = Arrays.copyOf(original[i], original[i].length);
        }
        return result;
    }

    public static int[] deepCopy(int[] original) {
        if (original == null) {
            return null;
        }

        int[] result = new int[original.length];
        result = Arrays.copyOf(original, original.length);
        return result;
    }

}


text:
import DefaultAdapter from '../../src/adapters/DefaultAdapter';

export default class DummyAdapter extends DefaultAdapter {}

redpajama_set_name: RedPajamaGithub


text:
import {Notification, SystemNotifications} from "models/notifications/system_notifications";

export class DataSharingCleaner {
  static USAGE_DATA_LAST_REPORTED_TIME_KEY = "last_usage_data_reporting_check_time";

  static clean() {
    DataSharingCleaner.cleanupLocalStorage();
    return DataSharingCleaner.cleanupNotifications();
  }

  static cleanupLocalStorage() {
    localStorage.removeItem(DataSharingCleaner.USAGE_DATA_LAST_REPORTED_TIME_KEY);
  }

  static cleanupNotifications() {
    return SystemNotifications.all().then((allNotifications: SystemNotifications) => {
      allNotifications.remove((m: Notification) => {
        return m.type === "DataSharing" || m.type === "DataSharing_v18.8.0";
      });

      SystemNotifications.setNotifications(allNotifications);
    });

  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2013 52°North Initiative for Geospatial Open Source Software GmbH

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

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

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<SearchSensorRequest service="SIR" version="0.3.0" xmlns="http://52north.org/sir/0.3.2" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:swe="http://www.opengis.net/swe/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://52north.org/sir/0.3.2 http://52north.org/schema/sir/0.3.2/sirAll.xsd">
	<SearchCriteria>
		<ServiceCriteria>
			<ServiceURL>http://v-swe.uni-muenster.de:8080/WeatherSOS/sos</ServiceURL>
			<ServiceType>SOS</ServiceType>
		</ServiceCriteria>
		<Phenomenon>
			<PhenomenonName>urn:x-ogc:def:property:OGC::RelativeHumidity</PhenomenonName>
		</Phenomenon>
		<BoundingBox crs="urn:ogc:def:crs:EPSG:6.14:4326" dimensions="2">
			<ows:LowerCorner>-180.0 -90.0 </ows:LowerCorner>
			<ows:UpperCorner>180.0 90.0 </ows:UpperCorner>
		</BoundingBox>
	</SearchCriteria>
</SearchSensorRequest>


text:
<div id="img_intro" class="parallax-window" data-parallax="scroll" data-image-src="<?php echo base_url(); ?>assets/img/home.png">

Le concept

<?php echo $concept; ?>

 À la une

		<?php
			foreach ($highlights as $item) {
				if ($item != null) $this->load->view('shared/_item_container', array('item' => $item));
			}
		?>

 Nous contacter:

				<input type="text" id="contact-name" class="form-control" />
				Votre nom

				<input type="text" id="contact-email" class="form-control" />
				Votre email

				<input type="text" id="contact-subject" class="form-control" />
				Sujet

				<textarea type="text" id="contact-message" class="md-textarea"></textarea>
				Votre message

				<button id="contact-admin" class="btn btn-default bg-green-color">Envoyer</button>

						Ou par téléphone?

						 + 01 234 565 280


text:
/*----------------------------------------------
Programmer: Alberto Bobadilla (labigm@gmail.com)
Date: 2017/06
----------------------------------------------*/
#ifndef __DEFINITIONS_H_
#define __DEFINITIONS_H_

//#include <vld.h>
#include "Simplex\Simplex.h"

#include "SFML\Window.hpp"
#include "SFML\Graphics.hpp"
#include "SFML\OpenGL.hpp"

#endif //__DEFINITIONS_H_

/*
USAGE:
ARGUMENTS: ---
OUTPUT: ---
*/


text:
<?php

/**
 * @param array                    $params
 * @param Smarty_Internal_Template $smarty
 *
 * @return string
 *
 * @author Kovács Vince
 */
function smarty_function_url_current($params, Smarty_Internal_Template &$smarty)
{
    return \URL::current();
}


text:
C++ library

## Getting Started

A collection of c++ modules, that are build for cross-platform usage, small code footprint and performance

### Prerequisities

C++14 compliant compiler. Code is tested using MSVC and Clang. Should work cross-platform
GNP requires gnuplot to be installed on the system and that its location is specified when constructing `vool::gnuplot`

### Installing

Include "include" folder into your project and `#include` wanted modules

Example:

```cpp
#include "Vecmap.h"
```

## Running the tests

Easiest way is to download the entire project, compile it and take a look at main() in test/Main.cpp

## Features

### Vecmap.h
A key value container built on top of std::vector
For an in depth explanation and benchmarks read this [blog post](http://www.lukas-bergdoll.net/blog/2016/1/31/big-o-pitfalls)

```cpp
vool::vec_map<K, V> map;
map.insert(key, value);
V lookup = map[key]; // value lookup using binary search
```

### GNP.h
A gnuplot pipe interface, built for convenience. Features include:
* Easy string concatenation
* Simple presets for live window or png output
* Ploting data using `vool::plot_data_2D` struct as data representation

```cpp
vool::gnuplot::filepath_t gnuplot_filepath = "C:\\ProgramData\\gnuplot\\bin\\gnuplot";
vool::gnuplot gnp(gnuplot_filepath);

uint32_t samples = 100;
gnp("set samples ", samples);
gnp.name_axis("A", "B");
gnp.set_terminal_window(1200, 500);
gnp.add_linestyle(1, "#FF5A62", 2, 3, 5, 1.5f);
gnp.add_grid();

gnp("plot sin(x) ls 1"); // should open window and display plot of sin(x)

gnp.set_terminal_png(1200, 500);
gnp.set_png_filename("TestGraph");

gnp("plot sin(x) ls 1"); // should save plot of sin(x) as png file
```

### TestSuit.h
Benchmarking tool using GNP to visualize its results

```cpp
size_t size = 1000;

auto test_vec = vool::make_test("build vec",
    [](const size_t size)
    { std::vector<int> v(size); }
);

auto test_list = vool::make_test("build list",
    [](const size_t size)
    { std::list<int> l(size); }
);

auto category = vool::make_test_category("build", test_vec, test_list);

vool::suit_config config;
config.filename = "Tst_";

auto suit = vool::make_test_suit(config, category);
suit.perform_categorys(0, size);
suit.render_results();
```

### TaskQueue.h
Smart multithreading helper, designed for small overhead
Internally using `std::atomic_flag` as synchronization primitive
Tasks can be added from different threads

```cpp
{
vool::task_queue tq;

// add 2 tasks which can execute in parallel
auto condition_a = tq.add_task([&vec_a] { func(vec_a); });
auto condition_b = tq.add_task([&vec_b] { func(vec_b); });

// add a task that should only start as soon as the first 2 are finished
tq.add_task(
	[&vec_a, &vec_b, &res]() { combine(vec_a, vec_b, res) },
	{ condition_a, condition_b } // requesites returned from adding task A and B
);
}

// tq now out of scope
// task_queue destructor should block until all tasks are done
```

## Built With

* MSCV 15 update 3, or Clang 3.7

## Contributing

Fork and open a pull request

## Authors

* **Lukas Bergdoll** - [Blog](http://www.lukas-bergdoll.net/blog)

## License

This project is licensed under the Apache License 2.0 License - see the [LICENSE.md](LICENSE.md) file for details


text:
package hivemall.regression;

import hivemall.common.EtaEstimator;
import hivemall.common.LossFunctions;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;

public final class LogressUDTF extends OnlineRegressionUDTF {

    private EtaEstimator etaEstimator;

    @Override
    public StructObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException {
        final int numArgs = argOIs.length;
        if(numArgs != 2 && numArgs != 3) {
            throw new UDFArgumentException("LogressUDTF takes 2 or 3 arguments: List<Text|Int|BitInt> features, float target [, constant string options]");
        }

        return super.initialize(argOIs);
    }

    @Override
    protected Options getOptions() {
        Options opts = super.getOptions();
        opts.addOption("t", "total_steps", true, "a total of n_samples * epochs time steps");
        opts.addOption("power_t", true, "The exponent for inverse scaling learning rate [default 0.1]");
        opts.addOption("eta0", true, "The initial learning rate [default 0.1]");
        return opts;
    }

    @Override
    protected CommandLine processOptions(ObjectInspector[] argOIs) throws UDFArgumentException {
        CommandLine cl = super.processOptions(argOIs);

        this.etaEstimator = EtaEstimator.get(cl);
        return cl;
    }

    @Override
    protected void checkTargetValue(final float target) throws UDFArgumentException {
        if(target < 0.f || target > 1.f) {
            throw new UDFArgumentException("target must be in range 0 to 1: " + target);
        }
    }

    @Override
    protected float computeUpdate(final float target, final float predicted) {
        float eta = etaEstimator.eta(count);
        float gradient = LossFunctions.logisticLoss(target, predicted);
        return eta * gradient;
    }

}


text:
<form action="decrypt.php" method="post">
    <fieldset>

            <input autofocus class="form-control" name="cipher" placeholder="Cipher" type="text"/>

            <input class="form-control" name="key" placeholder="Key" type="text"/>

            <button type="submit" class="btn btn-default">Decrypt</button>

    </fieldset>
</form>


text:
require('shelljs/global');
var fs = require('fs');
var current_path = process.cwd();
var child_process = require('child_process');

mkdir('-p', current_path + '/offl');
// cp('-Rf', __dirname + '/*', current_path + '/mongoose-console');

child_process.exec('cp -rf '+ __dirname + '/vendor/cgo/*' +' ' + current_path + '/offl',
  function (error, stdout, stderr) {
    if (error !== null) {
      console.log('exec error: ' + error);
    }
});


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

  <meta content="text/html; charset=iso-8859-1" http-equiv="content-type">
  <title>GAT Help</title>
  <link rel="stylesheet" type="text/css" href="Help.css">

Spatial filtering

Spatial filtering is one of the most powerful tool for spatial analysis
based on local neighbourhoods. This process involes the use of a moving window,
or kernel, of a specified size. The window is moved over-top of each grid cell
in a grid and each of the neighbouring cells within the window are examined and
some form of mathematical manipulation is performed. Often the manipulation
involves convolving the neighbouring values with a specified set of weight
values. Spatial filtering is used in many image analysis applications, most
notably, smoothing and noise reduction, sharpening, edge detection, line
detection, skeletonization and line thinning, and mathematical morphology.

The following spatial filters are available in Whitebox GAT:

  <col>
  <col>

Adaptive filter

Diversity

Emboss

Edge-preserving Smoothing (Bilateral)

Gaussian

High-pass

k-Nearest mean

Laplacian

Line detection

Maximum

Mean

Minimum

Median

Mode

Olympic

Percentile

Prewitt

Range

Sobel

Standard deviation

Total

User-defined weights

For further information about the specifics of their algorithms and use,
please see their individual help entries.


text:
"""
parser.http.topBottomParser module (imdb package).

This module provides the classes (and the instances), used to parse the
lists of top 250 and bottom 100 movies.
E.g.:
    http://akas.imdb.com/chart/top
    http://akas.imdb.com/chart/bottom

Copyright 2009 Davide Alberani <da@erlug.linux.it>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
"""

from imdb.utils import analyze_title
from utils import DOMParserBase, Attribute, Extractor, analyze_imdbid

class DOMHTMLTop250Parser(DOMParserBase):
    """Parser for the "top 250" page.
    The page should be provided as a string, as taken from
    the akas.imdb.com server.  The final result will be a
    dictionary, with a key for every relevant section.

    Example:
        tparser = DOMHTMLTop250Parser()
        result = tparser.parse(top250_html_string)
    """
    label = 'top 250'
    ranktext = 'top 250 rank'

    def _init(self):
        self.extractors = [Extractor(label=self.label,
                        path="//div[@id='main']//table//tr",
                        attrs=Attribute(key=None,
                                multi=True,
                                path={self.ranktext: "./td[1]//text()",
                                        'rating': "./td[2]//text()",
                                        'title': "./td[3]//text()",
                                        'movieID': "./td[3]//a/@href",
                                        'votes': "./td[4]//text()"
                                        }))]

    def postprocess_data(self, data):
        if not data or self.label not in data:
            return []
        mlist = []
        data = data[self.label]
        # Avoid duplicates.  A real fix, using XPath, is auspicabile.
        # XXX: probably this is no more needed.
        seenIDs = []
        for d in data:
            if 'movieID' not in d: continue
            if self.ranktext not in d: continue
            if 'title' not in d: continue
            theID = analyze_imdbid(d['movieID'])
            if theID is None:
                continue
            theID = str(theID)
            if theID in seenIDs:
                continue
            seenIDs.append(theID)
            minfo = analyze_title(d['title'])
            try: minfo[self.ranktext] = int(d[self.ranktext].replace('.', ''))
            except: pass
            if 'votes' in d:
                try: minfo['votes'] = int(d['votes'].replace(',', ''))
                except: pass
            if 'rating' in d:
                try: minfo['rating'] = float(d['rating'])
                except: pass
            mlist.append((theID, minfo))
        return mlist

class DOMHTMLBottom100Parser(DOMHTMLTop250Parser):
    """Parser for the "bottom 100" page.
    The page should be provided as a string, as taken from
    the akas.imdb.com server.  The final result will be a
    dictionary, with a key for every relevant section.

    Example:
        tparser = DOMHTMLBottom100Parser()
        result = tparser.parse(bottom100_html_string)
    """
    label = 'bottom 100'
    ranktext = 'bottom 100 rank'

_OBJECTS = {
    'top250_parser':  ((DOMHTMLTop250Parser,), None),
    'bottom100_parser':  ((DOMHTMLBottom100Parser,), None)
}


text:
from __future__ import absolute_import, unicode_literals
from cel.cel import task
from src import db, logging
import pexpect
#*args is testing hook
@task.task
def run_command(command, password, taskid, *args): #runs built command and determines if become password needs to be used
	#rules = ['-k' in command,
	#		'--ask-sudo-pass' in command,
	#		'-K' in command,
	#		'--ask-pass' in command]
	logging.debug(command)
	logging.debug(password)
	#if any(rules):
	#try except fall through
	try:
		process = pexpect.spawnu(command, timeout=None)
		logging.debug('enter password')
		process.expect('password')
		process.sendline(password)
		pexpect_readout(password, taskid)
	except pexpect.exceptions.EOF:
		process = pexpect.spawnu(command, timeout=None)
		pexpect_readout(process, taskid)

def pexpect_readout(process, taskid):
	stdout = process.read()
	logging.debug(stdout+ 'stdout')
	db.db_updateinput(stdout, taskid)


text:
import azure.cosmos.cosmos_client as cosmos_client
import azure.cosmos._synchronized_request as synchronized_request
import unittest
import test_config

#  TODO: Check if this test is needed - not sure what is being tested here other than account names?

class FakePipelineResponse:
    def __init__(
        self,
        http_response,
    ):
        self.http_response = http_response

class FakeHttpResponse:
    def __init__(
        self,
        content,
        headers,
        status_code
    ):
        self.content = content
        self.headers = headers
        self.status_code = status_code

    def body(self):
        return self.content

class MediaTests(unittest.TestCase):
    database_account_string = b'''{"_self": "",
    "id": "fake-media",
    "_rid": "fake-media.documents.azure.com",
    "media": "//media/",
    "addresses": "//addresses/",
    "_dbs": "//dbs/",
    "writableLocations": [
        {"name": "UK South", "databaseAccountEndpoint": "https://fake-media-uksouth.documents.azure.com:443/"}],
     "readableLocations": [
         {"name": "UK South", "databaseAccountEndpoint": "https://fake-media-uksouth.documents.azure.com:443/"},
         {"name": "UK West", "databaseAccountEndpoint": "https://fake-media-ukwest.documents.azure.com:443/"}],
     "enableMultipleWriteLocations": false,
     "userReplicationPolicy": {"asyncReplication": false, "minReplicaSetSize": 3, "maxReplicasetSize": 4},
     "userConsistencyPolicy": {"defaultConsistencyLevel": "Session"},
     "systemReplicationPolicy": {"minReplicaSetSize": 3, "maxReplicasetSize": 4},
     "readPolicy": {"primaryReadCoefficient": 1, "secondaryReadCoefficient": 1}}'''

    response = FakePipelineResponse(FakeHttpResponse(database_account_string, {}, 200))

    def test_account_name_with_media(self):
        host = "https://fake-media.documents.azure.com:443/"
        master_key = test_config._test_config.masterKey
        try:
            original_execute_function = synchronized_request._PipelineRunFunction
            synchronized_request._PipelineRunFunction = self._MockRunFunction
            cosmos_client.CosmosClient(host, master_key, consistency_level="Session")
        finally:
            synchronized_request._PipelineRunFunction = original_execute_function

    def _MockRunFunction(self, pipeline_client, request, **kwargs):
        return self.response


text:
package scalatime.impl

import java.time.temporal.Temporal
import java.time.{DateTimeException, Month, MonthDay}

import scala.language.implicitConversions

/** Enriches a [[Month]] with additional methods. */
final case class MonthOps(underlying: Month) extends AnyVal {

  /** Obtains the month-of-year which is the specified number of months after this one. */
  def +(months: Int): Month = underlying.plus(months)

  /** Obtains the month-of-year which is the specified number of months before this one. */
  def -(months: Int): Month = underlying.minus(months)

  /** Obtains a [[java.time.MonthDay]] by combining this month with the specified day-of-month.
    *
    * @throws DateTimeException if the day-of-month is invalid for the month.
    */
  def /(day: Int): MonthDay = MonthDay.of(underlying, day)

  def =~(temporal: Temporal): Temporal = underlying.adjustInto(temporal)

}

trait ToMonthOps extends Any {
  implicit final def toMonthOpsFromMonth(f: Month): MonthOps = new MonthOps(f)
}


text:
.class Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;
.super Ljava/lang/Object;
.source "KeyguardHostView.java"

# interfaces
.implements Lcom/android/internal/policy/impl/keyguard/KeyguardSecurityCallback;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

# direct methods
.method constructor <init>(Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;)V
    .locals 0
    .parameter

    .prologue
    .line 628
    iput-object p1, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public dismiss(Z)V
    .locals 1
    .parameter "authenticated"

    .prologue
    .line 637
    iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    #calls: Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->showNextSecurityScreenOrFinish(Z)V
    invoke-static {v0, p1}, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->access$900(Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;Z)V

    .line 638
    return-void
.end method

.method public getFailedAttempts()I
    .locals 1

    .prologue
    .line 658
    iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    #getter for: Landroid/view/View;->mContext:Landroid/content/Context;
    invoke-static {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->access$1600(Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;)Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->getInstance(Landroid/content/Context;)Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;

    move-result-object v0

    invoke-virtual {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->getFailedUnlockAttempts()I

    move-result v0

    return v0
.end method

.method public isVerifyUnlockOnly()Z
    .locals 1

    .prologue
    .line 641
    iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->mIsVerifyUnlockOnly:Z
    invoke-static {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->access$1000(Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;)Z

    move-result v0

    return v0
.end method

.method public reportFailedUnlockAttempt()V
    .locals 2

    .prologue
    .line 650
    iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->mCurrentSecuritySelection:Lcom/android/internal/policy/impl/keyguard/KeyguardSecurityModel$SecurityMode;
    invoke-static {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->access$1300(Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;)Lcom/android/internal/policy/impl/keyguard/KeyguardSecurityModel$SecurityMode;

    move-result-object v0

    sget-object v1, Lcom/android/internal/policy/impl/keyguard/KeyguardSecurityModel$SecurityMode;->Biometric:Lcom/android/internal/policy/impl/keyguard/KeyguardSecurityModel$SecurityMode;

    if-ne v0, v1, :cond_0

    .line 651
    iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    #getter for: Landroid/view/View;->mContext:Landroid/content/Context;
    invoke-static {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->access$1400(Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;)Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->getInstance(Landroid/content/Context;)Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;

    move-result-object v0

    invoke-virtual {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->reportFailedBiometricUnlockAttempt()V

    .line 655
    :goto_0
    return-void

    .line 653
    :cond_0
    iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    #calls: Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->reportFailedUnlockAttempt()V
    invoke-static {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->access$1500(Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;)V

    goto :goto_0
.end method

.method public reportSuccessfulUnlockAttempt()V
    .locals 1

    .prologue
    .line 645
    iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    #getter for: Landroid/view/View;->mContext:Landroid/content/Context;
    invoke-static {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->access$1100(Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;)Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->getInstance(Landroid/content/Context;)Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;

    move-result-object v0

    invoke-virtual {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->clearFailedUnlockAttempts()V

    .line 646
    iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->mLockPatternUtils:Lcom/android/internal/widget/LockPatternUtils;
    invoke-static {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->access$1200(Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;)Lcom/android/internal/widget/LockPatternUtils;

    move-result-object v0

    invoke-virtual {v0}, Lcom/android/internal/widget/LockPatternUtils;->reportSuccessfulPasswordAttempt()V

    .line 647
    return-void
.end method

.method public setOnDismissAction(Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$OnDismissAction;)V
    .locals 1
    .parameter "action"

    .prologue
    .line 668
    iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    invoke-virtual {v0, p1}, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->setOnDismissAction(Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$OnDismissAction;)V

    .line 669
    return-void
.end method

.method public showBackupSecurity()V
    .locals 1

    .prologue
    .line 663
    iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    #calls: Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->showBackupSecurityScreen()V
    invoke-static {v0}, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;->access$1700(Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;)V

    .line 664
    return-void
.end method

.method public userActivity(J)V
    .locals 1
    .parameter "timeout"

    .prologue
    .line 631
    iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    iget-object v0, v0, Lcom/android/internal/policy/impl/keyguard/KeyguardViewBase;->mViewMediatorCallback:Lcom/android/internal/policy/impl/keyguard/KeyguardViewMediator$ViewMediatorCallback;

    if-eqz v0, :cond_0

    .line 632
    iget-object v0, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardHostView$3;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardHostView;

    iget-object v0, v0, Lcom/android/internal/policy/impl/keyguard/KeyguardViewBase;->mViewMediatorCallback:Lcom/android/internal/policy/impl/keyguard/KeyguardViewMediator$ViewMediatorCallback;

    invoke-interface {v0, p1, p2}, Lcom/android/internal/policy/impl/keyguard/KeyguardViewMediator$ViewMediatorCallback;->userActivity(J)V

    .line 634
    :cond_0
    return-void
.end method


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Net;
using System.Reflection;
// ReSharper disable ClassNeverInstantiated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Local
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable UnusedMember.Global

namespace Miracle.Settings.Tests
{
    public class Nested
    {
        public string Foo { get; set; }
        public int Bar { get; set; }
    }

    public class DefaultSettings
    {
        // -- Vefault values --
        [DefaultValue("Default Hello World")]
        public string DefaultString { get; private set; }

        [DefaultValue(BindingFlags.Instance | BindingFlags.Public)]
        public BindingFlags DefaultEnum { get; private set; }

        [DefaultValue("1966-06-11T12:34:56.7890000+01:00")]
        public DateTime DefaultDateTime { get; private set; }

        [DefaultValue("1.02:03:04")]
        public TimeSpan DefaultTimeSpan { get; private set; }

		[DefaultValue(typeof(AccessViolationException))]
		public Type DefaultType { get; private set; }

		[DefaultValue("https://foo.bar")]
		public Uri DefaultUri { get; private set; }

        [DefaultValue("EE58EE2B-4CE6-44A4-8773-EC4E283146EB")]
        public Guid DefaultGuid { get; private set; }

        [DefaultValue("10.42.42.42")]
        public IPAddress DefaultIp { get; private set; }

        [DefaultValue(new[] {"foo","bar"})]
        public string[] DefaultArray { get; private set; }
    }

    public class SimpleSettings
    {
        // -- Simple values --
        public string String { get; private set; }
        public BindingFlags Enum { get; private set; }
        public DateTime DateTime { get; private set; }
        public TimeSpan TimeSpan { get; private set; }
	    public Type Type { get; private set; }
	    public Uri Uri { get; private set; }
	    public Guid Guid { get; private set; }
	    public IPAddress IPAddress { get; private set; }
    }

    public class IgnoreSettings
    {
        // Required
        public string String { get; private set; }

		// Ignored using IgnoreAttribute
        [Ignore]
        public string Ignored { get; private set; }
        [Ignore]
        public Nested NestedIgnored { get; private set; }
        [Ignore]
        public string[] NestedIgnoredArray { get; private set; }
	}

	public class OptionalSettings
    {
        // Required
        public string String { get; private set; }
        [Optional]
        public string OptionalPresent { get; private set; }
        [Optional]
        public string OptionalMissing { get; private set; }
        [Optional]
        public Nested OptionalNestedPresent { get; private set; }
        [Optional]
        public Nested OptionalNestedMissing { get; private set; }
        [Optional]
        public string[] OptionalArrayPresent { get; private set; }
        [Optional]
        public string[] OptionalArrayMissing { get; private set; }

        // Optional by convension
        public TimeSpan? OptionalTimespanMissing { get; private set; }
        public TimeSpan? OptionalTimespanPresent { get; private set; }
        public int? OptionalIntMissing { get; private set; }
        public int? OptionalIntPresent { get; private set; }
        public AnimalType? OptionalEnumMissing { get; private set; }
        public AnimalType? OptionalEnumPresent { get; private set; }
    }

    public class NullableSettings
    {
        // Optional by convension
        [Setting(IgnoreValue = "")]
        public TimeSpan? NullableTimespan { get; private set; }
        [Setting(IgnoreValue = "")]
        public int? NullableInt { get; private set; }
        [Setting(IgnoreValue = "")]
        public AnimalType? NullableAnimal { get; private set; }
    }

    public class SimpleSettingsWithSettingName
    {
        // -- Values with Setting Attribute --
        [Setting("String")]
        public string String1 { get; private set; }
        [Setting(Name="Enum")]
        public BindingFlags Enum2 { get; private set; }
        [Setting("DateTime")]
        public DateTime DateTime3 { get; private set; }
        [Setting("TimeSpan")]
        public TimeSpan TimeSpan4 { get; private set; }
        [Setting("Uri")]
        public Uri Uri5 { get; private set; }
        [Setting("Guid")]
        public Guid Guid6 { get; private set; }
    }

    public class FileSettings
    {
        public FileInfo SimpleFile { get; private set; }
        public FileInfo PartialFile { get; private set; }
		[Setting("FullFile")]
		public FileInfo FullFileInfo { get; private set; }
		[Setting("RelativeFile", Reference = "RelativeDirectory")]
        public FileInfo RelativeFileInfo { get; private set; }
    }

    public class FileAnnotationSettings
    {
		[Setting(Name = "FileName", References = new[] { "Drive", "Folder" })]
		public FileInfo FullName { get; private set; }
	}

    public class TypeSettings
    {
		public Type MyType { get; private set; }
	}

    public class DirectorySettings
    {
        public DirectoryInfo SimpleDirectory { get; private set; }
		public DirectoryInfo PartialDirectory { get; private set; }
		[Setting("FullDirectory")]
        public DirectoryInfo FullDirectoryInfo { get; private set; }
		[Setting("RelativeDirectory2", Reference = "RelativeDirectory")]
		public DirectoryInfo RelativeDirectoryInfo { get; private set; }
	}

    public class NestedSettings
    {
        public Nested MyNestedProperty { get; internal set; }
    }

    public class InlineSettings
    {
        [Setting(Inline = true)]
        public Nested MyNestedProperty { get; internal set; }
        public TimeSpan Baz { get; set; }
    }

    public class OptionalInlineSettings
    {
        [Setting(Inline = true)]
        [Optional]
        public Nested MyNestedProperty { get; internal set; }
        public TimeSpan Baz { get; set; }
    }

    public class ArraySettings
    {
        public string[] MySimpleArrayProperty { get; private set; }
        public decimal[] MyNumericArrayProperty { get; private set; }
        public Nested[] MyArrayProperty { get; private set; }
        [Setting("LostNumbers", Separator =',')]
        public int[] LostNumbersArray { get; private set; }
    }

    public class ListSettings
    {
        public IList<string> MySimpleListProperty { get; private set; }
        public List<Nested> MyListProperty { get; private set; }
        [Setting("LostNumbers", Separator = ',')]
        public List<int> LostNumbersList { get; private set; }
    }

    public class DictionarySettings
    {
        public Dictionary<string, string> MySimpleDictionaryProperty { get; private set; }
        public Dictionary<string, byte> MyNumericDictionaryProperty { get; private set; }
        public Dictionary<string, Nested> MyDictionaryProperty { get; private set; }
    }

    public enum AnimalType { Parrot, Rabbit, Fox, Otter };

    class Animal
    {
        public string Name { get; internal set; }
        public bool Talks { get; internal set; }
    }

    public class ReferenceSettings
    {
        // -- Settings with References --
        [Setting(Name="BaseUrl")]
        public Uri MyUrl { get; set; }
        [Setting(Reference="BaseUrl")]
        public Uri PageUrl { get; set; }
        [Setting(References = new [] {"BaseUrl"})]
        public Uri LoginUrl { get; set; }
    }

    public class PathTypeConverterSettings
    {
        // -- Settings with TypeConverter --
        [Setting(Reference="RootFolder", TypeConverter = typeof(PathTypeConverter))]
        public string Upload { get; set; }
        // -- Settings with TypeConverter --
        [Setting(Reference="RootFolder", TypeConverter = typeof(PathTypeConverter))]
        public string Download { get; set; }
        // -- Settings with TypeConverter --
        [Setting(References= new[] { "RootFolder", "Upload"}, TypeConverter = typeof(PathTypeConverter))]
        public string Sub { get; set; }
    }

    public class MissingStringSetting
    {
        public string MissingString { get; private set; }
    }

    public class MissingDateTimeSetting
    {
        public DateTime MissingDateTime { get; private set; }
    }

    public class MissingIntSetting
    {
        public int MissingInt { get; private set; }
    }

    public class MissingTimeSpanSetting
    {
        public TimeSpan MissingTimeSpan { get; private set; }
    }

    public class MissingUriSetting
    {
        public Uri MissingUri { get; private set; }
    }

	public class MissingFileInfoSetting
	{
		public FileInfo MissingFile { get; private set; }
	}

	public class MissingDirectoryInfoSetting
	{
		public DirectoryInfo MissingDir { get; private set; }
	}

    public class MissingInlineSetting
    {
        [Setting(Inline = true)]
        public Nested Inline { get; private set; }
    }

    public class InlineTypeConversionSetting
    {
        [Setting(Inline = true)]
        public MissingIntSetting Inline { get; private set; }
    }

    public class BadTypeConverterSetting
    {
        [Setting(TypeConverter = typeof(string))]
        [DefaultValue("Bar")]
        public string Foo { get; private set; }
    }

    public class TypeConversionFailureSetting
    {
        [DefaultValue("XYZ")]
        public int Foo { get; private set; }
    }

    public class ExplicitTypeConversionFailureSetting
    {
        [DefaultValue("http://XYZ")]
        [Setting(TypeConverter = typeof(UriTypeConverter))]
        public int Foo { get; private set; }
    }

    public interface IMyInterface
    {
        string Foo { get;  }
        int Bar { get; }
    }

    public class MyConcreteImplementation: IMyInterface
    {
        public string Foo { get; private set; }
        public int Bar { get; private set; }
    }

    public class InterfaceMapping
    {
        [Setting(ConcreteType = typeof(MyConcreteImplementation))]
        public IMyInterface Prop { get; private set; }
    }

    public class BadInterfaceMapping
    {
        [Setting(ConcreteType = typeof(Nested))]
        public IMyInterface Prop { get; private set; }
    }

    public class BadConversion
    {
        public Uri BadUri { get; set; }
    }

    public class MultiLevel1
    {
        public string Foo { get; set; }
        public MultiLevel2 Level2 { get; set; }
    }

    public class MultiLevel2
    {
        public string Bar { get; set; }
        public MultiLevel3 Level3 { get; set; }
    }

    public class MultiLevel3
    {
        public string Baz { get; set; }
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>QUnit</title>
  <link rel="stylesheet" href="vendor/qunit/qunit-1.10.0.css"/>

CITE Collection Editor


text:
(function () {

var Project = Karel.Models.Project
,   Editor  = Karel.Views.Editor

describe("Editor", function () {
  var project, editor

  beforeEach(function () {
    project = new Project({
      language: 'karol',
      code: 'putBrick\nmove\nputBrick\nturnLeft'
    })
    editor = new Editor({ model: project })

    $(testEl).css('display', 'block')
    editor.appendTo(testEl)
  })

  afterEach(function () {
    editor.remove()
    $(testEl).css('display', 'none')
  })

  it("should have the code of the project as it's initial value", function () {
    expect(editor.getValue()).toBe(project.get('code'))
  })

  it("should set the project's code when the user enters text", function () {
    var currentValue = project.get('code')
    ,   nextValue    = currentValue + '\nturnRight'
    editor.setValue(nextValue)
    expect(project.get('code')).toBe(nextValue)
  })

  it("should stop the propagation of all key events", function () {
    /*
     * Doesn't work at the moment.
     * Maybe that's because we need to use DOM APIs to create events.
    var spy = jasmine.createSpy()
    $(editor.el).keydown(spy)
    editor.$('textarea').trigger(new $.Event('keydown'))
    expect(spy).not.toHaveBeenCalled()
     */
  })

  it("should update the mode if the language changes", function () {
    expect(editor.codeMirror.getOption('mode')).toBe('karol')
    project.set({ language: 'javascript' })
    expect(editor.codeMirror.getOption('mode')).toBe('javascript')
  })

  it("should mark lines", function () {
    expect(editor.$('.current-line').length).toBe(0)
    editor.markLine(1)
    expect(editor.$('.current-line').length).toBe(1)
    editor.markLine(2)
    expect(editor.$('.current-line').length).toBe(1) // only one marker
  })

  it("should mark a line at each step of the execution", function () {
    expect(editor.$('.current-line').length).toBe(0)
    project.step()
    expect(editor.$('.current-line').length).toBe(1)
    project.step()
    expect(editor.$('.current-line').length).toBe(1)
    project.run()
    expect(editor.$('.current-line').length).toBe(0)
  })

  it("should unmark lines", function () {
    editor.markLine(1)
    expect(editor.$('.current-line').length).toBe(1)
    editor.removeMarker()
    expect(editor.$('.current-line').length).toBe(0)
  })
})

})()


text:
package org.asynchttpclient;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.asynchttpclient.Dsl.*;
import static org.asynchttpclient.test.TestUtils.*;
import static org.testng.Assert.*;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

public class BasicAuthTest extends AbstractBasicTest {

    protected static final String MY_MESSAGE = "my message";

    private Server server2;
    private Server serverNoAuth;
    private int portNoAuth;

    @BeforeClass(alwaysRun = true)
    @Override
    public void setUpGlobal() throws Exception {
        port1 = findFreePort();
        port2 = findFreePort();
        portNoAuth = findFreePort();

        server = newJettyHttpServer(port1);
        addBasicAuthHandler(server, configureHandler());
        server.start();

        server2 = newJettyHttpServer(port2);
        addBasicAuthHandler(server2, new RedirectHandler());
        server2.start();

        // need noAuth server to verify the preemptive auth mode (see
        // basicAuthTestPreemtiveTest)
        serverNoAuth = newJettyHttpServer(portNoAuth);
        serverNoAuth.setHandler(new SimpleHandler());
        serverNoAuth.start();

        logger.info("Local HTTP server started successfully");
    }

    @AfterClass(alwaysRun = true)
    public void tearDownGlobal() throws Exception {
        super.tearDownGlobal();
        server2.stop();
        serverNoAuth.stop();
    }

    @Override
    protected String getTargetUrl() {
        return "http://127.0.0.1:" + port1 + "/";
    }

    @Override
    protected String getTargetUrl2() {
        return "http://127.0.0.1:" + port2 + "/uff";
    }

    protected String getTargetUrlNoAuth() {
        return "http://127.0.0.1:" + portNoAuth + "/";
    }

    @Override
    public AbstractHandler configureHandler() throws Exception {
        return new SimpleHandler();
    }

    private static class RedirectHandler extends AbstractHandler {

        private static final Logger LOGGER = LoggerFactory.getLogger(RedirectHandler.class);

        public void handle(String s, Request r, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

            LOGGER.info("request: " + request.getRequestURI());

            if ("/uff".equals(request.getRequestURI())) {
                LOGGER.info("redirect to /bla");
                response.setStatus(302);
                response.setContentLength(0);
                response.setHeader("Location", "/bla");

            } else {
                LOGGER.info("got redirected" + request.getRequestURI());
                response.setStatus(200);
                response.addHeader("X-Auth", request.getHeader("Authorization"));
                response.addHeader("X-Content-Length", String.valueOf(request.getContentLength()));
                byte[] b = "content".getBytes(UTF_8);
                response.setContentLength(b.length);
                response.getOutputStream().write(b);
            }
            response.getOutputStream().flush();
            response.getOutputStream().close();
        }
    }

    private static class SimpleHandler extends AbstractHandler {

        public void handle(String s, Request r, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

            if (request.getHeader("X-401") != null) {
                response.setStatus(401);
                response.setContentLength(0);

            } else {
                response.addHeader("X-Auth", request.getHeader("Authorization"));
                response.addHeader("X-Content-Length", String.valueOf(request.getContentLength()));
                response.setStatus(200);

                int size = 10 * 1024;
                if (request.getContentLength() > 0) {
                    size = request.getContentLength();
                }
                byte[] bytes = new byte[size];
                int contentLength = 0;
                if (bytes.length > 0) {
                    int read = request.getInputStream().read(bytes);
                    if (read > 0) {
                        contentLength = read;
                        response.getOutputStream().write(bytes, 0, read);
                    }
                }
                response.setContentLength(contentLength);
            }
            response.getOutputStream().flush();
            response.getOutputStream().close();
        }
    }

    @Test(groups = "standalone")
    public void basicAuthTest() throws IOException, ExecutionException, TimeoutException, InterruptedException {
        try (AsyncHttpClient client = asyncHttpClient()) {
            Future<Response> f = client.prepareGet(getTargetUrl())//
                    .setRealm(basicAuthRealm(USER, ADMIN).build())//
                    .execute();
            Response resp = f.get(3, TimeUnit.SECONDS);
            assertNotNull(resp);
            assertNotNull(resp.getHeader("X-Auth"));
            assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);
        }
    }

    @Test(groups = "standalone")
    public void redirectAndDigestAuthTest() throws Exception, ExecutionException, TimeoutException, InterruptedException {
        try (AsyncHttpClient client = asyncHttpClient(config().setFollowRedirect(true).setMaxRedirects(10))) {
            Future<Response> f = client.prepareGet(getTargetUrl2())//
                    .setRealm(basicAuthRealm(USER, ADMIN).build())//
                    .execute();
            Response resp = f.get(3, TimeUnit.SECONDS);
            assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);
            assertNotNull(resp);
            assertNotNull(resp.getHeader("X-Auth"));
        }
    }

    @Test(groups = "standalone")
    public void basic401Test() throws IOException, ExecutionException, TimeoutException, InterruptedException {
        try (AsyncHttpClient client = asyncHttpClient()) {
            BoundRequestBuilder r = client.prepareGet(getTargetUrl())//
                    .setHeader("X-401", "401")//
                    .setRealm(basicAuthRealm(USER, ADMIN).build());

            Future<Integer> f = r.execute(new AsyncHandler<Integer>() {

                private HttpResponseStatus status;

                public void onThrowable(Throwable t) {

                }

                public State onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception {
                    return State.CONTINUE;
                }

                public State onStatusReceived(HttpResponseStatus responseStatus) throws Exception {
                    this.status = responseStatus;

                    if (status.getStatusCode() != 200) {
                        return State.ABORT;
                    }
                    return State.CONTINUE;
                }

                public State onHeadersReceived(HttpResponseHeaders headers) throws Exception {
                    return State.CONTINUE;
                }

                public Integer onCompleted() throws Exception {
                    return status.getStatusCode();
                }
            });
            Integer statusCode = f.get(10, TimeUnit.SECONDS);
            assertNotNull(statusCode);
            assertEquals(statusCode.intValue(), 401);
        }
    }

    @Test(groups = "standalone")
    public void basicAuthTestPreemtiveTest() throws IOException, ExecutionException, TimeoutException, InterruptedException {
        try (AsyncHttpClient client = asyncHttpClient()) {
            // send the request to the no-auth endpoint to be able to verify the
            // auth header is really sent preemptively for the initial call.
            Future<Response> f = client.prepareGet(getTargetUrlNoAuth())//
                    .setRealm(basicAuthRealm(USER, ADMIN).setUsePreemptiveAuth(true).build())//
                    .execute();

            Response resp = f.get(3, TimeUnit.SECONDS);
            assertNotNull(resp);
            assertNotNull(resp.getHeader("X-Auth"));
            assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);
        }
    }

    @Test(groups = "standalone")
    public void basicAuthNegativeTest() throws IOException, ExecutionException, TimeoutException, InterruptedException {
        try (AsyncHttpClient client = asyncHttpClient()) {
            Future<Response> f = client.prepareGet(getTargetUrl())//
                    .setRealm(basicAuthRealm("fake", ADMIN).build())//
                    .execute();

            Response resp = f.get(3, TimeUnit.SECONDS);
            assertNotNull(resp);
            assertEquals(resp.getStatusCode(), 401);
        }
    }

    @Test(groups = "standalone")
    public void basicAuthInputStreamTest() throws IOException, ExecutionException, TimeoutException, InterruptedException {
        try (AsyncHttpClient client = asyncHttpClient()) {
            Future<Response> f = client.preparePost(getTargetUrl())//
                    .setBody(new ByteArrayInputStream("test".getBytes()))//
                    .setRealm(basicAuthRealm(USER, ADMIN).build())//
                    .execute();

            Response resp = f.get(30, TimeUnit.SECONDS);
            assertNotNull(resp);
            assertNotNull(resp.getHeader("X-Auth"));
            assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);
            assertEquals(resp.getResponseBody(), "test");
        }
    }

    @Test(groups = "standalone")
    public void basicAuthFileTest() throws Exception {
        try (AsyncHttpClient client = asyncHttpClient()) {
            Future<Response> f = client.preparePost(getTargetUrl())//
                    .setBody(SIMPLE_TEXT_FILE)//
                    .setRealm(basicAuthRealm(USER, ADMIN).build())//
                    .execute();

            Response resp = f.get(3, TimeUnit.SECONDS);
            assertNotNull(resp);
            assertNotNull(resp.getHeader("X-Auth"));
            assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);
            assertEquals(resp.getResponseBody(), SIMPLE_TEXT_FILE_STRING);
        }
    }

    @Test(groups = "standalone")
    public void basicAuthAsyncConfigTest() throws Exception {
        try (AsyncHttpClient client = asyncHttpClient(config().setRealm(basicAuthRealm(USER, ADMIN)))) {
            Future<Response> f = client.preparePost(getTargetUrl())//
                    .setBody(SIMPLE_TEXT_FILE_STRING)//
                    .execute();

            Response resp = f.get(3, TimeUnit.SECONDS);
            assertNotNull(resp);
            assertNotNull(resp.getHeader("X-Auth"));
            assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);
            assertEquals(resp.getResponseBody(), SIMPLE_TEXT_FILE_STRING);
        }
    }

    @Test(groups = "standalone")
    public void basicAuthFileNoKeepAliveTest() throws Exception {
        try (AsyncHttpClient client = asyncHttpClient(config().setKeepAlive(false))) {

            Future<Response> f = client.preparePost(getTargetUrl())//
                    .setBody(SIMPLE_TEXT_FILE)//
                    .setRealm(basicAuthRealm(USER, ADMIN).build())//
                    .execute();

            Response resp = f.get(3, TimeUnit.SECONDS);
            assertNotNull(resp);
            assertNotNull(resp.getHeader("X-Auth"));
            assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);
            assertEquals(resp.getResponseBody(), SIMPLE_TEXT_FILE_STRING);
        }
    }

    @Test(groups = "standalone")
    public void noneAuthTest() throws IOException, ExecutionException, TimeoutException, InterruptedException {
        try (AsyncHttpClient client = asyncHttpClient()) {
            BoundRequestBuilder r = client.prepareGet(getTargetUrl()).setRealm(basicAuthRealm(USER, ADMIN).build());

            Future<Response> f = r.execute();
            Response resp = f.get(3, TimeUnit.SECONDS);
            assertNotNull(resp);
            assertNotNull(resp.getHeader("X-Auth"));
            assertEquals(resp.getStatusCode(), HttpServletResponse.SC_OK);
        }
    }
}


text:
/**
 * Module dependencies.
 */

var Transport = require('../transport');
var parser = require('engine.io-parser');
var util = require('util');
var debug = require('debug')('engine:ws');

/**
 * Export the constructor.
 */

module.exports = WebSocket;

/**
 * WebSocket transport
 *
 * @param {http.ServerRequest}
 * @api public
 */

function WebSocket (req) {
  Transport.call(this, req);
  var self = this;
  this.socket = req.websocket;
  this.socket.on('message', this.onData.bind(this));
  this.socket.once('close', this.onClose.bind(this));
  this.socket.on('error', this.onError.bind(this));
  this.socket.on('headers', function (headers) {
    self.emit('headers', headers);
  });
  this.writable = true;
  this.perMessageDeflate = null;
}

/**
 * Inherits from Transport.
 */

util.inherits(WebSocket, Transport);

/**
 * Transport name
 *
 * @api public
 */

WebSocket.prototype.name = 'websocket';

/**
 * Advertise upgrade support.
 *
 * @api public
 */

WebSocket.prototype.handlesUpgrades = true;

/**
 * Advertise framing support.
 *
 * @api public
 */

WebSocket.prototype.supportsFraming = true;

/**
 * Processes the incoming data.
 *
 * @param {String} encoded packet
 * @api private
 */

WebSocket.prototype.onData = function (data) {
  debug('received "%s"', data);
  Transport.prototype.onData.call(this, data);
};

/**
 * Writes a packet payload.
 *
 * @param {Array} packets
 * @api private
 */

WebSocket.prototype.send = function (packets) {
  var self = this;
  packets.forEach(function (packet) {
    parser.encodePacket(packet, self.supportsBinary, function (data) {
      debug('writing "%s"', data);

      // always creates a new object since ws modifies it
      var opts = {};
      if (packet.options) {
        opts.compress = packet.options.compress;
      }

      if (self.perMessageDeflate) {
        var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length;
        if (len < self.perMessageDeflate.threshold) {
          opts.compress = false;
        }
      }

      self.writable = false;
      self.socket.send(data, opts, function (err) {
        if (err) return self.onError('write error', err.stack);
        self.writable = true;
        self.emit('drain');
      });
    });
  });
};

/**
 * Closes the transport.
 *
 * @api private
 */

WebSocket.prototype.doClose = function (fn) {
  debug('closing');
  this.socket.close();
  fn && fn();
};


text:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>
        <variable
            name="content"
            type="String" />
    </data>

    <WebView
        app:html="@{content}"
        app:htmlTextSize="@{@dimen/text_size}"
        app:htmlMargin="@{@dimen/activity_horizontal_margin}"
        app:htmlBackgroundColor="@{io.github.hidroh.tldroid.R.attr.themedBackground}"
        app:htmlTextColor="@{android.R.attr.textColorPrimary}"
        app:htmlLinkColor="@{android.R.attr.textColorLink}"
        android:scrollbarStyle="insideOverlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</layout>


text:
\textbf{Входные параметры:}

Option - имени параметра алгоритма.

\textbf{Возвращаемое значение:}

Отсутствуют.


text:
This is just a BOM which was created for the purposes of testing the bom release pipeline.
This BOM should not be used by anyone as it provides absolutely nothing. The only entry in
this BOM file will be azure-sdk-template which is our library used for testing the release
pipeline for libraries.

## Table of contents

## Getting started

### Adding the BOM to your project

### Adding libraries to your project

### Adding library dependencies to your project


text:
package nl.devlab.common.form;

/**
 * @author Marco Kortooms - Atos
 *
 */
public class FormField extends FormElement {

	private String blockId = "";
	private String groupId = "";
	private String subtypeId = "";
	private String title = "";
	private String description = "";
	private ValidationType validationType = ValidationType.NOTEMPTY; // Set default validation of field to NOTEMPTY
	private SaveType saveType = SaveType.SAVE; // set default of all field to SAVE
	private String value = "";
	private FormFieldType type = FormFieldType.TEXT;
	private String[] comboboxValues;
	private String modalFormName;

	public FormField(String name) {
		super(FormElementType.FIELD, name);
	}
	public FormField(String blockId,
			String groupId, String subtypeId, String name, String title,
			String description) {

		super(FormElementType.FIELD, name);

		this.blockId = blockId;
		this.groupId = groupId;
		this.subtypeId = subtypeId;
		this.title = title;
		this.description = description;
		this.validationType = ValidationType.NOTEMPTY;
		this.saveType = SaveType.SAVE;
	}
	public FormField(String blockId,
			String groupId, String subtypeId, String name,
			String title, String description,
			ValidationType validationType, SaveType saveType) {

		super(FormElementType.FIELD, name);

		this.blockId = blockId;
		this.groupId = groupId;
		this.subtypeId = subtypeId;
		this.title = title;
		this.description = description;
		this.validationType = validationType;
		this.saveType = saveType;
	}
	public FormField(String blockId,
			String groupId, String subtypeId, String name, String title,
			String description, String[] comboboxValues) {

		super(FormElementType.FIELD, name);

		this.blockId = blockId;
		this.groupId = groupId;
		this.subtypeId = subtypeId;
		this.title = title;
		this.description = description;
		this.validationType = ValidationType.NOTEMPTY;
		this.saveType = SaveType.SAVE;
		this.type=FormFieldType.COMBOBOX;
		this.comboboxValues=comboboxValues;
	}
	public FormField(String blockId,
			String groupId, String subtypeId, String name, String title,
			String description, String modalFormName) {

		super(FormElementType.FIELD, name);

		this.blockId = blockId;
		this.groupId = groupId;
		this.subtypeId = subtypeId;
		this.title = title;
		this.description = description;
		this.validationType = ValidationType.NOTEMPTY;
		this.saveType = SaveType.SAVE;
		this.type=FormFieldType.MODALFORM;
		this.modalFormName=modalFormName;
	}

	public String getBlockId() {
		return blockId;
	}
	public void setBlockId(String blockId) {
		this.blockId = blockId;
	}
	public String getGroupId() {
		return groupId;
	}
	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}
	public String getSubtypeId() {
		return subtypeId;
	}
	public void setSubtypeId(String subtypeId) {
		this.subtypeId = subtypeId;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getValue() {
		FormElement parentForm = getParent();
		while (!(parentForm instanceof Form) && parentForm != null) {
			parentForm = parentForm.getParent();
		}
		if (parentForm == null) {
			return value;
		} else {
			return parentForm.getFieldMap().get(getUuid()); // Formfield is added, return fieldMap value
		}
	}
	public void setValue(String value) {
		FormElement parentForm = getParent();
		while (!(parentForm instanceof Form) && parentForm != null) {
			parentForm = parentForm.getParent();
		}
		if (parentForm == null) {
			this.value = value;
		} else {
			parentForm.getFieldMap().put(getUuid(), value); // Formfield is added, set fieldMap value
		}
	}
	public ValidationType getValidationType() {
		return validationType;
	}
	public void setValidationType(ValidationType validationType) {
		this.validationType = validationType;
	}
	public SaveType getSaveType() {
		return saveType;
	}
	public void setSaveType(SaveType saveType) {
		this.saveType = saveType;
	}
	public FormFieldType getType() {
		return type;
	}
	public void setType(FormFieldType type) {
		this.type = type;
	}
	public String[] getComboboxValues() {
		return comboboxValues;
	}
	public void setComboboxValues(String[] comboboxValues) {
		this.comboboxValues = comboboxValues;
	}
	public String getModalFormName() {
		return modalFormName;
	}
	public void setModalFormName(String modalFormName) {
		this.modalFormName = modalFormName;
	}

	public String toString() {
		StringBuffer strBuf = new StringBuffer();
		strBuf.append(blockId);
		strBuf.append(", ");
		strBuf.append(groupId);
		strBuf.append(", ");
		strBuf.append(subtypeId);
		strBuf.append(", ");
		strBuf.append(getName());
		strBuf.append(", ");
		strBuf.append(title);
		strBuf.append(", ");
		strBuf.append(description);
		strBuf.append(", ");
		strBuf.append(getUuid());
		strBuf.append(", ");
		strBuf.append(getValue());
		strBuf.append(", ");
		strBuf.append(getValidationType());
		strBuf.append(", ");
		strBuf.append(getType().toString());
		strBuf.append(", ");
		strBuf.append(getComboboxValues());
		strBuf.append(", ");
		strBuf.append(getModalFormName());
		return strBuf.toString();
	}
}


text:
@interface ADCountriesViewModel ()

@property (strong, nonatomic) NSDictionary *currentCountry;

@end

@implementation ADCountriesViewModel

- (instancetype)initWithParam:(NSDictionary *)param {
    self = [super initWithParam:param];
    if (self) {
        self.currentCountry = param[@"country"];
    }

    return self;
}

- (void)initialize {
    [super initialize];

    self.title = @"All Countries";

    self.bShouldFetchData = NO;
    self.bShouldPullToRefresh = NO;

    NSString *filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Countries.json"];
    NSData *data = [NSData dataWithContentsOfFile:filePath];

    self.dataSourceArray = @[[NSJSONSerialization JSONObjectWithData:data options:0 error:nil]];

    @weakify(self);
    self.didSelectCommand = [[RACCommand alloc]initWithSignalBlock:^RACSignal *(NSIndexPath *indexPath) {
        @strongify(self);

        self.currentCountry = self.dataSourceArray[indexPath.section][indexPath.row];

        return [RACSignal empty];
    }];
}

@end


text:
.. automodule:: scenesim.display.viewer
   :members:


text:
from datetime import datetime
from urlparse import urlunsplit
import arrow
from flask.app import Flask
from flask.globals import request
from flask.templating import render_template
from redis.client import StrictRedis
from werkzeug.utils import redirect
from models import Mirror
from logging import getLogger

log = getLogger(__name__)

app = Flask(__name__)
app.config.from_object("config.Config")

if 'SENTRY_DSN' in app.config:
    from raven.contrib.flask import Sentry
    sentry = Sentry(app)

redis = StrictRedis(app.config['REDIS']['HOST'], app.config['REDIS']['PORT'], app.config['REDIS']['DB'])

@app.route("/")
def index():
    remote_addr = request.remote_addr
    if app.config['DEBUG'] and request.args.get('_IP'):
        remote_addr = request.args.get('_IP')

    if remote_addr.startswith("::ffff:"):
        remote_addr = remote_addr.replace("::ffff:", "")

    distances = Mirror.get_mirror_distances(remote_addr)
    context = {
        'ip': remote_addr,
        'last_update': arrow.get(redis.get(app.config['KEY_LAST_UPDATE']))
    }
    if distances:
        nearest_mirror = next(distances.iteritems())
        context['mirror'] = nearest_mirror[0]
        context['mirror_distance'] = nearest_mirror[1]
        context['distances'] = distances
    else:
        context['no_mirror'] = True
        context['fallback_mirror'] = app.config['FALLBACK_MIRROR']
    return render_template("index.html", **context)

@app.route("/simple/")
@app.route("/simple/<path:path>")
def proxy(path=""):
    remote_addr = request.remote_addr
    if app.config['DEBUG'] and request.args.get('_IP'):
        remote_addr = request.args.get('_IP')

    mirror = Mirror.get_nearest_mirror(remote_addr)
    url = urlunsplit((
        "http",
        mirror,
        "simple/{}".format(path),
        request.query_string,
        None
    ))
    log.debug("Redirecting to %s", url)
    return redirect(url)

if __name__ == "__main__":
    app.run("0.0.0.0", 8000, debug=True)


text:
package main

import (
	"compress/gzip"
	"fmt"
	"image"
	_ "image/gif"
	_ "image/jpeg"
	_ "image/png"
	"io"
	"os"
	"path/filepath"
	"strings"
)

func analyze(path, outfile string) {
	if _, err := os.Stat(*dir); os.IsNotExist(err) {
		usageAndExit("No such file or directory: %s\n", *dir)
	}

	if false == isDir(path) {
		usageAndExit("Expecting a directory: %s", path)
	}

	w := newWalk(path, outfile)
	defer w.close()
	if err := filepath.Walk(path, w.walkFn); err != nil {
		usageAndExit("Walk Error: %s", err)
	}
	fmt.Fprintf(os.Stdout, "Wrote to file: %s\n", outfile)

}

type walk struct {
	basePath string
	outF     io.WriteCloser
	outW     io.WriteCloser
}

func newWalk(path, outfile string) *walk {

	w := &walk{
		basePath: path,
	}

	var err error
	w.outF, err = os.Create(outfile)
	if err != nil {
		usageAndExit("Failed to open %s with error: %s", outfile, err)
	}
	w.outW = gzip.NewWriter(w.outF)

	return w
}

func (w *walk) close() {
	if err := w.outW.Close(); err != nil {
		fmt.Fprintf(os.Stderr, "GZIP close error: %s\n", err)
	}
	if err := w.outF.Close(); err != nil {
		fmt.Fprintf(os.Stderr, "File close error: %s\n", err)
	}
}

func (w *walk) getRelative(path string) string {
	path = filepath.Clean(path)
	parts := strings.Split(path, w.basePath)
	if len(parts) < 2 {
		return ""
	}
	return parts[1]
}

func (w *walk) walkFn(path string, info os.FileInfo, err error) error {
	rel := w.getRelative(path)
	if rel == "" || info.IsDir() {
		return nil
	}

	var imgWidth, imgHeight int
	ext := strings.ToLower(filepath.Ext(rel))
	switch ext {
	case ".jpg", ".jpeg", ".png", ".gif":
		imgWidth, imgHeight = getImageDimension(path)
		//	default:
		//		log.Println(rel, ext)
	}

	r := record{
		Path:    rel,
		ModTime: info.ModTime(),
		Width:   imgWidth,
		Height:  imgHeight,
	}
	return r.Write(w.outW)
}

func getImageDimension(imagePath string) (int, int) {
	file, err := os.Open(imagePath)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Cannot open image: %s\n", err)
		return 0, 0

	}

	image, _, err := image.DecodeConfig(file)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Image %s decoding error: %s\n", imagePath, err)
		return 0, 0
	}

	if err := file.Close(); err != nil {
		fmt.Fprintf(os.Stderr, "Close error: %s: %s\n", imagePath, err)
		return 0, 0
	}
	return image.Width, image.Height
}

func isDir(path string) bool {
	fileInfo, err := os.Stat(path)
	return fileInfo.IsDir() && err == nil
}


text:
Sample configuration files for:
```
SystemD: npccoind.service
Upstart: npccoind.conf
OpenRC:  npccoind.openrc
         npccoind.openrcconf
CentOS:  npccoind.init
macOS:    org.npccoin.npccoind.plist
```
have been made available to assist packagers in creating node packages here.

See doc/init.md for more information.


text:
    {!! header_title() !!}
    {!! breadcrumbs() !!}


text:
import { point, featureCollection } from "@turf/helpers";
import interpolate from "./";

const cellSize = 1;
const property = "pressure";
const gridType = "square";
const weight = 0.5;
const units = "miles";
const points = featureCollection([
  point([1, 2]),
  point([12, 13]),
  point([23, 22]),
]);

const grid = interpolate(points, cellSize, {
  gridType,
  property,
  units,
  weight,
});
grid.features[0].properties?.pressure;

// Optional properties
interpolate(points, cellSize, { gridType, property, units });
interpolate(points, cellSize, { gridType, property });
interpolate(points, cellSize, { gridType });
interpolate(points, cellSize, { gridType: "point" });


text:
- Use pm2 to serve the app in prod.
- Add docker file.
- Add deploy task (bin/deploy)
- Add details on folder structure.
- add task for cleaning up the docs and extra files when the boilerplate is downloaded.
- Make a boilerplate-angular example