text:
import Ember from 'ember';
import nsEvents from 'canvas-web/lib/ns-events';

const { $, on } = Ember;

export default Ember.Mixin.create({
  eventList: 'click touchstart',
  isOpen: false,
  onClose: Ember.K,
  onOpen: Ember.K,

  setUpEventHandlers: on('didInsertElement', function() {
    $(document).on(nsEvents(this, this.get('eventList')),
      Ember.run.bind(this, 'dropdownClick'));
  }),

  tearDownEventHandlers: on('willDestroyElement', function() {
    $(document).off(nsEvents(this, this.get('eventList')));
  }),

  click(event) {
    event.stopPropagation();
  },

  dropdownClick() {
    this.send('closeDropdown');
  },

  actions: {
    closeDropdown() {
      this.set('isOpen', false);
      this.get('onClose')();
    },

    openDropdown() {
      this.set('isOpen', true);
      this.get('onOpen')();
    },

    toggleDropdown() {
      this.toggleProperty('isOpen');

      if (this.get('isOpen')) {
        this.get('onOpen')();
      } else {
        this.get('onClose')();
      }
    }
  }
});


text: Projekt pri OPB

redpajama_set_name: RedPajamaGithub


text:
##Swarm NLP

Uses particle swarm optimization to find approximate solutions to
non-linear programming and multi-criteria decision making problems.

To use:
Enter in one or many objective functions in any number of dimensions.
Enter in your constraints.
Run the swarm until you have an acceptable solution.

There may be multiple solutions in the non-dominating set, a sample
of these solutions are show as orange dots on the UI.

Options in the UI allow you to view a cross section of any 2 dimensions
for any objective function.

A shaded red region indicates infeasible solutions.
Lighter and darker regions on the screen indicate high and low function values.


text:
#include "SearchQueryWrapper.h"

#include <limits>
#include <memory>

#include "SearchQueryBuilder.h"

#include "InteropHelper.h"

// clang-format off

namespace CLIInterop {

	indexer_common::uSearchQuery SearchQueryWrapper::ToUnmanagedQuery()
	{
		std::u16string text = Helper::ToU16string(Text);
		std::u16string searchDirPath = Helper::ToU16string(SearchDirPath);

		indexer_common::SearchQueryBuilder builder;
		builder.SetSearchText(text)
			.SetSearchDirPath(searchDirPath);

		if (MatchCase) builder.SetMatchCase();
		if (UseRegex) builder.SetUseRegex();

		builder.SetSizeFrom(SizeFrom);
		if (SizeTo != 0) builder.SetSizeTo(SizeTo);

		if (ExcludeHiddenAndSystem) builder.SetExcludeHiddenAndSystem();
		if (ExcludeFolders) builder.SetExcludeFolders();
		if (ExcludeFiles) builder.SetExcludeFiles();

		// Adjusting to the end of the day.
		CreatedTimeTo = CreatedTimeTo->AddDays(1).Subtract(System::TimeSpan::FromMilliseconds(1));

		auto cTimeFrom = (CreatedTimeFrom->Year < 1970)
			? 0
			: Helper::DateTimeToUnixTimeSeconds(CreatedTimeFrom);

		auto cTimeTo = (CreatedTimeTo->Year < 1970)
			? std::numeric_limits<indexer_common::uint>::max()
			: Helper::DateTimeToUnixTimeSeconds(CreatedTimeTo);

		builder.SetCreationTimeFrom(cTimeFrom).SetCreationTimeTo(cTimeTo);

		return builder.Build();
	}
}


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

namespace Myre.Entities.Behaviours
{
    /// <summary>
    /// An interface which defines a manger for entity behaviours.
    /// </summary>
    /// <remarks>
    /// <para>Behaviour managers perform all the logic required to implement a specific type of behaviour.
    /// Each scene contains an manager instance for each behaviour type, and these managers batch process all behaviours in the scene.</para>
    /// <para>Managers can utilise the services contained in the scene to register for updates or events.</para>
    /// </remarks>
    public interface IBehaviourManager
        : IDisposableObject
    {
        void Initialise(Scene scene);
    }

    public static class BehaviourManagerExtensions
    {
        //private static Dictionary<Type, Dictionary<Type, MethodInfo>> managerMethods = new Dictionary<Type, Dictionary<Type, MethodInfo>>();
        private static readonly Dictionary<Type, Type[]> _managedTypes = new();

        public static IEnumerable<Type> GetManagedTypes(this IBehaviourManager manager)
        {
            var managerType = manager.GetType();

            if (!_managedTypes.TryGetValue(managerType, out var behaviourTypes))
            {
                var types = from i in managerType.GetInterfaces()
                            where i.FullName.StartsWith(typeof(IBehaviourManager<>).FullName)
                            select i.GetGenericArguments().First();

                behaviourTypes = types.ToArray();
                _managedTypes[managerType] = behaviourTypes;
            }

            return behaviourTypes;
        }
    }

    /// <summary>
    /// An interface which defines a manger for entity behaviours.
    /// </summary>
    /// <remarks>
    /// <para>Behaviour managers perform all the logic required to implement a specific type of behaviour.
    /// Each scene contains an manager instance for each behaviour type, and these managers batch process all behaviours in the scene.</para>
    /// <para>Managers can utilise the services contained in the scene to register for updates or events.</para>
    /// </remarks>
    public interface IBehaviourManager<in T>
        : IBehaviourManager
        where T : Behaviour
    {
        /// <summary>
        /// Adds a behaviour to this manager.
        /// </summary>
        /// <param name="behaviour">The behaviour the manager should begin to manage.</param>
        void Add(T behaviour);

        /// <summary>
        /// Removes a behaviour from this manager.
        /// </summary>
        /// <param name="behaviour">The behaviour this manager should stop managing.</param>
        /// <returns><c>true</c> if the behaviour was removed; else <c>false</c>.</returns>
        bool Remove(T behaviour);
    }

    /// <summary>
    /// An abstract base implementation of a Behaviour Manager.
    /// </summary>
    /// <typeparam name="T">The type of behaviour to be managed.</typeparam>
    public abstract class BehaviourManager<T>
        : IBehaviourManager<T>
        where T : Behaviour
    {
        /// <summary>
        /// Gets a list of behaviours being managed by this instance.
        /// </summary>
        /// <value>The behaviours.</value>
        protected List<T> Behaviours { get; private set; }

        /// <summary>
        /// Gets a value indicating whether this instance is disposed.
        /// </summary>
        /// <value></value>
        public bool IsDisposed { get; private set; }

        /// <summary>
        /// Gets the type this manager manages.
        /// </summary>
        /// <value></value>
        public Type BehaviourType => typeof(T);

        /// <summary>
        /// Initializes a new instance of the <see cref="BehaviourManager<T>"/> class.
        /// </summary>
        protected BehaviourManager()
        {
            Behaviours = new List<T>();
        }

        public virtual void Initialise(Scene scene)
        {
        }

        /// <summary>
        /// Adds a behaviour to this manager.
        /// </summary>
        /// <param name="behaviour">The behaviour the manager should begin to manage.</param>
        public virtual void Add(T behaviour)
        {
            Behaviours.Add(behaviour);
        }

        /// <summary>
        /// Removes a behaviour from this manager.
        /// </summary>
        /// <param name="behaviour">The behaviour this manager should stop managing.</param>
        /// <returns>
        /// 	<c>true</c> if the behaviour was removed; else <c>false</c>.
        /// </returns>
        public virtual bool Remove(T behaviour)
        {
            return Behaviours.Remove(behaviour);
        }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
        }

        /// <summary>
        /// Releases unmanaged and - optionally - managed resources
        /// </summary>
        /// <param name="disposeManagedResources"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
// ReSharper disable VirtualMemberNeverOverriden.Global
        protected virtual void Dispose(bool disposeManagedResources)
// ReSharper restore VirtualMemberNeverOverriden.Global
        {
            if (IsDisposed)
                return;

            IsDisposed = true;

            if (disposeManagedResources)
            {
                var behaviours = Behaviours;
                for (var i = behaviours.Count - 1; i >= 0; i--)
                {
                    var b = behaviours[i];
                    Remove(b);
                }
            }
        }
    }
}


text:
Mac OS X Build Instructions and Notes
====================================
This guide will show you how to build mazad(headless client) for OSX.
The commands in this guide should be executed in a Terminal application.
The built-in one is located in `/Applications/Utilities/Terminal.app`.

Preparation
-----------
Install the OS X command line tools:

`xcode-select --install`

When the popup appears, click `Install`.

Then install [Homebrew](https://brew.sh).

Dependencies
----------------------

    brew install automake berkeley-db4 libtool boost miniupnpc openssl pkg-config protobuf python3 qt libevent

See [dependencies.md](dependencies.md) for a complete overview.

If you want to build the disk image with `make deploy` (.dmg / optional), you need RSVG

    brew install librsvg

If you want to build with ZeroMQ support

    brew install zeromq

NOTE: Building with Qt4 is still supported, however, could result in a broken UI. Building with Qt5 is recommended.

Berkeley DB
-----------
It is recommended to use Berkeley DB 4.8. If you have to build it yourself,
you can use [the installation script included in contrib/](/contrib/install_db4.sh)
like so

```shell
./contrib/install_db4.sh .
```

from the root of the repository.

**Note**: You only need Berkeley DB if the wallet is enabled (see the section *Disable-Wallet mode* below).

Build Maza Core
------------------------

### Building `mazad`
1. Clone the maza source code and cd into `maza`

        git clone https://github.com/mazacoin/maza
        cd maza

        git clone https://github.com/maza/maza.git
        cd maza

2.  Build mazad:

    You can disable the GUI build by passing `--without-gui` to configure.

        ./autogen.sh
        ./configure
        make

3.  It is recommended to build and run the unit tests:

        make check

Creating a release build
------------------------
You can ignore this section if you are building `mazad` for your own use.

mazad/maza-cli binaries are not included in the Maza-Qt.app bundle.

If you are building `mazad` or `Maza-Qt` for others, your build machine should be set up
as follows for maximum compatibility:

        make install

    or

        cd ~/maza/src
        cp mazad /usr/local/bin/
        cp maza-cli /usr/local/bin/
Once dependencies are compiled, see release-process.md for how the Mazacoin-Qt.app
bundle is packaged and signed to create the .dmg disk image that is distributed.

Running
-------

It's now available at `./mazad`, provided that you are still in the `src`
directory. We have to first create the RPC configuration file, though.

Run `./mazad` to get the filename where it should be put, or just try these
commands:

    echo -e "rpcuser=mazarpc\nrpcpassword=$(xxd -l 16 -p /dev/urandom)" > "/Users/${USER}/Library/Application Support/Maza/maza.conf"
    chmod 600 "/Users/${USER}/Library/Application Support/Maza/maza.conf"

    chmod 600 "/Users/${USER}/Library/Application Support/Maza/maza.conf"

    tail -f $HOME/Library/Application\ Support/Maza/debug.log

You can monitor the download process by looking at the debug.log file:

    tail -f $HOME/Library/Application\ Support/Maza/debug.log

Other commands:
-------

    ./mazad -daemon # to start the maza daemon.
    ./maza-cli --help  # for a list of command-line options.
    ./maza-cli help    # When the daemon is running, to get a list of RPC commands

Using Qt Creator as IDE
------------------------
You can use Qt Creator as an IDE, for maza development.
Download and install the community edition of [Qt Creator](https://www.qt.io/download/).
Uncheck everything except Qt Creator during the installation process.

1. Make sure you installed everything through Homebrew mentioned above
2. Do a proper ./configure --enable-debug
3. In Qt Creator do "New Project" -> Import Project -> Import Existing Project
4. Enter "maza-qt" as project name, enter src/qt as location
5. Leave the file selection as it is
6. Confirm the "summary page"
7. In the "Projects" tab select "Manage Kits..."
8. Select the default "Desktop" kit and select "Clang (x86 64bit in /usr/bin)" as compiler
9. Select LLDB as debugger (you might need to set the path to your installation)
10. Start debugging with Qt Creator

Notes
-----

* Tested on OS X 10.8 through 10.13 on 64-bit Intel processors only.

* Building with downloaded Qt binaries is not officially supported. See the notes in [#7714](https://github.com/bitcoin/bitcoin/issues/7714)


text:
var assert = require('assert');
var express = require('express');
var rewrite = require('..');
var supertest = require('supertest');

describe('Accept with req', function () {
    var rewritten = false;

    var app = express();
    app.use(rewrite({
        accept: function (req, res) {
            var isHtml  = res.getHeader('content-type').match(/text\/html/);
            var needsUs = !!req.query['save-me'];
            return isHtml && needsUs;
        },
        rewrite: function (body) {
            rewritten = true;
            return body;
        }
    }));

    app.get('/html', function (req, res) {
        res.send(200, 'OK!');
    });

    it('should not accept based on request params', function (done) {
        supertest(app)
            .get('/html')
            .expect(200)
            .expect('OK!')
            .end(function (err) {
                assert(!rewritten);
                done(err);
            });
    });

    it('Should accept HTML with query base on request params', function (done) {
        supertest(app)
            .get('/html?save-me=please')
            .expect(200)
            .expect('Content-Type', /html/)
            .expect('OK!')
            .end(function (err) {
                assert(rewritten);
                done(err);
            });
    });
});


text:
template-navigation
===================

Test de navigation. Source : https://github.com/jplusplus/dragons-gifts

A faire : le brancher sur Gdoc (ou via Misodataset, Turntable ou Copytext)

mkvirtualenv NOM DU PROJET
pip install - requirements.txt
make run (pour le server)
make freeze pour lancer le build


text:
- order: 5

使用 `tipFormatter` 可以格式化 `Tooltip` 的内容,设置 `tipFormatter={null}`,则隐藏 `Tooltip`。

---

````jsx
import { Slider } from 'antd';

function formatter(value) {
  return '$' + value;
}

ReactDOM.render(<div>
  <Slider tipFormatter={formatter} />
  <Slider tipFormatter={null} />
</div>, document.getElementById('components-slider-demo-tip-formatter'));
````


text:
package ru.job4j;

import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

/**
 * Test.
 *
 * @author Sergey Dubouski
 * @version $Id$
 * @since 13.01.2017
*/
public class CounterTest {

	/**
	 * Test even-even range of numbers' sum.
	*/
	@Test
	public void whenFirstNumberEvenSecondEvenThenSum() {

		final int first = 4;
		final int second = 6;
		final int expectedResult = 0;

		final Counter count = new Counter();
		final int actualResult = count.add(first, second);

		assertThat(actualResult, is(expectedResult));
	}

	/**
	 * Test odd-even range of numbers' sum.
	*/
	@Test
	public void whenFirstNumberOddSecondEvenThenSum() {

		final int first = 1;
		final int second = 2;
		final int expectedResult = 0;

		final Counter count = new Counter();
		final int actualResult = count.add(first, second);

		assertThat(actualResult, is(expectedResult));
	}

	/**
	 * Test even-odd range of numbers' sum.
	*/
	@Test
	public void whenFirstNumberEvenSecondOddThenSum() {

		final int first = 2;
		final int second = 7;
		final int expectedResult = 10;

		final Counter count = new Counter();
		final int actualResult = count.add(first, second);

		assertThat(actualResult, is(expectedResult));
	}

	/**
	 * Test odd-odd range of numbers' sum.
	*/
	@Test
	public void whenFirstNumberOddSecondOddThenSum() {

		final int first = 1;
		final int second = 5;
		final int expectedResult = 6;

		final Counter count = new Counter();
		final int actualResult = count.add(first, second);

		assertThat(actualResult, is(expectedResult));
	}
}


text:
package org.epnoi.comparator.helper;

import lombok.Getter;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * Created by cbadenes on 13/01/16.
 */
@Component
public class SparkHelper {

    @Value("${epnoi.comparator.threads}")
    String threads; // 2

    @Value("${epnoi.comparator.memory}")
    String memory; // 3g

    private SparkConf conf;

    @Getter
    private JavaSparkContext sc;

    @PostConstruct
    public void setup(){

        // Initialize Spark Context
        this.conf = new SparkConf().
                setMaster("local["+threads+"]").
                setAppName("DrInventor-Comparator").
                set("spark.executor.memory", memory).
                set("spark.driver.maxResultSize","0");
        sc = new JavaSparkContext(conf);
    }

}


text:
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { SharedVariableService } from "../../../../_service/sharedvariable-service";
import { ActionBtnProp } from '../../../../_model/action_buttons'
import { Subscription } from 'rxjs/Subscription';
import { CommonService } from '../../../../_service/common/common-service'
import { CustomerAddService } from "../../../../_service/customer/add/add-service";
import { MessageService, messageType } from '../../../../_service/messages/message-service';
import { AddrbookComp } from "../../../usercontrol/addressbook/adrbook.comp";
import { UserService } from '../../../../_service/user/user-service';
import { LoginUserModel } from '../../../../_model/user_model';
import { AddDynamicTabComp } from "../../../usercontrol/adddynamictab";
// import { AttributeComp } from "../../../usercontrol/attribute/attr.comp";
import { AttributeModuleComp } from "../../../usercontrol/attributemodule/attrmod.comp";
import { LazyLoadEvent, DataTable } from 'primeng/primeng';

import { Router, ActivatedRoute } from '@angular/router';

declare var $: any;
declare var commonfun: any;
@Component({
    templateUrl: 'add.comp.html',
    providers: [CustomerAddService, CommonService]

}) export class CustAdd implements OnInit, OnDestroy {
    actionButton: ActionBtnProp[] = [];
    subscr_actionbarevt: Subscription;

    //Add Local Veriable
    ledgerParamDT: any = [];
    custid: any = 0;
    code: any = "";
    Custname: any = "";
    warehouse: any = 0;
    dayslist: any = [];
    keyvallist: any = [];
    warehouselist: any = [];
    debitlist: any = [];
    creditlist: any = [];
    billadr: any = "";
    shippingchk: boolean = false;
    shippingadr: any = "";
    issh: any = 0;
    key: any = "";
    value: any = "";
    debit: any = 0;
    credit: any = 0;
    Duplicateflag: boolean = false;
    days: any = 0;
    ope: any = 0;
    remark: any = "";
    attrname: any = "";
    attrid: any = 0;
    invtypname: any = "";
    invtypid: any = 0;
    ctrlname: any = "";
    ctrlid: any = 0;
    //Ctrllist: any = [];
    attrtable: boolean = true;
    ctrlhide: boolean = true;
    profflag: boolean = true;
    constflag: boolean = true;
    disattrlist: any = [];
    disattrname: any = "";
    disattrid: any = 0;
    fromval: any = 0;
    toval: any = 0;
    dis: any = 0;
    parentcodename: any = "";
    parentid: any = 0;
    parentname: any = "";
    itemsname: any = "";
    itemsid: any = 0;
    itemsdis: any = 0;
    itemslist: any = [];
    counter: number = 0;
    taxlist: any = [];
    upperlimit: number = 0;
    lowerlimit: number = 0;

    //Other Module Declare
    adrbookid: any = [];
    adrid: number = 0;
    suppdoc: any = [];
    module: string = "";

    uploadedFiles: any = [];
    adrcsvid: any = "";
    adrmodule: string = "";
    accode: string = "";
    acinfiid: any = 0;
    acinfival: any = "";
    salesmanlist: any = [];
    salename: any = "";
    salesid: any = 0;
    transname: any = "";
    transid: any = 0;
    translist: any = [];
    editmode: boolean = false;
    isactive: boolean = false;

    //Autoextender
    TranspoterAutodata: any = [];
    SalesmanAutodata: any = [];
    ControlCentAutodata: any = [];
    ParentcodeAutodata: any = [];
    acinfivalAutodata: any = [];
    TaxAutodata: any = [];

    // tab panel
    @ViewChild('tabpanel')
    tabpanel: AddDynamicTabComp;
    tabListDT: any = [];
    selectedtab: any = [];
    isedittab: boolean = false;

    //user details
    loginUser: LoginUserModel;
    loginUserName: string;

    allload: any = {
        "wearhouse": false,
        "otherdropdwn": false
    }

    _editid: number = 0;

    @ViewChild('addrbook')
    addressBook: AddrbookComp;

    // @ViewChild('attribute')
    // attribute: AttributeComp;

    @ViewChild('attributemodule')
    attributemodule: AttributeModuleComp

    @ViewChild('attrPrice')
    attrPrice: AttributeModuleComp

    //  @ViewChild('transpoter')
    // transpoter: AttributeComp;

    private subscribeParameters: any;

    //Add Servies Refrence
    constructor(private _router: Router, private setActionButtons: SharedVariableService,
        private CustAddServies: CustomerAddService, private _autoservice: CommonService,
        private _routeParams: ActivatedRoute, private _msg: MessageService, private _userService: UserService) {
        this.module = "cust";

        this.loginUser = this._userService.getUser();
    }
    //Add Save Edit Delete Button
    ngOnInit() {
        this.actionButton.push(new ActionBtnProp("back", "Back to view", "long-arrow-left", true, false));
        this.actionButton.push(new ActionBtnProp("save", "Save", "save", true, false));
        this.actionButton.push(new ActionBtnProp("edit", "Edit", "edit", true, true));
        this.actionButton.push(new ActionBtnProp("delete", "Delete", "trash", true, true));
        this.actionButton.push(new ActionBtnProp("clear", "Refresh", "refresh", true, false));
        this.setActionButtons.setActionButtons(this.actionButton);
        this.setActionButtons.setTitle("Customer Master");
        this.subscr_actionbarevt = this.setActionButtons.setActionButtonsEvent$.subscribe(evt => this.actionBarEvt(evt));
        $(".code").removeAttr('disabled', 'disabled');
        $(".code").focus();
        this.getcustomerdrop();
        this.subscribeParameters = this._routeParams.params.subscribe(params => {
            if (params['id'] !== undefined) {
                this.actionButton.find(a => a.id === "save").hide = true;
                this.actionButton.find(a => a.id === "edit").hide = false;

                this.custid = params['id'];
                this._editid = this.custid

                $('input').attr('disabled', 'disabled');
                $('select').attr('disabled', 'disabled');
                $('textarea').attr('disabled', 'disabled');

            }
            else {
                this.actionButton.find(a => a.id === "save").hide = false;
                this.actionButton.find(a => a.id === "edit").hide = true;
            }
        });
        setTimeout(function () {
            commonfun.addrequire();
        }, 0);
        this.attributemodule.attrtype = "attribute";
        this.attributemodule.attParentNam = "custinfo_attr";
        this.attributemodule.labelname = "Customer Attribute";
        this.attrPrice.attrtype = "attribute";
        this.attrPrice.attParentNam = "item_attr";
        this.attrPrice.labelname = "MRP";
    }

    //Get Code Blur Event
    Getcode() {
        this.accode = this.code;
        this.addressBook.AddBook(this.code);
        this.adrbookid = [];
    }

    loadRBIGrid(event: LazyLoadEvent) {

    }

    //Discount Tab Click Event
    discount() {
        this.disattrname = "";
        this.fromval = "";
        this.toval = "";
        this.dis = "";
        setTimeout(function () {
            $(".disattr").focus();
        }, 100);

    }

    //Attribute Auto Extender
    getAutoCompletedisattr(me: any) {
        try {
            var that = this;
            this._autoservice.getAutoData({
                "type": "attribute",
                "search": that.disattrname,
                "cmpid": this.loginUser.cmpid,
                "FY": this.loginUser.fy,
                "filter": "item_attr",
                "createdby": this.loginUser.login
            }).subscribe(data => {
                $(".disattr").autocomplete({
                    source: data.data,
                    width: 300,
                    max: 20,
                    delay: 100,
                    minLength: 0,
                    autoFocus: true,
                    cacheLength: 1,
                    scroll: true,
                    highlight: false,
                    select: function (event, ui) {
                        me.disattrid = ui.item.value;
                        me.disattrname = ui.item.label;
                    }
                });
            }, err => {
                console.log("Error");
            }, () => {
                this.attrid = 0;
            })
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }

    }

    //Account Info Autoextender
    acinfivalAuto(event) {
        let query = event.query;
        this._autoservice.getAutoDataGET({
            "type": "attribute",
            "cmpid": this.loginUser.cmpid,
            "fy": this.loginUser.fy,
            "createdby": this.loginUser.login,
            "filter": "acinfo_attr",
            "search": query
        }).then(data => {
            this.acinfivalAutodata = data;
        });
    }

    //Account Info Selected
    acinfivalSelect(event) {
        this.acinfiid = event.value;
        this.acinfival = event.label;
    }

    //Transpoter Autoextender
    TranspoterAuto(event) {
        let query = event.query;
        this._autoservice.getAutoDataGET({
            "type": "transpoter",
            "cmpid": this.loginUser.cmpid,
            "fy": this.loginUser.fy,
            "createdby": this.loginUser.login,
            "search": query
        }).then(data => {
            this.TranspoterAutodata = data;
        });
    }

    //Transpoter Selected
    TranspoterSelect(event) {
        this.transid = event.value;
        this.transname = event.label;
    }

    //Parent Code Autoextender
    ParentcodeAuto(event) {
        let query = event.query;
        this._autoservice.getAutoDataGET({
            "type": "custcode",
            "cmpid": this.loginUser.cmpid,
            "fy": this.loginUser.fy,
            "createdby": this.loginUser.login,
            "search": query
        }).then(data => {
            this.ParentcodeAutodata = data;
        });
    }

    //Parent Code Selected
    ParentcodeSelect(event) {
        this.parentid = event.autoid;
        this.parentcodename = event.custcode;
        this.parentname = event.custname;
    }

    //Salesman Autoextender
    SalesmanAuto(event) {
        let query = event.query;
        this._autoservice.getAutoDataGET({
            "type": "salesman",
            "cmpid": this.loginUser.cmpid,
            "fy": this.loginUser.fy,
            "createdby": this.loginUser.login,
            "search": query
        }).then(data => {
            this.SalesmanAutodata = data;
        });
    }

    //Salesman Selected
    SalesmanSelect(event) {
        this.salesid = event.value;
        this.salename = event.label;
    }

    getparentname(pid: number) {
        try {
            this.CustAddServies.getcustomer({
                "cmpid": this.loginUser.cmpid,
                "flag": "parentname",
                "parentid": pid,
                "createdby": this.loginUser.login
            }).subscribe(result => {
                this.parentname = "";
                this.parentname = result.data[0][0].custname;
            }, err => {
                console.log("error");
            }, () => {
                //Complete
            })
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }
    }

    getAutoCompleteItems(me: any) {
        try {
            var that = this;
            this._autoservice.getAutoData({
                "type": "product",
                "search": that.itemsname,
                "cmpid": this.loginUser.cmpid,
                "fy": this.loginUser.fy,
                "createdby": this.loginUser.login
            }).subscribe(data => {
                $(".itemsname").autocomplete({
                    source: data.data,
                    width: 300,
                    max: 20,
                    delay: 100,
                    minLength: 0,
                    autoFocus: true,
                    cacheLength: 1,
                    scroll: true,
                    highlight: false,
                    select: function (event, ui) {
                        me.itemsid = ui.item.value;
                        me.itemsname = ui.item.label;
                    }
                });
            }, err => {
                console.log("Error");
            }, () => {
                this.attrid = 0;
            })
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }
    }

    //attribute list Add Div
    TranspoterAdd() {
        try {
            if (this.transid > 0) {
                this.Duplicateflag = true;
                if (this.translist.length > 0) {
                    for (var i = 0; i < this.translist.length; i++) {
                        if (this.translist[i].transname == this.transname) {
                            this.Duplicateflag = false;
                            break;
                        }
                    }
                }
                if (this.Duplicateflag == true) {
                    this.translist.push({
                        'transname': this.transname,
                        'value': this.transid
                    });
                    this.transname = "";
                    this.transid = 0;
                    $(".transname input").focus();
                }
                else {
                    this._msg.Show(messageType.error, "error", "Duplicate transpoter");
                    $(".transname input").focus();
                    this.transid = 0;
                    return;
                }

            }
            else {
                this._msg.Show(messageType.error, "error", "Please enter valied transpoter name");
                $(".transname input").focus();
                return;
            }
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }
    }

    transtab() {
        setTimeout(function () {
            this.transid = 0;
            this.transname = "";
            $(".transname input").val("");
            $(".transname input").focus();
        }, 0);

    }

    //Remove Attribute
    RemoveTranspoter(row) {
        var index = -1;
        for (var i = 0; i < this.translist.length; i++) {
            if (this.translist[i].value === row.value) {
                index = i;
                break;
            }
        }
        if (index === -1) {
            console.log("Wrong Delete Entry");
        }
        this.translist.splice(index, 1);
        $(".trans").focus();
    }

    //Add Attribute Items
    Additems() {
        try {
            if (this.itemsid > 0) {
                if ($(".itemdis").val() == "") {
                    this._msg.Show(messageType.error, "error", "Please Enter Items Discount");
                    $(".itemdis").focus();
                    return;
                }
                this.Duplicateflag = true;
                for (var i = 0; i < this.itemslist.length; i++) {
                    if (this.itemslist[i].itemsname == this.itemsname && this.itemslist[i].itemsdis == this.itemsdis) {
                        this.Duplicateflag = false;
                        break;
                    }
                }
                if (this.Duplicateflag == true) {
                    this.itemslist.push({
                        'itemsname': this.itemsname,
                        'itemsdis': this.itemsdis,
                        'itemsid': this.itemsid,
                        'counter': this.counter
                    });
                    this.counter++;
                    this.itemsname = "";
                    this.itemsdis = "";
                    this.itemsid = 0;
                    $(".itemsname").focus();
                }
                else {
                    this._msg.Show(messageType.error, "error", "Duplicate Items");
                    $(".itemsname").focus();
                    return;
                }
            }
            else {
                this._msg.Show(messageType.error, "error", "Please enter valid items name");
                $(".itemsname").focus();
                return;
            }
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }

    }

    saletab() {
        setTimeout(function () {
            this.salename = "";
            $(".sales input").focus();
        }, 0);
    }

    SalemanAdd() {
        try {
            if (this.salesid > 0) {
                this.Duplicateflag = true;
                if (this.salesmanlist.length > 0) {
                    for (var i = 0; i < this.salesmanlist.length; i++) {
                        if (this.salesmanlist[i].salename == this.salename) {
                            this.Duplicateflag = false;
                            break;
                        }
                    }
                }

                if (this.Duplicateflag == true) {
                    this.salesmanlist.push({
                        'salename': this.salename,
                        'value': this.salesid
                    });
                    this.salename = "";
                    this.salesid = 0;
                    $(".sales input").focus();
                }
                else {
                    this._msg.Show(messageType.error, "error", "Duplicate Salesman");
                    $(".sales input").focus();
                    return;
                }

            }
            else {
                this._msg.Show(messageType.error, "error", "Please enter valied salesman name");
                $(".sales input").focus();
                return;
            }
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }
    }

    RemoveSale(row: any = []) {
        var index = -1;
        for (var i = 0; i < this.salesmanlist.length; i++) {
            if (this.salesmanlist[i].value === row.value) {
                index = i;
                break;
            }
        }
        if (index === -1) {
            console.log("Wrong Delete Entry");
        }
        this.salesmanlist.splice(index, 1);
        $(".sales").focus();
    }

    itemdis() {
        setTimeout(function () {
            this.itemsname = "";
            this.itemsdis = "";
            this.itemsid = 0;
            $(".itemsname").focus();
        }, 0);
    }

    itemsRemove(row: any = []) {
        var index = -1;
        for (var i = 0; i < this.itemslist.length; i++) {
            if (this.itemslist[i].counter === row.counter) {
                index = i;
                break;
            }
        }
        if (index === -1) {
            console.log("Wrong Delete Entry");
        }
        this.itemslist.splice(index, 1);
        $(".itemsname").focus();
    }

    //Add Attribute Items
    AddNewdisattr() {
        try {
            if (this.fromval > this.toval) {
                this._msg.Show(messageType.error, "error", "Wrong entry From greater than to");
                $(".fromval").focus();
                return;
            }
            if (this.disattrid > 0) {
                this.Duplicateflag = true;
                if (this.disattrlist.length > 0) {
                    for (var i = 0; i < this.disattrlist.length; i++) {
                        if (this.disattrlist[i].disattrname == this.disattrname &&
                            parseInt(this.disattrlist[i].toval) < parseInt(this.fromval)) {
                            this.Duplicateflag = true;
                        }
                        else {
                            this.Duplicateflag = false;
                        }
                    }
                }
                if (this.Duplicateflag == true) {
                    this.disattrlist.push({
                        'disattrname': this.disattrname,
                        'id': this.disattrid,
                        'fromval': this.fromval,
                        'toval': this.toval,
                        'discou': this.dis,
                        'counter': this.counter
                    });
                    this.counter++;
                    this.disattrname = "";
                    this.fromval = "";
                    this.disattrid = 0;
                    this.toval = "";
                    this.dis = "";
                    $(".disattr").focus();
                }
                else {
                    this._msg.Show(messageType.error, "error", "Duplicate Attribute");
                    $(".disattr").focus();
                    return;
                }

            }
            else {
                this._msg.Show(messageType.error, "error", "Please enter valid attribute name");
                $(".disattr").focus();
                return;
            }
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }

    }

    //Remove Attribute
    disRemoveattr(row) {
        var index = -1;
        for (var i = 0; i < this.disattrlist.length; i++) {
            if (this.disattrlist[i].counter === row.counter) {
                index = i;
                break;
            }
        }
        if (index === -1) {
            console.log("Wrong Delete Entry");
        }
        this.disattrlist.splice(index, 1);
        $(".attr").focus();
    }

    //File Upload Start
    onUploadStart(e) {
        this.actionButton.find(a => a.id === "save").enabled = false;
    }

    //File Upload Complete
    onUploadComplete(e) {
        for (var i = 0; i < e.length; i++) {
            this.suppdoc.push({ "id": e[i].id });
        }
        this.actionButton.find(a => a.id === "save").enabled = true;
    }

    //Get Company And Warehouse Dropdown Bind
    getcustomerdrop() {
        try {
            var _this = this;
            this.CustAddServies.getCustomerdrop({
                "cmpid": this.loginUser.cmpid,
                "createdby": this.loginUser.login,
                "tblname": "customer",
                "fy": this.loginUser.fy
            }).subscribe(result => {
                _this.warehouselist = result.data[0];
                _this.debitlist = result.data[1];
                _this.creditlist = result.data[1];
                _this.dayslist = result.data[2];
                if (!_this.editmode) {
                    _this.keyvallist = result.data[3];
                }
                _this.allload.otherdropdwn = true;
                _this.checkalllead();
            }, err => {
                console.log("Error");
            }, () => {
                // console.log("Complete");
            })
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }
    }

    //First Time Load
    checkalllead() {
        if (this.allload.otherdropdwn) {
            if (this._editid > 0) {
                this.EditCust(this._editid);
            }
        }
    }

    //Salesman Create Json
    salesmanjson() {
        var salesman = [];
        for (let items of this.salesmanlist) {
            salesman.push(items.value);
        }
        return JSON.stringify(salesman).replace('[', '{').replace(']', '}');
    }

    //Add Accounting Row
    AddNewKyeval() {
        try {
            var that = this;
            if (that.acinfiid == 0) {
                that._msg.Show(messageType.error, "error", "Please enter key");
                $(".key input").focus()
                return;
            }
            if (that.value == "") {
                that._msg.Show(messageType.error, "error", "Please enter value");
                $(".val").focus()
                return;
            }
            that.Duplicateflag = true;
            if (that.keyvallist.length > 0) {
                for (var i = 0; i < that.keyvallist.length; i++) {
                    if (that.keyvallist[i].keyid === that.acinfiid && that.keyvallist[i].value === that.acinfival) {
                        that.Duplicateflag = false;
                        break;
                    }
                }
            }
            if (that.Duplicateflag == true) {
                that.keyvallist.push({
                    'key': that.acinfival,
                    'keyid': that.acinfiid,
                    'value': that.value
                });
                that.acinfival = "";
                that.value = "";
                that.acinfiid = 0;
                that.attrtable = false;
                $(".key input").focus();

            }
            else {
                that._msg.Show(messageType.error, "error", "Duplicate key and value");
                $(".key input").focus();
                return;
            }
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }
    }

    createkeydatajson() {
        var keydata = [];
        if (this.keyvallist.length > 0) {
            for (let items of this.keyvallist) {
                if (items.value != "") {
                    keydata.push({
                        "id": items.keyid,
                        "val": items.value
                    });
                }
            }
        }
        return keydata;
    }

    //Delete Accounting Row
    DeleteRow(row) {
        var index = -1;
        for (var i = 0; i < this.keyvallist.length; i++) {
            if (this.keyvallist[i].key === row.key) {
                index = i;
                break;
            }
        }
        if (index === -1) {
            console.log("Wrong Delete Entry");
        }
        this.keyvallist.splice(index, 1);
        $(".key").focus();
    }

    //Final Save Clear Controll
    ClearControll() {
        this.custid = 0;
        this.code = "";
        this.Custname = "";
        this.warehouse = "";
        this.billadr = "";
        this.shippingadr = "";
        this.shippingchk = false;
        this.remark = "";
        this.warehouselist = [];
        this.keyvallist = [];
        this.adrbookid = [];
        this.attributemodule.attrlist = [];
        this.disattrlist = [];
        this.itemslist = [];
        this.translist = [];
        // this.Ctrllist = [];
        this.taxlist = [];
        this.debit = 0;
        this.credit = 0;
        this.days = 0;
        this.ope = "";
        this.parentname = "";
        this.parentid = 0;
        this.parentcodename = "";
        this.editmode = false;
        this.addressBook.ClearArray();
    }

    //Edit Customer
    EditCust(id) {
        try {
            var that = this;

            that.CustAddServies.getcustomer({
                "cmpid": this.loginUser.cmpid,
                "flag": "Edit",
                "custid": id,
                "createdby": this.loginUser.login
            }).subscribe(result => {
                that.editmode = true;
                var resultdata = result.data[0][0]
                //var _custdata = resultdata._custdata;
                var _uploadedfile = resultdata._uploadedfile == null ? [] : resultdata._uploadedfile;
                var _docfile = resultdata._docfile == null ? [] : resultdata._docfile;
                var _parentname = resultdata._parentid == null ? [] : resultdata._parentid;

                this.ledgerParamDT = resultdata._acledger === null ? [] : resultdata._acledger.length === 0 ? [] : resultdata._acledger;
                that.parentid = resultdata.parentid;
                that.custid = resultdata.autoid;
                that.code = resultdata.custcode;
                that.Custname = resultdata.custname;
                that.ope = resultdata.ope == null ? 0 : resultdata.ope;
                that.upperlimit = resultdata.upperlimit == null ? 0 : resultdata.upperlimit;
                that.lowerlimit = resultdata.lowerlimit == null ? 0 : resultdata.lowerlimit;
                that.isactive = resultdata.isactive;
                that.taxlist = resultdata.taxdetail == null ? [] : resultdata.taxdetail;
                that.attributemodule.attrlist = resultdata.attr == null ? [] : resultdata.attr;
                that.attrPrice.attrlist = resultdata.mrp == null ? [] : resultdata.mrp;
                that.itemslist = resultdata._itemsdiscount == null ? [] : resultdata._itemsdiscount;
                that.disattrlist = resultdata._discount == null ? [] : resultdata._discount;
                that.translist = resultdata.transpoter == null ? [] : resultdata.transpoter;
                that.keyvallist = resultdata.accinfo == null ? [] : resultdata.accinfo;
                that.ctrlname = resultdata.cc[0].ctrlname;
                that.ctrlid = resultdata.cc[0].id;
                that.salesmanlist = resultdata.salesman == null ? [] : resultdata.salesman;

                that.issh = 1;
                that.days = resultdata._crday;
                that.remark = resultdata.remark;
                that.adrid = resultdata._adr;

                if (_uploadedfile != null) {
                    that.uploadedFiles = _docfile == null ? [] : _uploadedfile;
                    that.suppdoc = _docfile == null ? [] : _docfile;
                }
                that.adrcsvid = "";
                if (resultdata.adr != null) {
                    for (let items of resultdata.adr) {
                        that.adrcsvid += items + ',';
                    }
                    that.addressBook.getAddress(that.adrcsvid.slice(0, -1));
                }

                //Warehouse check edit mode
                if (that.warehouselist.length > 0) {
                    var wareedit = resultdata.wh === null ? [] : resultdata.wh;
                    if (wareedit.length > 0) {
                        for (var j = 0; j <= wareedit.length - 1; j++) {
                            var chk = that.warehouselist.find(a => a.value === wareedit[j]);
                            chk.Warechk = true;
                        }
                    }
                }

            }, err => {
                console.log("error");
            }, () => {
                //Done
            })
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }

    }

    //Multipal Warehouse Selection Create a Json
    warehousejson() {
        var warehouseid = [];
        for (let wareid of this.warehouselist) {
            if (wareid.Warechk == true) {
                warehouseid.push(wareid.value);
            }
        }
        return JSON.stringify(warehouseid).replace('[', '{').replace(']', '}');
    }

    taxjson() {
        var taxlistjson = [];
        for (let item of this.taxlist) {
            taxlistjson.push({
                "taxid": item.autoid,
                "taxname": item.taxname,
                "ontax": item.ontax,
                "puramt": item.puramt,
                "taxval": item.taxval,
                "invtyp": item.id,
                "seq": item.seq
            });
        }
        return taxlistjson;
    }

    //Create a Json in controll
    // Ctrljson() {
    //     var Ctrllistdet = [];
    //     for (let ctrid of this.Ctrllist) {
    //         Ctrllistdet.push({
    //             "id": ctrid.id,
    //             "profchk": ctrid.profflag,
    //             "conschk": ctrid.constflag
    //         });
    //     }
    //     return Ctrllistdet;
    // }

    //Create a Json in discount
    discountjson() {
        var dislist = [];
        if (this.disattrlist.length > 0) {
            for (let item of this.disattrlist) {
                dislist.push({
                    "id": item.id, "froms": item.fromval,
                    "tos": item.toval, "discou": item.dis
                });
            }
        }
        return dislist;
    }

    //Create a Json in items discount
    itemsdiscountjson() {
        var itemdislist = [];
        if (this.itemslist.length > 0) {
            for (let item of this.itemslist) {
                itemdislist.push({
                    "id": item.itemsid, "val": item.itemsdis
                });
            }
        }
        return itemdislist;

    }

    //Create a Json in items transpoter
    transpoterjson() {
        var translist = [];
        if (this.translist.length > 0) {
            for (let item of this.translist) {
                translist.push(item.value);
            }
        }
        return JSON.stringify(translist).replace('[', '{').replace(']', '}');
    }

    //Autocompleted Attribute Name
    getAutoCompleteattr(me: any) {
        try {
            var that = this;
            this._autoservice.getAutoData({
                "type": "attribute",
                "search": that.attrname,
                "cmpid": this.loginUser.cmpid,
                "FY": this.loginUser.fy,
                "filter": "item_attr",
                "createdby": this.loginUser.login
            }).subscribe(data => {
                $(".attr").autocomplete({
                    source: data.data,
                    width: 300,
                    max: 20,
                    delay: 100,
                    minLength: 0,
                    autoFocus: true,
                    cacheLength: 1,
                    scroll: true,
                    highlight: false,
                    select: function (event, ui) {
                        me.attrid = ui.item.value;
                        me.attrname = ui.item.label;
                    }
                });
            }, err => {
                console.log("Error");
            }, () => {
                this.attrid = 0;
            })
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }

    }

    //Control Center Autoextender
    ControlCentAuto(event) {
        let query = event.query;
        this._autoservice.getAutoDataGET({
            "type": "ccauto",
            "cmpid": this.loginUser.cmpid,
            "fy": this.loginUser.fy,
            "createdby": this.loginUser.login,
            "search": query
        }).then(data => {
            this.ControlCentAutodata = data;
        });
    }

    //Control Center Selected
    ControlCentSelect(event) {
        debugger;
        this.ctrlid = event.value;
        this.ctrlname = event.label;
    }

    //Tax Autoextender
    TaxAuto(event) {
        let query = event.query;
        this._autoservice.getAutoDataGET({
            "type": "invoicetype",
            "cmpid": this.loginUser.cmpid,
            "fy": this.loginUser.fy,
            "createdby": this.loginUser.login,
            "search": query
        }).then(data => {
            this.TaxAutodata = data;
        });
    }

    //Tax Selected
    TaxSelect(event) {
        this.invtypid = event.value;
        this.invtypname = event.label;
    }

    //Selected Tax Bind
    SelectedTax() {
        try {
            if ($(".invtype input").val() == "") {
                this._msg.Show(messageType.error, "error", "Please enter tax");
                $(".invtype input").focus();
                return;
            }
            if (this.invtypid > 0) {
                var that = this;
                this.CustAddServies.getTaxMaster({
                    "flag": "custtax",
                    "invtyp": this.invtypid,
                    "cmpid": this.loginUser.cmpid,
                    "fy": this.loginUser.fy,
                    "createdby": this.loginUser.login
                }).subscribe(data => {
                    this.taxlist = data.data[0];
                }, err => {
                    console.log("Error");
                }, () => {
                    //Complete
                })
            }
            else {
                this._msg.Show(messageType.error, "error", "Please enter valid tax");
                $(".invtype input").val();
                $(".invtype input").focus();
                return;
            }
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }
    }

    //Tax Remove in the Grid
    TaxDeleteRow(row) {
        var index = -1;
        for (var i = 0; i < this.taxlist.length; i++) {
            if (this.taxlist[i].autoid === row.autoid) {
                index = i;
                break;
            }
        }
        if (index === -1) {
            console.log("Wrong Delete Entry");
        }
        this.taxlist.splice(index, 1);
        //$(".key").focus();
    }

    // Ctrl() {
    //     setTimeout(function () {
    //         $(".ctrl").val("");
    //         $(".ctrl input").focus();
    //     }, 0)
    // }

    //Json Attribute
    createattrjson() {
        var attrid = [];
        if (this.attributemodule.attrlist.length > 0) {
            for (let items of this.attributemodule.attrlist) {
                attrid.push(items.value);
            }
            return JSON.stringify(attrid).replace('[', '{').replace(']', '}');
        }
    }

    createMRPjson() {
        var mrpid = [];
        if (this.attrPrice.attrlist.length > 0) {
            for (let items of this.attrPrice.attrlist) {
                mrpid.push(items.value);
            }
            return JSON.stringify(mrpid).replace('[', '{').replace(']', '}');
        }
    }

    //Add New Controll Center
    // AddNewCtrl() {
    //     if (this.ctrlid > 0) {
    //         this.CustAddServies.getctrldetail({
    //             "id": this.ctrlid,
    //             "cmpid": this.loginUser.cmpid
    //         }).subscribe(result => {
    //             if (result.data.length > 0) {
    //                 this.Duplicateflag = true;
    //                 for (var i = 0; i < this.Ctrllist.length; i++) {
    //                     if (this.Ctrllist[i].ctrlname == this.ctrlname) {
    //                         this.Duplicateflag = false;
    //                         break;
    //                     }
    //                 }
    //                 if (this.Duplicateflag == true) {
    //                     this.Ctrllist.push({
    //                         "ctrlname": result.data[0].ctrlname,
    //                         "proftcode": result.data[0].proftcode,
    //                         "costcode": result.data[0].costcode,
    //                         "profflag": this.profflag,
    //                         "constflag": this.constflag,
    //                         "id": result.data[0].autoid
    //                     });
    //                     this.ctrlhide = false;
    //                     this.ctrlid = 0;
    //                     this.ctrlname = "";
    //                     $(".ctrl input").focus();

    //                 }
    //                 else {
    //                     this._msg.Show(messageType.error, "error", "Duplicate control center");
    //                     this.ctrlname = "";
    //                     $(".ctrl input").focus();
    //                     return;
    //                 }
    //             }
    //             else {
    //                 this._msg.Show(messageType.error, "error", "Control name Not found");
    //                 this.ctrlname = "";
    //                 $(".ctrl input").focus();
    //                 return;
    //             }
    //         }, err => {
    //             console.log("Error")
    //         }, () => {
    //             //console.log("completed")
    //         })
    //     }
    //     else {
    //         this._msg.Show(messageType.error, "error", "Please enter valid controll center");
    //         this.ctrlname = "";
    //         this.ctrlid = 0;
    //         $(".ctrl input").focus();
    //         return;
    //     }
    // }

    //Address Book
    CreateAddressArry() {
        var adrarry = [];
        for (var i = 0; i < this.adrbookid.length; i++) {
            adrarry.push(this.adrbookid[i])
        }
        return JSON.stringify(adrarry).replace('[', '{').replace(']', '}');
    }

    //Delete Control Center Row
    // DeleteCtrl(row) {
    //     var index = -1;
    //     for (var i = 0; i < this.Ctrllist.length; i++) {
    //         if (this.Ctrllist[i].ctrlname === row.ctrlname) {
    //             index = i;
    //             break;
    //         }
    //     }
    //     if (index === -1) {
    //         console.log("Wrong Delete Entry");
    //     }
    //     this.Ctrllist.splice(index, 1);
    //     $(".ctrl").focus();
    // }

    ledgerparam() {
        var ledgerlist = [];

        ledgerlist.push({
            "cmpid": this.loginUser.cmpid,
            "fy": this.loginUser.fy,
            "typ": "cust",
            "dramt": this.ope == "" ? 0 : this.ope,
            "cramt": 0,
            "acid": this.code,
            "nar": this.remark,
            "createdby": this.loginUser.login
        });

        return ledgerlist;
    }

    //Paramter Wth Json
    paramterjson() {
        try {
            if (this.ledgerParamDT.length === 0) {
                this.ledgerParamDT.push({
                    "autoid": 0,
                    "module": "cust",
                    "cmpid": this.loginUser.cmpid,
                    "fy": this.loginUser.fy,
                    "code": this.code,
                    "trndate": new Date(),
                    "actype": "cust",
                    "dramt": this.ope == "" ? 0 : this.ope,
                    "cramt": 0,
                    "createdby": this.loginUser.login,
                    "narration": this.remark
                });
            }

            var param = {
                "custid": this.custid,
                "code": this.code,
                "custname": this.Custname,
                "warehouse": this.warehousejson(),
                "keyval": this.createkeydatajson(),
                "dis": this.discountjson(),
                "attr": this.createattrjson(),
                "mrp": this.createMRPjson(),
                "suppdoc": this.suppdoc,
                "itemsdis": this.itemsdiscountjson(),
                "trans": this.transpoterjson(),
                "sales": this.salesmanjson(),
                "isactive": this.isactive,
                "days": this.days == "" ? 0 : this.days,
                "cr": this.credit == "" ? 0 : this.credit,
                "dr": this.debit == "" ? 0 : this.debit,
                "op": this.ope == "" ? 0 : this.ope,
                "tax": this.taxjson(),
                "cmpid": this.loginUser.cmpid,
                "upper": this.upperlimit,
                "lower": this.lowerlimit,
                "remark": this.remark,
                "ctrl": this.ctrlid,
                "createdby": this.loginUser.login,
                "adrid": this.adrbookid,
                "parentid": this.parentid,
                "ledgerparam": this.ledgerParamDT,
                "dynamicfields": this.tabListDT,
                "remark1": '',
                "remark2": "",
                "remark3": []
            }
            console.log(param);
            return param;
        } catch (e) {
            this._msg.Show(messageType.error, "error", e.message);
        }

    }

    //Add Top Buttons Add Edit And Save
    actionBarEvt(evt) {
        if (evt === "clear") {
            this.ClearControll();
            $(".code").focus();
        }
        if (evt === "back") {
            this._router.navigate(['master/customer']);
        }
        if (evt === "save") {
            var validateme = commonfun.validate();
            if (!validateme.status) {
                this._msg.Show(messageType.error, "error", validateme.msglist);
                validateme.data[0].input.focus();
                return;
            }

            if (this.adrbookid.length == 0) {
                this._msg.Show(messageType.error, "error", "Please enter contact address");
                return;
            }
            if (this.salesmanlist.length == 0) {
                this._msg.Show(messageType.error, "error", "Please enter saleman");
                $(".sales input").focus();
                return;
            }
            if (this.warehouselist.length > 0) {
                var checkware = false;
                for (let wareid of this.warehouselist) {
                    if (wareid.Warechk == true) {
                        checkware = true;
                        break;
                    }
                }
                if (checkware == false) {
                    this._msg.Show(messageType.error, "error", "Please Check Warehouse");
                    return;
                }
            }
            else {
                this._msg.Show(messageType.error, "error", "Please create warehouse master");
                return;
            }
            // if (this.Ctrllist.length == 0) {
            //     this._msg.Show(messageType.error, "error", "Please enter control center");
            //     return;
            // }
            this.actionButton.find(a => a.id === "save").enabled = false;
            this.CustAddServies.saveCustomer(
                this.paramterjson()
            ).subscribe(result => {
                var dataset = result.data;
                if (dataset[0].funsave_customer.maxid == '-1') {
                    this._msg.Show(messageType.error, "error", "Customer code already exists");
                    $(".code").focus();
                    return;
                }
                if (dataset[0].funsave_customer.maxid > 0) {
                    this._msg.Show(messageType.success, "success", "Data save successfully");
                    this.ClearControll();
                    $(".code").removeAttr('disabled', 'disabled');
                    $(".code").focus();
                    if (this.issh == 1) {
                        this._router.navigate(['master/customer']);
                    }
                    else {
                        this.getcustomerdrop();
                        this.issh = 0;
                    }
                }
            }, err => {
                console.log("Error");
            }, () => {
                // console.log("Complete");
            })
            this.actionButton.find(a => a.id === "save").enabled = true;
        } else if (evt === "edit") {
            $('input').removeAttr('disabled');
            $('select').removeAttr('disabled');
            $('textarea').removeAttr('disabled');
            $(".code").attr('disabled', 'disabled');
            this.actionButton.find(a => a.id === "save").hide = false;
            this.actionButton.find(a => a.id === "edit").hide = true;
            this.addressBook.AddBook(this.code);
            $(".fname").focus();
        } else if (evt === "delete") {
            alert("delete called");
        }
    }

    //Attribute Tab Click Event
    Attr() {
        setTimeout(function () {
            $(".attr").val("");
            $(".attr").focus();
        }, 0);
    }

    //get tax master with attribute value
    getattr() {
        var attrlist = [];
        if (this.attributemodule.attrlist.length > 0) {
            for (let items of this.attributemodule.attrlist) {
                attrlist.push(items.value);
            }
        }
        //return attrlist.slice(0, -1);
        return JSON.stringify(attrlist).replace('[', '{').replace(']', '}');
    }

    //Tax Tab Click
    taxtab() {
        this.taxlist = [];
        if (this.attributemodule.attrlist.length > 0) {
            this.CustAddServies.getcustomer({
                "custid": this.custid,
                "cmpid": this.loginUser.cmpid,
                "fy": this.loginUser.fy,
                "flag": "taxdetails",
                "attrcsv": this.getattr()
            }).subscribe(result => {
                console.log(result.data)
                var dataset = result.data[0];
                if (dataset[0]._attrtax.length > 0) {
                    this.taxlist = dataset[0]._attrtax;
                }
            }, err => {
                console.log("Error")
            }, () => {
                //console.log("completed")
            })
        }
    }

    //Account Info Tab Click Event
    Acinfo() {
        setTimeout(function () {
            $(".key").val("");
            $(".val").val("");
            $(".key").focus();
        }, 0);
    }

    //Warehose Tab Click Bind
    warehouseBind() {
        var that = this;
        that.CustAddServies.getCustomerdrop({
            "cmpid": this.loginUser.cmpid,
            "createdby": this.loginUser.login
        }).subscribe(result => {
            if (result.data[0].length > 0) {
                that.warehouselist = result.data[0];
            }
            else {
                this._msg.Show(messageType.error, "error", "No warehouse found");
            }

        }, err => {
            console.log("Error");
        }, () => {
            // console.log("Complete");
        })
    }

    //Warehouse Tab Click Event
    TabWare() {
        var that = this;
        if (that.issh == 0) {
            that.issh = 1;
            that.warehouseBind();
        } else {
            that.issh == 0;
        }
    }

    ngOnDestroy() {
        this.actionButton = [];
        this.subscr_actionbarevt.unsubscribe();
        this.setActionButtons.setTitle("");
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.

/**
 * This package contains the classes for Redis cache samples.
 */
package com.azure.resourcemanager.rediscache.samples;


text:
<!DOCTYPE html>

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>mne.beamformer.Beamformer — MNE 0.17.1 documentation</title>
    <link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../_static/gallery.css" />
    <link rel="stylesheet" type="text/css" href="../_static/reset-syntax.css" />

    <link rel="shortcut icon" href="../_static/favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />

    <link rel="stylesheet" href="../_static/style.css " type="text/css" />
    <link rel="stylesheet" href="../_static/font-awesome.css" type="text/css" />
    <link rel="stylesheet" href="../_static/flag-icon.css" type="text/css" />

  <link rel="canonical" href="https://mne.tools/stable/index.html" />

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">

        </button>

        0.17.1

Install

Documentation

API

Glossary

Examples

Contribute

  Site

  <button type="button" class="btn btn-primary navbar-btn dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">
    v0.17.1

  </button>

Development

v0.17 (stable)

v0.16

v0.15

v0.14

v0.13

v0.12

v0.11

<form class="navbar-form navbar-right" action="../search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

mne.beamformer.Beamformer

<form action="../search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

mne.beamformer.Beamformer¶

class mne.beamformer.Beamformer[source]¶

A computed beamformer.

Notes

New in version 0.17.

Methods

<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>

__contains__($self, key, /)
True if D has a key k, else False.

__getitem__
x.__getitem__(y) <==> x[y]

__iter__($self, /)
Implement iter(self).

__len__($self, /)
Return len(self).

clear()

copy()
Copy the beamformer.

fromkeys($type, iterable[, value])
Returns a new dict with keys from iterable and values equal to value.

get(k[,d])

items()

keys()

pop(k[,d])
If key is not found, d is returned if given, otherwise KeyError is raised

popitem()
2-tuple; but raise KeyError if D is empty.

save(fname[, overwrite, verbose])
Save the beamformer filter.

setdefault(k[,d])

update([E, ]**F)
If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v In either case, this is followed by: for k in F:  D[k] = F[k]

values()

__contains__($self, key, /)¶

True if D has a key k, else False.

__getitem__()¶

x.__getitem__(y) <==> x[y]

__iter__($self, /)¶

Implement iter(self).

__len__($self, /)¶

Return len(self).

clear() → None.  Remove all items from D.¶

copy()[source]¶

Copy the beamformer.

<col class="field-name" />
<col class="field-body" />

Returns:

beamformer : instance of Beamformer

A deep copy of the beamformer.

fromkeys($type, iterable, value=None, /)¶

Returns a new dict with keys from iterable and values equal to value.

get(k[, d]) → D[k] if k in D, else d.  d defaults to None.¶

items() → a set-like object providing a view on D's items¶

keys() → a set-like object providing a view on D's keys¶

pop(k[, d]) → v, remove specified key and return the corresponding value.¶

If key is not found, d is returned if given, otherwise KeyError is raised

popitem() → (k, v), remove and return some (key, value) pair as a¶

2-tuple; but raise KeyError if D is empty.

save(fname, overwrite=False, verbose=None)[source]¶

Save the beamformer filter.

<col class="field-name" />
<col class="field-body" />

Parameters:

fname : str

The filename to use to write the HDF5 data.
Should end in '-lcmv.h5' or '-dics.h5'.

overwrite : bool

If True, overwrite the file (if it exists).

verbose : bool, str, int, or None

If not None, override default verbose level (see
mne.verbose() and Logging documentation
for more).

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D¶

update([E, ]**F) → None.  Update D from dict/iterable E and F.¶

If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]
If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v
In either case, this is followed by: for k in F:  D[k] = F[k]

values() → an object providing a view on D's values¶

GitHub

·

Mailing list

·

Gitter

·

What's new

·

Cite MNE

Back to top

© Copyright 2012-2019, MNE Developers. Last updated on 2019-02-22.


text:
namespace CommandBlockLanguageInterpreter
{
    partial class PlayerControls
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PlayerControls));
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.button4 = new System.Windows.Forms.Button();
            this.button5 = new System.Windows.Forms.Button();
            this.button6 = new System.Windows.Forms.Button();
            this.button7 = new System.Windows.Forms.Button();
            this.button8 = new System.Windows.Forms.Button();
            this.button9 = new System.Windows.Forms.Button();
            this.button10 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // textBox1
            //
            this.textBox1.BackColor = System.Drawing.Color.Black;
            this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.textBox1.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.textBox1.ForeColor = System.Drawing.Color.White;
            this.textBox1.Location = new System.Drawing.Point(12, 67);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(399, 22);
            this.textBox1.TabIndex = 0;
            //
            // label1
            //
            this.label1.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.ForeColor = System.Drawing.Color.White;
            this.label1.Location = new System.Drawing.Point(12, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(399, 26);
            this.label1.TabIndex = 1;
            this.label1.Text = "label1";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            //
            // button1
            //
            this.button1.BackColor = System.Drawing.Color.DarkGray;
            this.button1.FlatAppearance.BorderSize = 0;
            this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button1.ForeColor = System.Drawing.Color.White;
            this.button1.Location = new System.Drawing.Point(12, 95);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 2;
            this.button1.Text = "Tell";
            this.button1.UseVisualStyleBackColor = false;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // button2
            //
            this.button2.BackColor = System.Drawing.Color.DarkGray;
            this.button2.FlatAppearance.BorderSize = 0;
            this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button2.ForeColor = System.Drawing.Color.White;
            this.button2.Location = new System.Drawing.Point(174, 95);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(75, 23);
            this.button2.TabIndex = 3;
            this.button2.Text = "Kick";
            this.button2.UseVisualStyleBackColor = false;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            //
            // button3
            //
            this.button3.BackColor = System.Drawing.Color.DarkGray;
            this.button3.FlatAppearance.BorderSize = 0;
            this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button3.ForeColor = System.Drawing.Color.White;
            this.button3.Location = new System.Drawing.Point(255, 95);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(75, 23);
            this.button3.TabIndex = 4;
            this.button3.Text = "Ban";
            this.button3.UseVisualStyleBackColor = false;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            //
            // button4
            //
            this.button4.BackColor = System.Drawing.Color.DarkGray;
            this.button4.FlatAppearance.BorderSize = 0;
            this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button4.ForeColor = System.Drawing.Color.White;
            this.button4.Location = new System.Drawing.Point(12, 38);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(75, 23);
            this.button4.TabIndex = 5;
            this.button4.Text = "OP";
            this.button4.UseVisualStyleBackColor = false;
            this.button4.Click += new System.EventHandler(this.button4_Click);
            //
            // button5
            //
            this.button5.BackColor = System.Drawing.Color.DarkGray;
            this.button5.FlatAppearance.BorderSize = 0;
            this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button5.ForeColor = System.Drawing.Color.White;
            this.button5.Location = new System.Drawing.Point(93, 38);
            this.button5.Name = "button5";
            this.button5.Size = new System.Drawing.Size(75, 23);
            this.button5.TabIndex = 6;
            this.button5.Text = "De-Op";
            this.button5.UseVisualStyleBackColor = false;
            this.button5.Click += new System.EventHandler(this.button5_Click);
            //
            // button6
            //
            this.button6.BackColor = System.Drawing.Color.DarkGray;
            this.button6.FlatAppearance.BorderSize = 0;
            this.button6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button6.ForeColor = System.Drawing.Color.White;
            this.button6.Location = new System.Drawing.Point(336, 95);
            this.button6.Name = "button6";
            this.button6.Size = new System.Drawing.Size(75, 23);
            this.button6.TabIndex = 7;
            this.button6.Text = "IP Ban";
            this.button6.UseVisualStyleBackColor = false;
            this.button6.Click += new System.EventHandler(this.button6_Click);
            //
            // button7
            //
            this.button7.BackColor = System.Drawing.Color.DarkGray;
            this.button7.FlatAppearance.BorderSize = 0;
            this.button7.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button7.ForeColor = System.Drawing.Color.White;
            this.button7.Location = new System.Drawing.Point(93, 95);
            this.button7.Name = "button7";
            this.button7.Size = new System.Drawing.Size(75, 23);
            this.button7.TabIndex = 8;
            this.button7.Text = "Execute";
            this.button7.UseVisualStyleBackColor = false;
            this.button7.Click += new System.EventHandler(this.button7_Click);
            //
            // button8
            //
            this.button8.BackColor = System.Drawing.Color.DarkGray;
            this.button8.FlatAppearance.BorderSize = 0;
            this.button8.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button8.ForeColor = System.Drawing.Color.White;
            this.button8.Location = new System.Drawing.Point(174, 38);
            this.button8.Name = "button8";
            this.button8.Size = new System.Drawing.Size(75, 23);
            this.button8.TabIndex = 9;
            this.button8.Text = "Whitelist";
            this.button8.UseVisualStyleBackColor = false;
            this.button8.Click += new System.EventHandler(this.button8_Click);
            //
            // button9
            //
            this.button9.BackColor = System.Drawing.Color.DarkGray;
            this.button9.FlatAppearance.BorderSize = 0;
            this.button9.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button9.ForeColor = System.Drawing.Color.White;
            this.button9.Location = new System.Drawing.Point(255, 38);
            this.button9.Name = "button9";
            this.button9.Size = new System.Drawing.Size(75, 23);
            this.button9.TabIndex = 10;
            this.button9.Text = "Un-Whitelist";
            this.button9.UseVisualStyleBackColor = false;
            this.button9.Click += new System.EventHandler(this.button9_Click);
            //
            // button10
            //
            this.button10.BackColor = System.Drawing.Color.DarkGray;
            this.button10.FlatAppearance.BorderSize = 0;
            this.button10.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button10.ForeColor = System.Drawing.Color.White;
            this.button10.Location = new System.Drawing.Point(336, 38);
            this.button10.Name = "button10";
            this.button10.Size = new System.Drawing.Size(75, 23);
            this.button10.TabIndex = 11;
            this.button10.Text = "Kill";
            this.button10.UseVisualStyleBackColor = false;
            this.button10.Click += new System.EventHandler(this.button10_Click);
            //
            // PlayerControls
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.Color.DimGray;
            this.ClientSize = new System.Drawing.Size(425, 135);
            this.Controls.Add(this.button10);
            this.Controls.Add(this.button9);
            this.Controls.Add(this.button8);
            this.Controls.Add(this.button7);
            this.Controls.Add(this.button6);
            this.Controls.Add(this.button5);
            this.Controls.Add(this.button4);
            this.Controls.Add(this.button3);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.textBox1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "PlayerControls";
            this.Text = "Player Controls";
            this.Load += new System.EventHandler(this.PlayerControls_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Button button4;
        private System.Windows.Forms.Button button5;
        private System.Windows.Forms.Button button6;
        private System.Windows.Forms.Button button7;
        private System.Windows.Forms.Button button8;
        private System.Windows.Forms.Button button9;
        private System.Windows.Forms.Button button10;
    }
}


text:
package com.github.stathvaille.marketimports.service;

import com.github.stathvaille.marketimports.domain.esi.MarketOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;

import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Utility code for handling ESI calls which may have multiple pages of response
 */
public class MultiPageESIRequest<T> {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    public List<T> makeESICall(URI uri, ParameterizedTypeReference esiObjectType, RestTemplate restTemplate){
        try{
            // First get headers to figure out how many pages there are
            HttpHeaders responseHeader = restTemplate.headForHeaders(uri);
            int numberOfPages = Integer.parseInt(responseHeader.getFirst("X-Pages"));
            logger.info(String.format("There are %d pages for endpoint: %s", numberOfPages, uri));

            List<T> allResults = new ArrayList<T>();
            for (int page = 1; page <= numberOfPages; page++){
                allResults.addAll(getForPage(page, numberOfPages, uri, esiObjectType, restTemplate));
            }

            return allResults;
        }
        catch (RestClientException e){
            logger.error("Error calling API getting", e.getMessage());
            throw new RuntimeException("Could not make mulit page ESI call", e);
        }
    }

    private List<T> getForPage(int pageNumber, int totalNumberOfPages, URI uri, ParameterizedTypeReference esiObjectType, RestTemplate restTemplate){
        URI pageUri = UriComponentsBuilder.fromUri(uri).queryParam("page", pageNumber).build().toUri();
        logger.info(String.format("Getting page %d/%d at endpoint: %s", pageNumber, totalNumberOfPages, pageUri.toString()));
        MultiValueMap<String, String> requestHeaders = new HttpHeaders();
        HttpEntity<?> entity = new HttpEntity<>(requestHeaders); // for request
        HttpEntity<List<T>> response = restTemplate.exchange(pageUri, HttpMethod.GET, entity, esiObjectType);
        return response.getBody();
    }
}


text:
"""
byceps.services.guest_server.transfer.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2014-2022 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""

from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime
from ipaddress import IPv4Address, IPv6Address
from typing import NewType, Optional, Union
from uuid import UUID

from ....typing import PartyID, UserID

IPAddress = Union[IPv4Address, IPv6Address]

ServerID = NewType('ServerID', UUID)

AddressID = NewType('AddressID', UUID)

@dataclass(frozen=True)
class Setting:
    party_id: PartyID
    netmask: Optional[IPAddress]
    gateway: Optional[IPAddress]
    dns_server1: Optional[IPAddress]
    dns_server2: Optional[IPAddress]
    domain: Optional[str]

@dataclass(frozen=True)
class Server:
    id: ServerID
    party_id: PartyID
    created_at: datetime
    creator_id: UserID
    owner_id: UserID
    notes_owner: Optional[str]
    notes_admin: Optional[str]
    approved: bool
    addresses: set[Address]

@dataclass(frozen=True)
class Address:
    id: AddressID
    server_id: ServerID
    ip_address: Optional[IPAddress]
    hostname: Optional[str]
    netmask: Optional[IPAddress]
    gateway: Optional[IPAddress]


text:
const fs = require('fs');

const net = require('./lib/net');
const loadImage = require('./lib/loadImage');

(async () => {
	const input = await loadImage(process.argv[2], false);

	const output = net.update(input);

	const max = Math.max(...output);
	const maxIndex = output.indexOf(max);

	const colors = {
		0: 'green',
		1: 'yellow',
		2: 'red'
	};

	console.log(output);
	console.log(`Traffic lights are '${colors[maxIndex]}' with a ${(max * 100).toFixed(2)}% probability.`);
})();


text:
MAYBE_SUDO=$1
grep -i ubuntu /proc/version > /dev/null
if [ "$?" -eq "0" ]; then
    # ubuntu
    echo Running on Ubuntu
    if ${MAYBE_SUDO} grep -q -E '[^!]requiretty' /etc/sudoers; then
        echo creating sudoers user file
        echo "Defaults:`whoami` !requiretty" | ${MAYBE_SUDO} tee /etc/sudoers.d/`whoami` >/dev/null
        ${MAYBE_SUDO} chmod 0440 /etc/sudoers.d/`whoami`
    else
        echo No requiretty directive found, nothing to do
    fi
else
    # other - modify sudoers file
    if [ ! -f "/etc/sudoers" ]; then
        echo "sudoers file not found in /etc/sudoers"
        exit 1
    fi
    echo Setting privileged mode
    ${MAYBE_SUDO} sed -i 's/^Defaults.*requiretty/#&/g' /etc/sudoers
fi


text:
export * from "./PartnerArtists"
export * from "./PartnerArtistList"
export * from "./PartnerArtistItem"
export * from "./PartnerArtistListPlaceholder"


text:
package org.asciidoctor.extension;

import java.util.List;

public interface Reader {

    /**
     * Get the 1-based offset of the current line.
     *
     * @return 1-based offset.
     */
    int getLineno();

    /**
     * Check whether there are any lines left to read. If a previous call to this method resulted in a value of false,
     * immediately returned the cached value. Otherwise, delegate to peek_line to determine if there is a next line
     * available.
     *
     * @return True if there are more lines, False if there are not.
     */
    boolean hasMoreLines();

    /**
     * Peek at the next line and check if it's empty (i.e., whitespace only)
     *
     * This method Does not consume the line from the stack.
     *
     * @return True if the there are no more lines or if the next line is empty
     */
    boolean isNextLineEmpty();

    /**
     * Get the remaining lines of source data joined as a String. Delegates to Reader#read_lines, then joins the result.
     *
     * @return the lines read joined as a String
     */
    String read();

    /**
     * Get the remaining lines of source data. This method calls Reader#read_line repeatedly until all lines are
     * consumed and returns the lines as a String Array. This method differs from Reader#lines in that it processes each
     * line in turn, hence triggering any preprocessors implemented in sub-classes.
     *
     * @return the lines read as a String Array
     */
    List<String> readLines();

    List<String> lines();

    /**
     * Advance to the next line by discarding the line at the front of the stack
     *
     * @return a Boolean indicating whether there was a line to discard.
     */
    boolean advance();

    /**
     *
     * Public: Advance to the end of the reader, consuming all remaining lines
     */
    void terminate();
}


text:
@implementation SDLJingle

+ (NSString *)NEGATIVE_JINGLE {
    return @"NEGATIVE_JINGLE";
}
+ (NSString *)POSITIVE_JINGLE {
    return @"POSITIVE_JINGLE";
}
+ (NSString *)LISTEN_JINGLE {
    return @"LISTEN_JINGLE";
}
+ (NSString *)INITIAL_JINGLE {
    return @"INITIAL_JINGLE";
}
+ (NSString *)HELP_JINGLE {
    return @"HELP_JINGLE";
}

@end


text:
import express from 'express'
import { join } from 'path'
import favicon from 'serve-favicon'
import logger from 'morgan'
import bodyParser from 'body-parser'
import session from 'express-session'

import mainRoute from './server/routes/main'
import config from './webpack.config'

import routes from './src/routes/routes.jsx'

import { SESSION_PASS } from './config/config'

const app = express()

const buildDir = '/build'
const staticDir = join(__dirname, buildDir)

// uncomment after placing your favicon in /public
app.use(favicon(join(__dirname, '/public/favicon.ico')))
app.use(logger('dev'))
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use(session({
  secret           : SESSION_PASS,
  resave           : false,
  saveUninitialized: false
}))
app.use(express.static(join(__dirname, 'public')))

app.use('/static', express.static(staticDir))
app.use('/', mainRoute)

export default app


text:
//
// Depot library - a Java relational persistence library
// https://github.com/threerings/depot/blob/master/LICENSE

package com.samskivert.depot.clause;

import com.samskivert.depot.SQLFragment;

/**
 * Represents a piece or modifier of an SQL query.
 */
public interface QueryClause extends SQLFragment
{
}


text:
package org.spongepowered.common.event.tracking.phase.packet;

import net.minecraft.entity.player.EntityPlayerMP;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.data.Transaction;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.event.SpongeEventFactory;
import org.spongepowered.api.event.item.inventory.ClickInventoryEvent;
import org.spongepowered.api.item.inventory.Container;
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
import org.spongepowered.api.item.inventory.transaction.SlotTransaction;

import java.util.List;

final class DoubleClickInventoryState extends BasicInventoryPacketState {

    DoubleClickInventoryState() {
        super(PacketPhase.MODE_DOUBLE_CLICK | PacketPhase.BUTTON_PRIMARY | PacketPhase.BUTTON_SECONDARY, PacketPhase.MASK_MODE | PacketPhase.MASK_BUTTON);
    }

    @Override
    public ClickInventoryEvent createInventoryEvent(EntityPlayerMP playerMP, Container openContainer, Transaction<ItemStackSnapshot> transaction,
            List<SlotTransaction> slotTransactions, List<Entity> capturedEntities, int usedButton) {
        return SpongeEventFactory.createClickInventoryEventDouble(Sponge.getCauseStackManager().getCurrentCause(), transaction, openContainer, slotTransactions);
    }
}


text:
class Category < ActiveRecord::Base
  has_many :topics
  belongs_to :type

  #
  def self.get_all_items(page,per_page="10")
    paginate :per_page => per_page, :page => page
  end

end


text:
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Group extends Model
{
    public function links()
    {
        return $this->hasMany('App\Link');
    }
}