text:
'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
	errorHandler = require('./errors.server.controller'),
	eqiRes = mongoose.model('eqiresult'),
	eqiDet = mongoose.model('eqidetail'),
    vendorDet = mongoose.model('vendorcontractdetails'),
	calcService = require('./calc.server.controller'),
  Q = require('q'),
	_ = require('lodash');

/**
 * Module dependencies.
 */
var Client = require('node-rest-client').Client;

//This function returns array of JSON objects of County Name, State
//based on the matching RegEx pattern
exports.autoComplete = function(req, res) {
    var stateCounty = req.query.q;
    var regex = new RegExp(stateCounty, 'i');
    console.log('stateCounty is :' + stateCounty);

    vendorDet.aggregate({
        $match: {
            countyDescription: regex
        }
    }, function(err, results) {

        if (err) throw err;

        var counties = [];

        for (var countyDescription in results) {

            counties.push(results[countyDescription].countyDescription + ',' + results[countyDescription].stateCode);

        }

        var result = {
            results: counties
        };

        res.json(result);

    });
};

exports.searchByDuns = function(req,res){
    var duns = req.query.q;
    var results = {};

    console.log('Calling Vendor API 1');
    var client = new Client();
    var request = client.get('http://api.data.gov/sam/v1/registrations/'+duns+'0000?api_key=IzgShQdB6ZUJTOVRed2J4rSqZooptXlx8SOfIKGg', function(data, response, err){

                //res.send(results);
                results.contact_name = data.sam_data.registration.electronicBusinessPoc.firstName + ' ' + data.sam_data.registration.electronicBusinessPoc.lastName;
                results.contact_phone = data.sam_data.registration.electronicBusinessPoc.usPhone;
                results.contact_email = data.sam_data.registration.electronicBusinessPoc.email;

                var request2 = client.get('https://api.data.gov/sam/v1/registrations?qterms=(duns:'+duns+')&api_key=IzgShQdB6ZUJTOVRed2J4rSqZooptXlx8SOfIKGg', function(data2, response2, err2){
                    results.vendor_name = data2.results[0].legalBusinessName;
                    results.address = data2.results[0].samAddress.line1 +
                                        data2.results[0].samAddress.city +
                                        ', '+
                                        data2.results[0].samAddress.stateOrProvince +
                                        ' '+
                                        data2.results[0].samAddress.zip +
                                        '-'+
                                        data2.results[0].samAddress.zip4;
                    results.exclusion_ind = (data2.results[0].hasKnownExclusion  ?'Yes':'No');

                    results.reps_certs = 'SMALL BUSINESS';
                    results.duns = duns;

                    console.log(results);
                    res.send(results);
                });

        });

};

exports.getDetails = function(req, res) {
    var duns = req.query.q;
    console.log('*'+duns+'*');
    var details = {};
    details.contracts = {};
    vendorDet.find({
        piid: 'GS35F366BA'
    }, function(err, results) {
        console.log(results.length);
         for (var i = 0; i < results.length; i++) {
            console.log('details');
            details.contracts.contract_numb = results[i].piid;
            details.contracts.agency_name = results[i].agencyname;
            details.contracts.pop_st_dt = results[i].effectivedate;
            details.contracts.pop_end_dt = results[i].lastdatetoorder;
            details.contracts.obligated_amt = results[i].totalbaseandalloptsvalue;
         }
         console.log(details);
         res.send(details);
    }
    );
};

//This funciton returns aggregate results and score for a given county
exports.searchByCountyState = function(req, res) {
    var stateCounty = req.query.q;
    //split county and code
    console.log('index : ' + stateCounty.indexOf(','));
    if (stateCounty.indexOf(',') === -1) {
        console.log('inside');
        res.status(400).send({
            'error': 'Invalid Search'
        });
        return false;
    }
    var str = stateCounty.split(',');
    console.log('stateCounty is :' + stateCounty);
    var county = str[0];
    var stateCd = str[1];

    console.log('County is :' + county);
    console.log('State is :' + stateCd);
    var data = {};
    data.detail = {};
    data.detail.air = {};
    data.detail.water = {};
    data.detail.infra = {};
    data.detail.socio = {};

    eqiDet.find({
        countyDescription: county,
        stateCode: stateCd
    }, function(err, results) {
        //console.log('Results detail '+results);
        // if there is an error retrieving, send the error. nothing after res.send(err) will execute
        if (err)
            res.send(err);
        if (results.length === 0) {
            res.status(400).send({
                'error': 'No Results in Details'
            });
            return false;
        }

        var minVarArray, maxVarArray;

        var setMinVariables = function() {
            var deferred = Q.defer();
            calcService.minimumVariables(deferred);
            return deferred.promise;
        };

        var setMaxVariables = function() {
            var deferred = Q.defer();
            calcService.maximumVariables(deferred);
            return deferred.promise;
        };

        setMinVariables()
            .then(function(success) {
                minVarArray = success;
                setVarVals();
            });

        setMaxVariables()
            .then(function(success) {
                maxVarArray = success;
                setVarVals();
            });

        // set results
        var setVarVals = function() {

            if (minVarArray === undefined && maxVarArray === undefined) return false;
            for (var i = 0; i < results.length; i++) {

                if (results[i].variableCode.toLowerCase() === 'a_no2_mean_ln' && results[i].domain.toLowerCase() === 'air') {
                    data.detail.air.nitro = results[i].variableValue;
                    data.detail.air.nitro_perc = calcService.calculateOtherPercentage(minVarArray.minNitro, maxVarArray.maxNitro, results[i].variableValue);
                } else if (results[i].variableCode.toLowerCase() === 'a_so2_mean_ln' && results[i].domain.toLowerCase() === 'air') {
                    data.detail.air.sulfur = results[i].variableValue;
                    data.detail.air.sulfur_perc = calcService.calculateOtherPercentage(minVarArray.minSulfur, maxVarArray.maxSulfur, results[i].variableValue);
                } else if (results[i].variableCode.toLowerCase() === 'a_co_mean_ln' && results[i].domain.toLowerCase() === 'air') {
                    data.detail.air.carbon = results[i].variableValue;
                    data.detail.air.carbon_perc = calcService.calculateOtherPercentage(minVarArray.minCarbon, maxVarArray.maxCarbon, results[i].variableValue);
                } else if (results[i].variableCode.toLowerCase() === 'avgofd3_ave' && results[i].domain.toLowerCase() === 'water') {
                    data.detail.water.drought = results[i].variableValue;
                    data.detail.water.drought_perc = calcService.calculateOtherPercentage(minVarArray.minDrought, maxVarArray.maxDrought, results[i].variableValue);
                } else if (results[i].variableCode.toLowerCase() === 'w_hg_ln' && results[i].domain.toLowerCase() === 'water') {
                    data.detail.water.mercury = results[i].variableValue;
                    data.detail.water.mercury_perc = calcService.calculateOtherPercentage(minVarArray.minMercury, maxVarArray.maxMercury, results[i].variableValue);
                } else if (results[i].variableCode.toLowerCase() === 'w_as_ln' && results[i].domain.toLowerCase() === 'water') {
                    data.detail.water.arsenic = results[i].variableValue;
                    data.detail.water.arsenic_perc = calcService.calculateOtherPercentage(minVarArray.minArsenic, maxVarArray.maxArsenic, results[i].variableValue);
                } else if (results[i].variableCode.toLowerCase() === 'hwyprop' && results[i].domain.toLowerCase() === 'built') {
                    data.detail.infra.highway = results[i].variableValue;
                    data.detail.infra.highway_perc = calcService.calculateOtherPercentage(minVarArray.minHighway, maxVarArray.maxHighway, results[i].variableValue);
                } else if (results[i].variableCode.toLowerCase() === 'ryprop' && results[i].domain.toLowerCase() === 'built') {
                    data.detail.infra.streets = results[i].variableValue;
                    data.detail.infra.streets_perc = calcService.calculateOtherPercentage(minVarArray.minStreets, maxVarArray.maxStreets, results[i].variableValue);
                } else if (results[i].variableCode.toLowerCase() === 'fatal_rate_log' && results[i].domain.toLowerCase() === 'built') {
                    data.detail.infra.fatalities = results[i].variableValue;
                    data.detail.infra.fatalities_perc = calcService.calculateOtherPercentage(minVarArray.minFatalities, maxVarArray.maxFatalities, results[i].variableValue);
                } else if (results[i].variableCode.toLowerCase() === 'med_hh_inc' && results[i].domain.toLowerCase() === 'sociodemographic') {
                    data.detail.socio.income = results[i].variableValue;
                    data.detail.socio.income_perc = calcService.calculateOtherPercentage(minVarArray.minIncome, maxVarArray.maxIncome, results[i].variableValue);
                } else if (results[i].variableCode.toLowerCase() === 'pct_unemp' && results[i].domain.toLowerCase() === 'sociodemographic') {
                    data.detail.socio.unemployed = results[i].variableValue;
                    data.detail.socio.unemployed_perc = calcService.calculateUnemploymentPercentage(minVarArray.minUnemployed, maxVarArray.maxUnemployed, results[i].variableValue);
                } else if (results[i].variableCode.toLowerCase() === 'violent_rate_log' && results[i].domain.toLowerCase() === 'sociodemographic') {
                    data.detail.socio.crimes = results[i].variableValue;
                    data.detail.socio.crimes_perc = calcService.calculateOtherPercentage(minVarArray.minCrime, maxVarArray.maxCrime, results[i].variableValue);
                }

            }

            eqiRes.find({
                countyDescription: county,
                stateCode: stateCd
            }, function(err, results) {
                //console.log('Results result '+results);
                // if there is an error retrieving, send the error. nothing after res.send(err) will execute
                if (err)
                    res.send(err);

                if (results.length === 0) {
                    res.status(400).send({
                        'error': 'No Results in Results'
                    });
                    return false;
                }

                var minEqiArray, maxEqiArray;

                var setMinEqis = function() {
                    var deferred = Q.defer();
                    calcService.minimumEqi(deferred);
                    return deferred.promise;
                };

                var setMaxEqis = function() {
                    var deferred = Q.defer();
                    calcService.maximumEqi(deferred);
                    return deferred.promise;
                };

                setMinEqis()
                    .then(function(success) {
                        minEqiArray = success;
                        setEqiVals();
                    });

                setMaxEqis()
                    .then(function(success) {
                        maxEqiArray = success;
                        setEqiVals();
                    });

                // set results
                data.county_name = results[0].countyDescription;
                data.state = results[0].stateCode;
                data.stfips = results[0].countyCode;

                console.log('County ' + results[0].countyDescription);

                var setEqiVals = function() {

                    if (minEqiArray === undefined && maxEqiArray === undefined) return false;

                    for (var i = 0; i < results.length; i++) {
                        var percent = 0;
                        var rate;
                        if (results[i].domain.toLowerCase() === 'overall') {
                            data.overall_result = results[i].eqi;
                            percent = calcService.calculateEqiPercentage(minEqiArray.minOverall, maxEqiArray.maxOverall, results[i].eqi, true);
                            data.overall_result_perc = percent;
                            data.overall_result_rate = calcService.rating(percent);

                        } else if (results[i].domain.toLowerCase() === 'air') {

                            data.detail.air.overall = results[i].eqi;
                            percent = calcService.calculateEqiPercentage(minEqiArray.minAir, maxEqiArray.maxAir, results[i].eqi, true);
                            data.detail.air.overall_perc = percent;
                            data.detail.air.overall_rate = calcService.rating(percent);

                        } else if (results[i].domain.toLowerCase() === 'water') {

                            data.detail.water.overall = results[i].eqi;
                            percent = calcService.calculateEqiPercentage(minEqiArray.minWater, maxEqiArray.maxWater, results[i].eqi, true);
                            data.detail.water.overall_perc = percent;
                            data.detail.water.overall_rate = calcService.rating(percent);

                        } else if (results[i].domain.toLowerCase() === 'built') {

                            data.detail.infra.overall = results[i].eqi;
                            percent = calcService.calculateEqiPercentage(minEqiArray.minBuilt, maxEqiArray.maxBuilt, results[i].eqi, true);
                            data.detail.infra.overall_perc = percent;
                            data.detail.infra.overall_rate = calcService.rating(percent);

                        } else if (results[i].domain.toLowerCase() === 'sociodemographic') {

                            data.detail.socio.overall = results[i].eqi;
                            percent = calcService.calculateEqiPercentage(minEqiArray.minSocio, maxEqiArray.maxSocio, results[i].eqi, true);
                            data.detail.socio.overall_perc = percent;
                            data.detail.socio.overall_rate = calcService.rating(percent);
                        }

                    }
                    //console.log( data);
                    res.json(data);

                };

            });

        };

    });

};

/**
 * Create a article
/*
exports.create = function(req, res) {
	var article = new Article(req.body);
	article.user = req.user;

	article.save(function(err) {
		if (err) {
			return res.status(400).send({
				message: errorHandler.getErrorMessage(err)
			});
		} else {
			res.json(article);
		}
	});
};*/

/**
 * Show the current article
 */
/*exports.read = function(req, res) {
	res.json(req.article);
};*/

/**
 * Update a article
 */
/*exports.update = function(req, res) {
	var article = req.article;

	article = _.extend(article, req.body);

	article.save(function(err) {
		if (err) {
			return res.status(400).send({
				message: errorHandler.getErrorMessage(err)
			});
		} else {
			res.json(article);
		}
	});
};*/

/**
 * Delete an article
 */
/*exports.delete = function(req, res) {
	var article = req.article;

	article.remove(function(err) {
		if (err) {
			return res.status(400).send({
				message: errorHandler.getErrorMessage(err)
			});
		} else {
			res.json(article);
		}
	});
};*/

/**
 * List of Articles
 */
/*exports.list = function(req, res) {
	Article.find().sort('-created').populate('user', 'displayName').exec(function(err, articles) {
		if (err) {
			return res.status(400).send({
				message: errorHandler.getErrorMessage(err)
			});
		} else {
			res.json(articles);
		}
	});
};*/

/**
 * Article middleware
 */
/*exports.articleByID = function(req, res, next, id) {

	if (!mongoose.Types.ObjectId.isValid(id)) {
		return res.status(400).send({
			message: 'Article is invalid'
		});
	}

	Article.findById(id).populate('user', 'displayName').exec(function(err, article) {
		if (err) return next(err);
		if (!article) {
			return res.status(404).send({
				message: 'Article not found'
			});
		}
		req.article = article;
		next();
	});
};*/

/**
 * Article authorization middleware
 */
/*exports.hasAuthorization = function(req, res, next) {
	if (req.article.user.id !=== req.user.id) {
		return res.status(403).send({
			message: 'User is not authorized'
		});
	}
	next();
};*/


text:
Set of useful tools for [Pivotal API](https://www.pivotaltracker.com/help/api)

## Install

This project requires python3.

You will need to install pip requirements first:

`pip3 install -r requirements.txt`

Second, copy sample config to a new file `config.yaml`:

`cp config.sample.yaml config.yaml`

Third, update your `config.yaml` with `pivotal.tracker_token` obtained from [Pivotal profile page](https://www.pivotaltracker.com/profile).

## Use

Entry point is the `cli.py` script.

### Arguments for `cli.py`

 * __required__ `--report` select report type, should be one of:
    * `weekly_dev` weekly report for developer
 * `--weeks-ago` use 0 for current week (default), 1 for previous and so on
 * `--projects` filter stories by projects using space-separated list of project ids

### Examples

Print developer report for current week:

`python3 cli.py --report weekly_dev`

Print developer report for previous week:

`python3 cli.py --report weekly_dev --weeks-ago 1`

Print developer report for current week for specified projects only:

`python3 cli.py --report weekly_dev --projects 2 3 5 8`

redpajama_set_name: RedPajamaGithub


text:
package com.alexkolpa.torrentmonitor;

import android.accounts.Account;
import android.annotation.TargetApi;
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SyncResult;
import android.os.Build;
import android.os.Bundle;

/**
 * Handle the transfer of data between a server and an app, using the Android sync adapter framework.
 */
public class TorrentSyncAdapter extends AbstractThreadedSyncAdapter {
	// Global variables
	// Define a variable to contain a content resolver instance
	ContentResolver mContentResolver;

	/**
	 * Set up the sync adapter
	 */
	public TorrentSyncAdapter(Context context, boolean autoInitialize) {
		super(context, autoInitialize);
	}

	/**
	 * Set up the sync adapter. This form of the constructor maintains compatibility with Android 3.0 and later
	 * platform
	 * versions
	 */
	@TargetApi(Build.VERSION_CODES.HONEYCOMB)
	public TorrentSyncAdapter(
			Context context,
			boolean autoInitialize,
			boolean allowParallelSyncs) {
		super(context, autoInitialize, allowParallelSyncs);
	}

	@Override
	public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider,
			SyncResult syncResult) {

	}
}


text:
package org.inaturalist.android;

import android.app.NotificationManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.koushikdutta.urlimageviewhelper.UrlImageViewCallback;
import com.koushikdutta.urlimageviewhelper.UrlImageViewHelper;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Locale;

class UserIdentificationsAdapter extends ArrayAdapter<String> {
    private ArrayList<JSONObject> mResultList;
    private Context mContext;
    private String mUsername;

    public UserIdentificationsAdapter(Context context, ArrayList<JSONObject> results, String username) {
        super(context, android.R.layout.simple_list_item_1);

        mContext = context;
        mResultList = results;
        mUsername = username;
    }

    @Override
    public int getCount() {
        return (mResultList != null ? mResultList.size() : 0);
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.user_profile_identifications_item, parent, false);
        JSONObject item = null;
        item = mResultList.get(position);

        ((ViewGroup)view.findViewById(R.id.taxon_result)).setVisibility(View.VISIBLE);

        // Get the taxon display name according to device locale
        try {
            ImageView idPic = (ImageView) view.findViewById(R.id.id_pic);
            TextView idName = (TextView) view.findViewById(R.id.id_name);
            TextView idTaxonName = (TextView) view.findViewById(R.id.id_taxon_name);

            JSONObject observation = item.getJSONObject("observation");
            JSONObject taxon = item.getJSONObject("taxon");
            idName.setText(observation.optString("species_guess"));
            idTaxonName.setText(String.format(mContext.getString(R.string.users_identification), mUsername, getTaxonName(taxon)));

            idPic.setImageResource(R.drawable.iconic_taxon_unknown);

            JSONArray photos = observation.optJSONArray("photos");
            if ((photos != null) && (photos.length() > 0)) {
                UrlImageViewHelper.setUrlDrawable(idPic, photos.getJSONObject(0).getString("square_url"), ObservationPhotosViewer.observationIcon(item), new UrlImageViewCallback() {
                    @Override
                    public void onLoaded(ImageView imageView, Bitmap loadedBitmap, String url, boolean loadedFromCache) {
                        if (loadedBitmap != null)
                            imageView.setImageBitmap(ImageUtils.getRoundedCornerBitmap(loadedBitmap, 4));
                    }

                    @Override
                    public Bitmap onPreSetBitmap(ImageView imageView, Bitmap loadedBitmap, String url, boolean loadedFromCache) {
                        return loadedBitmap;
                    }
                });
            }

            view.setTag(item);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return view;
    }

    private String getTaxonName(JSONObject item) {
        JSONObject defaultName;
        String displayName = null;

        // Get the taxon display name according to device locale
        NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
        Locale deviceLocale = mContext.getResources().getConfiguration().locale;
        String deviceLexicon =   deviceLocale.getLanguage();

        try {
            JSONArray taxonNames = item.getJSONArray("taxon_names");
            for (int i = 0; i < taxonNames.length(); i++) {
                JSONObject taxonName = taxonNames.getJSONObject(i);
                String lexicon = taxonName.getString("lexicon");
                if (lexicon.equals(deviceLexicon)) {
                    // Found the appropriate lexicon for the taxon
                    displayName = taxonName.getString("name");
                    break;
                }
            }
        } catch (JSONException e3) {
            //e3.printStackTrace();
        }

        if (displayName == null) {
            // Couldn't extract the display name from the taxon names list - use the default one
            try {
                displayName = item.getString("unique_name");
            } catch (JSONException e2) {
                displayName = null;
            }
            try {
                defaultName = item.getJSONObject("default_name");
                displayName = defaultName.getString("name");
            } catch (JSONException e1) {
                // alas
                JSONObject commonName = item.optJSONObject("common_name");
                if (commonName != null) {
                    displayName = commonName.optString("name");
                } else {
                    displayName = item.optString("name");
                }
            }
        }

        return displayName;

    }
}


text:
0. Check out [Hacking on Force][hacking] in the README guide for
   bootstrapping the project for local development
1. [Fork the repository.][fork]
2. [Create a topic branch.][branch]
3. Implement your feature and make sure it is covered by appropriate tests
4. Run `go test` and make sure all of the tests pass
5. Add documentation for your feature or bug fix
6. Run `go fmt` from the root of the project, to enforce style.
7. Add, commit, and push your changes. Following [this guide for commits and commit messages][commits] is very appreciated
8. [Submit a pull request.][pr] Please be specific with your message, detailing what the why/how of your contribution.
9. Please expect and facilitate feedback and discussion :)

[hacking]: https://github.com/joist-engineering/force#hacking
[fork]: https://help.github.com/articles/fork-a-repo
[branch]: http://learn.github.com/p/branching.html
[pr]: https://help.github.com/articles/using-pull-requests
[commits]: http://git-scm.com/book/en/Distributed-Git-Contributing-to-a-Project#Commit-Guidelines


text:
package org.broadleafcommerce.common.copy;

import org.broadleafcommerce.common.extension.AbstractExtensionHandler;
import org.broadleafcommerce.common.extension.ExtensionResultStatusType;

public class AbstractMultiTenantCopierExtensionHandler extends AbstractExtensionHandler
        implements MultiTenantCopierExtensionHandler {

    @Override
    public ExtensionResultStatusType transformCopy(MultiTenantCopyContext context, Object from, Object to) {
        return ExtensionResultStatusType.NOT_HANDLED;
    }

    @Override
    public ExtensionResultStatusType prepareForSave(MultiTenantCopyContext context, Object from, Object to) {
        return ExtensionResultStatusType.NOT_HANDLED;
    }

}


text:
/**
 * Support and FAQ: visit Atmel Support
 */

#ifndef CONF_BUSART_IF_H_INCLUDED
#define CONF_BUSART_IF_H_INCLUDED

/** Timers Configuration */
#define ID_TC_USART              ID_TC4
#define TC_USART                 TC1
#define TC_USART_CHN             1
#define TC_USART_Handler         TC4_Handler

/** Configuration Size Buffers */
#define RX_USART_BUF0_SIZE       1024
#define TX_USART_BUF0_SIZE       1024

#define RX_USART_BUF1_SIZE       1024
#define TX_USART_BUF1_SIZE       1024

#endif  /* CONF_BUSART_IF_H_INCLUDED */


text:
@class DBFILEREQUESTSCountFileRequestsResult;

NS_ASSUME_NONNULL_BEGIN

#pragma mark - API Object

///
/// The `CountFileRequestsResult` struct.
///
/// Result for `count`.
///
/// This class implements the `DBSerializable` protocol (serialize and
/// deserialize instance methods), which is required for all Obj-C SDK API route
/// objects.
///
@interface DBFILEREQUESTSCountFileRequestsResult : NSObject <DBSerializable, NSCopying>

#pragma mark - Instance fields

/// The number file requests owner by this user.
@property (nonatomic, readonly) NSNumber *fileRequestCount;

#pragma mark - Constructors

///
/// Full constructor for the struct (exposes all instance variables).
///
/// @param fileRequestCount The number file requests owner by this user.
///
/// @return An initialized instance.
///
- (instancetype)initWithFileRequestCount:(NSNumber *)fileRequestCount;

- (instancetype)init NS_UNAVAILABLE;

@end

#pragma mark - Serializer Object

///
/// The serialization class for the `CountFileRequestsResult` struct.
///
@interface DBFILEREQUESTSCountFileRequestsResultSerializer : NSObject

///
/// Serializes `DBFILEREQUESTSCountFileRequestsResult` instances.
///
/// @param instance An instance of the `DBFILEREQUESTSCountFileRequestsResult`
/// API object.
///
/// @return A json-compatible dictionary representation of the
/// `DBFILEREQUESTSCountFileRequestsResult` API object.
///
+ (nullable NSDictionary<NSString *, id> *)serialize:(DBFILEREQUESTSCountFileRequestsResult *)instance;

///
/// Deserializes `DBFILEREQUESTSCountFileRequestsResult` instances.
///
/// @param dict A json-compatible dictionary representation of the
/// `DBFILEREQUESTSCountFileRequestsResult` API object.
///
/// @return An instantiation of the `DBFILEREQUESTSCountFileRequestsResult`
/// object.
///
+ (DBFILEREQUESTSCountFileRequestsResult *)deserialize:(NSDictionary<NSString *, id> *)dict;

@end

NS_ASSUME_NONNULL_END


text:
import {Component, Input, OnChanges} from '@angular/core';
import * as d3 from 'd3';

@Component({
  selector: 'charts',
  templateUrl: 'charts.component.html',
  styleUrls: ['charts.component.css']
})
export class ChartsComponent implements OnChanges {
  constructor() {}

  @Input() optimalAllocs: Array<any>;
  @Input() title: string;

  createChart() {
    let container = document.getElementsByClassName('chart')[0];
    let margin = {top: 20, right: 20, bottom: 30, left: 40},
    width = container.clientWidth - margin.left - margin.right,
    height = 384 - margin.top - margin.bottom;

    let x = d3.scale.ordinal()
        .rangeRoundBands([0, width], .1);

    let y = d3.scale.linear()
        .range([height, 0]);

    let xAxis = d3.svg.axis()
        .scale(x)
        .orient('bottom');

    let yAxis = d3.svg.axis()
        .scale(y)
        .orient('left');

    let svg = d3.select('div.chart').append('svg')
        .attr('width', width + margin.left + margin.right)
        .attr('height', height + margin.top + margin.bottom)
      .append('g')
        .attr('transform', "translate(" + margin.left + "," + margin.top + ")");

    x.domain(this.optimalAllocs.map(function(d) { return d.name; }));
    y.domain([0, d3.max(this.optimalAllocs, function(d) { return d.value; })]);

    svg.append('g')
        .attr('class', 'x axis')
        .attr('transform', "translate(0," + height + ")")
        .call(xAxis);

    svg.append('g')
      .attr('class', 'y axis')
      .call(yAxis);

    svg.selectAll('.bar')
        .data(this.optimalAllocs)
      .enter().append('rect')
        .attr('class', 'bar')
        .attr('x', function(d) { return x(d.name); })
        .attr('width', x.rangeBand())
        .attr('y', function(d) { return y(d.value); })
        .attr('height', function(d) { return height - y(d.value); });
  }

  removeOldChart() {
    // If svg element exists, remove it
    // If it doesn't, nothing happens
    d3.select('svg').remove();
  }

  ngOnChanges(){
    // Called on changes to the bindings
    // At the very beginning when the bindings are first specified, this counts as a change
    this.removeOldChart();
    this.createChart();
  }

}


text:
import merge from "ember-metal/merge";
import Stream from "ember-metal/streams/stream";
import create from "ember-metal/platform/create";
import { read, isStream } from "ember-metal/streams/utils";

function SimpleStream(source) {
  this.init();
  this.source = source;
  this.dependency = this.addDependency(this.source);
}

SimpleStream.prototype = create(Stream.prototype);

merge(SimpleStream.prototype, {
  valueFn() {
    return read(this.source);
  },

  setValue(value) {
    var source = this.source;

    if (isStream(source)) {
      source.setValue(value);
    }
  },

  setSource(nextSource) {
    var prevSource = this.source;
    if (nextSource !== prevSource) {
      this.dependency.replace(nextSource);
      this.source = nextSource;
      this.notify();
    }
  },

  _super$destroy: Stream.prototype.destroy,

  destroy() {
    if (this._super$destroy()) {
      this.source = undefined;
      return true;
    }
  }
});

export default SimpleStream;


text:
using System;
using System.Diagnostics.Contracts;
using RazorEngine.Templating;

namespace Essential.Templating.Razor
{
    public class Template<T> : Template, ITemplate<T>
    {
        public Template(TemplateContext templateContext) : base(templateContext)
        {
            Contract.Requires<ArgumentNullException>(templateContext != null);
        }

        public T Model { get; set; }
    }
}


text:
package org.wso2.carbon.device.mgt.iot.config.datastore;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;

@XmlRootElement(name = "DataStores")
@XmlAccessorType(XmlAccessType.FIELD)
public class FireAlarmDataStoreConfigurations {

    @XmlElement(name = "DataStore", nillable = true)
    private List<DeviceDataStoreConfig> deviceDataStoreConfigs;

    public List<DeviceDataStoreConfig> getIotDataSourceConfigs() {
        return deviceDataStoreConfigs;
    }

    public void setIotDataSourceConfigs(List<DeviceDataStoreConfig> deviceDataStoreConfigs) {
        this.deviceDataStoreConfigs = deviceDataStoreConfigs;
    }

}


text:
package webhook

import (
	"fmt"
	"net/http"
	"strings"

	"github.com/golang/glog"

	kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
	"github.com/openshift/origin/pkg/build/api"
	buildclient "github.com/openshift/origin/pkg/build/client"
	buildutil "github.com/openshift/origin/pkg/build/util"
	osclient "github.com/openshift/origin/pkg/client"
)

// Plugin for Webhook verification is dependent on the sending side, it can be
// eg. github, bitbucket or else, so there must be a separate Plugin
// instance for each webhook provider.
type Plugin interface {
	// Method extracts build information and returns:
	// - newly created build object or nil if default is to be created
	// - information whether to trigger the build itself
	// - eventual error.
	Extract(buildCfg *api.BuildConfig, secret, path string, req *http.Request) (*api.SourceRevision, bool, error)
}

// controller used for processing webhook requests.
type controller struct {
	buildCreator      buildclient.BuildCreator
	buildConfigGetter buildclient.BuildConfigGetter
	imageRepoGetter   osclient.ImageRepositoryNamespaceGetter
	plugins           map[string]Plugin
}

// urlVars holds parsed URL parts.
type urlVars struct {
	namespace       string
	buildConfigName string
	secret          string
	plugin          string
	path            string
}

// NewController creates new webhook controller and feed it with provided plugins.
func NewController(buildConfigGetter buildclient.BuildConfigGetter, buildCreator buildclient.BuildCreator, imageRepoGetter osclient.ImageRepositoryNamespaceGetter, plugins map[string]Plugin) http.Handler {
	return &controller{
		buildConfigGetter: buildConfigGetter,
		buildCreator:      buildCreator,
		imageRepoGetter:   imageRepoGetter,
		plugins:           plugins,
	}
}

// ServeHTTP main REST service method.
func (c *controller) ServeHTTP(w http.ResponseWriter, req *http.Request) {
	uv, err := parseURL(req)
	if err != nil {
		glog.V(4).Infof("Failed parsing request URL: %v", err)
		notFound(w, err.Error())
		return
	}

	buildCfg, err := c.buildConfigGetter.Get(uv.namespace, uv.buildConfigName)
	if err != nil {
		glog.V(4).Infof("Failed getting BuildConfig: %v", err)
		badRequest(w, err.Error())
		return
	}

	plugin, ok := c.plugins[uv.plugin]
	if !ok {
		glog.V(4).Infof("Plugin %s not found", uv.plugin)
		notFound(w, "Plugin ", uv.plugin, " not found")
		return
	}
	revision, proceed, err := plugin.Extract(buildCfg, uv.secret, uv.path, req)
	if err != nil {
		glog.V(4).Infof("Failed extracting information from webhook: %v", err)
		badRequest(w, err.Error())
		return
	}
	if !proceed {
		return
	}
	build, err := buildutil.GenerateBuildWithImageTag(buildCfg, revision, c.imageRepoGetter)
	if err != nil {
		glog.V(4).Infof("Failed generating new build: %v", err)
		badRequest(w, err.Error())
		return
	}
	if err := c.buildCreator.Create(uv.namespace, build); err != nil {
		glog.V(4).Infof("Failed creating new build: %v", err)
		badRequest(w, err.Error())
	}
}

// parseURL retrieves the namespace from the query parameters and returns a context wrapping the namespace,
// the parameters for the webhook call, and an error.
// according to the docs (http://godoc.org/code.google.com/p/go.net/context) ctx is not supposed to be wrapped in another object
func parseURL(req *http.Request) (uv urlVars, err error) {
	url := req.URL.Path

	parts := splitPath(url)
	if len(parts) < 3 {
		err = fmt.Errorf("Unexpected URL %s", url)
		return
	}
	uv = urlVars{
		namespace:       kapi.NamespaceDefault,
		buildConfigName: parts[0],
		secret:          parts[1],
		plugin:          parts[2],
		path:            "",
	}
	if len(parts) > 3 {
		uv.path = strings.Join(parts[3:], "/")
	}

	// TODO for now, we pull namespace from query parameter, but according to spec, it must go in resource path in future PR
	// if a namespace if specified, it's always used.
	// for list/watch operations, a namespace is not required if omitted.
	// for all other operations, if namespace is omitted, we will default to default namespace.
	namespace := req.URL.Query().Get("namespace")
	if len(namespace) > 0 {
		uv.namespace = namespace
	}

	return
}

func splitPath(path string) []string {
	path = strings.Trim(path, "/")
	if path == "" {
		return []string{}
	}
	return strings.Split(path, "/")
}

func notFound(w http.ResponseWriter, args ...string) {
	http.Error(w, strings.Join(args, ""), http.StatusNotFound)
}

func badRequest(w http.ResponseWriter, args ...string) {
	http.Error(w, strings.Join(args, ""), http.StatusBadRequest)
}


text:
/* eslint-env mocha */
"use strict";

const assert = require("assert");
const http = require("http");
const async = require("async");

function getHttpStatus(sUrl, fnCallback) {
	const oOptions = {
		hostname: "localhost",
		port: 8080,
		path: sUrl,
		method: "GET"
	};

	const oRequest = http.request(oOptions, function(oResponse) {
		// If you do not add this the server will hang after 5 requests
		oResponse.on("data", function() {/* do nothing */});

		fnCallback(oResponse.statusCode);
	});

	oRequest.end();
}

function fnStatusOkTestCase(sUrl, fnDone) {
	getHttpStatus(sUrl, function(statusCode) {
		assert.equal(statusCode, 200, "Did return a 200 for url: " + sUrl + " returned http-status: " + statusCode);
		fnDone();
	});
}

function fnStatusNotFoundTestCase(sUrl, fnDone) {
	getHttpStatus(sUrl, function(iStatusCode) {
		assert.equal(iStatusCode, 404, "Did return a 404 for url: " + sUrl + " returned http-status: " + iStatusCode);
		fnDone();
	});
}

describe("openui5 connect should return status 200 ok for", function() {
	it("an existing test-resource file of another library", function(fnDone) {
		fnStatusOkTestCase("/mycontext/test-resources/SomeTest.html", fnDone);
	});

	it("a file in a different folter in the app resources", function(fnDone) {
		fnStatusOkTestCase("/mycontext/foo.html", fnDone);
	});

	it("an existing resource file", function(fnDone) {
		fnStatusOkTestCase("/mycontext/resources/controlOfAnotherLib.js", fnDone);
	});

	it("an existing test-resource file", function(fnDone) {
		fnStatusOkTestCase("/mycontext/test-resources/someTest.js", fnDone);
	});

	it("an existing resource file of another library", function(fnDone) {
		fnStatusOkTestCase("/mycontext/resources/someHtml.html", fnDone);
	});

	it("a file in the app resources", function(fnDone) {
		fnStatusOkTestCase("/mycontext/app.html", fnDone);
	});

	it("a file from custom connect middleware", function(fnDone) {
		fnStatusOkTestCase("/foo", fnDone);
	});
});

describe("openui5 connect should return status 404 not found for", function() {
	it("a non existing resource file", function(fnDone) {
		fnStatusNotFoundTestCase("/mycontext/resources/hundekuchen.js", fnDone);
	});

	it("a existing resource file without the context path", function(fnDone) {
		fnStatusNotFoundTestCase("/resources/someHtml.html", fnDone);
	});

	it("a file in the app resources", function(fnDone) {
		fnStatusNotFoundTestCase("/resources/someHtml.html", fnDone);
	});
});

function connectTestcase(fnDone, sUrl) {
	let sExpectedData = "";
	let sActualData = "";
	let iExpectedStatusCode;
	let iActualStatusCode;
	const aCalls = [];

	aCalls.push(function(fnCallback) {
		http.get("http://localhost:9000/" + sUrl, function(oResponse) {
			oResponse.on("data", function(oData) {
				sExpectedData += oData;
			});
			iExpectedStatusCode = oResponse.statusCode;
			oResponse.on("end", fnCallback);
		});
	});

	aCalls.push(function(fnCallback) {
		http.get("http://localhost:8080/mycontext/proxy/http/localhost:9000/" + sUrl, function(oResponse) {
			oResponse.on("data", function(oData) {
				sActualData += oData;
			});
			iActualStatusCode = oResponse.statusCode;
			oResponse.on("end", fnCallback);
		});
	});

	async.parallel(aCalls, function() {
		assert.equal(sExpectedData, sActualData);
		assert.equal(iExpectedStatusCode, iActualStatusCode);
		fnDone();
	});
}

describe("openui5 connect should proxy requests", function() {
	it("proxies a request to an existing resource", function(done) {
		connectTestcase(done, "mycontext/resources/someHtml.html");
	});

	it("proxies a request to an non existing resource", function(done) {
		connectTestcase(done, "mycontext/resources/hundekuchen.js");
	});

	it("proxies a request to an non existing resource not in the context", function(done) {
		connectTestcase(done, "any/other/url.js");
	});
});


text:
package org.elasticsearch.ingest;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptService;
import org.elasticsearch.script.ScriptType;
import org.elasticsearch.script.TemplateScript;
import org.elasticsearch.xcontent.NamedXContentRegistry;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentParser;
import org.elasticsearch.xcontent.XContentType;
import org.elasticsearch.xcontent.json.JsonXContent;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.elasticsearch.script.Script.DEFAULT_TEMPLATE_LANG;

public final class ConfigurationUtils {

    public static final String TAG_KEY = "tag";
    public static final String DESCRIPTION_KEY = "description";
    public static final String[] VALID_MEDIA_TYPES = { "application/json", "text/plain", "application/x-www-form-urlencoded" };

    private ConfigurationUtils() {}

    /**
     * Returns and removes the specified optional property from the specified configuration map.
     *
     * If the property value isn't of type string a {@link ElasticsearchParseException} is thrown.
     */
    public static String readOptionalStringProperty(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName
    ) {
        Object value = configuration.remove(propertyName);
        return readString(processorType, processorTag, propertyName, value);
    }

    /**
     * Returns and removes the specified property from the specified configuration map.
     *
     * If the property value isn't of type string an {@link ElasticsearchParseException} is thrown.
     * If the property is missing an {@link ElasticsearchParseException} is thrown
     */
    public static String readStringProperty(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName
    ) {
        return readStringProperty(processorType, processorTag, configuration, propertyName, null);
    }

    /**
     * Returns and removes the specified property from the specified configuration map.
     *
     * If the property value isn't of type string a {@link ElasticsearchParseException} is thrown.
     * If the property is missing and no default value has been specified a {@link ElasticsearchParseException} is thrown
     */
    public static String readStringProperty(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName,
        String defaultValue
    ) {
        Object value = configuration.remove(propertyName);
        if (value == null && defaultValue != null) {
            return defaultValue;
        } else if (value == null) {
            throw newConfigurationException(processorType, processorTag, propertyName, "required property is missing");
        }
        return readString(processorType, processorTag, propertyName, value);
    }

    private static String readString(String processorType, String processorTag, String propertyName, Object value) {
        if (value == null) {
            return null;
        }
        if (value instanceof String string) {
            return string;
        }
        throw newConfigurationException(
            processorType,
            processorTag,
            propertyName,
            "property isn't a string, but of type [" + value.getClass().getName() + "]"
        );
    }

    /**
     * Returns and removes the specified property from the specified configuration map.
     *
     * If the property value isn't of type string or int a {@link ElasticsearchParseException} is thrown.
     * If the property is missing and no default value has been specified a {@link ElasticsearchParseException} is thrown
     */
    public static String readStringOrIntProperty(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName,
        String defaultValue
    ) {
        Object value = configuration.remove(propertyName);
        if (value == null && defaultValue != null) {
            return defaultValue;
        } else if (value == null) {
            throw newConfigurationException(processorType, processorTag, propertyName, "required property is missing");
        }
        return readStringOrInt(processorType, processorTag, propertyName, value);
    }

    private static String readStringOrInt(String processorType, String processorTag, String propertyName, Object value) {
        if (value == null) {
            return null;
        }
        if (value instanceof String string) {
            return string;
        } else if (value instanceof Integer integer) {
            return String.valueOf(integer);
        }
        throw newConfigurationException(
            processorType,
            processorTag,
            propertyName,
            "property isn't a string or int, but of type [" + value.getClass().getName() + "]"
        );
    }

    /**
     * Returns and removes the specified property from the specified configuration map.
     *
     * If the property value isn't of type string or int a {@link ElasticsearchParseException} is thrown.
     */
    public static String readOptionalStringOrIntProperty(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName
    ) {
        Object value = configuration.remove(propertyName);
        if (value == null) {
            return null;
        }
        return readStringOrInt(processorType, processorTag, propertyName, value);
    }

    private static String readStringOrLong(String processorType, String processorTag, String propertyName, Object value) {
        if (value == null) {
            return null;
        }
        if (value instanceof String string) {
            return string;
        } else if (value instanceof Long || value instanceof Integer) {
            return String.valueOf(value);
        }
        throw newConfigurationException(
            processorType,
            processorTag,
            propertyName,
            "property isn't a string or long, but of type [" + value.getClass().getName() + "]"
        );
    }

    /**
     * Returns and removes the specified property from the specified configuration map.
     *
     * If the property value isn't of type string or long a {@link ElasticsearchParseException} is thrown.
     */
    public static String readOptionalStringOrLongProperty(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName
    ) {
        Object value = configuration.remove(propertyName);
        if (value == null) {
            return null;
        }
        return readStringOrLong(processorType, processorTag, propertyName, value);
    }

    public static Boolean readBooleanProperty(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName,
        boolean defaultValue
    ) {
        Object value = configuration.remove(propertyName);
        if (value == null) {
            return defaultValue;
        } else {
            return readBoolean(processorType, processorTag, propertyName, value).booleanValue();
        }
    }

    private static Boolean readBoolean(String processorType, String processorTag, String propertyName, Object value) {
        if (value == null) {
            return null;
        }
        if (value instanceof Boolean b) {
            return b;
        }
        throw newConfigurationException(
            processorType,
            processorTag,
            propertyName,
            "property isn't a boolean, but of type [" + value.getClass().getName() + "]"
        );
    }

    /**
     * Returns and removes the specified property from the specified configuration map.
     *
     * If the property value isn't of type int a {@link ElasticsearchParseException} is thrown.
     * If the property is missing an {@link ElasticsearchParseException} is thrown
     */
    public static Integer readIntProperty(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName,
        Integer defaultValue
    ) {
        Object value = configuration.remove(propertyName);
        if (value == null) {
            return defaultValue;
        }
        try {
            return Integer.parseInt(value.toString());
        } catch (Exception e) {
            throw newConfigurationException(
                processorType,
                processorTag,
                propertyName,
                "property cannot be converted to an int [" + value.toString() + "]"
            );
        }
    }

    /**
     * Returns and removes the specified property from the specified configuration map.
     *
     * If the property value isn't of type int a {@link ElasticsearchParseException} is thrown.
     * If the property is missing an {@link ElasticsearchParseException} is thrown
     */
    public static Double readDoubleProperty(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName
    ) {
        Object value = configuration.remove(propertyName);
        if (value == null) {
            throw newConfigurationException(processorType, processorTag, propertyName, "required property is missing");
        }
        try {
            return Double.parseDouble(value.toString());
        } catch (Exception e) {
            throw newConfigurationException(
                processorType,
                processorTag,
                propertyName,
                "property cannot be converted to a double [" + value.toString() + "]"
            );
        }
    }

    /**
     * Returns and removes the specified property of type list from the specified configuration map.
     *
     * If the property value isn't of type list an {@link ElasticsearchParseException} is thrown.
     */
    public static <T> List<T> readOptionalList(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName
    ) {
        Object value = configuration.remove(propertyName);
        if (value == null) {
            return null;
        }
        return readList(processorType, processorTag, propertyName, value);
    }

    /**
     * Returns and removes the specified property of type list from the specified configuration map.
     *
     * If the property value isn't of type list an {@link ElasticsearchParseException} is thrown.
     * If the property is missing an {@link ElasticsearchParseException} is thrown
     */
    public static <T> List<T> readList(String processorType, String processorTag, Map<String, Object> configuration, String propertyName) {
        Object value = configuration.remove(propertyName);
        if (value == null) {
            throw newConfigurationException(processorType, processorTag, propertyName, "required property is missing");
        }

        return readList(processorType, processorTag, propertyName, value);
    }

    private static <T> List<T> readList(String processorType, String processorTag, String propertyName, Object value) {
        if (value instanceof List) {
            @SuppressWarnings("unchecked")
            List<T> stringList = (List<T>) value;
            return stringList;
        } else {
            throw newConfigurationException(
                processorType,
                processorTag,
                propertyName,
                "property isn't a list, but of type [" + value.getClass().getName() + "]"
            );
        }
    }

    /**
     * Returns and removes the specified property of type map from the specified configuration map.
     *
     * If the property value isn't of type map an {@link ElasticsearchParseException} is thrown.
     * If the property is missing an {@link ElasticsearchParseException} is thrown
     */
    public static <T> Map<String, T> readMap(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName
    ) {
        Object value = configuration.remove(propertyName);
        if (value == null) {
            throw newConfigurationException(processorType, processorTag, propertyName, "required property is missing");
        }

        return readMap(processorType, processorTag, propertyName, value);
    }

    /**
     * Returns and removes the specified property of type map from the specified configuration map.
     *
     * If the property value isn't of type map an {@link ElasticsearchParseException} is thrown.
     */
    public static <T> Map<String, T> readOptionalMap(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName
    ) {
        Object value = configuration.remove(propertyName);
        if (value == null) {
            return null;
        }

        return readMap(processorType, processorTag, propertyName, value);
    }

    private static <T> Map<String, T> readMap(String processorType, String processorTag, String propertyName, Object value) {
        if (value instanceof Map) {
            @SuppressWarnings("unchecked")
            Map<String, T> map = (Map<String, T>) value;
            return map;
        } else {
            throw newConfigurationException(
                processorType,
                processorTag,
                propertyName,
                "property isn't a map, but of type [" + value.getClass().getName() + "]"
            );
        }
    }

    /**
     * Returns and removes the specified property as an {@link Object} from the specified configuration map.
     */
    public static Object readObject(String processorType, String processorTag, Map<String, Object> configuration, String propertyName) {
        Object value = configuration.remove(propertyName);
        if (value == null) {
            throw newConfigurationException(processorType, processorTag, propertyName, "required property is missing");
        }
        return value;
    }

    public static String readMediaTypeProperty(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName,
        String defaultValue
    ) {
        String mediaType = readStringProperty(processorType, processorTag, configuration, propertyName, defaultValue);

        if (Arrays.asList(VALID_MEDIA_TYPES).contains(mediaType) == false) {
            throw newConfigurationException(
                processorType,
                processorTag,
                propertyName,
                "property does not contain a supported media type [" + mediaType + "]"
            );
        }

        return mediaType;
    }

    public static ElasticsearchException newConfigurationException(
        String processorType,
        String processorTag,
        String propertyName,
        String reason
    ) {
        String msg;
        if (propertyName == null) {
            msg = reason;
        } else {
            msg = "[" + propertyName + "] " + reason;
        }
        ElasticsearchParseException exception = new ElasticsearchParseException(msg);
        addMetadataToException(exception, processorType, processorTag, propertyName);
        return exception;
    }

    public static ElasticsearchException newConfigurationException(
        String processorType,
        String processorTag,
        String propertyName,
        Exception cause
    ) {
        ElasticsearchException exception = ExceptionsHelper.convertToElastic(cause);
        addMetadataToException(exception, processorType, processorTag, propertyName);
        return exception;
    }

    public static List<Processor> readProcessorConfigs(
        List<Map<String, Object>> processorConfigs,
        ScriptService scriptService,
        Map<String, Processor.Factory> processorFactories
    ) throws Exception {
        Exception exception = null;
        List<Processor> processors = new ArrayList<>();
        if (processorConfigs != null) {
            for (Map<String, Object> processorConfigWithKey : processorConfigs) {
                for (Map.Entry<String, Object> entry : processorConfigWithKey.entrySet()) {
                    try {
                        if (entry.getValue() == null) {
                            throw newConfigurationException(entry.getKey(), null, null, "processor config cannot be [null]");
                        } else {
                            processors.add(readProcessor(processorFactories, scriptService, entry.getKey(), entry.getValue()));
                        }
                    } catch (Exception e) {
                        exception = ExceptionsHelper.useOrSuppress(exception, e);
                    }
                }
            }
        }

        if (exception != null) {
            throw exception;
        }

        return processors;
    }

    public static TemplateScript.Factory readTemplateProperty(
        String processorType,
        String processorTag,
        Map<String, Object> configuration,
        String propertyName,
        ScriptService scriptService
    ) {
        String value = readStringProperty(processorType, processorTag, configuration, propertyName, null);
        return compileTemplate(processorType, processorTag, propertyName, value, scriptService);
    }

    public static TemplateScript.Factory compileTemplate(
        String processorType,
        String processorTag,
        String propertyName,
        String propertyValue,
        ScriptService scriptService
    ) {
        try {
            // This check is here because the DEFAULT_TEMPLATE_LANG(mustache) is not
            // installed for use by REST tests. `propertyValue` will not be
            // modified if templating is not available so a script that simply returns an unmodified `propertyValue`
            // is returned.
            if (scriptService.isLangSupported(DEFAULT_TEMPLATE_LANG) && propertyValue.contains("{{")) {
                Script script = new Script(ScriptType.INLINE, DEFAULT_TEMPLATE_LANG, propertyValue, Collections.emptyMap());
                return scriptService.compile(script, TemplateScript.CONTEXT);
            } else {
                return (params) -> new TemplateScript(params) {
                    @Override
                    public String execute() {
                        return propertyValue;
                    }
                };
            }
        } catch (Exception e) {
            throw ConfigurationUtils.newConfigurationException(processorType, processorTag, propertyName, e);
        }
    }

    private static void addMetadataToException(
        ElasticsearchException exception,
        String processorType,
        String processorTag,
        String propertyName
    ) {
        if (processorType != null) {
            exception.addMetadata("es.processor_type", processorType);
        }
        if (processorTag != null) {
            exception.addMetadata("es.processor_tag", processorTag);
        }
        if (propertyName != null) {
            exception.addMetadata("es.property_name", propertyName);
        }
    }

    @SuppressWarnings("unchecked")
    public static Processor readProcessor(
        Map<String, Processor.Factory> processorFactories,
        ScriptService scriptService,
        String type,
        Object config
    ) throws Exception {
        if (config instanceof Map) {
            return readProcessor(processorFactories, scriptService, type, (Map<String, Object>) config);
        } else if (config instanceof String && "script".equals(type)) {
            Map<String, Object> normalizedScript = new HashMap<>(1);
            normalizedScript.put(ScriptType.INLINE.getParseField().getPreferredName(), config);
            return readProcessor(processorFactories, scriptService, type, normalizedScript);
        } else {
            throw newConfigurationException(type, null, null, "property isn't a map, but of type [" + config.getClass().getName() + "]");
        }
    }

    public static Processor readProcessor(
        Map<String, Processor.Factory> processorFactories,
        ScriptService scriptService,
        String type,
        Map<String, Object> config
    ) throws Exception {
        String tag = ConfigurationUtils.readOptionalStringProperty(null, null, config, TAG_KEY);
        String description = ConfigurationUtils.readOptionalStringProperty(null, tag, config, DESCRIPTION_KEY);
        Script conditionalScript = extractConditional(config);
        Processor.Factory factory = processorFactories.get(type);
        if (factory != null) {
            boolean ignoreFailure = ConfigurationUtils.readBooleanProperty(null, null, config, "ignore_failure", false);
            List<Map<String, Object>> onFailureProcessorConfigs = ConfigurationUtils.readOptionalList(
                null,
                null,
                config,
                Pipeline.ON_FAILURE_KEY
            );

            List<Processor> onFailureProcessors = readProcessorConfigs(onFailureProcessorConfigs, scriptService, processorFactories);

            if (onFailureProcessorConfigs != null && onFailureProcessors.isEmpty()) {
                throw newConfigurationException(type, tag, Pipeline.ON_FAILURE_KEY, "processors list cannot be empty");
            }

            try {
                Processor processor = factory.create(processorFactories, tag, description, config);
                if (config.isEmpty() == false) {
                    throw new ElasticsearchParseException(
                        "processor [{}] doesn't support one or more provided configuration parameters {}",
                        type,
                        Arrays.toString(config.keySet().toArray())
                    );
                }
                if (onFailureProcessors.size() > 0 || ignoreFailure) {
                    processor = new CompoundProcessor(ignoreFailure, Collections.singletonList(processor), onFailureProcessors);
                }
                if (conditionalScript != null) {
                    processor = new ConditionalProcessor(tag, description, conditionalScript, scriptService, processor);
                }
                return processor;
            } catch (Exception e) {
                throw newConfigurationException(type, tag, null, e);
            }
        }
        throw newConfigurationException(type, tag, null, "No processor type exists with name [" + type + "]");
    }

    private static Script extractConditional(Map<String, Object> config) throws IOException {
        Object scriptSource = config.remove("if");
        if (scriptSource != null) {
            try (
                XContentBuilder builder = XContentBuilder.builder(JsonXContent.jsonXContent).map(normalizeScript(scriptSource));
                InputStream stream = BytesReference.bytes(builder).streamInput();
                XContentParser parser = XContentType.JSON.xContent()
                    .createParser(NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, stream)
            ) {
                return Script.parse(parser);
            }
        }
        return null;
    }

    @SuppressWarnings("unchecked")
    private static Map<String, Object> normalizeScript(Object scriptConfig) {
        if (scriptConfig instanceof Map<?, ?>) {
            return (Map<String, Object>) scriptConfig;
        } else if (scriptConfig instanceof String) {
            return Collections.singletonMap("source", scriptConfig);
        } else {
            throw newConfigurationException(
                "conditional",
                null,
                "script",
                "property isn't a map or string, but of type [" + scriptConfig.getClass().getName() + "]"
            );
        }
    }
}


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/iam/v1/iam_policy.proto

namespace Google\Iam\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Request message for `TestIamPermissions` method.
 *
 * Generated from protobuf message google.iam.v1.TestIamPermissionsRequest
 */
class TestIamPermissionsRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * REQUIRED: The resource for which the policy detail is being requested.
     * `resource` is usually specified as a path. For example, a Project
     * resource is specified as `projects/{project}`.
     *
     * Generated from protobuf field string resource = 1;
     */
    private $resource = '';
    /**
     * The set of permissions to check for the `resource`. Permissions with
     * wildcards (such as '*' or 'storage.*') are not allowed. For more
     * information see
     * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
     *
     * Generated from protobuf field repeated string permissions = 2;
     */
    private $permissions;

    public function __construct() {
        \GPBMetadata\Google\Iam\V1\IamPolicy::initOnce();
        parent::__construct();
    }

    /**
     * REQUIRED: The resource for which the policy detail is being requested.
     * `resource` is usually specified as a path. For example, a Project
     * resource is specified as `projects/{project}`.
     *
     * Generated from protobuf field string resource = 1;
     * @return string
     */
    public function getResource()
    {
        return $this->resource;
    }

    /**
     * REQUIRED: The resource for which the policy detail is being requested.
     * `resource` is usually specified as a path. For example, a Project
     * resource is specified as `projects/{project}`.
     *
     * Generated from protobuf field string resource = 1;
     * @param string $var
     * @return $this
     */
    public function setResource($var)
    {
        GPBUtil::checkString($var, True);
        $this->resource = $var;

        return $this;
    }

    /**
     * The set of permissions to check for the `resource`. Permissions with
     * wildcards (such as '*' or 'storage.*') are not allowed. For more
     * information see
     * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
     *
     * Generated from protobuf field repeated string permissions = 2;
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getPermissions()
    {
        return $this->permissions;
    }

    /**
     * The set of permissions to check for the `resource`. Permissions with
     * wildcards (such as '*' or 'storage.*') are not allowed. For more
     * information see
     * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
     *
     * Generated from protobuf field repeated string permissions = 2;
     * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setPermissions($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->permissions = $arr;

        return $this;
    }

}


text:
namespace torch
{

KeyframeSet::KeyframeSet(std::shared_ptr<Context> context) :
  m_context(context),
  m_validPixelCount(0),
  m_dirty(false)
{
  Initialize();
}

KeyframeSet::~KeyframeSet()
{
}

bool KeyframeSet::Empty() const
{
  return m_keyframes.empty();
}

size_t KeyframeSet::Size() const
{
  return m_keyframes.size();
}

void KeyframeSet::Add(std::shared_ptr<Keyframe> keyframe)
{
  m_keyframes.push_back(keyframe);
  m_validPixelCount += keyframe->GetValidPixelCount();
  m_dirty = true;
}

std::shared_ptr<Keyframe> KeyframeSet::operator[](size_t index) const
{
  return m_keyframes[index];
}

std::shared_ptr<Keyframe> KeyframeSet::Get(size_t index) const
{
  return m_keyframes[index];
}

size_t KeyframeSet::GetValidPixelIndex(size_t index, unsigned int x,
    unsigned int y) const
{
  size_t offset = 0;

  for (size_t i = 0; i < index; ++i)
  {
    offset += m_keyframes[i]->GetValidPixelCount();
  }

  return offset + m_keyframes[index]->GetValidPixelIndex(x, y);
}

size_t KeyframeSet::GetValidPixelCount() const
{
  return m_validPixelCount;
}

optix::Buffer KeyframeSet::GetCameraBuffer()
{
  UpdateBuffers();
  return m_cameras;
}

optix::Buffer KeyframeSet::GetPixelBuffer()
{
  UpdateBuffers();
  return m_pixels;
}

optix::Buffer KeyframeSet::GetReferenceBuffer()
{
  UpdateBuffers();
  return m_reference;
}

optix::Buffer KeyframeSet::GetRenderBuffer()
{
  UpdateBuffers();
  return m_render;
}

void KeyframeSet::UpdateBuffers()
{
  if (m_dirty)
  {
    UpdateCameraBuffer();
    UpdatePixelBuffer();
    UpdateReferenceBuffer();
    UpdateRenderBuffer();
    m_dirty = false;
  }
}

void KeyframeSet::UpdateCameraBuffer()
{
  m_cameras->setSize(m_keyframes.size());
  std::vector<CameraData> cameras(m_keyframes.size());

  for (size_t i = 0; i < m_keyframes.size(); ++i)
  {
    m_keyframes[i]->GetCamera(cameras[i]);
  }

  CameraData* device = reinterpret_cast<CameraData*>(m_cameras->map());
  std::copy(cameras.begin(), cameras.end(), device);
  m_cameras->unmap();
}

void KeyframeSet::UpdatePixelBuffer()
{
  m_pixels->setSize(m_validPixelCount);
  PixelSample* device = reinterpret_cast<PixelSample*>(m_pixels->map());
  std::vector<PixelSample> samples;
  std::vector<uint2> pixels;
  size_t offset = 0;

  for (size_t i = 0; i < m_keyframes.size(); ++i)
  {
    const std::shared_ptr<Keyframe> keyframe = m_keyframes[i];
    keyframe->GetValidPixels(pixels);
    samples.resize(pixels.size());

    for (size_t j = 0; j < pixels.size(); ++j)
    {
      samples[j].camera = i;
      samples[j].uv = pixels[j];
    }

    std::copy(samples.begin(), samples.end(), &device[offset]);
    offset += keyframe->GetValidPixelCount();
  }

  m_pixels->unmap();
}

void KeyframeSet::UpdateReferenceBuffer()
{
  m_reference->setSize(m_validPixelCount);
  Spectrum* device = reinterpret_cast<Spectrum*>(m_reference->map());
  std::vector<Spectrum> radiance;
  size_t offset = 0;

  for (const std::shared_ptr<Keyframe> keyframe : m_keyframes)
  {
    keyframe->GetValidPixelRadiance(radiance);
    std::copy(radiance.begin(), radiance.end(), &device[offset]);
    offset += keyframe->GetValidPixelCount();
  }

  m_reference->unmap();
}

void KeyframeSet::UpdateRenderBuffer()
{
  m_render->setSize(m_validPixelCount);
}

void KeyframeSet::Initialize()
{
  CreateCameraBuffer();
  CreatePixelBuffer();
  CreateReferenceBuffer();
  CreateRenderBuffer();
}

void KeyframeSet::CreateCameraBuffer()
{
  m_cameras = m_context->CreateBuffer(RT_BUFFER_INPUT);
  m_cameras->setFormat(RT_FORMAT_USER);
  m_cameras->setElementSize(sizeof(CameraData));
  m_cameras->setSize(0);
}

void KeyframeSet::CreatePixelBuffer()
{
  m_pixels = m_context->CreateBuffer(RT_BUFFER_INPUT);
  m_pixels->setFormat(RT_FORMAT_USER);
  m_pixels->setElementSize(sizeof(PixelSample));
  m_pixels->setSize(0);
}

void KeyframeSet::CreateReferenceBuffer()
{
  m_reference = m_context->CreateBuffer(RT_BUFFER_INPUT_OUTPUT);
  m_reference->setFormat(RT_FORMAT_FLOAT3);
  m_reference->setSize(0);
}

void KeyframeSet::CreateRenderBuffer()
{
  m_render = m_context->CreateBuffer(RT_BUFFER_INPUT_OUTPUT);
  m_render->setFormat(RT_FORMAT_FLOAT3);
  m_render->setSize(0);
}

} // namespace torch


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

namespace ClosedXML.Excel
{
    public interface IXLConditionalFormats: IEnumerable<IXLConditionalFormat>
    {
        void Add(IXLConditionalFormat conditionalFormat);
        void RemoveAll();
        void Remove(Predicate<IXLConditionalFormat> predicate);
    }
}


text:
/

#ifndef OCSTACK_CONFIG_H_
#define OCSTACK_CONFIG_H_

/**
 * Maximum length of the URI supported by client/server while processing
 * REST requests/responses.
 */
#if defined(ARDUINO) || defined(__TIZENRT__)
#define MAX_URI_LENGTH (64)
#else
#define MAX_URI_LENGTH (256)
#endif

/**
 * Maximum length of the query supported by client/server while processing
 * REST requests/responses.
 */
#if defined(ARDUINO) || defined(__TIZENRT__)
#define MAX_QUERY_LENGTH (64)
#else
#define MAX_QUERY_LENGTH (256)
#endif

/**
 * Maximum length of the Manufacturer name supported by the server
 * for manufacturer name.
 * @deprecated use MAX_PLATFORM_NAME_LENGTH instead.
 */
#define MAX_MANUFACTURER_NAME_LENGTH (64)

/**
 * Maximum length of the URL to the Manufacturer details supported by
 * the server.
 * @deprecated use MAX_PLATFORM_URL_LENGTH instead.
 */
#define MAX_MANUFACTURER_URL_LENGTH (256)

/**
 * Maximum length of the value supported by the server
 * for platform property of type string.
 */
#define MAX_PLATFORM_NAME_LENGTH (64)

/**
 * Maximum length of the URL supported by the server
 * for platform property of type url.
 */
#define MAX_PLATFORM_URL_LENGTH (256)

/**
 * Maximum number of resources which can be contained inside collection
 * resource.
 */
#define MAX_CONTAINED_RESOURCES  (5)

/**
 *  Maximum number of vendor specific header options an application can set or receive
 *  in PDU
 */
#ifdef ARDUINO
#define MAX_HEADER_OPTIONS (2)
#elif defined(__TIZENRT__)
#define MAX_HEADER_OPTIONS (4)
#else
#define MAX_HEADER_OPTIONS (50)
#endif

/**
 *  Maximum Length of the vendor specific header option
 */
#if defined(ARDUINO) || defined(__TIZENRT__)
#define MAX_HEADER_OPTION_DATA_LENGTH (20)
#else
#define MAX_HEADER_OPTION_DATA_LENGTH (1024)
#endif

/**
 * Sets the time to live (TTL) for response callback(s).
 * The callback(s) will be up for deletion after such time but are not guaranteed
 * to be deleted immediately and you may get responses even after timeout.
 * This timeout will NOT apply to OBSERVE requests. OBSERVE needs an explicit cancel using OCCancel().
 * @note: Changing the setting to a very long duration may lead to unsupported and untested
 * operation. Setting this to as small a value as reasonable will reclaim memory faster.
 */
#define MAX_CB_TIMEOUT_SECONDS   (2 * 60 * 60)  // 2 hours = 7200 seconds.

#endif //OCSTACK_CONFIG_H_


text:
import string

def rebase(i, frombase=None, tobase=None, fromalphabet=None, toalphabet=None, resize=1, too_big=40000, debug=False):
    ''' if frombase is not specified, it is guessed from the type and/or char in i with highest ord.
        tobase defaults to [10, 2][frombase == 10].
        the alphabets are map(chr, range(256)) if its base is between 62 and 255;
        otherwise, string.digits+string.letters.
        always returns a string which is also valid input.
        valid bases are ints in range(-256, 257).
        alphabets must be subscriptable, and can only contain str's.
        invalid tobases are replied with 'why?'; rebase('why?') == '217648673'.
        returned string is zfilled to the next largest multiple of resize
    '''
    if frombase == None:
        if isinstance(i, (int, long)):
            frombase = 10
        elif isinstance(i, str):
            a = str(i)
            if any([(chr(x) in a) for x in range(ord('0')) + range(58, 65) + range(91, 97) + range(123, 256)]):
                frombase = max(map(ord, a)) + 1
            else:
                frombase = max(map((string.digits + string.letters).index, a)) + 1
    if tobase == None:
        tobase = [10, 2][frombase == 10]
    # got bases, ensuring that everything is an int
    tobase = int(tobase)
    frombase = int(frombase)
    abstobase = abs(tobase)
    absfrombase = abs(frombase)
    if absfrombase in [0, 1]:
        i = len(str(i))
    elif 2 <= frombase <= 36:
        # may be difficult to translate to C
        i = int(str(i), frombase)
    else:
        i = str(i)
        n = 0
        if fromalphabet == None:
            if 62 <= absfrombase <= 256:
                fromalphabet = map(chr, range(256))
            else:
                fromalphabet = string.digits + string.letters
        fromalphabet = fromalphabet[:absfrombase]
        for j in range(len(i)):
            n += (frombase ** j) * fromalphabet.index(i[-1-j])
        i = n
    # got ints, converting to tobase
    if debug: print 'converting %d from base %d to %d' % (i, frombase, tobase)
    if abstobase in [0, 1]:
        return '0' * ((i > 0) and int(i) or 0)
    elif abstobase > 256:
        return 'why?'
    # if execution gets here, we might want the result to be zfilled to a multiple of resize
    r = ''
    if tobase == 10:
        r = str(i)
    else:
        if i < 0:
            print 'negative',
            i = -i
        if toalphabet is None:
            if 62 <= abstobase <= 256:
                toalphabet = map(chr, range(abstobase))
            else:
                toalphabet = (string.digits + string.letters)[:abstobase]
        if tobase < 0:
            i = -i
        j = 0
        while i != 0:
            r = toalphabet[i % tobase] + r
            i /= tobase
            j += 1
            if j >= too_big: raise "call again; set too_big bigger"
    if resize > 1:
        if 62 <= abstobase <= 256:
            r = toalphabet[0] * (resize - (len(r) % resize)) + r
        else:
            r = r.zfill(len(r) + resize - (len(r) % resize))
    return r


text:
arcgis_notebooks_server 'Unregister server machine' do
  server_url node['arcgis']['notebook_server']['url']
  username node['arcgis']['notebook_server']['admin_username']
  password node['arcgis']['notebook_server']['admin_password']
  hostname node['arcgis']['notebook_server']['hostname']
  retries 5
  retry_delay 30
  action :unregister_machine
end


text:
package org.apache.cloudstack.kernel;

import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;

public interface Partition extends InternalIdentity, Identity {
    enum PartitionType {
        Zone, Pod, Cluster, Host, VM
    }
    PartitionType partitionType();
}


text:
(function() {
    'use strict';
    var gulp = require('gulp');
    var browserSync = require('browser-sync').create();
    var path = require('path');
    var karma = require('karma');

    gulp.task('browser-sync', function(cb) {
        browserSync.init({
            server: {
                baseDir: './src',
                files: ['**/*.html', '**/*.js', '**/*.css'],
                port: 8000,
                // Not working for some reason....
                browser: ['internet explorer', 'google chrome'],
                logLevel: 'debug'
            }
        }, cb);
    });

    gulp.task('watch', [
        'browser-sync'
    ], function() {
        gulp.watch('src/**/*.html', function(event) {
            browserSync.reload(path.relative(__dirname, event.path));
        });
        gulp.watch('src/**/*.js', function(event) {
            browserSync.reload(path.relative(__dirname, event.path));
        });
        gulp.watch('src/**/*.css', function(event){
            browserSync.reload(path.relative(__dirname, event.path));
        });
    });

    gulp.task('test', function(cb) {
        new karma.Server({
            configFile: __dirname + '/karma.conf.js',
            singleRun: true
        }, cb).start();
    });

    gulp.task('default', [
        'watch'
    ]);

    // Trying out browserify builds + watchify.
    //var watchify = require('watchify');
    //var browserify = require('browserify');

    // TODO: To be continue...
})();


text: from .iers import *


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" href="style.css"/>

                <button id="reload-button"
                        class="button"
                        onclick="reloadUrl();"></button>


text:
<?php
/**
 * Trend Model for point value
 * Author: Chaucer Tian (tqignshuai@gmail.com)
 * Date: 2016/5/7
 */

namespace app\models;

use Yii;
use yii\db\ActiveRecord;

class Trend extends ActiveRecord {
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'trend';
    }
}


text:
package com.ilyagubarev.samples.springfour.common.server.kernel.context;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public abstract class ComponentBean implements BeanNameAware,
        DisposableBean, InitializingBean {

    private String name;

    public String getBeanName() {
        return name;
    }

    @Override
    public void setBeanName(String name) {
        this.name = name;
    }

    @Override
    public void destroy() throws Exception {

    }

    @Override
    public void afterPropertiesSet() throws Exception {

    }
}


text:
import EVENTS from '../../events.js';
import external from '../../externalModules.js';
import { state } from '../../store/index.js';
import anyHandlesOutsideImage from './../../manipulators/anyHandlesOutsideImage.js';
import { moveNewHandle } from '../../manipulators/index.js';
import {
  addToolState,
  removeToolState,
} from '../../stateManagement/toolState.js';
import triggerEvent from '../../util/triggerEvent.js';
import { getLogger } from '../../util/logger.js';

const logger = getLogger('eventDispatchers:touchEventHandlers');

export default function(evt, tool) {
  logger.log('addNewMeasurement');

  evt.preventDefault();
  evt.stopPropagation();

  const touchEventData = evt.detail;
  const element = touchEventData.element;
  const measurementData = tool.createNewMeasurement(touchEventData);

  if (!measurementData) {
    return;
  }

  addToolState(element, tool.name, measurementData);

  // Todo: Looks like we're handling the "up" of the tap?
  if (
    Object.keys(measurementData.handles).length === 1 &&
    touchEventData.type === EVENTS.TAP
  ) {
    // Todo: bold assumptions about measurement data for all tools?
    measurementData.active = false;
    measurementData.handles.end.active = false;
    measurementData.handles.end.highlight = false;
    measurementData.invalidated = true;

    const deleteIfHandleOutsideImage =
      state.deleteIfHandleOutsideImage ||
      tool.options.deleteIfHandleOutsideImage;

    if (
      deleteIfHandleOutsideImage &&
      anyHandlesOutsideImage(touchEventData, measurementData.handles)
    ) {
      // Delete the measurement
      removeToolState(element, tool.name, measurementData);
    }

    external.cornerstone.updateImage(element);

    return;
  }

  external.cornerstone.updateImage(element);

  moveNewHandle(
    touchEventData,
    tool.name,
    measurementData,
    measurementData.handles.end,
    tool.options,
    'touch',
    () => {
      const eventType = EVENTS.MEASUREMENT_COMPLETED;
      const eventData = {
        toolName: tool.name,
        toolType: tool.name, // Deprecation notice: toolType will be replaced by toolName
        element,
        measurementData,
      };

      triggerEvent(element, eventType, eventData);
    }
  );
}


text:
<?php
$maindir = "../../../";
include($maindir."conexion/config.inc.php");
require_once($maindir."funciones/check_session.php");
require_once($maindir."funciones/timeout.php");
if(!isset( $_SESSION['user_id'] ))
{
  header('Location: '.$maindir.'login/logout.php?code=100');
  exit();
}
  try
  {
     //Se reciben valores enviados por el ajax
	   $nombre = $_POST['nombreAreaProyecto'];
     //Se llama al procedimiento almacenado
     $stmt = $db->prepare("CALL SP_INSERTAR_AREAS(?,@mensajeError)");
	   //Introduccion de parametros
     $stmt->bindParam(1, $nombre, PDO::PARAM_STR);
     //Se ejecuta la consulta
     $stmt->execute();
     //Se recibe un mensaje de error, que se generó al ejecutar la consulta
     $output = $db->query("select @mensajeError")->fetch(PDO::FETCH_ASSOC);
     //Se obtiene mensaje
     $mensaje = $output['@mensajeError'];

     if (empty($mensaje)){
      $codMensaje=2;
     }
     else {$codMensaje = 1;}

    }catch(PDOExecption $e){
      $mensaje = 'Error al ingresar el registro o registro actualmente existente.';
      $codMensaje = 0;
    }
    //Se envia resultado
    if($codMensaje == 2){
      echo '

        ×
         Registro almacenado con éxito..!
';
    }elseif ($codMensaje == 1) {
      echo '

        ×
        '.$mensaje.'
';
    }
    else{
      echo '

        ×
         Error! '.$mensaje.'
';
  }
?>


text:
describe ManageIQ::Providers::Redhat::InfraManager::EventCatcher::Runner do
  context "#event_monitor_options" do
    let(:ems)     { FactoryBot.create(:ems_redhat, :hostname => "hostname") }
    let(:catcher) { ems.ovirt_services.event_fetcher }

    before do
      allow_any_instance_of(ManageIQ::Providers::Redhat::InfraManager).to receive_messages(:authentication_check => [true, ""])
      allow_any_instance_of(MiqWorker::Runner).to receive(:worker_initialization)
      stub_settings_merge(:ems => { :ems_redhat => { :use_ovirt_engine_sdk => use_ovirt_engine_sdk } })
      allow(ems).to receive(:supported_api_versions) { %w(3 4) }
    end

    context "api version 3" do
      let(:use_ovirt_engine_sdk) { false }
      it "numeric port" do
        ems.update_attributes(:port => 123)
        expect(catcher.event_monitor_options).to include(:port => 123)
      end

      it "nil port" do
        ems.update_attributes(:port => nil)
        expect(catcher.event_monitor_options).to include(:port => nil)
      end
    end
  end
end


text:
/**
 * 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.
 */
package org.apache.aurora.scheduler;

import java.util.Objects;
import java.util.UUID;

import javax.inject.Inject;

import com.twitter.common.util.Clock;

import org.apache.aurora.scheduler.storage.entities.ITaskConfig;

/**
 * A function that generates universally-unique (not guaranteed, but highly confident) task IDs.
 */
public interface TaskIdGenerator {

  /**
   * Generates a universally-unique ID for the task.  This is not necessarily a repeatable
   * operation, two subsequent invocations with the same object need not return the same value.
   *
   * @param task Configuration of the task to create an ID for.
   * @param instanceId Instance ID for the task.
   * @return A universally-unique ID for the task.
   */
  String generate(ITaskConfig task, int instanceId);

  class TaskIdGeneratorImpl implements TaskIdGenerator {
    private final Clock clock;

    @Inject
    TaskIdGeneratorImpl(Clock clock) {
      this.clock = Objects.requireNonNull(clock);
    }

    @Override
    public String generate(ITaskConfig task, int instanceId) {
      String sep = "-";
      return new StringBuilder()
          .append(clock.nowMillis())               // Allows chronological sorting.
          .append(sep)
          .append(task.getJob().getRole())       // Identification and collision prevention.
          .append(sep)
          .append(task.getJob().getEnvironment())
          .append(sep)
          .append(task.getJob().getName())
          .append(sep)
          .append(instanceId)                      // Collision prevention within job.
          .append(sep)
          .append(UUID.randomUUID())               // Just-in-case collision prevention.
          .toString().replaceAll("[^\\w-]", sep);  // Constrain character set.
    }
  }
}


text:
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Fody;
using GalaSoft.MvvmLight.Threading;

namespace Twice.Utilities.Ui
{
	[ExcludeFromCodeCoverage]
	internal class DispatcherHelperWrapper : IDispatcher
	{
		public void CheckBeginInvokeOnUI( Action action )
		{
			DispatcherHelper.CheckBeginInvokeOnUI( action );
		}

		[ConfigureAwait( false )]
		public async Task RunAsync( Action action )
		{
			await DispatcherHelper.UIDispatcher.InvokeAsync( action );
		}
	}
}


text:
package com.twitter.scrooge.adapt

import scala.collection.mutable

/**
 * Taken from scrooge/scrooge-generator/src/main/scala/com/twitter/scrooge/AST/Identifier.scala
 */
object CaseConverter {

  /**
   * convert string to camel case, with the following fine print:
   *   - leading underscores are preserved
   *   - internal underscores are removed. Character following an underscore
   *     is converted to upper case.
   *   - first character (non underscore char) is lower case
   *   - first character of the second and following parts (text between
   *     underscores) is always in upper case
   *   - if a part is all upper case it is converted to lower case (except for
   *     first character), in other cases case is preserved
   *
   *   Examples: (original, camel case)
   *     (gen_html_report, genHtmlReport)
   *     (GEN_HTML_REPORT, genHtmlReport)
   *     (Gen_HTMLReport, genHTMLReport)
   *     (Gen_HTML_Report, genHtmlReport)
   *     (GENHTMLREPORT, genhtmlreport)
   *     (genhtmlreport, genhtmlreport)
   *     (genHtmlReport, genHtmlReport)
   *     (genHTMLReport, genHTMLReport)
   *     (_genHtmlReport, _genHtmlReport)
   */
  def toCamelCase(str: String): String = {
    str.takeWhile(_ == '_') +
      str
        .split('_')
        .filterNot(_.isEmpty)
        .zipWithIndex
        .map {
          case (part, ind) =>
            val first = if (ind == 0) part(0).toLower else part(0).toUpper
            val isAllUpperCase = part.forall { c => c.isUpper || !c.isLetter }
            val rest = if (isAllUpperCase) part.drop(1).toLowerCase else part.drop(1)
            new mutable.StringBuilder(part.size).append(first).append(rest)
        }
        .mkString
  }
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
in Sérusiaux, Diederich, Brand & van den Boom, Lejeunia, n. s. 162: 57 (1999)

#### Original name
Nectria rubefaciens Ellis & Everh., 1887

### Remarks
null


text:
<template class="width100 height100" style="position: absolute; background-color: chocolate;">
	AAA
	<br><button is="d-button" id="makeDesktopBut">Set Desktop sizes</button>
</template>


text:
package com.hubspot.singularity;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Optional;

public enum LoadBalancerRequestType {
  ADD,
  REMOVE,
  DEPLOY,
  DELETE;

  public static class LoadBalancerRequestId {
    private final String id;
    private final LoadBalancerRequestType requestType;
    private final int attemptNumber;

    @JsonCreator
    public LoadBalancerRequestId(
      @JsonProperty("id") String id,
      @JsonProperty("requestType") LoadBalancerRequestType requestType,
      @JsonProperty("attemptNumber") Optional<Integer> attemptNumber
    ) {
      this.id = id;
      this.requestType = requestType;
      this.attemptNumber = attemptNumber.orElse(1);
    }

    @Override
    public String toString() {
      return String.format("%s-%s-%s", id, requestType, attemptNumber);
    }

    public String getId() {
      return id;
    }

    public LoadBalancerRequestType getRequestType() {
      return requestType;
    }

    public int getAttemptNumber() {
      return attemptNumber;
    }
  }
}


text:
#import <Foundation/Foundation.h>
#import "UploaderDelegate.h"

@interface HTTPStreamUploader : NSObject <NSStreamDelegate> {

    NSInputStream *inputStream;
    NSOutputStream *outputStream;
    NSInputStream *fileInputStream;
    NSMutableData *data;
    int32_t byteIndex;
    NSString *serviceHost;
    NSNumber *servicePort;
    NSString *servicePath;
    NSString *LMCCookie;
    NSMutableString *responseBody;
    BOOL useSSL;
    BOOL isChunkedRequest;
    BOOL isCertificateValidationDisabled;
    id resultDelegate;

   }
@property (nonatomic,retain) NSMutableString* responseBody;

@property (nonatomic,retain) NSString* serviceHost;
@property (nonatomic,retain) NSNumber* servicePort;
@property (nonatomic,retain) NSString* servicePath;
@property (nonatomic,retain) NSString* LMCCookie;
@property (assign) BOOL useSSL;
@property (assign) BOOL isChunkedRequest;
@property (assign) BOOL isCertificateValidationDisabled;

-(void) startStreamedUpload:(NSString*)url port:(NSNumber*)port path:(NSString*)path isSecure:(BOOL) ssl cookie:(NSString*)cookie;

-(void) stopStreamedUpload;

- (void)initNetworkCommunication;
- (void) writeData:(NSData *)content;
- (void) writePostFooter;
- (NSMutableData *) getChunkHeader:(NSMutableData *) chunk;
- (void) setResultDelegate:(id) delegate;
@end