text:
/**
 * @fileoverview `typescript-config/target` warns against providing a `compilerOptions.target`
 * in the TypeScript configuration file (i.e `tsconfig.json`) not optimized for the defined
 * `browserslist` values.
 */

import { HintContext, IHint } from 'hint';

import { TypeScriptConfigEvents, TypeScriptConfigParse } from '@hint/parser-typescript-config';

import meta from './meta/target';

/*
 * ------------------------------------------------------------------------------
 * Public
 * ------------------------------------------------------------------------------
 */

type Browser = number | string;

type Browsers = {
    [name: string]: Browser | undefined;
    chrome: Browser;
    firefox: Browser;
    edge: Browser;
    ie: Browser;
    ie_mob: Browser; // eslint-disable-line camelcase
    opera: Browser;
    safari: Browser;
};

export default class TypeScriptConfigTarget implements IHint {
    public static readonly meta = meta;

    public constructor(context: HintContext<TypeScriptConfigEvents>) {
        const Targets = new Map([
            ['es3', 'ES3'],
            ['es5', 'ES5'],
            ['es6', 'ES2015'],
            ['es2015', 'ES2015'],
            ['es2016', 'ES2016'],
            ['es2017', 'ES2017'],
            ['es2018', 'ES2018'],
            ['esnext', 'ESNext'],
            ['latest', 'ESNext']
        ]);

        /**
         * ES compatibility matrix. For each version of ES, it enumerates the minimum browser with
         * acceptable support.
         *
         * Data obtained from:
         * * http://kangax.github.io/compat-table/es5/
         * * http://kangax.github.io/compat-table/es6/
         * * http://kangax.github.io/compat-table/es2016plus/
         * * http://2ality.com/2011/02/es5-shim-use-ecmascript-5-in-older.html
         * * https://www.chromestatus.com/features#ES6
         */
        const compatMatrix: { [index: string]: Browsers } = {
            es5: {
                chrome: 5,
                edge: 12,
                firefox: 4,
                ie: 9,
                ie_mob: 9, // eslint-disable-line camelcase
                opera: 44,
                safari: 5
            },
            es2015: { // eslint-disable-line sort-keys
                chrome: 49,
                edge: 13,
                firefox: 37,
                ie: 'none',
                ie_mob: 'none', // eslint-disable-line camelcase
                opera: 44,
                safari: 10
            },
            es2016: {
                chrome: 57,
                edge: 14,
                firefox: 52,
                ie: 'none',
                ie_mob: 'none', // eslint-disable-line camelcase
                opera: 44,
                safari: 10.1
            },
            es2017: {
                chrome: 58,
                edge: 16,
                firefox: 53,
                ie: 'none',
                ie_mob: 'none', // eslint-disable-line camelcase
                opera: 45,
                safari: 10.1
            }
        };

        const getMajor = (version: string | number): number => {
            if (typeof version === 'number') {
                return version;
            }

            // Something like "4.4.3-4.4.4" --> 4
            return parseInt(version.split('-')[0].split('.')[0]);
        };

        /**
         * Checks if `version1` is older (i.e.: lower version) than `version2` taking into
         * account ranges and minor versions. E.g.: `4.4.3-4.4.4` will use `4.4.3` to compare
         */
        const isOlder = (version1: number | string, version2: number | string): boolean => {

            if (typeof version1 === 'number' && typeof version2 === 'number') {
                return version1 < version2;
            }

            // Can't store `typeof` or otherwise TypeScript complains about `includes` not being on `number`
            if (typeof version1 === 'string' && typeof version2 === 'string') {
                if (version1.includes('-') || version2.includes('-')) {
                    const range1 = version1.split('-')[0];
                    const range2 = version2.split('-')[0];

                    if (range1.includes('.') && range2.includes('.')) {
                        const parts1 = range1.split('.');
                        const parts2 = range2.split('.');

                        let older = true;

                        for (let i = 0; i < parts1.length && older; i++) {
                            older = isOlder(parseInt(parts1[i]), parseInt(parts2[i]));
                        }

                        return older;

                    }

                    return isOlder(parseInt(range1), parseInt(range2));
                }
            }

            // If we reach this point we are probably comparing something like "android 62" and "android 4.4.3-4.4.4"
            return isOlder(getMajor(version1), getMajor(version2));
        };

        /** Transforms a browserslist array into an object with the minimum versions of each one */
        const toMiniumBrowser = (targetedBrowsers: string[]) => {
            const configuration = targetedBrowsers.reduce((config, browserVersion) => {
                // The format in the array is "browser version". E.g.: "firefox 52"
                const [browser, strVersion] = browserVersion.split(' ');
                const version = strVersion.includes('.') || strVersion.includes('-') ? strVersion : parseInt(strVersion);
                const previousVersion = config[browser];

                if (!previousVersion || isOlder(version, previousVersion)) {
                    config[browser] = version;
                }

                return config;
            }, {} as any);

            return configuration;
        };

        /**
         * Returns the configured normalized target:
         * This is necessary because in the config file the value can be
         * either lowercase or uppercase and some values map to others.
         *
         * * The `es` part will be upper cased (e.g.: ES2015, ESNext)
         * * ES6 --> ES2015
         */
        const normalizeScriptTarget = (target: string): string => {
            return Targets.get(target) || target;
        };

        /**
         * Based on the minimum supported browser configuration passed,
         * determines what's the maximum ES version that can be targetted.
         */
        const getMaxVersion = (minimumBrowsers: Browsers): string => {
            const versions = Object.keys(compatMatrix);
            let maxVersion = 'ES3';

            /**
             * This will check all the ES versions and compare all the
             * browsers from the compat matrix agains the given ones.
             * If there's one in the compat matrix newer than the ones
             * provided, it will fail.
             */
            versions.forEach((version) => {
                /** The list of browsers to take into account for the compat matrix. */
                const browsers = Object.entries(compatMatrix[version]) as [string, Browser][];

                const validates = browsers.reduce((valid, [browser, minimumBrowserVersion]) => {
                    const minimumTargettedBrowserVersion = minimumBrowsers[browser];

                    // The user doesn't care about this browser, there isn't a version
                    if (!minimumTargettedBrowserVersion) {
                        return valid;
                    }

                    /*
                     * The user cares about this browsers but there's no browsers version that supports
                     * this ES release.
                     * E.g.: ES2015 and IE11
                     */
                    if (minimumBrowserVersion === 'none' && minimumTargettedBrowserVersion) {
                        return false;
                    }

                    /**
                     *  `isOlder` checks if it's strictly older. We do
                     * `!isOlder(minimumTargettedBrowserVersion, minimumBrowserVersion)` instead of
                     * `isOlder(minimumBrowserVersion, minimumTargettedBrowserVersion)`
                     * just in case they are the same version
                     */
                    const newer = !isOlder(minimumTargettedBrowserVersion, minimumBrowserVersion);

                    return valid && newer;
                }, true);

                maxVersion = validates ? normalizeScriptTarget(version) : maxVersion;
            });

            return maxVersion;
        };

        const validate = (evt: TypeScriptConfigParse) => {
            const { config, getLocation, resource } = evt;
            const { targetedBrowsers } = context;
            const target = normalizeScriptTarget(config.compilerOptions.target as any);
            const minimumBrowsers = toMiniumBrowser(targetedBrowsers);

            const maxESVersion = getMaxVersion(minimumBrowsers);

            if (maxESVersion !== target) {
                const message = `Based on your browser configuration your "compilerOptions.target" should be "${maxESVersion}". Current one is "${target}"`;
                const location = getLocation('compilerOptions.target');

                context.report(resource, message, { location });
            }
        };

        context.on('parse::end::typescript-config', validate);
    }
}


text:
"""
"""
__author__ = 'Alisue <lambdalisue@hashnote.net>'
import os
from maidenhair.loaders.base import unite_dataset as _unite_dataset
from maidenhair.compat import OrderedDict

def default_unite_function(data):
    """
    A default unite_function which recieve `data` and return filename without
    middle extensions

    >>> # [<filename>] is mimicking `data`
    >>> default_unite_function(['./foo/foo.bar.hoge.piyo'])
    './foo/foo.piyo'
    >>> default_unite_function(['./foo/foo.piyo'])
    './foo/foo.piyo'
    >>> default_unite_function(['./foo/foo'])
    './foo/foo'
    """
    # data[0] indicate the filename of the data
    rootname, basename = os.path.split(data[0])
    filename, ext = os.path.splitext(basename)
    if '.' in filename:
        filename = filename.rsplit('.')[0]
    filename = os.path.join(rootname, filename + ext)
    return filename

def unite_dataset(dataset, basecolumn, fn=None):
    """
    Unite dataset via fn

    Parameters
    ----------
    dataset : list
        A list of data
    basecolumn : int
        A number of column which will be respected in uniting dataset
    fn : function
        A function which recieve :attr:`data` and return classification string.
        It if is None, a function which return the first item of the
        :attr:`data` will be used (See ``with_filename`` parameter of
        :func:`maidenhair.load` function).

    Returns
    -------
    list
        A united dataset
    """
    # create default unite_fn
    if fn is None:
        fn = default_unite_function
    # classify dataset via unite_fn
    united_dataset = OrderedDict()
    for data in dataset:
        unite_name = fn(data)
        if unite_name not in united_dataset:
            united_dataset[unite_name] = []
        united_dataset[unite_name].append(data[1:])
    # unite dataset via maidenhair.loaders.base.unite_dataset
    for name, dataset in united_dataset.items():
        united_dataset[name] = _unite_dataset(dataset, basecolumn)[0]
    # create new dataset (respect the order of the dataset)
    dataset = []
    for name, _dataset in united_dataset.items():
        dataset.append([name] + _dataset)
    return dataset

redpajama_set_name: RedPajamaGithub


text:
system :selector do |skip|
    input :clk, :reset
    output :enable_update

    # The clock counter.
    [Math::log2(skip).ceil].inner :counter

    # The behavior handling the skip counter
    par(clk.posedge) do
        hif(reset == 1) { counter <= 0 }
        helse do
            hif(counter == skip-1) { counter <=0 }
            helse        {counter <= counter + 1 }
        end
    end

    # The behavior handling the update signal
    par(clk.posedge) do
        hif(reset == 1) { enable_update <= 0 }
        helse do
            hif(counter == skip-1) { enable_update <= 1 }
            helse                  { enable_update <= 0 }
        end
    end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.google.cloud.tools.eclipse</groupId>
    <artifactId>plugins</artifactId>
    <version>0.1.0-SNAPSHOT</version>
  </parent>
  <artifactId>com.google.cloud.tools.eclipse.appengine.localserver.test</artifactId>
  <version>0.1.0-SNAPSHOT</version>
  <packaging>eclipse-test-plugin</packaging>

  <build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-surefire-plugin</artifactId>
        <configuration>
          <useUIHarness>true</useUIHarness>
          <useUIThread>true</useUIThread>
          <product>org.eclipse.platform.ide</product>
          <systemProperties>
            <disablePrivacyTos>true</disablePrivacyTos>
          </systemProperties>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>target-platform-configuration</artifactId>
        <configuration>
          <dependency-resolution>
            <extraRequirements>
              <requirement>
                <type>eclipse-feature</type>
                <id>org.eclipse.rcp</id>
                <versionRange>0.0.0</versionRange>
              </requirement>
              <requirement>
                <type>eclipse-feature</type>
                <id>org.eclipse.m2e.feature</id>
                <versionRange>0.0.0</versionRange>
              </requirement>
              <requirement>
                <type>eclipse-feature</type>
                <id>org.eclipse.jst.web_ui.feature</id>
                <versionRange>0.0.0</versionRange>
              </requirement>
              <requirement>
                <type>eclipse-feature</type>
                <id>org.eclipse.jst.common.fproj.enablement.jdt</id>
                <versionRange>0.0.0</versionRange>
              </requirement>
              <requirement>
                <type>eclipse-feature</type>
                <id>org.eclipse.wst.common.fproj</id>
                <versionRange>0.0.0</versionRange>
              </requirement>
              <requirement>
                <type>eclipse-feature</type>
                <id>org.eclipse.wst.server_adapters.feature</id>
                <versionRange>0.0.0</versionRange>
              </requirement>
              <requirement>
                <type>eclipse-feature</type>
                <id>org.eclipse.jdt</id>
                <versionRange>0.0.0</versionRange>
              </requirement>
            </extraRequirements>
          </dependency-resolution>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


text:
//
//  UIView+Extend.h
//  Category
//
//  Created by Evan.Cheng on 15/12/26.
//  Copyright (c) 2015年 Cheng. All rights reserved.
//

#import <UIKit/UIKit.h>

#define CustomViewTranslate(ViewClass,view) (ViewClass *)view;

typedef enum{

    //上
    UIViewBorderDirectTop=0,

    //左
    UIViewBorderDirectLeft,

    //下
    UIViewBorderDirectBottom,

    //右
    UIViewBorderDirectRight,

}UIViewBorderDirect;

@interface UIView (Extend)

@property (nonatomic, assign) CGFloat x;
@property (nonatomic, assign) CGFloat y;
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;
@property (nonatomic, assign) CGSize  size;
@property (nonatomic, assign) CGPoint origin;
@property (nonatomic, assign) CGFloat radius;

/**
 *  自动从xib创建视图
 */
+ (instancetype)viewFromXIB;

/**
 *  添加边框:注给scrollView添加会出错
 *
 *  @param direct 方向
 *  @param color  颜色
 *  @param width  线宽
 */
- (void)ct_addSingleBorder:(UIViewBorderDirect)direct color:(UIColor *)color width:(CGFloat)width;

/**
 *  添加一组子view:
 */
- (void)ct_addSubviewsWithArray:(NSArray *)subViews;

/**
 *  添加边框:四边
 */
- (void)ct_setBorder:(UIColor *)color width:(CGFloat)width;

/**
 *  批量移除视图
 *
 *  @param views 需要移除的视图数组
 */
+ (void)ct_removeViews:(NSArray *)views;

- (CGFloat)ct_alphaInPoint:(CGPoint)point;

- (UIColor *)ct_colorInPoint:(CGPoint)point;

@end


text:
@interface NSManagedObject (Safe)

- (void)safeSetObject:(id)anObject forKey:(NSString *)aKey;

@end


text:
jQuery("#listdnd").tableDnD({scrollAmount:0});
jQuery("#listdnd").jqGrid({
   	url:'server.php?q=1',
	datatype: "xml",
   	colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
   	colModel:[
   		{name:'id',index:'id', width:55},
   		{name:'invdate',index:'invdate', width:90},
   		{name:'name',index:'name', width:100},
   		{name:'amount',index:'amount', width:80, align:"right"},
   		{name:'tax',index:'tax', width:80, align:"right"},
   		{name:'total',index:'total', width:80,align:"right"},
   		{name:'note',index:'note', width:150, sortable:false}
   	],
   	rowNum:10,
   	rowList:[10,20,30],
   	imgpath: gridimgpath,
   	pager: jQuery('#pagerdnd'),
   	sortname: 'id',
    viewrecords: true,
    sortorder: "desc",
    caption:"XML Example",
    gridComplete: function() {
    	$("#_empty","#listdnd").addClass("nodrag nodrop");
    	jQuery("#listdnd").tableDnDUpdate();
    },
    editurl:"someurl.php"
}).navGrid('#pager1',{edit:false,add:false,del:false});


text:
package com.kapokyue.pizza.model;

import lombok.Data;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

@Entity @Table( name = "customer_order" ) @Data
@ToString( exclude = { "items" } )
public class Order implements Serializable
{
  @Id
  @GeneratedValue( strategy = GenerationType.AUTO )
  long id;

  @ManyToOne( fetch = FetchType.LAZY, optional = false )
  @JoinColumn( name = "user_id" )
  Customer customer;

  long charge;

  String status, address;

  String note;

  Timestamp orderAt;

  @OneToMany( mappedBy = "order", fetch = FetchType.EAGER )
  List<OrderItem> items;
}


text:
using System.Configuration;

namespace Umbraco.Web.BaseRest.Configuration
{
	public class MethodElement : ConfigurationElement
	{
		const string KeyName = "name";
		const string KeyAllowAll = "allowAll";
		const string KeyAllowGroup = "allowGroup";
		const string KeyAllowType = "allowType";
		const string KeyAllowMember = "allowMember";
		const string KeyReturnXml = "returnXml";

		[ConfigurationProperty(KeyName, IsKey = true, IsRequired = true)]
		public string Name
		{
			get { return (string)base[KeyName]; }
		}

		[ConfigurationProperty(KeyAllowAll, IsKey = false, IsRequired = false, DefaultValue = false)]
		public bool AllowAll
		{
			get { return (bool)base[KeyAllowAll]; }
		}

		[ConfigurationProperty(KeyAllowGroup, IsKey = false, IsRequired = false, DefaultValue = null)]
		public string AllowGroup
		{
			get { return (string)base[KeyAllowGroup]; }
		}

		[ConfigurationProperty(KeyAllowType, IsKey = false, IsRequired = false, DefaultValue = null)]
		public string AllowType
		{
			get { return (string)base[KeyAllowType]; }
		}

		[ConfigurationProperty(KeyAllowMember, IsKey = false, IsRequired = false, DefaultValue = null)]
		public string AllowMember
		{
			get { return (string)base[KeyAllowMember]; }
		}

		[ConfigurationProperty(KeyReturnXml, IsKey = false, IsRequired = false, DefaultValue = true)]
		public bool ReturnXml
		{
			get { return (bool)base[KeyReturnXml]; }
		}
	}
}


text:
BSLS_IDENT("$Id: $")

//@PURPOSE: Provide a parameterized day-count convention implementation.
//
//@CLASSES:
//  bbldc::BasicBasicDayCountAdapter: 'bbldc::BasicDayCount' realization
//
//@DESCRIPTION: This component provides a parameterized (template)
// implementation, 'bbldc::BasicBasicDayCountAdapter', of the
// 'bbldc::BasicDayCount' protocol.  The template argument can be any type
// supporting the following two class methods.
//..
//  int daysDiff(const bdlt::Date& beginDate, const bdlt::Date& endDate);
//
//  double yearsDiff(const bdlt::Date& beginDate, const bdlt::Date& endDate);
//..
// The template class 'bbldc::BasicBasicDayCountAdapter' provides convenient
// support for run-time polymorphic choice of day-count conventions (via
// conventional use of a base-class pointer or reference) without having to
// implement each derived type explicitly.  In this sense,
// 'bbldc::BasicBasicDayCountAdapter' adapts the various concrete "basic"
// day-count convention classes (e.g., 'bbldc::BasicIsma30360') to a run-time
// binding mechanism.
//
///Usage
///-----
// This section illustrates intended use of this component.
//
///Example 1: Adapting 'bbldc::BasicIsma30360'
///- - - - - - - - - - - - - - - - - - - - - -
// This example shows the procedure for using
// 'bbldc::BasicBasicDayCountAdapter' to adapt the 'bbldc::BasicIsma30360'
// day-count convention to the 'bbldc::BasicDayCount' protocol, and then the
// use of the day-count methods.  First, we define an instance of the adapted
// day-count convention and obtain a reference to the 'bbldc::BasicDayCount':
//..
//  const bbldc::BasicBasicDayCountAdapter<bbldc::BasicIsma30360> myDcc =
//                   bbldc::BasicBasicDayCountAdapter<bbldc::BasicIsma30360>();
//  const bbldc::BasicDayCount&                                   dcc = myDcc;
//..
// Then, create two 'bdlt::Date' variables, 'd1' and 'd2', with which to use
// the day-count convention methods:
//..
//  const bdlt::Date d1(2003, 10, 18);
//  const bdlt::Date d2(2003, 12, 31);
//..
// Now, use the base-class reference to compute the day count between the two
// dates:
//..
//  const int daysDiff = dcc.daysDiff(d1, d2);
//  assert(72 == daysDiff);
//..
// Finally, use the base-class reference to compute the year fraction between
// the two dates:
//..
//  const double yearsDiff = dcc.yearsDiff(d1, d2);
//  // Need fuzzy comparison since 'yearsDiff' is a 'double'.
//  assert(0.1999 < yearsDiff && 0.2001 > yearsDiff);
//..

#include <bblscm_version.h>

#include <bbldc_basicdaycount.h>

#include <bdlt_date.h>

namespace BloombergLP {

namespace bbldc {

                     // ===============================
                     // class BasicBasicDayCountAdapter
                     // ===============================

template <class CONVENTION>
class BasicBasicDayCountAdapter : public BasicDayCount {
    // This 'class' provides an "adapter" from the specified 'CONVENTION' to
    // the 'bbldc::BasicDayCount' protocol that can be used for determining
    // values based on dates according to the day-count 'CONVENTION'.

  public:
    // ACCESSORS
    int daysDiff(const bdlt::Date& beginDate, const bdlt::Date& endDate) const;
        // Return the (signed) number of days between the specified 'beginDate'
        // and 'endDate' as per the 'CONVENTION' template policy.  If
        // 'beginDate <= endDate', then the result is non-negative.  Note that
        // reversing the order of 'beginDate' and 'endDate' negates the result.

    double yearsDiff(const bdlt::Date& beginDate,
                     const bdlt::Date& endDate) const;
        // Return the (signed fractional) number of years between the specified
        // 'beginDate' and 'endDate' as per the 'CONVENTION' template policy.
        // If 'beginDate <= endDate', then the result is non-negative.  Note
        // that reversing the order of 'beginDate' and 'endDate' negates the
        // result; specifically,
        // '|yearsDiff(b, e) + yearsDiff(e, b)| <= 1.0e-15' for all dates 'b'
        // and 'e'.
};

// ============================================================================
//                             INLINE DEFINITIONS
// ============================================================================

                     // -------------------------------
                     // class BasicBasicDayCountAdapter
                     // -------------------------------

// ACCESSORS
template <class CONVENTION>
inline
int BasicBasicDayCountAdapter<CONVENTION>::daysDiff(
                                               const bdlt::Date& beginDate,
                                               const bdlt::Date& endDate) const
{
    return CONVENTION::daysDiff(beginDate, endDate);
}

template <class CONVENTION>
inline
double
BasicBasicDayCountAdapter<CONVENTION>::yearsDiff(
                                               const bdlt::Date& beginDate,
                                               const bdlt::Date& endDate) const
{
    return CONVENTION::yearsDiff(beginDate, endDate);
}

}  // close package namespace
}  // close enterprise namespace

#endif

// ----------------------------------------------------------------------------
// Copyright 2015 Bloomberg Finance L.P.
//
// 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.
// ----------------------------- END-OF-FILE ----------------------------------


text:
using Nwc.XmlRpc;
using System.Net;

namespace OpenSim.Framework.Servers.HttpServer
{
    public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request, IPEndPoint client);
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="Database.Plugin.Tests.Droid">
	<uses-sdk android:minSdkVersion="15" />
	<application android:label="Database.Plugin.Tests.Droid">
	</application>
</manifest>


text:
#include "physics/ChSystem.h"
#include "physics/ChBodyEasy.h"
#include "physics/ChConveyor.h"
#include "unit_IRRLICHT/ChIrrApp.h"

// Use the namespace of Chrono

using namespace chrono;
using namespace chrono::collision;

// Use the main namespaces of Irrlicht
using namespace irr;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

// Static values valid through the entire program (bad
// programming practice, but enough for quick tests)

double STATIC_flow = 100;
double STATIC_speed = 2;
std::vector< ChSharedPtr<ChBody> > particlelist;

// Define a MyEventReceiver class which will be used to manage input
// from the GUI graphical user interface

class MyEventReceiver : public IEventReceiver
{
public:

	MyEventReceiver(ChIrrAppInterface* myapp)
			{
				// store pointer applicaiton
				application = myapp;

				// ..add a GUI slider to control particles flow
				scrollbar_flow = application->GetIGUIEnvironment()->addScrollBar(
								true, rect<s32>(510, 85, 650, 100), 0, 101);
				scrollbar_flow->setMax(300);
				scrollbar_flow->setPos(150);
				text_flow = application->GetIGUIEnvironment()->addStaticText(
							L"Flow [particles/s]", rect<s32>(650,85,750,100), false);

				// ..add GUI slider to control the speed
				scrollbar_speed = application->GetIGUIEnvironment()->addScrollBar(
								true, rect<s32>(510, 125, 650, 140), 0, 102);
				scrollbar_speed->setMax(100);
				scrollbar_speed->setPos(100);
				text_speed = application->GetIGUIEnvironment()->addStaticText(
								L"Conveyor speed [m/s]:", rect<s32>(650,125,750,140), false);
			}

	bool OnEvent(const SEvent& event)
			{

				// check if user moved the sliders with mouse..
				if (event.EventType == EET_GUI_EVENT)
				{
					s32 id = event.GUIEvent.Caller->getID();
					IGUIEnvironment* env = application->GetIGUIEnvironment();

					switch(event.GUIEvent.EventType)
					{
					case EGET_SCROLL_BAR_CHANGED:
							if (id == 101) // id of 'flow' slider..
							{
								s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
								STATIC_flow = (double)pos;
							}
							if (id == 102) // id of 'speed' slider..
							{
								s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
								STATIC_speed = (((double)pos)/100)*2;
							}
					break;
					}

				}

				return false;
			}

private:
	ChIrrAppInterface* application;

	IGUIScrollBar*  scrollbar_flow;
	IGUIStaticText* text_flow;
	IGUIScrollBar*  scrollbar_speed;
	IGUIStaticText* text_speed;
};

// Function that creates debris that fall on the conveyor belt, to be called at each dt

void create_debris(ChIrrApp& application, double dt, double particles_second)
{
	double xnozzlesize = 0.2;
	double znozzlesize = 0.56;
	double ynozzle = 0.2;

	double box_fraction = 0.3; // 30% cubes
	double cyl_fraction = 0.4; // 40% cylinders
	double sph_fraction = 1-box_fraction-cyl_fraction;

	double density = 1;
	double sphrad = 0.013;
	double sphmass = (4/3)*CH_C_PI*pow(sphrad,3)*density;
	double sphinertia = pow(sphrad,2) * sphmass;

	ChBodySceneNode* mrigidBody;

	double exact_particles_dt = dt * particles_second;
	double particles_dt = floor(exact_particles_dt);
	double remaind = exact_particles_dt - particles_dt;
	if (remaind > ChRandom()) particles_dt +=1;

  video::ITexture* bluwhiteMap = application.GetVideoDriver()->getTexture(GetChronoDataFile("bluwhite.png").c_str());
  video::ITexture* pinkwhiteMap = application.GetVideoDriver()->getTexture(GetChronoDataFile("pinkwhite.png").c_str());

	for (int i = 0; i < particles_dt; i++)
	{
		double rand_fract = ChRandom();

		if (rand_fract < box_fraction)
		{
			ChSharedPtr<ChBodyEasySphere> mrigidBody (new ChBodyEasySphere(
											sphrad,		// size
											1,		    // density
											true,		// collide enable?
											true));		// visualization?
			mrigidBody->SetPos( ChVector<>(-0.5*xnozzlesize+ChRandom()*xnozzlesize, ynozzle+i*0.005, -0.5*znozzlesize+ChRandom()*znozzlesize) );
			mrigidBody->SetFriction(0.2f);
			mrigidBody->SetImpactC(0.8f);
      mrigidBody->AddAsset(ChSharedPtr<ChTexture>(new ChTexture(GetChronoDataFile("bluwhite.png"))));

			application.GetSystem()->Add(mrigidBody);

			// This will make particle's visualization assets visible in Irrlicht:
			application.AssetBind(mrigidBody);
			application.AssetUpdate(mrigidBody);

			particlelist.push_back(mrigidBody);
		}

		if ((rand_fract > box_fraction) &&
			(rand_fract < box_fraction+cyl_fraction))
		{
			double xscale = 1.3*(1-0.8*ChRandom()); // for oddly-shaped boxes..
			double yscale = 1.3*(1-0.8*ChRandom());
			double zscale = 1.3*(1-0.8*ChRandom());

			ChSharedPtr<ChBodyEasyBox> mrigidBody (new ChBodyEasyBox(
											sphrad*2*xscale,
											sphrad*2*yscale,
											sphrad*2*zscale,
											1,		    // density
											true,		// collide enable?
											true));		// visualization?
			mrigidBody->SetPos( ChVector<>(-0.5*xnozzlesize+ChRandom()*xnozzlesize, ynozzle+i*0.005, -0.5*znozzlesize+ChRandom()*znozzlesize) );
			mrigidBody->SetFriction(0.4f);
      mrigidBody->AddAsset(ChSharedPtr<ChTexture>(new ChTexture(GetChronoDataFile("cubetexture_bluwhite.png"))));

			application.GetSystem()->Add(mrigidBody);

			// This will make particle's visualization assets visible in Irrlicht:
			application.AssetBind(mrigidBody);
			application.AssetUpdate(mrigidBody);

			particlelist.push_back(mrigidBody);
		}

		if (rand_fract > box_fraction+cyl_fraction)
		{
			ChSharedPtr<ChBodyEasyCylinder> mrigidBody (new ChBodyEasyCylinder(
											sphrad,sphrad*2,	// rad, height
											1,		    // density
											true,		// collide enable?
											true));		// visualization?
			mrigidBody->SetPos( ChVector<>(-0.5*xnozzlesize+ChRandom()*xnozzlesize, ynozzle+i*0.005, -0.5*znozzlesize+ChRandom()*znozzlesize) );
			mrigidBody->SetFriction(0.2f);
      mrigidBody->AddAsset(ChSharedPtr<ChTexture>(new ChTexture(GetChronoDataFile("pinkwhite.png"))));

			application.GetSystem()->Add(mrigidBody);

			// This will make particle's visualization assets visible in Irrlicht:
			application.AssetBind(mrigidBody);
			application.AssetUpdate(mrigidBody);

			particlelist.push_back(mrigidBody);
		}

	}

}

// Function that deletes old debris (to avoid infinite creation that fills memory)

void purge_debris(ChIrrAppInterface& application, int nmaxparticles = 100)
{
	while (particlelist.size() > nmaxparticles)
	{
		application.GetSystem()->Remove(particlelist[0]);	// remove from physical simulation
		particlelist.erase(particlelist.begin());			// remove also from our particle list (will also automatically delete object thank to shared pointer)
	}
}

int main(int argc, char* argv[])
{
	// Create a ChronoENGINE physical system
	ChSystem mphysicalSystem;

	// Create the Irrlicht visualization (open the Irrlicht device,
	// bind a simple user interface, etc. etc.)
	ChIrrApp application(&mphysicalSystem, L"Conveyor belt",core::dimension2d<u32>(800,600),false);

	// Easy shortcuts to add camera, lights, logo and sky in Irrlicht scene:
	ChIrrWizard::add_typical_Logo(application.GetDevice());
	ChIrrWizard::add_typical_Sky(application.GetDevice());
	ChIrrWizard::add_typical_Lights(application.GetDevice());
	ChIrrWizard::add_typical_Camera(application.GetDevice(), core::vector3df(1.5,0.4,-1), core::vector3df(0.5,0,0) );

	// This is for GUI tweaking of system parameters..
	MyEventReceiver receiver(&application);
	  // note how to add the custom event receiver to the default interface:
	application.SetUserEventReceiver(&receiver);

	// Set small collision envelopes for objects that will be created from now on..
	ChCollisionModel::SetDefaultSuggestedEnvelope(0.002);
	ChCollisionModel::SetDefaultSuggestedMargin  (0.002);

	// Create two conveyor fences
	ChBodySceneNode* mfence1 = (ChBodySceneNode*)addChBodySceneNode_easyBox(
											&mphysicalSystem, application.GetSceneManager(),
											1.0,
											ChVector<>(0,0,-0.325),
											ChQuaternion<>(1,0,0,0),
											ChVector<>(2,0.11,0.04) );
	mfence1->GetBody()->SetBodyFixed(true);
	mfence1->GetBody()->SetFriction(0.1);

	ChBodySceneNode* mfence2 = (ChBodySceneNode*)addChBodySceneNode_easyBox(
											&mphysicalSystem, application.GetSceneManager(),
											1.0,
											ChVector<>(0,0, 0.325),
											ChQuaternion<>(1,0,0,0),
											ChVector<>(2,0.11,0.04) );
	mfence2->GetBody()->SetBodyFixed(true);
	mfence2->GetBody()->SetFriction(0.1);

	// Create the conveyor belt (this is a pure Chrono::Engine object,
	// because an Irrlicht 'SceneNode' wrapper is not yet available, so it is invisible - no 3D preview)

	ChSharedPtr<ChConveyor> mconveyor (new ChConveyor(2, 0.05, 0.6));
	mconveyor->SetBodyFixed(true);
	mconveyor->SetFriction(0.35);
	mconveyor->SetConveyorSpeed(STATIC_speed);
	mconveyor->SetPos( ChVector<>(0, 0, 0) );

	mphysicalSystem.Add(mconveyor);

	// Create an Irrlicht 'directory' where debris will be put during the simulation loop
	ISceneNode* parent = application.GetSceneManager()->addEmptySceneNode();

	//
	// THE SOFT-REAL-TIME CYCLE
	//

	application.SetStepManage(true);
	application.SetTimestep(0.005);

	while(application.GetDevice()->run())
	{
		application.GetVideoDriver()->beginScene(true, true, SColor(255,140,161,192));

		application.DrawAll();

		application.DoStep();

		if (!application.GetPaused())
		{
			// Continuosly create debris that fall on the conveyor belt
			create_debris(application, application.GetTimestep(), STATIC_flow);

			// Limit the max number of debris particles on the scene, deleting the oldest ones, for performance
			purge_debris (application, 300);

			// Maybe the user played with the slider and changed STATIC_speed...
		 	mconveyor->SetConveyorSpeed(STATIC_speed);
		}

		application.GetVideoDriver()->endScene();

	}

	return 0;
}


text:
import pretty

supports_numeric = False
try :
   import Numeric
   supports_numeric = True
   array = Numeric.array
   types_map = pretty.NumericToOCMap
except :
   pass

supports_numpy = False
try :
   import numpy
   supports_numpy = True
   array = numpy.array
   types_map = pretty.NumPyToOCMap
except :
   pass

a = [1.123456789123456789, -100, 123456789 ]

for option_out in [pretty.LIKE_NUMERIC, pretty.LIKE_NUMPY, pretty.NATURAL] :
   pretty.ArrayOutputOption = option_out
   for typecode in types_map :
      print typecode

      b = array(a, typecode)
      print b
      pretty.pretty(b)
      print


text:
class Strongswan < Formula
  desc "VPN based on IPsec"
  homepage "https://www.strongswan.org"
  url "https://download.strongswan.org/strongswan-5.6.0.tar.bz2"
  sha256 "a14dc0d92634ed52730bfc76a76db30943a28ed3c65a560066e1e9f785827b13"

  bottle do
    sha256 "61461a200f859adc1f2130151b14ea2f960ba9f7c042b74027888508a72ed762" => :sierra
    sha256 "ef21438d02abb2571c4e0a5f974e7b65220e63a8c5a37e743a09482e3877624a" => :el_capitan
    sha256 "1359184d5e990d3bad261037ba409d7ee5944971bdf771bef14ddb1be3fb7bf2" => :yosemite
  end

  head do
    url "https://git.strongswan.org/strongswan.git"

    depends_on "autoconf" => :build
    depends_on "automake" => :build
    depends_on "libtool" => :build
    depends_on "pkg-config" => :build
    depends_on "gettext" => :build
    depends_on "bison" => :build
  end

  option "with-curl", "Build with libcurl based fetcher"
  option "with-suite-b", "Build with Suite B support (does not use the IPsec implementation provided by the kernel)"

  depends_on "openssl"
  depends_on "curl" => :optional

  def install
    args = %W[
      --disable-dependency-tracking
      --prefix=#{prefix}
      --sbindir=#{bin}
      --sysconfdir=#{etc}
      --disable-defaults
      --enable-charon
      --enable-cmd
      --enable-constraints
      --enable-curve25519
      --enable-eap-gtc
      --enable-eap-identity
      --enable-eap-md5
      --enable-eap-mschapv2
      --enable-ikev1
      --enable-ikev2
      --enable-kernel-pfroute
      --enable-nonce
      --enable-openssl
      --enable-osx-attr
      --enable-pem
      --enable-pgp
      --enable-pkcs1
      --enable-pkcs8
      --enable-pki
      --enable-pubkey
      --enable-revocation
      --enable-scepclient
      --enable-socket-default
      --enable-sshkey
      --enable-stroke
      --enable-swanctl
      --enable-unity
      --enable-updown
      --enable-x509
      --enable-xauth-generic
    ]
    args << "--enable-curl" if build.with? "curl"

    if build.with? "suite-b"
      args << "--enable-kernel-libipsec"
    else
      args << "--enable-kernel-pfkey"
    end

    system "./autogen.sh" if build.head?
    system "./configure", *args
    system "make", "check"
    system "make", "install"
  end

  def caveats
    msg = <<-EOS.undent
      strongSwan's configuration files are placed in:
        #{etc}

      You will have to run both "ipsec" and "charon-cmd" with "sudo".
    EOS
    if build.with? "suite-b"
      msg += <<-EOS.undent

        If you previously ran strongSwan without Suite B support it might be
        required to execute "sudo sysctl -w net.inet.ipsec.esp_port=0" in order
        to receive packets.
      EOS
    end
    msg
  end

  test do
    system "#{bin}/ipsec", "--version"
    system "#{bin}/charon-cmd", "--version"
  end
end


text:
using System.Collections.Generic;
using ZyGames.Framework.Game.Service;
using ZyGames.Framework.Game.Cache;
using ZyGames.Framework.Common;
using System.Data;
using ZyGames.Tianjiexing.Model;

namespace ZyGames.Tianjiexing.BLL.Action
{

    /// <summary>
    /// 1441_佣兵升级界面接口
    /// </summary>
    public class Action1441 : BaseAction
    {
        private int generalID;
        private short nextLv;
        private short isUp;
        private string[] strUserItemID = new string[0];

        private UserGeneral userGeneral = null;

        public Action1441(ZyGames.Framework.Game.Contract.HttpGet httpGet)
            : base(ActionIDDefine.Cst_Action1441, httpGet)
        {

        }

        public override void BuildPacket()
        {
            this.PushIntoStack(strUserItemID.Length);
            foreach (var str in strUserItemID)
            {
                ItemBaseInfo itemInfo = string.IsNullOrEmpty(str) ? null : GetItemBaseInfo(ContextUser.UserID, str);
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(str.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? 0 : itemInfo.ItemID);
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.ItemName.ToNotNullString());
                dsItem.PushIntoStack(itemInfo == null ? string.Empty : itemInfo.HeadID.ToNotNullString());
                PushIntoStack(dsItem);
            }
            this.PushIntoStack(userGeneral == null ? string.Empty : userGeneral.GeneralName.ToNotNullString());
            this.PushIntoStack(userGeneral == null ? (short)0 : userGeneral.GeneralLv);
            this.PushIntoStack((short)nextLv);
            this.PushIntoStack(userGeneral == null ? string.Empty : userGeneral.PicturesID.ToNotNullString());
            this.PushIntoStack(userGeneral == null ? 0 : userGeneral.LifeNum);
            this.PushIntoStack(userGeneral == null ? 0 : userGeneral.CurrExperience);
            this.PushIntoStack(userGeneral == null ? 0 : userGeneral.AbilityID);
            this.PushIntoStack((short)isUp);

        }

        public override bool GetUrlElement()
        {
            if (httpGet.GetInt("GeneralID", ref generalID))
            {
                return true;
            }
            return false;
        }

        public override bool TakeAction()
        {
            var userGeneralList = new GameDataCacheSet<UserGeneral>().FindAll(ContextUser.UserID,
                                                                              s =>
                                                                              s.GeneralID != generalID &&
                                                                              s.GeneralType == GeneralType.YongBing && s.GeneralType != GeneralType.Soul);
            foreach (var general in userGeneralList)
            {
                general.GeneralCard = string.Empty;
            }
            userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(ContextUser.UserID, generalID);
            if (userGeneral != null)
            {
                nextLv = MathUtils.Addition(userGeneral.GeneralLv, (short)1);
                if (!string.IsNullOrEmpty(userGeneral.GeneralCard))
                {
                    strUserItemID = userGeneral.GeneralCard.TrimEnd(',').Split(',');
                }
            }
            var generalInfo = new ConfigCacheSet<GeneralInfo>().FindKey(generalID);
            if (generalInfo != null)
            {
                isUp = 1;
            }
            return true;
        }

        /// <summary>
        /// 佣兵卡片物品
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="userItemID"></param>
        /// <returns></returns>
        public static ItemBaseInfo GetItemBaseInfo(string userID, string userItemID)
        {
            var package = UserItemPackage.Get(userID);
            if (package != null)
            {
                var useritem = package.ItemPackage.Find(s => !s.IsRemove && s.UserItemID == userItemID);
                if (useritem != null)
                {
                    return new ConfigCacheSet<ItemBaseInfo>().FindKey(useritem.ItemID);
                }
            }
            return null;
        }
    }
}


text:
module VagrantPlugins
  module UpstartDockerProvisioner
    module Cap
      module Linux
        module DockerInstalled
          def self.docker_installed(machine)
            machine.communicate.test("test -f /usr/bin/docker", sudo: true)
          end
        end
      end
    end
  end
end


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Diagnostics;
using System.Linq;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.Options;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.LanguageServer.Client;
using Microsoft.VisualStudio.LanguageServices.DocumentOutline;
using Microsoft.VisualStudio.LanguageServices.Implementation.NavigationBar;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.TextManager.Interop;
using Roslyn.Utilities;

namespace Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService
{
    internal abstract partial class AbstractLanguageService<TPackage, TLanguageService>
    {
        internal class VsCodeWindowManager : IVsCodeWindowManager, IVsCodeWindowEvents, IVsDocOutlineProvider
        {
            private readonly TLanguageService _languageService;
            private readonly IVsCodeWindow _codeWindow;
            private readonly ComEventSink _sink;
            private readonly IGlobalOptionService _globalOptions;

            private IDisposable? _navigationBarController;
            private IVsDropdownBarClient? _dropdownBarClient;
            private ElementHost? _documentOutlineViewHost;
            private DocumentOutlineControl? _documentOutlineControl;

            public VsCodeWindowManager(TLanguageService languageService, IVsCodeWindow codeWindow)
            {
                _languageService = languageService;
                _codeWindow = codeWindow;

                _globalOptions = languageService.Package.ComponentModel.GetService<IGlobalOptionService>();

                _sink = ComEventSink.Advise<IVsCodeWindowEvents>(codeWindow, this);
                _globalOptions.OptionChanged += GlobalOptionChanged;
            }

            private void SetupView(IVsTextView view)
                => _languageService.SetupNewTextView(view);

            private void GlobalOptionChanged(object sender, OptionChangedEventArgs e)
            {
                if (e.Language != _languageService.RoslynLanguageName ||
                    e.Option != NavigationBarViewOptionsStorage.ShowNavigationBar)
                {
                    return;
                }

                AddOrRemoveDropdown();
            }

            private void AddOrRemoveDropdown()
            {
                if (_codeWindow is not IVsDropdownBarManager dropdownManager)
                {
                    return;
                }

                if (ErrorHandler.Failed(_codeWindow.GetBuffer(out var buffer)) || buffer == null)
                {
                    return;
                }

                var textBuffer = _languageService.EditorAdaptersFactoryService.GetDataBuffer(buffer);
                var document = textBuffer?.AsTextContainer()?.GetRelatedDocuments().FirstOrDefault();
                // TODO - Remove the TS check once they move the liveshare navbar to LSP.  Then we can also switch to LSP
                // for the local navbar implementation.
                // https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1163360
                if (textBuffer?.IsInLspEditorContext() == true && document!.Project!.Language != InternalLanguageNames.TypeScript)
                {
                    // Remove the existing dropdown bar if it is ours.
                    if (IsOurDropdownBar(dropdownManager, out var _))
                    {
                        RemoveDropdownBar(dropdownManager);
                    }

                    return;
                }

                var enabled = _globalOptions.GetOption(NavigationBarViewOptionsStorage.ShowNavigationBar, _languageService.RoslynLanguageName);
                if (enabled)
                {
                    if (IsOurDropdownBar(dropdownManager, out var existingDropdownBar))
                    {
                        // The dropdown bar is already one of ours, do nothing.
                        return;
                    }

                    if (existingDropdownBar != null)
                    {
                        // Not ours, so remove the old one so that we can add ours.
                        RemoveDropdownBar(dropdownManager);
                    }
                    else
                    {
                        Contract.ThrowIfFalse(_navigationBarController == null, "We shouldn't have a controller manager if there isn't a dropdown");
                        Contract.ThrowIfFalse(_dropdownBarClient == null, "We shouldn't have a dropdown client if there isn't a dropdown");
                    }

                    AddDropdownBar(dropdownManager);
                }
                else
                {
                    RemoveDropdownBar(dropdownManager);
                }

                bool IsOurDropdownBar(IVsDropdownBarManager dropdownBarManager, out IVsDropdownBar? existingDropdownBar)
                {
                    existingDropdownBar = GetDropdownBar(dropdownBarManager);
                    if (existingDropdownBar != null)
                    {
                        if (_dropdownBarClient != null &&
                            _dropdownBarClient == GetDropdownBarClient(existingDropdownBar))
                        {
                            return true;
                        }
                    }

                    return false;
                }
            }

            private static IVsDropdownBar GetDropdownBar(IVsDropdownBarManager dropdownManager)
            {
                ErrorHandler.ThrowOnFailure(dropdownManager.GetDropdownBar(out var existingDropdownBar));
                return existingDropdownBar;
            }

            private static IVsDropdownBarClient GetDropdownBarClient(IVsDropdownBar dropdownBar)
            {
                ErrorHandler.ThrowOnFailure(dropdownBar.GetClient(out var dropdownBarClient));
                return dropdownBarClient;
            }

            private void AddDropdownBar(IVsDropdownBarManager dropdownManager)
            {
                if (ErrorHandler.Failed(_codeWindow.GetBuffer(out var buffer)))
                {
                    return;
                }

                var navigationBarClient = new NavigationBarClient(dropdownManager, _codeWindow, _languageService.SystemServiceProvider, _languageService.Workspace);
                var textBuffer = _languageService.EditorAdaptersFactoryService.GetDataBuffer(buffer);
                var controllerFactoryService = _languageService.Package.ComponentModel.GetService<INavigationBarControllerFactoryService>();
                var newController = controllerFactoryService.CreateController(navigationBarClient, textBuffer);
                var hr = dropdownManager.AddDropdownBar(cCombos: 3, pClient: navigationBarClient);

                if (ErrorHandler.Failed(hr))
                {
                    newController.Dispose();
                    ErrorHandler.ThrowOnFailure(hr);
                }

                _navigationBarController = newController;
                _dropdownBarClient = navigationBarClient;
                return;
            }

            private void RemoveDropdownBar(IVsDropdownBarManager dropdownManager)
            {
                if (ErrorHandler.Succeeded(dropdownManager.RemoveDropdownBar()))
                {
                    if (_navigationBarController != null)
                    {
                        _navigationBarController.Dispose();
                        _navigationBarController = null;
                    }

                    _dropdownBarClient = null;
                }
            }

            public int AddAdornments()
            {
                int hr;
                if (ErrorHandler.Failed(hr = _codeWindow.GetPrimaryView(out var primaryView)))
                {
                    Debug.Fail("GetPrimaryView failed in IVsCodeWindowManager.AddAdornments");
                    return hr;
                }

                SetupView(primaryView);
                if (ErrorHandler.Succeeded(_codeWindow.GetSecondaryView(out var secondaryView)))
                {
                    SetupView(secondaryView);
                }

                AddOrRemoveDropdown();

                return VSConstants.S_OK;
            }

            public int OnCloseView(IVsTextView view)
            {
                return VSConstants.S_OK;
            }

            public int OnNewView(IVsTextView view)
            {
                SetupView(view);

                return VSConstants.S_OK;
            }

            public int RemoveAdornments()
            {
                _sink.Unadvise();
                _globalOptions.OptionChanged -= GlobalOptionChanged;

                if (_codeWindow is IVsDropdownBarManager dropdownManager)
                {
                    RemoveDropdownBar(dropdownManager);
                }

                return VSConstants.S_OK;
            }

            // GetOutline is called every time a new code window is created. Whenever we switch to a different window, it is guaranteed
            // that ReleaseOutline will be called on the old window before GetOutline is called for the new window.
            int IVsDocOutlineProvider.GetOutline(out IntPtr phwnd, out IOleCommandTarget? ppCmdTarget)
            {
                var languageServiceBroker = _languageService.Package.ComponentModel.GetService<ILanguageServiceBroker2>();
                var threadingContext = _languageService.Package.ComponentModel.GetService<IThreadingContext>();
                var asyncListenerProvider = _languageService.Package.ComponentModel.GetService<IAsynchronousOperationListenerProvider>();
                var asyncListener = asyncListenerProvider.GetListener(FeatureAttribute.DocumentOutline);
                var editorAdaptersFactoryService = _languageService.Package.ComponentModel.GetService<IVsEditorAdaptersFactoryService>();

                threadingContext.ThrowIfNotOnUIThread();

                // Assert that the previous Document Outline Control and host have been freed.
                Contract.ThrowIfFalse(_documentOutlineControl is null);
                Contract.ThrowIfFalse(_documentOutlineViewHost is null);

                _documentOutlineControl = new DocumentOutlineControl(
                    languageServiceBroker, threadingContext, asyncListener, editorAdaptersFactoryService, _codeWindow);

                _documentOutlineViewHost = new ElementHost
                {
                    Dock = DockStyle.Fill,
                    Child = _documentOutlineControl
                };

                phwnd = _documentOutlineViewHost.Handle;
                ppCmdTarget = null;

                Logger.Log(FunctionId.DocumentOutline_WindowOpen, logLevel: LogLevel.Information);

                return VSConstants.S_OK;
            }

            int IVsDocOutlineProvider.ReleaseOutline(IntPtr hwnd, IOleCommandTarget pCmdTarget)
            {
                var threadingContext = _languageService.Package.ComponentModel.GetService<IThreadingContext>();
                threadingContext.ThrowIfNotOnUIThread();

                // Assert that we are not attempting to double free the Document Outline Control and host.
                Contract.ThrowIfNull(_documentOutlineViewHost);
                Contract.ThrowIfNull(_documentOutlineControl);

                _documentOutlineViewHost.SuspendLayout();
                _documentOutlineControl.Dispose();
                _documentOutlineControl = null;
                _documentOutlineViewHost.Child = null;
                _documentOutlineViewHost.Parent = null;
                _documentOutlineViewHost.Dispose();
                _documentOutlineViewHost = null;

                return VSConstants.S_OK;
            }

            int IVsDocOutlineProvider.GetOutlineCaption(VSOUTLINECAPTION nCaptionType, out string pbstrCaption)
            {
                pbstrCaption = ServicesVSResources.Document_Outline;
                return VSConstants.S_OK;
            }

            int IVsDocOutlineProvider.OnOutlineStateChange(uint dwMask, uint dwState)
            {
                return VSConstants.S_OK;
            }
        }
    }
}


text:
// Copyright 2015 The Oppia Authors. All Rights Reserved.
//
// 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.

/**
 * @fileoverview Factory for creating new frontend instances of Content
 * domain objects.
 */

oppia.factory('ContentObjectFactory', [function() {
  var Content = function(type, value) {
    this.type = type;
    this.value = value;
  };

  Content.prototype.toBackendDict = function() {
    return {
      type: this.type,
      value: this.value
    };
  };

  Content.createFromBackendDict = function(contentBackendDict) {
    return new Content(contentBackendDict.type, contentBackendDict.value);
  };

  return Content;
}]);


text:
@interface MessageVC : UIViewController

@end


text:
package org.eclipse.equinox.p2.metadata;

/**
 * Exception thrown when parsing Omni Version formats.
 * @noextend This class is not intended to be subclassed by clients.
 * @since 2.0
 */
public class VersionFormatException extends Exception {

	private static final long serialVersionUID = -867104101610941043L;

	public VersionFormatException(String message) {
		super(message);
	}
}


text:
layout: post
title: What is SOA? What is SOAP-RPC?
date: 2008-04-14T06:35:00.004Z
author: Marcus Hammarberg
tags:
  - SOA
  - Life of a consultant
modified_time: 2008-04-14T13:46:43.471Z
blogger_id: tag:blogger.com,1999:blog-36533086.post-7521587768438377192
blogger_orig_url: http://www.marcusoft.net/2008/04/what-is-soa-what-is-soap-rpc.html
---

The now almost age-old question; "but what is
[SOA](http://en.wikipedia.org/wiki/Service-oriented_architecture) then?"
has been out for debate at the office where i am right now. It must be
stated that this is a gang of developers and quite often the questions
bubbles down to; "but this line of code then, is this
[SOA](http://en.wikipedia.org/wiki/Service-oriented_architecture)?".

I took some time over the weekend and though about it - and came to the
conclusion that you cannot answerer that question because the question
is not correct in itself.
[SOA](http://en.wikipedia.org/wiki/Service-oriented_architecture) has to
do with switching position and behold your world from another angle, was
my conclusion.

And lo and behold; today i found an article that explained a lot of
stuff surronding this for me:
<http://wisdomofganesh.blogspot.com/2008/02/deciding-characteristic-of-soa.html>

Great explanation of the differences between
[SOA](http://en.wikipedia.org/wiki/Service-oriented_architecture) and
SOAP-RPC.


text:
#ifndef _SCENE_CONVERTER_H_
#define _SCENE_CONVERTER_H_

#include "Converter.h"
#include <dae.h>
#include <dom.h>
#include <dom/domVisual_scene.h>

#include <Ogre.h>
#include "HasLog.h"

namespace cologreng{
///Class for converting collada scenes into ogre scenegraphs.
class CSceneConverter : public CConverter, protected HasLog
{
public:
    typedef enum {SHOW_LIGHT_BILLBOARD, HIDE_LIGHT_BILLBOARD} LightBillBoardMode;
    typedef enum {USE_FILE_MATERIAL, USE_GENERIC_MATERIAL} MaterialMode;

public:
    ///Constructor
    CSceneConverter(Ogre::Log *_log);
    ///Destructor
    virtual ~CSceneConverter(void);

    /**Reads collada "<scenes>s" and creates an Ogre scene graph accordingly. It parses all "<node>s" of a collada scene
       and tries to creates ogre scene graph nodes for each. If a skeleton reference is found within a node, it
       creates ogre-skeletons of the corresponding nodes of type JOINT and assignes the skeleton to the mesh skin.
       For all objects, a scene node only is created when the corresponding mesh already exists in the ogre MeshManager resource pool.
       /remarks This convert function needs to be called separately from all other converters and will not be called automatically
       if you call CColladaDatabase::convertResources(), but can be called using CColladaDatabase::convertScene() (see
       CColladaDatabase class description for details). This has two reasons, the first being that for the creation of ogre
       scene nodes, a scene manager is needed, whereas all meshes, materials and so on can be created with only an existing
       ogre root object. The second reason is gives the user the choice to ignore the collada scene definition at all
       (so just calling CColladaDatabase::convertResource()) and build his/her own scene graph using the converted
       resources.
       @param pElement daeElement of the collada DAE database to be converted, must be of type "<scene>"
       @param pOgreSceneManager Pointer to a pre-created, valid Ogre::SceneManager object.
       @param pParentNode Pointer to ogre scene node under which to build the scene
       @param _bbMode Specify whether or not to show light billboards
       @param _materialMode Specify the material mode to use (defined in the file or a generic gray one)
       @return 0 if succeeded, 1 upon error, prints error message to stderr
    */
    int convert(daeElement* pElement, Ogre::SceneManager* pOgreSceneManager, Ogre::SceneNode *pParentNode, LightBillBoardMode _bbMode, MaterialMode _materialMode);

    void _createDefaultLight( Ogre::SceneManager* pOgreSceneManager );
protected:
    /** builds an ogre skeleton based on the following rules :
       -the collada node pNode passed in as the first parameter must be of type JOINT
       -if pParentBone == NULL, a parent bone will be created in the first recursion step
       -it will recusively parse all subnodes of pNode and add them to pParentNode as children
       -it will NOT YET apply any transfomations to the bones and NOT attach a mesh to the skeleton
       @param pNode Collada Dom node pointer, must be of type JOINT
       @param pParentBone ogre bone to attach all created bones to as children, one will be created if NULL
       @param pOgreSkeleton ogre skeleton pointer through which all bones will be created and therefore become part of this skeleton
    */
    void buildSkeleton(domNode* pNode, Ogre::Bone* pParentBone, Ogre::SkeletonPtr pOgreSkeleton);
    ///transforms a skeleton recursively
    void transformSkeleton(domNode* pNode, Ogre::SkeletonInstance* pOgreSkeletonInstance);
    /** takes a collada node array as starting input, loops through all elements of this array and calls itself recursively
       for all the childnodes of each node. Creates an ogre scene node for each collada node and attached them to
       pParentNode in the right hirachy
       @param pNodeArray Collada DOM node array
       @param pParentNode ogre node to attach all created node to as children
       @param pOgreSceneManager needs to be passed in to create ogre entities
    */
    void buildSceneHierarchy(domNode_Array* pNodeArray, Ogre::SceneNode* pParentNode, Ogre::SceneManager* pOgreSceneManager);

    ///transforms an Ogre scene node using Collada DOM translate-, rotate- and scale-arrays or the transformation matrix
    void transformNode(domNode* pDomNode, Ogre::Node* pOgreNode);

    void _instantiateGeometry( domNodeRef &nodeRef, Ogre::SceneNode* pSceneNode, Ogre::SceneManager* pOgreSceneManager);
    void _instantiateLights( domNodeRef &nodeRef, Ogre::SceneManager* pOgreSceneManager, Ogre::SceneNode* pSceneNode);
    void _addLightToScene(Ogre::Light *_light, Ogre::SceneNode *_node, Ogre::SceneManager *_sceneMgr);
    void _instantiateSkeletons( domNodeRef nodeRef, Ogre::SceneManager* pOgreSceneManager, Ogre::SceneNode* pSceneNode);
    Ogre::MeshPtr _getOgreMesh( domInstance_geometryRef instanceGeometryRef);
    void _bindMaterialsToMesh( domBind_materialRef bindMaterialRef, Ogre::MeshPtr ogreMesh);
    void _setSubmeshMaterial(Ogre::SubMesh *_subMesh, const std::string &_materialName, const std::string &_meshName, unsigned int _submeshIndex);
    std::string _makeNodeID();

protected:
    ///in here because lights need a scene manager to be created and there is no resource manager for lights
    /// called automatically whenever a light is found in the scene, adds lights to the scene graph
    Ogre::Light* convertLight(domLight* pLight, Ogre::SceneManager* pOgreSceneManager);

    void _setLightAttenuation( domLight::domTechnique_common::domPointRef pointRef, Ogre::Light* pOgreLight, float attenuationRange );
    /// \internal stores whether there is at least one light in the scene, if not, a default light will be added depending on CConverter::m_convOptions
    bool m_hasLight;

    LightBillBoardMode mShowLights;
    MaterialMode mMaterialMode;

    static unsigned int sGenericNodeID;

};

} // namespace cologreng

#endif //_SCENE_CONVERTER_H_


text:
package net.mtu.eggplant.dbc.test;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

/**
 * test parsing of anonomous classes.
 *
 * @version $Revision: 1.3 $
 */
public class AnonymousClass {
  private ActionListener _al;

  public AnonymousClass() {
     _al = new ActionListener() {
         /**
            @pre (ae != null)
         **/
        public void actionPerformed(ActionEvent ae) {
          int j=0;
        }
      };
  }

  public void pass() {
    _al.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "test"));
  }

  public void fail() {
    _al.actionPerformed(null);
  }

}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using NXDO.Data.MVCP;
using EMP.MvcDemo.Models;

namespace EMP.MvcDemo.Views
{
    public partial class EmpEdit : UserControl, IViewControl<EmpModel>
    {
        public EmpEdit()
        {
            InitializeComponent();
        }

        public NXDO.Data.Factory.MvcHelper<EmpModel> Mvc
        {
            get;
            set;
        }

        public void Register(NXDO.Data.Factory.MvcHelper<EmpModel> mvc)
        {
            mvc.ForTitle(this.label1, l => l.Text, m => m.ID);
            mvc.ForTitle(this.label2, l => l.Text, m => m.Name);
            mvc.ForTitle(this.label3, l => l.Text, m => m.Sex);
            mvc.ForTitle(this.label4, l => l.Text, m => m.Birthday);
            mvc.ForText(this.textBox1, m => m.ID);
            mvc.ForText(this.textBox2, m => m.Name);

            var lst = mvc.ViewBag.ListData as List<SexModel>;
            mvc.FillDataList(this.comboBox1, lst, (SexModel sm) => new { sm.Value, sm.Name });
            mvc.ForKnown(this.comboBox1, c => c.SelectedValue, m => m.Sex);
            mvc.ForValue(this.dateTimePicker1, m => m.Birthday);
        }

        private void EmpEdit_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Mvc.Action("Save");
        }
    }
}


text:
#include "brc_default_codes.h"

namespace {

const char check_user_code_[] = CHECK_USER_CODE;
const char check_channel_code_[] = CHECK_CHANNEL_CODE;
const char verify_password_code_[] = VERIFY_PASSWORD_CODE;
const char register_code_[] = REGISTER_CODE;
const char delete_user_code_[] = DELETE_USER_CODE;
const char join_channel_code_[] = JOIN_CHANNEL_CODE;
const char part_channel_code_[] = PART_CHANNEL_CODE;
const char delete_channel_code_[] = DELETE_CHANNEL_CODE;
const char add_channel_admin_code_[] = ADD_CHANNEL_ADMIN_CODE;
const char request_password_code_[] = REQUEST_PASSWORD_CODE;
const char channel_chat_code_[] = CHANNEL_CHAT_CODE;
const char user_chat_code_[] = USER_CHAT_CODE;
const char ping_code_[] = PING_CODE;
const char pong_code_[] = PONG_CODE;
const char server_exit_code_[] = SERVER_EXIT_CODE;
const char remote_admin_token_request_code_[] = REMOTE_ADMIN_TOKEN_REQUEST_CODE;

const char eom_[] = EOM;
const char ok_[] = OK;
BrcResponse *success_resp_ = new BrcResponse(OK_ID, (char *)ok_, sizeof(ok_));
const char user_exists_[] = USER_EXISTS;
BrcResponse *user_exists_resp_ = new BrcResponse(USER_EXISTS_ID, (char *)user_exists_, sizeof(user_exists_));
const char failure_[] = FAILURE;
BrcResponse *failure_resp_ = new BrcResponse(FAILURE_ID, (char *)failure_, sizeof(failure_));
const char malformed_[] = MALFORMED_DATA;
BrcResponse *malformed_resp_ = new BrcResponse(MALFORMED_DATA_ID, (char *)malformed_, sizeof(malformed_));
const char exit_server_[] = EXIT_SERVER;
BrcResponse *exit_server_resp_ = new BrcResponse(EXIT_SERVER_ID, (char *)exit_server_, sizeof(exit_server_));

}

namespace BrcGlobals {

const char *check_user_code() { return check_user_code_; }
const char *check_channel_code() { return check_channel_code_; }
const char *verify_password_code() { return verify_password_code_; }
const char *register_code() { return register_code_; }
const char *delete_user_code() { return delete_user_code_; }
const char *join_channel_code() { return join_channel_code_; }
const char *part_channel_code() { return part_channel_code_; }
const char *delete_channel_code() { return delete_channel_code_; }
const char *add_channel_admin_code() { return add_channel_admin_code_; }
const char *request_password_code() { return request_password_code_; }
const char *channel_chat_code() { return channel_chat_code_; }
const char *user_chat_code() { return user_chat_code_; }
const char *ping_code() { return ping_code_; }
const char *pong_code() { return pong_code_; }
const char *server_exit_code() { return server_exit_code_; }
const char *remote_admin_token_request_code() { return remote_admin_token_request_code_; }

const char *eom() { return eom_; }
unsigned short eom_length() { return sizeof(eom_); }
const char *ok() { return ok_; }
const char *user_exists() { return user_exists_; }
const char *failure() { return failure_; };
const char *malformed() { return malformed_; }
const char *exit_server() { return exit_server_; }
BrcResponse *success_resp() { return success_resp_; }
BrcResponse *user_exists_resp() { return  user_exists_resp_; }
BrcResponse *failure_resp() { return failure_resp_; }
BrcResponse *malformed_resp() { return malformed_resp_; }
BrcResponse *exit_server_resp() { return exit_server_resp_; }

}


text:
/* Multidimensional optimization by conjugate gradient descent.
 *
 * SRE, Wed Jun 22 09:53:05 2005
 * SVN $Id: esl_minimizer.h 664 2011-02-27 17:08:36Z eddys $
 * SVN $URL: https://svn.janelia.org/eddylab/eddys/easel/branches/hmmer/3.1/esl_minimizer.h $
 */
#ifndef eslMINIMIZER_INCLUDED
#define eslMINIMIZER_INCLUDED

#define MAXITERATIONS 100

extern int esl_min_Bracket(double *a, double *d, double *u, int n,
			   double (*func)(double *, int, void *), void *prm,
			   double *ret_fa,
			   double *b, double *ret_bx, double *ret_fb,
			   double *c, double *ret_cx, double *ret_fc);
extern int esl_min_LineSearch(double *ori, double *d, double *u, int n,
			      double (*func)(double *, int, void *), void *prm,
			      double tol, double *b,
			      double *x, double *ret_xx, double *ret_fx);
extern int esl_min_ConjugateGradientDescent(double *x, double *u, int n,
					    double (*func)(double *, int, void *),
					    void (*dfunc)(double *, int, void *, double *),
					    void *prm, double tol, double *wrk, double *ret_fx);

#endif /*eslMINIMIZER_INCLUDED*/
/*****************************************************************
 * Easel - a library of C functions for biological sequence analysis
 * Version h3.1b2; February 2015
 * Copyright (C) 2015 Howard Hughes Medical Institute.
 * Other copyrights also apply. See the COPYRIGHT file for a full list.
 *
 * Easel is distributed under the Janelia Farm Software License, a BSD
 * license. See the LICENSE file for more details.
 *****************************************************************/


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

namespace WinSysInfo.PEView.Model
{
    /// <summary>
    /// After the MSDOS stub, at the file offset specified at offset 0x3c,
    /// is a 4-byte signature that identifies the file as a PE format image file
    /// </summary>
    public class NTHeaderLayout
    {
        /// <summary>
        /// This signature is "PE\0\0" (the letters "P" and "E" followed by two
        /// null bytes).
        /// </summary>
        private char[] signature = new char[4];
        public char[] Signature
        {
            get { return signature; }
            set { signature = value; }
        }
    }
}


text:
package org.codehaus.groovy.transform.trait;

import org.codehaus.groovy.ast.ASTNode;
import org.codehaus.groovy.ast.ClassCodeExpressionTransformer;
import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.DynamicVariable;
import org.codehaus.groovy.ast.FieldNode;
import org.codehaus.groovy.ast.GenericsType;
import org.codehaus.groovy.ast.MethodNode;
import org.codehaus.groovy.ast.PropertyNode;
import org.codehaus.groovy.ast.Variable;
import org.codehaus.groovy.ast.expr.ArgumentListExpression;
import org.codehaus.groovy.ast.expr.BinaryExpression;
import org.codehaus.groovy.ast.expr.ClosureExpression;
import org.codehaus.groovy.ast.expr.ConstantExpression;
import org.codehaus.groovy.ast.expr.DeclarationExpression;
import org.codehaus.groovy.ast.expr.Expression;
import org.codehaus.groovy.ast.expr.FieldExpression;
import org.codehaus.groovy.ast.expr.MethodCallExpression;
import org.codehaus.groovy.ast.expr.PropertyExpression;
import org.codehaus.groovy.ast.expr.StaticMethodCallExpression;
import org.codehaus.groovy.ast.expr.TupleExpression;
import org.codehaus.groovy.ast.expr.VariableExpression;
import org.codehaus.groovy.control.SourceUnit;
import org.codehaus.groovy.syntax.SyntaxException;
import org.codehaus.groovy.syntax.Token;
import org.codehaus.groovy.syntax.Types;

import java.lang.reflect.Modifier;
import java.util.Collection;

import static org.codehaus.groovy.ast.tools.GeneralUtils.args;
import static org.codehaus.groovy.ast.tools.GeneralUtils.binX;
import static org.codehaus.groovy.ast.tools.GeneralUtils.callX;
import static org.codehaus.groovy.ast.tools.GeneralUtils.castX;
import static org.codehaus.groovy.ast.tools.GeneralUtils.classX;
import static org.codehaus.groovy.ast.tools.GeneralUtils.isInstanceOfX;
import static org.codehaus.groovy.ast.tools.GeneralUtils.propX;
import static org.codehaus.groovy.ast.tools.GeneralUtils.ternaryX;
import static org.codehaus.groovy.ast.tools.GeneralUtils.varX;

/**
 * This expression transformer is used internally by the {@link org.codehaus.groovy.transform.trait.TraitASTTransformation
 * trait} AST transformation to change the receiver of a message on "this" into a static method call on the trait helper
 * class.
 *

 * In a nutshell, code like the following method definition in a trait: void foo() { this.bar() } is
 * transformed into: void foo() { TraitHelper$bar(this) }
 *
 * @since 2.3.0
 */
class TraitReceiverTransformer extends ClassCodeExpressionTransformer {

    private final VariableExpression weaved;
    private final SourceUnit unit;
    private final ClassNode traitClass;
    private final ClassNode traitHelperClass;
    private final ClassNode fieldHelper;
    private final Collection<String> knownFields;

    private boolean inClosure;

    public TraitReceiverTransformer(final VariableExpression thisObject, final SourceUnit unit, final ClassNode traitClass,
                                    final ClassNode traitHelperClass, final ClassNode fieldHelper, final Collection<String> knownFields) {
        this.weaved = thisObject;
        this.unit = unit;
        this.traitClass = traitClass;
        this.traitHelperClass = traitHelperClass;
        this.fieldHelper = fieldHelper;
        this.knownFields = knownFields;
    }

    @Override
    protected SourceUnit getSourceUnit() {
        return unit;
    }

    @Override
    public Expression transform(final Expression exp) {
        ClassNode weavedType = weaved.getOriginType();
        if (exp instanceof BinaryExpression) {
            return transformBinaryExpression((BinaryExpression) exp, weavedType);
        } else if (exp instanceof StaticMethodCallExpression) {
            StaticMethodCallExpression call = (StaticMethodCallExpression) exp;
            if (call.getOwnerType().equals(traitClass)) {
                MethodCallExpression mce = callX(
                        varX(weaved),
                        call.getMethod(),
                        transform(call.getArguments())
                );
                mce.setSafe(false);
                mce.setSpreadSafe(false);
                mce.setImplicitThis(false);
                mce.setSourcePosition(exp);
                return mce;
            }
        } else if (exp instanceof MethodCallExpression) {
            MethodCallExpression mce = (MethodCallExpression) exp;
            String obj = mce.getObjectExpression().getText();
            if (mce.isImplicitThis() || "this".equals(obj)) {
                return transformMethodCallOnThis(mce);
            } else if ("super".equals(obj)) {
                return transformSuperMethodCall(mce);
            }
        } else if (exp instanceof FieldExpression) {
            FieldNode fn = ((FieldExpression) exp).getField();
            return transformFieldReference(exp, fn, fn.isStatic());
        } else if (exp instanceof VariableExpression) {
            VariableExpression vexp = (VariableExpression) exp;
            Variable accessedVariable = vexp.getAccessedVariable();
            if (accessedVariable instanceof FieldNode || accessedVariable instanceof PropertyNode) {
                if (knownFields.contains(vexp.getName())) {
                    boolean isStatic = Modifier.isStatic(accessedVariable.getModifiers());
                    return transformFieldReference(exp, accessedVariable instanceof FieldNode
                            ? (FieldNode) accessedVariable : ((PropertyNode) accessedVariable).getField(), isStatic);
                } else {
                    PropertyExpression propertyExpression = propX(varX(weaved), vexp.getName());
                    propertyExpression.getProperty().setSourcePosition(exp);
                    return propertyExpression;
                }
            } else if (accessedVariable instanceof DynamicVariable && !inClosure) { // GROOVY-9386
                PropertyExpression propertyExpression = propX(varX(weaved), vexp.getName());
                propertyExpression.getProperty().setSourcePosition(exp);
                return propertyExpression;
            }
            if (vexp.isThisExpression()) {
                VariableExpression variableExpression = varX(weaved);
                variableExpression.setSourcePosition(exp);
                return variableExpression;
            }
            if (vexp.isSuperExpression()) {
                throwSuperError(vexp);
            }
        } else if (exp instanceof PropertyExpression) {
            PropertyExpression pexp = (PropertyExpression) exp;
            String obj = pexp.getObjectExpression().getText();
            if (pexp.isImplicitThis() || "this".equals(obj)) {
                String propName = pexp.getPropertyAsString();
                if (knownFields.contains(propName)) {
                    FieldNode fn = new FieldNode(propName, 0, ClassHelper.OBJECT_TYPE, weavedType, null);
                    return transformFieldReference(exp, fn, false);
                }
            }
        } else if (exp instanceof ClosureExpression) {
            MethodCallExpression mce = callX(exp, "rehydrate", args(
                    varX(weaved),
                    varX(weaved),
                    varX(weaved)
            ));
            mce.setImplicitThis(false);
            mce.setSourcePosition(exp);
            boolean oldInClosure = inClosure;
            inClosure = true;
            ((ClosureExpression) exp).getCode().visit(this);
            inClosure = oldInClosure;
            // The rewrite we do is causing some troubles with type checking, which will
            // not be able to perform closure parameter type inference
            // so we store the replacement, which will be done *after* type checking.
            exp.putNodeMetaData(TraitASTTransformation.POST_TYPECHECKING_REPLACEMENT, mce);
            return exp;
        }

        // TODO: unary expressions (field++, field+=, ...)
        return super.transform(exp);
    }

    private Expression transformBinaryExpression(final BinaryExpression exp, final ClassNode weavedType) {
        Expression leftExpression = exp.getLeftExpression();
        Expression rightExpression = exp.getRightExpression();
        Token operation = exp.getOperation();
        if (operation.getType() == Types.ASSIGN) {
            String leftFieldName = null;
            if (leftExpression instanceof VariableExpression && ((VariableExpression) leftExpression).getAccessedVariable() instanceof FieldNode) {
                leftFieldName = ((VariableExpression) leftExpression).getAccessedVariable().getName();
            } else if (leftExpression instanceof FieldExpression) {
                leftFieldName = ((FieldExpression) leftExpression).getFieldName();
            } else if (leftExpression instanceof PropertyExpression
                    && (((PropertyExpression) leftExpression).isImplicitThis() || "this".equals(((PropertyExpression) leftExpression).getObjectExpression().getText()))) {
                leftFieldName = ((PropertyExpression) leftExpression).getPropertyAsString();
            }
            if (leftFieldName != null) {
                FieldNode staticField = tryGetFieldNode(weavedType, leftFieldName);
                if (fieldHelper == null || staticField == null && !fieldHelper.hasPossibleMethod(Traits.helperSetterName(new FieldNode(leftFieldName, 0, ClassHelper.OBJECT_TYPE, weavedType, null)), rightExpression)) {
                    return binX(propX(varX(weaved), leftFieldName), operation, transform(rightExpression)); // GROOVY-7342, GROOVY-7456, GROOVY-9739, GROOVY-10143, et al.
                }
                FieldNode fn = weavedType.getDeclaredField(leftFieldName);
                if (fn == null) {
                    fn = new FieldNode(leftFieldName, 0, ClassHelper.OBJECT_TYPE, weavedType, null);
                }
                Expression receiver = createFieldHelperReceiver();
                boolean isStatic = staticField != null && staticField.isStatic();
                if (fn.isStatic()) { // DO NOT USE isStatic variable here!
                    receiver = propX(receiver, "class");
                }
                String method = Traits.helperSetterName(fn);
                MethodCallExpression mce = callX(
                        receiver,
                        method,
                        super.transform(rightExpression)
                );
                mce.setImplicitThis(false);
                mce.setSourcePosition(exp);
                markDynamicCall(mce, staticField, isStatic);
                return mce;
            }
        }

        Expression leftTransform = transform(leftExpression);
        Expression rightTransform = transform(rightExpression);
        Expression ret = exp instanceof DeclarationExpression ?
                new DeclarationExpression(leftTransform, operation, rightTransform) : binX(leftTransform, operation, rightTransform);
        ret.setSourcePosition(exp);
        ret.copyNodeMetaData(exp);
        return ret;
    }

    private Expression transformFieldReference(final Expression exp, final FieldNode fn, final boolean isStatic) {
        Expression receiver = createFieldHelperReceiver();
        if (isStatic) {
            receiver = asClass(receiver);
        }

        MethodCallExpression mce = callX(receiver, Traits.helperGetterName(fn));
        mce.setImplicitThis(false);
        mce.setSourcePosition(exp);
        markDynamicCall(mce, fn, isStatic);
        return mce;
    }

    private static void markDynamicCall(final MethodCallExpression mce, final FieldNode fn, final boolean isStatic) {
        if (isStatic) {
            mce.putNodeMetaData(TraitASTTransformation.DO_DYNAMIC, fn.getOriginType());
        }
    }

    private static FieldNode tryGetFieldNode(final ClassNode weavedType, final String fieldName) {
        FieldNode fn = weavedType.getDeclaredField(fieldName);
        if (fn == null && ClassHelper.isClassType(weavedType)) {
            GenericsType[] genericsTypes = weavedType.getGenericsTypes();
            if (genericsTypes != null && genericsTypes.length == 1) {
                // for static properties
                fn = genericsTypes[0].getType().getDeclaredField(fieldName);
            }
        }
        return fn;
    }

    private void throwSuperError(final ASTNode node) {
        unit.addError(new SyntaxException("Call to super is not allowed in a trait", node.getLineNumber(), node.getColumnNumber()));
    }

    private Expression transformSuperMethodCall(final MethodCallExpression call) {
        String method = call.getMethodAsString();
        if (method == null) {
            throwSuperError(call);
        }

        Expression arguments = transform(call.getArguments());
        ArgumentListExpression superCallArgs = new ArgumentListExpression();
        if (arguments instanceof ArgumentListExpression) {
            ArgumentListExpression list = (ArgumentListExpression) arguments;
            for (Expression expression : list) {
                superCallArgs.addExpression(expression);
            }
        } else {
            superCallArgs.addExpression(arguments);
        }
        MethodCallExpression newCall = callX(
                weaved,
                Traits.getSuperTraitMethodName(traitClass, method),
                superCallArgs
        );
        newCall.setSourcePosition(call);
        newCall.setSafe(call.isSafe());
        newCall.setSpreadSafe(call.isSpreadSafe());
        newCall.setImplicitThis(false);
        return newCall;
    }

    private Expression transformMethodCallOnThis(final MethodCallExpression call) {
        Expression method = call.getMethod();
        Expression arguments = call.getArguments();
        Expression thisExpr = call.getObjectExpression();

        if (method instanceof ConstantExpression) {
            String methodName = call.getMethodAsString();
            for (MethodNode methodNode : traitClass.getMethods(methodName)) {
                if (methodName.equals(methodNode.getName()) && (methodNode.isStatic() || methodNode.isPrivate())) {
                    MethodCallExpression newCall;
                    if (!inClosure && methodNode.isStatic()) { // GROOVY-10312: $self or $static$self.staticMethod(...)
                        newCall = callX(varX(weaved), methodName, transform(arguments));
                        newCall.setImplicitThis(false);
                        newCall.setSafe(false);
                    } else {
                        ArgumentListExpression newArgs = createArgumentList(methodNode.isStatic() ? asClass(varX("this")) : weaved, arguments);
                        newCall = callX(inClosure ? classX(traitHelperClass) : thisExpr, methodName, newArgs);
                        newCall.setImplicitThis(true);
                        newCall.setSafe(call.isSafe());
                    }
                    newCall.setSpreadSafe(call.isSpreadSafe());
                    newCall.setSourcePosition(call);
                    return newCall;
                }
            }
        }

        MethodCallExpression newCall = callX(inClosure ? thisExpr : weaved, method, transform(arguments));
        newCall.setImplicitThis(inClosure ? call.isImplicitThis() : false);
        newCall.setSafe(inClosure ? call.isSafe() : false);
        newCall.setSpreadSafe(call.isSpreadSafe());
        newCall.setSourcePosition(call);
        return newCall;
    }

    private ArgumentListExpression createArgumentList(final Expression self, final Expression arguments) {
        ArgumentListExpression newArgs = new ArgumentListExpression();
        newArgs.addExpression(self);
        if (arguments instanceof TupleExpression) {
            for (Expression argument : (TupleExpression) arguments) {
                newArgs.addExpression(transform(argument));
            }
        } else {
            newArgs.addExpression(transform(arguments));
        }
        return newArgs;
    }

    private Expression createFieldHelperReceiver() {
        return ClassHelper.isClassType(weaved.getOriginType()) ? weaved : castX(fieldHelper, weaved);
    }

    private Expression asClass(final Expression e) {
        ClassNode rawClass = ClassHelper.CLASS_Type.getPlainNodeReference();
        return ternaryX(isInstanceOfX(e, rawClass), e, callX(e, "getClass"));
    }
}


text:
var widgets = require('./widgets');
var BeakerXApi = require('./tree/Utils/BeakerXApi').default;
var _ = require('underscore');
var $ = require('jquery');

var DataGridScope = require('./tableDisplay/dataGrid').DataGridScope;
var TableScope = require('./tableDisplay/tableScope');

require('datatables.net-dt/css/jquery.dataTables.css');
require('datatables.net-colreorder-dt/css/colReorder.dataTables.css');
require('datatables.net-fixedcolumns-dt/css/fixedColumns.dataTables.css');
require('datatables.net-keytable-dt/css/keyTable.dataTables.css');
require('./tableDisplay/css/datatables.scss');

var TableDisplayModel = widgets.DOMWidgetModel.extend({
  defaults: function() {
    return _.extend({}, widgets.DOMWidgetModel.prototype.defaults.apply(this), {
      _model_name: 'TableDisplayModel',
      _view_name: 'TableDisplayView',
      _model_module: 'beakerx',
      _view_module: 'beakerx',
      _model_module_version: BEAKERX_MODULE_VERSION,
      _view_module_version: BEAKERX_MODULE_VERSION
    });
  }
});

// Custom View. Renders the widget model.
var TableDisplayView = widgets.DOMWidgetView.extend({
  render: function() {
    var that = this;

    this._currentScope = null;

    this.$el.addClass('beaker-table-display');

    this.displayed.then(function() {
      var tableModel = that.model.get('model');
      if (tableModel.tooManyRows) {
        that.showWarning(tableModel);
      }
      that.initTableDisplay(tableModel);

      that.listenTo(that.model, 'beakerx-tabSelected', function() {
        that._currentScope && that._currentScope.adjustRedraw();
      });

      that.listenTo(that.model, 'change:updateData', that.handleUpdateData);
      that.listenTo(that.model, 'change:model', that.handleModellUpdate);
    });

    this.on('remove', function() {
      if (that._currentScope) {
        that._currentScope.doDestroy(true);
        that._currentScope = null;
      }
    });
  },

  handleModellUpdate: function() {
    var newModel = this.model.get('model');
    this._currentScope.updateModelData(newModel);
    this._currentScope.doResetAll();
  },

  handleUpdateData: function() {
    var change = this.model.get('updateData');
    var currentModel = this.model.get('model');
    var updatedModel = _.extend(currentModel, change);
    this.model.set('model', updatedModel, {updated_view: this});
    this.handleModellUpdate();
  },

  initTableDisplay: function(data) {
    var baseUrl;
    var api;
    var self = this;

    try {
      var coreutils = require('@jupyterlab/coreutils');
      coreutils.PageConfig.getOption('pageUrl');
      baseUrl = coreutils.PageConfig.getBaseUrl();
    } catch(e) {
      baseUrl = '/';
    }

    api = new BeakerXApi(baseUrl);
    api.loadSettings()
      .then(function (settings) { self.resolveWidget(settings, data); })
      .catch(function () { self.resolveWidget(api.DEFAULT_SETTINGS, data); });
  },

  resolveWidget: function(settings, data) {
    if (!settings || !settings.ui_options || !settings.ui_options.use_data_grid) {
      this.initDatatablesTable(data);
    } else {
      this.initDataGridTable(data);
    }
  },

  showWarning: function(data) {
    var rowLength = data.rowLength;
    var rowLimit = data.rowLimit;
    var tmpl = '
' +
      '
Note: table is too big to display. ' +
      'The limit is ' + rowLimit + ' rows, but this table has ' + rowLength + ' rows. ' +
      'The first 10000 rows are displayed as a preview.

';
    var tmplElement = $(tmpl);
    tmplElement.appendTo(this.$el);
  },

  initDataGridTable: function(data) {
    this._currentScope = new DataGridScope({
      element: this.el,
      data: data,
      widgetModel: this.model,
      widgetView: this
    });

    this._currentScope.render();
  },

  initDatatablesTable: function(data) {
    this._currentScope = new TableScope('wrap_'+this.model.model_id);
    var tmpl = this._currentScope.buildTemplate();
    var tmplElement = $(tmpl);

    tmplElement.appendTo(this.$el);

    this._currentScope.setWidgetModel(this.model);
    this._currentScope.setModelData(data);
    this._currentScope.setElement(tmplElement.children('.dtcontainer'));
    this._currentScope.enableJupyterKeyHandler();
    this._currentScope.run();
    this._currentScope.initColumLimitModal();
    this._currentScope.setWidgetView(this);
  }

});

module.exports = {
  TableDisplayModel: TableDisplayModel,
  TableDisplayView: TableDisplayView
};


text:
class CGameObject;
class CInventoryOwner;
class TiXmlNode;
class CUIXml;

typedef TiXmlNode		XML_NODE;

class CPhraseScript
{
public:
	CPhraseScript				();
	virtual ~CPhraseScript		();

	//çàãðóçêà èç XML ôàéëà
	virtual void Load			(CUIXml* ui_xml, XML_NODE* phrase_node);

	//âûçîâ ñ îäíèì ïàðàìåòðîì (info_portion)
	virtual bool				Precondition	(const CGameObject* pSpeaker, LPCSTR dialog_id, int phrase_num) const;
	virtual void				Action			(const CGameObject* pSpeaker, LPCSTR dialog_id, int phrase_num) const;
	//âûçîâ ñ äâóìÿ ïàðàìåòðàìè (dialog, phrase)
	virtual bool				Precondition	(const CGameObject* pSpeaker1, const CGameObject* pSpeaker2, LPCSTR dialog_id, int phrase_num, int next_phrase_num) const;
	virtual void				Action			(const CGameObject* pSpeaker1, const CGameObject* pSpeaker2, LPCSTR dialog_id, int phrase_num) const;
	//òåêñò èç ñêðèïòîâîé ôóíêöèè
//	virtual LPCSTR Text			(LPCSTR original_text, const CGameObject* pSpeaker1, const CGameObject* pSpeaker2, LPCSTR dialog_id, int phrase_num) const;
//	virtual bool   HasText		() const {return *m_sScriptTextFunc!=NULL;}

	DEFINE_VECTOR				(shared_str, PRECONDITION_VECTOR, PRECONDITION_VECTOR_IT);
	virtual const PRECONDITION_VECTOR& Preconditions		() const {return m_Preconditions;}

	DEFINE_VECTOR(shared_str, ACTION_NAME_VECTOR, ACTION_NAME_VECTOR_IT);
	virtual const ACTION_NAME_VECTOR& Actions() const {return m_ScriptActions;}

			void				AddPrecondition	(LPCSTR str);
			void				AddAction		(LPCSTR str);
			void				AddHasInfo		(LPCSTR str);
			void				AddDontHasInfo	(LPCSTR str);
			void				AddGiveInfo		(LPCSTR str);
			void				AddDisableInfo	(LPCSTR str);
protected:
	//çàãðóçêà ñîäåðæàíèÿ ïîñëåäîâàòåëüíîñòè òàãîâ â êîíòåéíåð ñòðîê
	template<class T>
		void					LoadSequence		(CUIXml* ui_xml, XML_NODE* phrase_node, LPCSTR tag, T&  str_vector);

	//ìàíèïóëÿöèè ñ èíôîðìàöèåé âî âðåìÿ âûçîâîâ Precondition è Action
	virtual bool				CheckInfo		(const CInventoryOwner* pOwner) const;
	virtual void				TransferInfo	(const CInventoryOwner* pOwner) const;

	//èìÿ ñêðèïòîâîé ôóíêöèè, êîòîðàÿ âîçâðàùàåò êàêîé-òî òåêñò
//	shared_str m_sScriptTextFunc;

	//ñêðèïòîâûå äåéñòâèÿ, êîòîðûå àêòèâèðóåòñÿ ïîñëå òîãî êàê
	//ãîâîðèòñÿ ôðàçà
	DEFINE_VECTOR				(shared_str, ACTION_NAME_VECTOR, ACTION_NAME_VECTOR_IT);
	ACTION_NAME_VECTOR			m_ScriptActions;

	DEFINE_VECTOR				(shared_str, INFO_VECTOR, INFO_VECTOR_IT);

	INFO_VECTOR					m_GiveInfo;
	INFO_VECTOR					m_DisableInfo;

	//ñïèñîê ñêðèïòîâûõ ïðåäèêàòîâ, âûïîëíåíèå, êîòîðûõ íåîáõîäèìî
	//äëÿ òîãî ÷òîá ôðàçà ñòàëà äîñòóïíîé
	DEFINE_VECTOR				(shared_str, PRECONDITION_VECTOR, PRECONDITION_VECTOR_IT);

	PRECONDITION_VECTOR			m_Preconditions;
	//ïðîâåðêà íàëè÷èÿ/îòñóòñòâèÿ èíôîðìàöèè
	INFO_VECTOR					m_HasInfo;
	INFO_VECTOR					m_DontHasInfo;
};


text:
package com.parrot.arsdk.ardiscovery.receivers;

public interface ARDiscoveryServicesDevicesListUpdatedReceiverDelegate
{
    public void onServicesDevicesListUpdated();
}


text:
require 'spec_helper'

RSpec.describe Cryptoexchange::Exchanges::Blokmy::Market do
  it { expect(described_class::NAME).to eq 'blokmy' }
  it { expect(described_class::API_URL).to eq 'https://blokmy.com/api/v2' }
end


text:
<?php
require_once('calculator.php'); //our calculator class which we will creater later.
class CalculatorTest extends PHPUnit_Framework_TestCase{

  //test if the add() method in our calculator class
  //actually returns the sum that
  //were expecting
  public function testAdd(){
      $calc = new Calculator();
      $sum = $calc->add(array(2,3,4,5));
      $this->assertEquals(14, $sum); //check if 2+3+4+5 is equal to 14
  }

  //test if the subtract() method in our calculator class
  //actually returns the difference that
  //were expecting
  public function testSubtract(){
      $calc = new Calculator();
      $difference = $calc->subtract(5,2);
      $this->assertEquals(3, $difference); //check if 5 - 2 is equal to 3
  }

  //test if the multiply() method in our calculator class
  //actually returns the product that
  //were expecting
  public function testMultiply(){
      $calc = new Calculator();
      $product = $calc->multiply(array(1,3,5,6));
      $this->assertEquals(90, $product); //check if 1*3*5*6 is equal to 90
  }

  //test if the divide() method in our calculator class
  //actually returns the quotient that
  //were expecting
  public function testDivide(){
      $calc = new Calculator();
      $quotient = $calc->divide(10,2);
      $this->assertEquals(5, $quotient); //check if 10/2 is equal to 5
  }
}
?>