text:
package com.hibegin.http.server.handler;

import com.hibegin.common.util.BytesUtil;
import com.hibegin.common.util.LoggerUtil;

import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLEngineResult.HandshakeStatus;
import javax.net.ssl.SSLEngineResult.Status;
import javax.net.ssl.SSLException;
import java.io.EOFException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * A helper class which performs I/O using the SSLEngine API.
 *

 * Each connection has a SocketChannel and a SSLEngine that is
 * used through the lifetime of the Channel.  We allocate byte buffers
 * for use as the outbound and inbound network buffers.
 *

 *

 * Application Data
 * src      requestBB
 * |           ^
 * |     |     |
 * v     |     |
 * +----+-----|-----+----+
 * |          |          |
 * |       SSL|Engine    |
 * wrap()  |          |          |  unwrap()
 * | OUTBOUND | INBOUND  |
 * |          |          |
 * +----+-----|-----+----+
 * |     |     ^
 * |     |     |
 * v           |
 * outNetBB     inNetBB
 * Net data
 *

 *

 * These buffers handle all of the intermediary data for the SSL
 * connection.  To make things easy, we'll require outNetBB be
 * completely flushed before trying to wrap any more data, but we
 * could certainly remove that restriction by using larger buffers.
 *

 * There are many, many ways to handle compute and I/O strategies.
 * What follows is a relatively simple one.  The reader is encouraged
 * to develop the strategy that best fits the application.
 *

 * In most of the non-blocking operations in this class, we let the
 * Selector tell us when we're ready to attempt an I/O operation (by the
 * application repeatedly calling our methods).  Another option would be
 * to attempt the operation and return from the method when no forward
 * progress can be made.
 *

 * There's lots of room for enhancements and improvement in this example.
 *

 * We're checking for SSL/TLS end-of-stream truncation attacks via
 * sslEngine.closeInbound().  When you reach the end of a input stream
 * via a read() returning -1 or an IOException, we call
 * sslEngine.closeInbound() to signal to the sslEngine that no more
 * input will be available.  If the peer's close_notify message has not
 * yet been received, this could indicate a trucation attack, in which
 * an attacker is trying to prematurely close the connection.   The
 * closeInbound() will throw an exception if this condition were
 * present.
 *
 * @author Brad R. Wetmore
 * @author Mark Reinhold
 * @version 1.2, 04/07/26
 */
public class SslReadWriteSelectorHandler extends PlainReadWriteSelectorHandler {

    private static final Logger LOGGER = LoggerUtil.getLogger(SslReadWriteSelectorHandler.class);
    /**
     * An empty ByteBuffer for use when one isn't available, say
     * as a source buffer during initial handshake wraps or for close
     * operations.
     */
    private static ByteBuffer hsBB = ByteBuffer.allocate(0);
    private SSLEngine sslEngine;
    /**
     * All I/O goes through these buffers.
     *

     * It might be nice to use a cache of ByteBuffers so we're
     * not alloc/dealloc'ing ByteBuffer's for each new SSLEngine.
     *

     * We use our superclass' requestBB for our application input buffer.
     * Outbound application data is supplied to us by our callers.
     */
    private ByteBuffer inNetBB;
    private ByteBuffer outNetBB;
    /**
     * The FileChannel we're currently transferTo'ing (reading).
     */
    private ByteBuffer fileChannelBB = null;

    /**
     * During our initial handshake, keep track of the next
     * SSLEngine operation that needs to occur:
     *

     * NEED_WRAP/NEED_UNWRAP
     *

     * Once the initial handshake has completed, we can short circuit
     * handshake checks with initialHSComplete.
     */
    private HandshakeStatus initialHSStatus;
    private boolean initialHSComplete;

    /**
     * We have received the shutdown request by our caller, and have
     * closed our outbound side.
     */
    private boolean shutdown = false;

    /**
     * Constructor for a secure ChannelIO variant.
     */
    public SslReadWriteSelectorHandler(SocketChannel sc, SelectionKey selectionKey,
                                       SSLContext sslContext) throws IOException {
        super(sc);

        sslEngine = sslContext.createSSLEngine();
        sslEngine.setUseClientMode(false);
        initialHSStatus = HandshakeStatus.NEED_UNWRAP;
        initialHSComplete = false;

        int netBBSize = sslEngine.getSession().getPacketBufferSize();
        inNetBB = ByteBuffer.allocate(netBBSize);
        outNetBB = ByteBuffer.allocate(netBBSize);
        outNetBB.position(0);
        outNetBB.limit(0);

        int appBBSize = sslEngine.getSession().getApplicationBufferSize();
        requestBB = ByteBuffer.allocate(appBBSize);

        while (!doHandshake(selectionKey)) {

        }
    }

    /**
     * Writes bb to the SocketChannel.
     *

     * Returns true when the ByteBuffer has no remaining data.
     */
    private boolean tryFlush(ByteBuffer bb) throws IOException {
        sc.write(bb);
        return !bb.hasRemaining();
    }

    /**
     * Perform any handshaking processing.
     *

     * If a SelectionKey is passed, register for selectable
     * operations.
     *

     * In the blocking case, our caller will keep calling us until
     * we finish the handshake.  Our reads/writes will block as expected.
     *

     * In the non-blocking case, we just received the selection notification
     * that this channel is ready for whatever the operation is, so give
     * it a try.
     *

     * return:
     * true when handshake is done.
     * false while handshake is in progress
     */
    boolean doHandshake(SelectionKey sk) throws IOException {

        SSLEngineResult result;

        if (initialHSComplete) {
            return true;
        }

        /*
         * Flush out the outgoing buffer, if there's anything left in
         * it.
         */
        if (outNetBB.hasRemaining()) {

            if (!tryFlush(outNetBB)) {
                return false;
            }

            // See if we need to switch from write to read mode.

            switch (initialHSStatus) {

                /*
                 * Is this the last buffer?
                 */
                case FINISHED:
                    initialHSComplete = true;
                    // Fall-through to reregister need for a Read.

                case NEED_UNWRAP:
                    if (sk != null) {
                        sk.interestOps(SelectionKey.OP_READ);
                    }
                    break;
            }

            return initialHSComplete;
        }

        switch (initialHSStatus) {

            case NEED_UNWRAP:
                if (sc.read(inNetBB) == -1) {
                    sslEngine.closeInbound();
                    return initialHSComplete;
                }

                needIO:
                while (initialHSStatus == HandshakeStatus.NEED_UNWRAP) {
                    /*
                     * Don't need to resize requestBB, since no app data should
                     * be generated here.
                     */
                    inNetBB.flip();
                    result = sslEngine.unwrap(inNetBB, requestBB);
                    inNetBB.compact();

                    initialHSStatus = result.getHandshakeStatus();

                    switch (result.getStatus()) {

                        case OK:
                            switch (initialHSStatus) {
                                case NOT_HANDSHAKING:
                                    throw new IOException(
                                            "Not handshaking during initial handshake");

                                case NEED_TASK:
                                    initialHSStatus = doTasks();
                                    break;

                                case FINISHED:
                                    initialHSComplete = true;
                                    break needIO;
                            }

                            break;

                        case BUFFER_UNDERFLOW:
                            /*
                             * Need to go reread the Channel for more data.
                             */
                            if (sk != null) {
                                sk.interestOps(SelectionKey.OP_READ);
                            }
                            break needIO;

                        default: // BUFFER_OVERFLOW/CLOSED:
                            throw new IOException("Received" + result.getStatus() +
                                    "during initial handshaking");
                    }
                }  // "needIO" block.

                /*
                 * Just transitioned from read to write.
                 */
                if (initialHSStatus != HandshakeStatus.NEED_WRAP) {
                    break;
                }

                // Fall through and fill the write buffers.

            case NEED_WRAP:
                /*
                 * The flush above guarantees the out buffer to be empty
                 */
                outNetBB.clear();
                result = sslEngine.wrap(hsBB, outNetBB);
                outNetBB.flip();

                initialHSStatus = result.getHandshakeStatus();

                switch (result.getStatus()) {
                    case OK:

                        if (initialHSStatus == HandshakeStatus.NEED_TASK) {
                            initialHSStatus = doTasks();
                        }

                        if (sk != null) {
                            sk.interestOps(SelectionKey.OP_WRITE);
                        }

                        break;

                    default: // BUFFER_OVERFLOW/BUFFER_UNDERFLOW/CLOSED:
                        throw new IOException("Received" + result.getStatus() +
                                "during initial handshaking");
                }
                break;

            default: // NOT_HANDSHAKING/NEED_TASK/FINISHED
                throw new RuntimeException("Invalid Handshaking State" +
                        initialHSStatus);
        } // switch

        return initialHSComplete;
    }

    /**
     * Do all the outstanding handshake tasks in the current Thread.
     */
    private SSLEngineResult.HandshakeStatus doTasks() {
        Runnable runnable;

        /*
         * We could run this in a separate thread, but
         * do in the current for now.
         */
        while ((runnable = sslEngine.getDelegatedTask()) != null) {
            runnable.run();
        }
        return sslEngine.getHandshakeStatus();
    }

    /**
     * Read the channel for more information, then unwrap the
     * (hopefully application) data we get.
     *

     * If we run out of data, we'll return to our caller (possibly using
     * a Selector) to get notification that more is available.
     *

     * Each call to this method will perform at most one underlying read().
     */
    @Override
    public ByteBuffer handleRead() throws IOException {
        readLock.lock();
        try {
            checkRequestBB();
            SSLEngineResult result;

            if (!initialHSComplete) {
                throw new IllegalStateException();
            }

            int pos = requestBB.position();

            if (sc.read(inNetBB) == -1) {
                // probably throws exception
                sslEngine.closeInbound();
                throw new EOFException();
            }

            do {
                // guarantees enough room for unwrap
                resizeRequestBB(inNetBB.remaining());
                inNetBB.flip();
                result = sslEngine.unwrap(inNetBB, requestBB);
                inNetBB.compact();

                /*
                 * Could check here for a renegotation, but we're only
                 * doing a simple read/write, and won't have enough state
                 * transitions to do a complete handshake, so ignore that
                 * possibility.
                 */
                switch (result.getStatus()) {

                    case BUFFER_UNDERFLOW:
                    case OK:
                        if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
                            doTasks();
                        }
                        break;

                    default:
                        throw new IOException("sslEngine error during data read: " +
                                result.getStatus());
                }
            } while ((inNetBB.position() != 0) &&
                    result.getStatus() != Status.BUFFER_UNDERFLOW);
            int readLength = requestBB.position() - pos;
            ByteBuffer byteBuffer = ByteBuffer.allocate(readLength);
            byteBuffer.put(BytesUtil.subBytes(requestBB.array(), pos, readLength));
            return byteBuffer;
        } catch (IOException e) {
            close();
            throw e;
        } finally {
            readLock.unlock();
        }
    }

    /**
     * Try to flush out any existing outbound data, then try to wrap
     * anything new contained in the src buffer.
     *

     * Return the number of bytes actually consumed from the buffer,
     * but the data may actually be still sitting in the output buffer,
     * waiting to be flushed.
     */
    private int doWrite(ByteBuffer src) throws IOException {
        int retValue = 0;

        if (outNetBB.hasRemaining() && !tryFlush(outNetBB)) {
            return retValue;
        }

        /*
         * The data buffer is empty, we can reuse the entire buffer.
         */
        outNetBB.clear();

        SSLEngineResult result = sslEngine.wrap(src, outNetBB);
        retValue = result.bytesConsumed();

        outNetBB.flip();

        if (result.getStatus() == Status.OK) {
            if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
                doTasks();
            }
        } else {
            throw new IOException("sslEngine error during data write: " +
                    result.getStatus());
        }

        /*
         * Try to flush the data, regardless of whether or not
         * it's been selected.  Odds of a write buffer being full
         * is less than a read buffer being empty.
         */
        tryFlush(src);
        if (outNetBB.hasRemaining()) {
            tryFlush(outNetBB);
        }

        return retValue;
    }

    /**
     * Flush any remaining data.
     *

     * Return true when the fileChannelBB and outNetBB are empty.
     */
    private boolean dataFlush() throws IOException {
        boolean fileFlushed = true;

        if ((fileChannelBB != null) && fileChannelBB.hasRemaining()) {
            doWrite(fileChannelBB);
            fileFlushed = !fileChannelBB.hasRemaining();
        } else if (outNetBB.hasRemaining()) {
            tryFlush(outNetBB);
        }

        return (fileFlushed && !outNetBB.hasRemaining());
    }

    /**
     * Begin the shutdown process.
     *

     * Close out the SSLEngine if not already done so, then
     * wrap our outgoing close_notify message and try to send it on.
     *

     * Return true when we're done passing the shutdown messsages.
     */
    private boolean shutdown() throws IOException {

        if (!shutdown) {
            sslEngine.closeOutbound();
            shutdown = true;
        }

        if (outNetBB.hasRemaining() && tryFlush(outNetBB)) {
            return false;
        }

        /*
         * By RFC 2616, we can "fire and forget" our close_notify
         * message, so that's what we'll do here.
         */
        outNetBB.clear();
        SSLEngineResult result = sslEngine.wrap(hsBB, outNetBB);
        if (result.getStatus() != Status.CLOSED) {
            throw new SSLException("Improper close state");
        }
        outNetBB.flip();

        /*
         * We won't wait for a select here, but if this doesn't work,
         * we'll cycle back through on the next select.
         */
        if (outNetBB.hasRemaining()) {
            tryFlush(outNetBB);
        }

        return (!outNetBB.hasRemaining() &&
                (result.getHandshakeStatus() != HandshakeStatus.NEED_WRAP));
    }

    @Override
    public void handleWrite(ByteBuffer byteBuffer) throws IOException {
        writeLock.lock();
        try {
            while (byteBuffer.hasRemaining() && sc.isOpen()) {
                int len = doWrite(byteBuffer);
                if (len < 0) {
                    throw new EOFException();
                }
            }
        } finally {
            writeLock.unlock();
        }
    }

    @Override
    public void close() {
        try {
            while (!dataFlush()) {

            }
            do {
            } while (!shutdown());
            super.close();
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, "", e);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System.Diagnostics.CodeAnalysis;
using System.Net.NetworkInformation;
using Thinktecture.Net.NetworkInformation;
using Thinktecture.Net.NetworkInformation.Adapters;

// ReSharper disable once CheckNamespace
namespace Thinktecture
{
   /// <summary>
   /// Extensions for <see cref="NetworkAvailabilityEventArgs"/>.
   /// </summary>
   // ReSharper disable once InconsistentNaming
   public static class NetworkAvailabilityEventArgsExtensions
   {
      /// <summary>
      /// Converts provided info to <see cref="INetworkAvailabilityEventArgs"/>.
      /// </summary>
      /// <param name="eventArgs">Event args to convert.</param>
      /// <returns>Converted event args.</returns>
      [return: NotNullIfNotNull("eventArgs")]
      public static INetworkAvailabilityEventArgs? ToInterface(this NetworkAvailabilityEventArgs? eventArgs)
      {
         return (eventArgs == null) ? null : new NetworkAvailabilityEventArgsAdapter(eventArgs);
      }

      /// <summary>
      /// Converts provided <see cref="INetworkAvailabilityEventArgs"/> info to <see cref="NetworkAvailabilityEventArgs"/>.
      /// </summary>
      /// <param name="abstraction">Instance of <see cref="INetworkAvailabilityEventArgs"/> to convert.</param>
      /// <returns>An instance of <see cref="NetworkAvailabilityEventArgs"/>.</returns>
      [return: NotNullIfNotNull("abstraction")]
      public static NetworkAvailabilityEventArgs? ToImplementation(this INetworkAvailabilityEventArgs? abstraction)
      {
         return ((IAbstraction<NetworkAvailabilityEventArgs>?)abstraction)?.UnsafeConvert();
      }
   }
}


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

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

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

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

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>@project.groupId@</groupId>
    <artifactId>@project.artifactId@-cache-test</artifactId>
    <version>@project.version@</version>

    <properties>
        <maven.compiler.release>11</maven.compiler.release>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <version>@project.version@</version>
                <executions>
                    <execution>
                        <id>format-code</id>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


text:
.table{font-size: 0.7em;}
.table tr td{border-top: none!important;}
.table tr td:first-child{
	margin-left: 0px;
	padding-left: 0px;
	text-align: left;
}
#productlist{font-size: 0.8em;}
#productlist tr td{
	text-align: center;
	vertical-align: middle;
	height:30px;
}
#productlist tbody td input{
	border:none;
	border-shadow:0;
	width: 96%;
	text-align: center;
}
.container-fluid{width: 1200px!important;/*²»Ê¹ÓÃÏìӦʽ,̨ʽ»úÓÃ*/}
.searcher:hover{
	color: blue;
	cursor: pointer;
}
#productinfo{padding-left: 0px;}
#productinfo table tr td{
	font-size: 0.9em;
	text-align: left;
}
#pay_form input{color: red;}
#pay_form .form-control[readonly]{
	color: red;
	background-color: #fff
}
.modal-backdrop.in{z-index: -9;}
.head{text-align: center;}
.well{border-radius:0;}


text:
using System;
using System.Collections.Generic;
using ReflectionLibrary.Enums;
using ReflectionLibrary.Interfaces;
#pragma warning disable 1591

namespace ReflectionLibrary.Models
{
    public class ReflectedProperty : IReflectedProperty
    {
        public ReflectedProperty()
        {
            Attributes = new HashSet<Attribute>();
        }
        /// <summary>
        /// Property Name
        /// </summary>
        public string Name { get; set; }

        public string PropertyTypeName { get; set; }

        public bool IsSimple { get; set; }
        public SimpleTypeEnum SimpleTypeEnum { get; set; }
        public ISimpleTypeParser SimpleTypeParser { get; set; }

        public bool IsComplex { get; set; }
        public bool IsCollection { get; set; }
        public string CollectionItemTypeName { get; set; }
        public bool IsNullable { get; set; }

        public IReflectedPropertyOperations ReflectedPropertyOperations { get; set; }
        public IReflectedClass ReflectedClass { get; set; }
        public ICollection<Attribute> Attributes { get; set; }

        public override string ToString()
        {
            return String.Format("{0}({1}) - {2} Attributes", Name, PropertyTypeName, Attributes.Count);
        }
    }
}


text:
<?php

namespace PHPExiftool\Driver\Tag\CanonCustom;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class SafetyShift extends AbstractTag
{

    protected $Id = 264;

    protected $Name = 'SafetyShift';

    protected $FullName = 'CanonCustom::Functions2';

    protected $GroupName = 'CanonCustom';

    protected $g0 = 'MakerNotes';

    protected $g1 = 'CanonCustom';

    protected $g2 = 'Camera';

    protected $Type = 'int32s';

    protected $Writable = true;

    protected $Description = 'Safety Shift';

    protected $flag_Permanent = true;

    protected $Values = array(
        0 => array(
            'Id' => 0,
            'Label' => 'Disable',
        ),
        1 => array(
            'Id' => 1,
            'Label' => 'Enable (Tv/Av)',
        ),
        2 => array(
            'Id' => 2,
            'Label' => 'Enable (ISO speed)',
        ),
    );

}


text:
object HelloWorld {

	def main(args: Array[String]): Unit = {
		val greeter = new Greeter("Hello Raymond")
		println(greeter.greet())
	}

}


text:
"""Intents"""
from setBuildingIntent import *
from getBuildingIntent import *
from getAvailMachinesIntent import *
from isMachineAvailIntent import *
from setMachineTimerIntent import *
from setNextAvailMachineTimerIntent import *
from getWelcomeResponseIntent import *
from handleSessionEndRequestIntent import *

""" --------------- Events ------------------ """
def onSessionStarted(sessionStartedRequest, session):
    """ Called when the session starts """
    print('onSessionStarted requestId=' + sessionStartedRequest.get('requestId')
          + ', sessionId=' + session.get('sessionId'))

def onLaunch(launchRequest, session):
    """ Called when the user launches the skill without specifying what they
        want
    """
    print('onLaunch requestId=' + launchRequest.get('requestId') +
          ', sessionId=' + session.get('sessionId'))
    return getWelcomeResponse()

def onIntent(intentRequest, session):
    """ Called when the user specifies an intent for this skill """

    print('onIntent requestId=' + intentRequest.get('requestId') +
          ', sessionId=' + session.get('sessionId'))

    intent = intentRequest.get('intent')
    intentName = intentRequest.get('intent').get('name')

    """ Dispatch to skill's intent handlers """
    if intentName == 'setBuilding':
        return setBuildingInSession(intent, session)
    elif intentName == 'getBuilding':
        return getBuildingFromSession(intent, session)
    elif intentName == 'getAvailMachines':
        return getAvailMachines(intent, session)
    elif intentName == 'isMachineAvail':
        return isMachineAvail(intent, session)
    elif intentName == 'setMachineTimer':
        return setMachineTimer(intent, session)
    elif intentName == 'setNextAvailMachineTimer':
        return setNextAvailMachineTimer(intent, session)
    elif intentName == 'AMAZON.HelpIntent':
        return getWelcomeResponse()
    elif intentName == 'AMAZON.CancelIntent' or intentName == 'AMAZON.StopIntent':
        return handleSessionEndRequest()
    else:
        raise ValueError('Invalid intent')

def onSessionEnded(sessionEndedRequest, session):
    """ Called when the user ends the session.
        Is not called when the skill returns shouldEndSession=True
    """
    print('onSessionEnded requestId=' + sessionEndedRequest.get('requestId') +
          ', sessionId=' + session.get('sessionId'))

""" --------------- Main handler ------------------ """
def alexaHandler(event, context):
    """ Route the incoming request based on type (LaunchRequest, IntentRequest,
        etc.) The JSON body of the request is provided in the event parameter.
    """
    print('event.session.application.applicationId=' +
          event.get('session').get('application').get('applicationId'))

    """
    if (event.get('session').get('application').get('applicationId') !=
         'amzn1.echo-sdk-ams.app..get(unique-value-here)'):
         raise ValueError('Invalid Application ID')
    """
    if event.get('session').get('new'):
        onSessionStarted({'requestId': event.get('request').get('requestId')}, event.get('session'))

    if event.get('request').get('type') == 'LaunchRequest':
        return onLaunch(event.get('request'), event.get('session'))
    elif event.get('request').get('type') == 'IntentRequest':
        return onIntent(event.get('request'), event.get('session'))
    elif event.get('request').get('type') == 'SessionEndedRequest':
        return onSessionEnded(event.get('request'), event.get('session'))


text:
package cz.metacentrum.perun.webgui.tabs.memberstabs;

import com.google.gwt.cell.client.FieldUpdater;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.client.ui.*;
import cz.metacentrum.perun.webgui.client.PerunWebSession;
import cz.metacentrum.perun.webgui.client.UiElements;
import cz.metacentrum.perun.webgui.client.localization.ButtonTranslation;
import cz.metacentrum.perun.webgui.client.resources.*;
import cz.metacentrum.perun.webgui.json.resourcesManager.GetAssignedRichResources;
import cz.metacentrum.perun.webgui.model.RichMember;
import cz.metacentrum.perun.webgui.model.RichResource;
import cz.metacentrum.perun.webgui.tabs.TabItem;
import cz.metacentrum.perun.webgui.tabs.resourcestabs.ResourceDetailTabItem;
import cz.metacentrum.perun.webgui.widgets.*;
import cz.metacentrum.perun.webgui.widgets.CustomButton;

/**
 * Displays members resources
 * !! USE AS INNER TAB ONLY !!
 *
 * @author Pavel Zlamal <256627@mail.muni.cz>
 */
public class MemberResourcesTabItem implements TabItem {

	private RichMember member;
	private int memberId;
	private PerunWebSession session = PerunWebSession.getInstance();
	private SimplePanel contentWidget = new SimplePanel();
	private Label titleWidget = new Label("Loading member details");
	private int groupId = 0;

	/**
	 * Constructor
	 *
	 * @param member RichMember object, typically from table
	 */
	public MemberResourcesTabItem(RichMember member, int groupId){
		this.member = member;
		this.memberId = member.getId();
		this.groupId = groupId;
	}

	public boolean isPrepared(){
		return !(member == null);
	}

	@Override
	public boolean isRefreshParentOnClose() {
		return false;
	}

	@Override
	public void onClose() {

	}

	public Widget draw() {

		this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(member.getUser().getFullNameWithTitles().trim()) + ": resources");

		// main widget panel
		VerticalPanel vp = new VerticalPanel();
		vp.setSize("100%","100%");

		TabMenu menu = new TabMenu();
		vp.add(menu);
		vp.setCellHeight(menu, "30px");

		menu.addWidget(UiElements.getRefreshButton(this));

		CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, true, "Add member to new resource", new ClickHandler() {
			@Override
			public void onClick(ClickEvent clickEvent) {
				AddMemberToResourceTabItem tab = new AddMemberToResourceTabItem(member.getVoId());
				tab.startAtStageTwo(member);
				session.getTabManager().addTabToCurrentTab(tab);
			}
		});
		if (!session.isVoAdmin(member.getVoId())) addButton.setEnabled(false);
		menu.addWidget(addButton);

		final GetAssignedRichResources resourcesCall = new GetAssignedRichResources(memberId, PerunEntity.MEMBER);
		resourcesCall.setCheckable(false);
		CellTable<RichResource> table = resourcesCall.getTable(new FieldUpdater<RichResource, String>() {
			@Override
			public void update(int i, RichResource resource, String s) {
				if (session.isVoAdmin(resource.getVoId()) || session.isFacilityAdmin(resource.getFacilityId())) {
					session.getTabManager().addTab(new ResourceDetailTabItem(resource, 0));
				} else {
					UiElements.generateInfo("Not privileged", "You are not allowed to manage this resource. You must be VO manager or Facility manager.");
				}
			}
		});

		menu.addFilterWidget(new ExtendedSuggestBox(resourcesCall.getOracle()), new PerunSearchEvent() {
			public void searchFor(String text) {
				resourcesCall.filterTable(text);
			}
		}, ButtonTranslation.INSTANCE.filterResources());

		// JsonUtils.addTableManagedButton(resourcesCall, table, removeButton);
		table.addStyleName("perun-table");
		ScrollPanel sp = new ScrollPanel(table);
		sp.addStyleName("perun-tableScrollPanel");
		session.getUiElements().resizePerunTable(sp, 350, this);

		vp.add(sp);

		this.contentWidget.setWidget(vp);

		return getWidget();

	}

	public Widget getWidget() {
		return this.contentWidget;
	}

	public Widget getTitle() {
		return this.titleWidget;
	}

	public ImageResource getIcon() {
		return SmallIcons.INSTANCE.userGreenIcon();
	}

	@Override
	public int hashCode() {
		final int prime = 1459;
		int result = 1;
		result = prime * result + memberId;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		MemberResourcesTabItem other = (MemberResourcesTabItem) obj;
		if (memberId != other.memberId)
			return false;
		return true;
	}

	public boolean multipleInstancesEnabled() {
		return false;
	}

	public void open() {

	}

	public boolean isAuthorized() {

		if (session.isVoAdmin(member.getVoId()) || session.isVoObserver(member.getVoId()) || session.isGroupAdmin(groupId)) {
			return true;
		} else {
			return false;
		}

	}

}


text:
ACCEPTED

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

#### Published in
null

#### Original name
Rondeletia heteranthera Brandegee

### Remarks
null


text:
#include <modules/vectorfieldvisualization/processors/datageneration/seedpointgenerator.h>

#include <glm/gtx/vector_angle.hpp>
#include <math.h>

#define RND 1
#define PLANE 2
#define LINE 3
#define SPHERE 4

namespace inviwo {

// The Class Identifier has to be globally unique. Use a reverse DNS naming scheme
const ProcessorInfo SeedPointGenerator::processorInfo_{
    "org.inviwo.SeedPointGenerator3D",  // Class identifier
    "Seed Point Generator 3D",          // Display name
    "Data Creation",                    // Category
    CodeState::Stable,                  // Code state
    "CPU, Seed Points, Generator",      // Tags
};
const ProcessorInfo SeedPointGenerator::getProcessorInfo() const { return processorInfo_; }

SeedPointGenerator::SeedPointGenerator()
    : Processor()
    , seedPoints_("seedPoints")
    , lineGroup_("line", "Line")
    , planeGroup_("plane", "Plane")
    , sphereGroup_("sphere", "Sphere")
    , numberOfPoints_("numberOfPoints", "Number of Points", 10, 1, 1000)
    , planeResolution_("planeResolution", "Resolution", vec2(4, 4), vec2(2, 2), vec2(100, 100))
    , planeOrigin_("planeOrigin_", "Origin", vec3(0.0f, 0.0f, 0.5f), vec3(-1, -1, -1),
                   vec3(1, 1, 1))
    , planeE1_("planeP1_", "Offset 1", vec3(1.0f, 0.0f, 0.5f), vec3(-1, -1, -1), vec3(1, 1, 1))
    , planeE2_("planeP2_", "Offset 2", vec3(0.0f, 1.0f, 0.5f), vec3(-1, -1, -1), vec3(1, 1, 1))
    , sphereCenter_("sphereCenter", "Center", vec3(0.5f, 0.5f, 0.5f), vec3(0, 0, 0), vec3(1, 1, 1))
    , sphereRadius_("sphereRadius", "Radius")
    , lineStart_("lineStart", "Start", vec3(0.5f, 0.0f, 0.5f), vec3(-1, -1, -1), vec3(1, 1, 1))
    , lineEnd_("lineEnd_", "End", vec3(0.5f, 1.0f, 0.5f), vec3(-1, -1, -1), vec3(1, 1, 1))
    , generator_("generator", "Generator")
    , randomness_("randomness", "Randomness")
    , useSameSeed_("useSameSeed", "Use same seed", true)
    , seed_("seed", "Seed", 1, 0, 1000)
    , rd_()
    , mt_(rd_()) {
    addPort(seedPoints_);

    generator_.addOption("random", "Random", RND);
    generator_.addOption("line", "Line", LINE);
    generator_.addOption("plane", "Plane", PLANE);
    generator_.addOption("sphere", "Sphere", SPHERE);
    generator_.setCurrentStateAsDefault();
    generator_.onChange([this]() { onGeneratorChange(); });
    addProperty(generator_);

    lineGroup_.addProperty(lineStart_);
    lineGroup_.addProperty(lineEnd_);
    addProperty(lineGroup_);

    planeGroup_.addProperty(planeResolution_);
    planeGroup_.addProperty(planeOrigin_);
    planeGroup_.addProperty(planeE1_);
    planeGroup_.addProperty(planeE2_);
    addProperty(planeGroup_);

    sphereGroup_.addProperty(sphereCenter_);
    sphereGroup_.addProperty(sphereRadius_);
    sphereRadius_.set(vec2(0.45, 0.55));
    sphereRadius_.setCurrentStateAsDefault();
    addProperty(sphereGroup_);

    addProperty(numberOfPoints_);

    addProperty(randomness_);
    randomness_.addProperty(useSameSeed_);
    randomness_.addProperty(seed_);
    useSameSeed_.onChange([&]() { seed_.setVisible(useSameSeed_.get()); });

    onGeneratorChange();
}

void SeedPointGenerator::process() {
    if (useSameSeed_.get()) {
        mt_.seed(seed_.get());
    }

    switch (generator_.get()) {
        case RND:
            randomPoints();
            break;
        case PLANE:
            planePoints();
            break;
        case LINE:
            linePoints();
            break;
        case SPHERE:
            spherePoints();
            break;
        default:
            LogWarn("No points generated since given type is not yet implemented");
            break;
    }
}

void SeedPointGenerator::onGeneratorChange() {
    bool rnd = generator_.get() == RND;
    bool plane = generator_.get() == PLANE;
    bool line = generator_.get() == LINE;
    bool sphere = generator_.get() == SPHERE;

    numberOfPoints_.setVisible(rnd || line || sphere);

    planeResolution_.setVisible(plane);
    planeOrigin_.setVisible(plane);
    planeE1_.setVisible(plane);
    planeE2_.setVisible(plane);

    sphereCenter_.setVisible(sphere);
    sphereRadius_.setVisible(sphere);

    lineStart_.setVisible(line);
    lineEnd_.setVisible(line);
}

void SeedPointGenerator::spherePoints() {
    std::uniform_real_distribution<float> T(0.0f, 2.0f * static_cast<float>(M_PI));
    std::uniform_real_distribution<float> cos_phi(-1.0f, 1.0f);
    std::uniform_real_distribution<float> R(0, 1.0f);

    auto points = std::make_shared<std::vector<vec3>>();

    for (int i = 0; i < numberOfPoints_.get(); i++) {
        float theta = T(mt_);
        float phi = std::acos(cos_phi(mt_));

        vec2 range = sphereRadius_.get();
        float r = std::pow(R(mt_), 1.0f / 3.0f);
        r = range.x + r * (range.y - range.x);

        float ct = std::cos(theta);
        float st = std::sin(theta);
        float sp = std::sin(phi);
        float cp = std::cos(phi);

        vec3 g = vec3(ct * sp, st * sp, cp);
        vec3 p = g * r + sphereCenter_.get();

        points->push_back(p);
    }

    seedPoints_.setData(points);
}

void SeedPointGenerator::linePoints() {
    auto points = std::make_shared<std::vector<vec3>>();
    float dt = 1.0f / (numberOfPoints_.get() - 1);
    for (int i = 0; i < numberOfPoints_.get(); i++) {
        auto p = lineStart_.get() + (lineEnd_.get() - lineStart_.get()) * (i * dt);
        points->push_back(p);
    }
    seedPoints_.setData(points);
}

void SeedPointGenerator::planePoints() {
    auto points = std::make_shared<std::vector<vec3>>();
    float dx = 1.0f / (planeResolution_.get().x - 1);
    float dy = 1.0f / (planeResolution_.get().y - 1);

    vec3 ox = planeE1_.get();  // - planeOrigin_.get();
    vec3 oy = planeE2_.get();  // - planeOrigin_.get();

    for (int i = 0; i < planeResolution_.get().x; i++) {
        for (int j = 0; j < planeResolution_.get().y; j++) {
            vec3 p = planeOrigin_.get();
            p += ox * (i * dx);
            p += oy * (j * dy);
            points->push_back(p);
        }
    }
    seedPoints_.setData(points);
}

void SeedPointGenerator::randomPoints() {
    auto points = std::make_shared<std::vector<vec3>>();
    std::uniform_real_distribution<float> r(0.0f, 1.0f);
    for (int i = 0; i < numberOfPoints_.get(); i++) {
        vec3 p(r(mt_), r(mt_), r(mt_));
        points->push_back(p);
    }
    seedPoints_.setData(points);
}

}  // namespace inviwo


text:
This is my hello-world repo :)

It's purpose is testing and getting an overview about GitHub


text:
#include "btDeformableContactProjection.h"
#include "btDeformableMultiBodyDynamicsWorld.h"
#include <algorithm>
#include <cmath>
btScalar btDeformableContactProjection::update(btCollisionObject** deformableBodies,int numDeformableBodies)
{
	btScalar residualSquare = 0;
	for (int i = 0; i < numDeformableBodies; ++i)
	{
		for (int j = 0; j < m_softBodies.size(); ++j)
		{
			btCollisionObject* psb = m_softBodies[j];
			if (psb != deformableBodies[i])
			{
				continue;
			}
			for (int k = 0; k < m_nodeRigidConstraints[j].size(); ++k)
			{
				btDeformableNodeRigidContactConstraint& constraint = m_nodeRigidConstraints[j][k];
				btScalar localResidualSquare = constraint.solveConstraint();
				residualSquare = btMax(residualSquare, localResidualSquare);
			}
			for (int k = 0; k < m_nodeAnchorConstraints[j].size(); ++k)
			{
				btDeformableNodeAnchorConstraint& constraint = m_nodeAnchorConstraints[j][k];
				btScalar localResidualSquare = constraint.solveConstraint();
				residualSquare = btMax(residualSquare, localResidualSquare);
			}
			for (int k = 0; k < m_faceRigidConstraints[j].size(); ++k)
			{
				btDeformableFaceRigidContactConstraint& constraint = m_faceRigidConstraints[j][k];
				btScalar localResidualSquare = constraint.solveConstraint();
				residualSquare = btMax(residualSquare, localResidualSquare);
			}
			for (int k = 0; k < m_deformableConstraints[j].size(); ++k)
			{
				btDeformableFaceNodeContactConstraint& constraint = m_deformableConstraints[j][k];
				btScalar localResidualSquare = constraint.solveConstraint();
				residualSquare = btMax(residualSquare, localResidualSquare);
			}
		}
	}
	return residualSquare;
}

void btDeformableContactProjection::splitImpulseSetup(const btContactSolverInfo& infoGlobal)
{
	for (int i = 0; i < m_softBodies.size(); ++i)
	{
		// node constraints
		for (int j = 0; j < m_nodeRigidConstraints[i].size(); ++j)
		{
			btDeformableNodeRigidContactConstraint& constraint = m_nodeRigidConstraints[i][j];
			constraint.setPenetrationScale(infoGlobal.m_deformable_erp);
		}
		// face constraints
		for (int j = 0; j < m_faceRigidConstraints[i].size(); ++j)
		{
			btDeformableFaceRigidContactConstraint& constraint = m_faceRigidConstraints[i][j];
			constraint.setPenetrationScale(infoGlobal.m_deformable_erp);
		}
	}
}

btScalar btDeformableContactProjection::solveSplitImpulse(const btContactSolverInfo& infoGlobal)
{
	btScalar residualSquare = 0;
	for (int i = 0; i < m_softBodies.size(); ++i)
	{
		// node constraints
		for (int j = 0; j < m_nodeRigidConstraints[i].size(); ++j)
		{
			btDeformableNodeRigidContactConstraint& constraint = m_nodeRigidConstraints[i][j];
			btScalar localResidualSquare = constraint.solveSplitImpulse(infoGlobal);
			residualSquare = btMax(residualSquare, localResidualSquare);
		}
		// anchor constraints
		for (int j = 0; j < m_nodeAnchorConstraints[i].size(); ++j)
		{
			btDeformableNodeAnchorConstraint& constraint = m_nodeAnchorConstraints[i][j];
			btScalar localResidualSquare = constraint.solveSplitImpulse(infoGlobal);
			residualSquare = btMax(residualSquare, localResidualSquare);
		}
		// face constraints
		for (int j = 0; j < m_faceRigidConstraints[i].size(); ++j)
		{
			btDeformableFaceRigidContactConstraint& constraint = m_faceRigidConstraints[i][j];
			btScalar localResidualSquare = constraint.solveSplitImpulse(infoGlobal);
			residualSquare = btMax(residualSquare, localResidualSquare);
		}

	}
	return residualSquare;
}

void btDeformableContactProjection::setConstraints()
{
	BT_PROFILE("setConstraints");
	for (int i = 0; i < m_softBodies.size(); ++i)
	{
		btSoftBody* psb = m_softBodies[i];
		if (!psb->isActive())
		{
			continue;
		}

		// set Dirichlet constraint
		for (int j = 0; j < psb->m_nodes.size(); ++j)
		{
			if (psb->m_nodes[j].m_im == 0)
			{
				btDeformableStaticConstraint static_constraint(&psb->m_nodes[j]);
				m_staticConstraints[i].push_back(static_constraint);
			}
		}

		// set up deformable anchors
		for (int j = 0; j < psb->m_deformableAnchors.size(); ++j)
		{
			btSoftBody::DeformableNodeRigidAnchor& anchor = psb->m_deformableAnchors[j];
			// skip fixed points
			if (anchor.m_node->m_im == 0)
			{
				continue;
			}
			anchor.m_c1 = anchor.m_cti.m_colObj->getWorldTransform().getBasis() * anchor.m_local;
			btDeformableNodeAnchorConstraint constraint(anchor);
			m_nodeAnchorConstraints[i].push_back(constraint);
		}

		// set Deformable Node vs. Rigid constraint
		for (int j = 0; j < psb->m_nodeRigidContacts.size(); ++j)
		{
			const btSoftBody::DeformableNodeRigidContact& contact = psb->m_nodeRigidContacts[j];
			// skip fixed points
			if (contact.m_node->m_im == 0)
			{
				continue;
			}
			btDeformableNodeRigidContactConstraint constraint(contact);
			btVector3 va = constraint.getVa();
			btVector3 vb = constraint.getVb();
			const btVector3 vr = vb - va;
			const btSoftBody::sCti& cti = contact.m_cti;
			const btScalar dn = btDot(vr, cti.m_normal);
			if (dn < SIMD_EPSILON)
			{
				m_nodeRigidConstraints[i].push_back(constraint);
			}
		}

		// set Deformable Face vs. Rigid constraint
		for (int j = 0; j < psb->m_faceRigidContacts.size(); ++j)
		{
			const btSoftBody::DeformableFaceRigidContact& contact = psb->m_faceRigidContacts[j];
			// skip fixed faces
			if (contact.m_c2 == 0)
			{
				continue;
			}
			btDeformableFaceRigidContactConstraint constraint(contact);
			btVector3 va = constraint.getVa();
			btVector3 vb = constraint.getVb();
			const btVector3 vr = vb - va;
			const btSoftBody::sCti& cti = contact.m_cti;
			const btScalar dn = btDot(vr, cti.m_normal);
			if (dn < SIMD_EPSILON)
			{
				m_faceRigidConstraints[i].push_back(constraint);
			}
		}

		// set Deformable Face vs. Deformable Node constraint
		for (int j = 0; j < psb->m_faceNodeContacts.size(); ++j)
		{
			const btSoftBody::DeformableFaceNodeContact& contact = psb->m_faceNodeContacts[j];

			btDeformableFaceNodeContactConstraint constraint(contact);
			btVector3 va = constraint.getVa();
			btVector3 vb = constraint.getVb();
			const btVector3 vr = vb - va;
			const btScalar dn = btDot(vr, contact.m_normal);
			if (dn > -SIMD_EPSILON)
			{
				m_deformableConstraints[i].push_back(constraint);
			}
		}
	}
}

void btDeformableContactProjection::project(TVStack& x)
{
	const int dim = 3;
	for (int index = 0; index < m_projectionsDict.size(); ++index)
	{
		btAlignedObjectArray<btVector3>& projectionDirs = *m_projectionsDict.getAtIndex(index);
		size_t i = m_projectionsDict.getKeyAtIndex(index).getUid1();
		if (projectionDirs.size() >= dim)
		{
			// static node
			x[i].setZero();
			continue;
		}
		else if (projectionDirs.size() == 2)
		{
			btVector3 dir0 = projectionDirs[0];
			btVector3 dir1 = projectionDirs[1];
			btVector3 free_dir = btCross(dir0, dir1);
			if (free_dir.safeNorm() < SIMD_EPSILON)
			{
				x[i] -= x[i].dot(dir0) * dir0;
				x[i] -= x[i].dot(dir1) * dir1;
			}
			else
			{
				free_dir.normalize();
				x[i] = x[i].dot(free_dir) * free_dir;
			}
		}
		else
		{
			btAssert(projectionDirs.size() == 1);
			btVector3 dir0 = projectionDirs[0];
			x[i] -= x[i].dot(dir0) * dir0;
		}
	}
}

void btDeformableContactProjection::setProjection()
{
	btAlignedObjectArray<btVector3> units;
	units.push_back(btVector3(1,0,0));
	units.push_back(btVector3(0,1,0));
	units.push_back(btVector3(0,0,1));
	for (int i = 0; i < m_softBodies.size(); ++i)
	{
		btSoftBody* psb = m_softBodies[i];
		if (!psb->isActive())
		{
			continue;
		}
		for (int j = 0; j < m_staticConstraints[i].size(); ++j)
		{
			int index = m_staticConstraints[i][j].m_node->index;
			if (m_projectionsDict.find(index) == NULL)
			{
				m_projectionsDict.insert(index, units);
			}
			else
			{
				btAlignedObjectArray<btVector3>& projections = *m_projectionsDict[index];
				for (int k = 0; k < 3; ++k)
				{
					projections.push_back(units[k]);
				}
			}
		}
		for (int j = 0; j < m_nodeAnchorConstraints[i].size(); ++j)
		{
			int index = m_nodeAnchorConstraints[i][j].m_anchor->m_node->index;
			if (m_projectionsDict.find(index) == NULL)
			{
				m_projectionsDict.insert(index, units);
			}
			else
			{
				btAlignedObjectArray<btVector3>& projections = *m_projectionsDict[index];
				for (int k = 0; k < 3; ++k)
				{
					projections.push_back(units[k]);
				}
			}
		}
		for (int j = 0; j < m_nodeRigidConstraints[i].size(); ++j)
		{
			int index = m_nodeRigidConstraints[i][j].m_node->index;
			if (m_nodeRigidConstraints[i][j].m_static)
			{
				if (m_projectionsDict.find(index) == NULL)
				{
					m_projectionsDict.insert(index, units);
				}
				else
				{
					btAlignedObjectArray<btVector3>& projections = *m_projectionsDict[index];
					for (int k = 0; k < 3; ++k)
					{
						projections.push_back(units[k]);
					}
				}
			}
			else
			{
				if (m_projectionsDict.find(index) == NULL)
				{
					btAlignedObjectArray<btVector3> projections;
					projections.push_back(m_nodeRigidConstraints[i][j].m_normal);
					m_projectionsDict.insert(index, projections);
				}
				else
				{
					btAlignedObjectArray<btVector3>& projections = *m_projectionsDict[index];
					projections.push_back(m_nodeRigidConstraints[i][j].m_normal);
				}
			}
		}
		for (int j = 0; j < m_faceRigidConstraints[i].size(); ++j)
		{
			const btSoftBody::Face* face = m_faceRigidConstraints[i][j].m_face;
			for (int k = 0; k < 3; ++k)
			{
				const btSoftBody::Node* node = face->m_n[k];
				int index = node->index;
				if (m_faceRigidConstraints[i][j].m_static)
				{
					if (m_projectionsDict.find(index) == NULL)
					{
						m_projectionsDict.insert(index, units);
					}
					else
					{
						btAlignedObjectArray<btVector3>& projections = *m_projectionsDict[index];
						for (int k = 0; k < 3; ++k)
						{
							projections.push_back(units[k]);
						}
					}
				}
				else
				{
					if (m_projectionsDict.find(index) == NULL)
					{
						btAlignedObjectArray<btVector3> projections;
						projections.push_back(m_faceRigidConstraints[i][j].m_normal);
						m_projectionsDict.insert(index, projections);
					}
					else
					{
						btAlignedObjectArray<btVector3>& projections = *m_projectionsDict[index];
						projections.push_back(m_faceRigidConstraints[i][j].m_normal);
					}
				}
			}
		}
		for (int j = 0; j < m_deformableConstraints[i].size(); ++j)
		{
			const btSoftBody::Face* face = m_deformableConstraints[i][j].m_face;
			for (int k = 0; k < 3; ++k)
			{
				const btSoftBody::Node* node = face->m_n[k];
				int index = node->index;
				if (m_deformableConstraints[i][j].m_static)
				{
					if (m_projectionsDict.find(index) == NULL)
					{
						m_projectionsDict.insert(index, units);
					}
					else
					{
						btAlignedObjectArray<btVector3>& projections = *m_projectionsDict[index];
						for (int k = 0; k < 3; ++k)
						{
							projections.push_back(units[k]);
						}
					}
				}
				else
				{
					if (m_projectionsDict.find(index) == NULL)
					{
						btAlignedObjectArray<btVector3> projections;
						projections.push_back(m_deformableConstraints[i][j].m_normal);
						m_projectionsDict.insert(index, projections);
					}
					else
					{
						btAlignedObjectArray<btVector3>& projections = *m_projectionsDict[index];
						projections.push_back(m_deformableConstraints[i][j].m_normal);
					}
				}
			}

			const btSoftBody::Node* node = m_deformableConstraints[i][j].m_node;
			int index = node->index;
			if (m_deformableConstraints[i][j].m_static)
			{
				if (m_projectionsDict.find(index) == NULL)
				{
					m_projectionsDict.insert(index, units);
				}
				else
				{
					btAlignedObjectArray<btVector3>& projections = *m_projectionsDict[index];
					for (int k = 0; k < 3; ++k)
					{
						projections.push_back(units[k]);
					}
				}
			}
			else
			{
				if (m_projectionsDict.find(index) == NULL)
				{
					btAlignedObjectArray<btVector3> projections;
					projections.push_back(m_deformableConstraints[i][j].m_normal);
					m_projectionsDict.insert(index, projections);
				}
				else
				{
					btAlignedObjectArray<btVector3>& projections = *m_projectionsDict[index];
					projections.push_back(m_deformableConstraints[i][j].m_normal);
				}
			}
		}
	}
}

void btDeformableContactProjection::applyDynamicFriction(TVStack& f)
{
	for (int i = 0; i < m_softBodies.size(); ++i)
	{
		for (int j = 0; j < m_nodeRigidConstraints[i].size(); ++j)
		{
			const btDeformableNodeRigidContactConstraint& constraint = m_nodeRigidConstraints[i][j];
			const btSoftBody::Node* node = constraint.m_node;
			if (node->m_im != 0)
			{
				int index = node->index;
				f[index] += constraint.getDv(node)* (1./node->m_im);
			}
		}
		for (int j = 0; j < m_faceRigidConstraints[i].size(); ++j)
		{
			const btDeformableFaceRigidContactConstraint& constraint = m_faceRigidConstraints[i][j];
			const btSoftBody::Face* face = constraint.getContact()->m_face;
			for (int k = 0; k < 3; ++k)
			{
				const btSoftBody::Node* node = face->m_n[k];
				if (node->m_im != 0)
				{
					int index = node->index;
					f[index] += constraint.getDv(node)* (1./node->m_im);
				}
			}
		}
		for (int j = 0; j < m_deformableConstraints[i].size(); ++j)
		{
			const btDeformableFaceNodeContactConstraint& constraint = m_deformableConstraints[i][j];
			const btSoftBody::Face* face = constraint.getContact()->m_face;
			const btSoftBody::Node* node = constraint.getContact()->m_node;
			if (node->m_im != 0)
			{
				int index = node->index;
				f[index] += constraint.getDv(node)* (1./node->m_im);
			}
			for (int k = 0; k < 3; ++k)
			{
				const btSoftBody::Node* node = face->m_n[k];
				if (node->m_im != 0)
				{
					int index = node->index;
					f[index] += constraint.getDv(node)* (1./node->m_im);
				}
			}
		}
	}
}

void btDeformableContactProjection::reinitialize(bool nodeUpdated)
{
	int N = m_softBodies.size();
	if (nodeUpdated)
	{
		m_staticConstraints.resize(N);
		m_nodeAnchorConstraints.resize(N);
		m_nodeRigidConstraints.resize(N);
		m_faceRigidConstraints.resize(N);
		m_deformableConstraints.resize(N);

	}
	for (int i = 0 ; i < N; ++i)
	{
		m_staticConstraints[i].clear();
		m_nodeAnchorConstraints[i].clear();
		m_nodeRigidConstraints[i].clear();
		m_faceRigidConstraints[i].clear();
		m_deformableConstraints[i].clear();
	}
	m_projectionsDict.clear();
}


text:
'use strict';

const util = require('util');

const common = require('common');

const getQuery = (name) => {
    return {
        'serviceName': name
    };
};

const getReplySuccess = (name) => {
    return {
        'deregister': 'success'
    };
};

const removeHandler = (name, reply) => {
    return (err, numRemoved) => {
        if (err) {
            console.error(err);
            return reply(common.getReplyError(err.message));
        }
        if (numRemoved === 0) {
            return reply(
                common.getReplyError(util.format('Service `%s` not found', name))
            ).code(404);
        }
        return reply(getReplySuccess());
    };
};

const handler = (server, request, reply) => {
    server.plugins.db.services.remove(
        getQuery(request.params.name), {},
        removeHandler(request.params.name, reply)
    );
};

exports.register = (server, options, next) => {
    server.route({
        'method': 'DELETE',
        'path': '/v1/services/deregister/{name}',
        'handler': handler.bind(this, server),
        'config': {
            'validate': {
                'params': {
                    'name': common.validators.service.name
                }
            },
            'description': 'Deregister (remove) a service',
            'notes': 'Removes a given service by Id',
            'tags': ['api', 'services']
        }
    });
    return next();
};

exports.register.attributes = {
    'name': 'core-services-deregister',
    'version': '1.0.0'
};


text:
import {ENGINE} from '../engine';
import {Rsqrt, RsqrtInputs} from '../kernel_names';
import {Tensor} from '../tensor';
import {NamedTensorMap} from '../tensor_types';
import {convertToTensor} from '../tensor_util_env';
import {TensorLike} from '../types';

import {op} from './operation';

/**
 * Computes reciprocal of square root of the input `tf.Tensor` element-wise:
 * `y = 1 / sqrt(x)`
 *
 * ```js
 * const x = tf.tensor1d([1, 2, 4, -1]);
 *
 * x.rsqrt().print();  // or tf.rsqrt(x)
 * ```
 * @param x The input tensor.
 *
 * @doc {heading: 'Operations', subheading: 'Basic math'}
 */
function rsqrt_<T extends Tensor>(x: T|TensorLike): T {
  const $x = convertToTensor(x, 'x', 'rsqrt', 'float32');

  const inputs: RsqrtInputs = {x: $x};

  return ENGINE.runKernel(Rsqrt, inputs as {} as NamedTensorMap);
}
export const rsqrt = op({rsqrt_});


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="54ded446-8366-473d-ad2c-9831363fad1d" name="Default" comment="" />
    <ignored path="requireJS.iws" />
    <ignored path=".idea/workspace.xml" />
    <ignored path=".idea/dataSources.local.xml" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
    <favorites_list name="requireJS" />
  </component>
  <component name="FileEditorManager">
    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
      <file leaf-file-name="index.html" pinned="false" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/index.html">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="126">
              <caret line="6" column="0" selection-start-line="6" selection-start-column="0" selection-end-line="8" selection-end-column="63" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="init.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/js/init.js">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="168">
              <caret line="8" column="3" selection-start-line="8" selection-start-column="3" selection-end-line="8" selection-end-column="3" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="smilePopup.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/lib/widjets/smilePopup.js">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="189">
              <caret line="9" column="11" selection-start-line="9" selection-start-column="11" selection-end-line="9" selection-end-column="11" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="requirejs-config.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/js/requirejs-config.js">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="189">
              <caret line="9" column="12" selection-start-line="9" selection-start-column="12" selection-end-line="9" selection-end-column="12" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="jquery-ui.min.css" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/css/jquery-ui.min.css">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="0">
              <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="smilePopupNew.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/lib/widjets/smilePopupNew.js">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="105">
              <caret line="5" column="34" selection-start-line="5" selection-start-column="24" selection-end-line="5" selection-end-column="34" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="table.jQuery.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/lib/widjets/table.jQuery.js">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="147">
              <caret line="7" column="24" selection-start-line="7" selection-start-column="24" selection-end-line="7" selection-end-column="24" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="FileTemplateManagerImpl">
    <option name="RECENT_TEMPLATES">
      <list>
        <option value="JavaScript File" />
      </list>
    </option>
  </component>
  <component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">
      <list>
        <option value="$PROJECT_DIR$/lib/requirejs-config.js" />
        <option value="$PROJECT_DIR$/lib/widjets/table.jQuery.js" />
        <option value="$PROJECT_DIR$/index.html" />
        <option value="$PROJECT_DIR$/lib/widjets/smilePopup.js" />
        <option value="$PROJECT_DIR$/js/init.js" />
        <option value="$PROJECT_DIR$/lib/widjets/smilePopupNew.js" />
        <option value="$PROJECT_DIR$/js/requirejs-config.js" />
      </list>
    </option>
  </component>
  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
  <component name="JsGulpfileManager">
    <detection-done>true</detection-done>
    <sorting>DEFINITION_ORDER</sorting>
  </component>
  <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
  <component name="ProjectFrameBounds">
    <option name="x" value="1407" />
    <option name="y" value="24" />
    <option name="width" value="1239" />
    <option name="height" value="776" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
    <OptionsSetting value="true" id="Add" />
    <OptionsSetting value="true" id="Remove" />
    <OptionsSetting value="true" id="Checkout" />
    <OptionsSetting value="true" id="Update" />
    <OptionsSetting value="true" id="Status" />
    <OptionsSetting value="true" id="Edit" />
    <ConfirmationsSetting value="0" id="Add" />
    <ConfirmationsSetting value="0" id="Remove" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
      <manualOrder />
      <foldersAlwaysOnTop value="true" />
    </navigator>
    <panes>
      <pane id="Scratches" />
      <pane id="Scope" />
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="lib" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="lib" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="widjets" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="lib" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="jQuery" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="js" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="requireJS" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="css" />
              <option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="settings.editor.selected.configurable" value="Errors" />
    <property name="settings.editor.splitter.proportion" value="0.2" />
    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
    <property name="WebServerToolWindowFactoryState" value="false" />
  </component>
  <component name="RecentsManager">
    <key name="CopyFile.RECENT_KEYS">
      <recent name="$PROJECT_DIR$/lib/widjets" />
      <recent name="$PROJECT_DIR$/css" />
      <recent name="$PROJECT_DIR$/lib/jQuery" />
    </key>
    <key name="MoveFile.RECENT_KEYS">
      <recent name="$PROJECT_DIR$/js" />
      <recent name="$PROJECT_DIR$/lib" />
    </key>
  </component>
  <component name="RunManager">
    <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
      <method />
    </configuration>
    <configuration default="true" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
      <TestRunner />
      <method />
    </configuration>
    <configuration default="true" type="PhpBehatConfigurationType" factoryName="Behat">
      <BehatRunner />
      <method />
    </configuration>
    <configuration default="true" type="PhpLocalRunConfigurationType" factoryName="PHP Console">
      <method />
    </configuration>
    <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
      <node-interpreter>project</node-interpreter>
      <node-options />
      <gulpfile />
      <tasks />
      <arguments />
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="js.build_tools.npm" factoryName="npm">
      <command value="run-script" />
      <scripts />
      <node-interpreter value="project" />
      <envs />
      <method />
    </configuration>
  </component>
  <component name="ShelveChangesManager" show_recycled="false">
    <option name="remove_strategy" value="false" />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="54ded446-8366-473d-ad2c-9831363fad1d" name="Default" comment="" />
      <created>1508013669146</created>
      <option name="number" value="Default" />
      <option name="presentableId" value="Default" />
      <updated>1508013669146</updated>
      <workItem from="1508013670353" duration="2333000" />
      <workItem from="1508317243492" duration="12678000" />
      <workItem from="1508346789926" duration="437000" />
    </task>
    <servers />
  </component>
  <component name="TimeTrackingManager">
    <option name="totallyTimeSpent" value="15448000" />
  </component>
  <component name="ToolWindowManager">
    <frame x="1407" y="24" width="1239" height="776" extended-state="6" />
    <editor active="true" />
    <layout>
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18273261" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager />
    <watches-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/init.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="189">
          <caret line="9" column="0" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/widjets/smilePopup.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="189">
          <caret line="9" column="11" selection-start-line="9" selection-start-column="11" selection-end-line="9" selection-end-column="11" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/requirejs-config.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="294">
          <caret line="14" column="0" selection-start-line="14" selection-start-column="0" selection-end-line="14" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/jquery-ui.min.css">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/widjets/smilePopupNew.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="105">
          <caret line="5" column="34" selection-start-line="5" selection-start-column="24" selection-end-line="5" selection-end-column="34" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/widjets/table.jQuery.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="147">
          <caret line="7" column="24" selection-start-line="7" selection-start-column="24" selection-end-line="7" selection-end-column="24" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="224">
          <caret line="14" column="0" selection-start-line="14" selection-start-column="0" selection-end-line="14" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/require.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/init.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="48">
          <caret line="3" column="19" selection-start-line="3" selection-start-column="19" selection-end-line="3" selection-end-column="19" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/widjets/smilePopup.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/widjets/table.jQuery.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="1216">
          <caret line="76" column="21" selection-start-line="76" selection-start-column="21" selection-end-line="76" selection-end-column="21" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/jQuery/jquery-ui.min.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/require.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/jQuery/jquery-ui.min.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="22">
          <caret line="10" column="6860" selection-start-line="10" selection-start-column="6860" selection-end-line="10" selection-end-column="6860" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/css/jquery-ui.min.css">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/widjets/table.jQuery.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="147">
          <caret line="7" column="24" selection-start-line="7" selection-start-column="24" selection-end-line="7" selection-end-column="24" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/widjets/smilePopupNew.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="105">
          <caret line="5" column="34" selection-start-line="5" selection-start-column="24" selection-end-line="5" selection-end-column="34" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/widjets/smilePopup.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="189">
          <caret line="9" column="11" selection-start-line="9" selection-start-column="11" selection-end-line="9" selection-end-column="11" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/requirejs-config.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="189">
          <caret line="9" column="12" selection-start-line="9" selection-start-column="12" selection-end-line="9" selection-end-column="12" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/js/init.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="168">
          <caret line="8" column="3" selection-start-line="8" selection-start-column="3" selection-end-line="8" selection-end-column="3" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="126">
          <caret line="6" column="0" selection-start-line="6" selection-start-column="0" selection-end-line="8" selection-end-column="63" />
          <folding />
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
**Description**

	Streaming Naive Bayes Classifier including dynamic re-binning, training, predictions, and classification
	error statistics. Handles heterogeneous feature sets with mixed INT, FLOAT, STRING feature types. Also handles
	missing feature values explicitly.

**Notes**

	Includes dynamic binning to account for updated feature dynamic ranges over data stream, re-binning implemented here
	is quite crude and needs to be improved.

**Methods Implemented**

    class_learn - Training using continuous (float), categorical (int or string), and mixed feature data types
	class_predict - Predictions based on Naive Bayes Classifier
	class_update - Update method for incremental (streaming) training
	class_acc - Classification error statistics method
	validate_features - Feature data type validation and mapping for learner

**Input**

    features dictionary with <feature_name> : [values] (list) pairs for every feature
    target class dictionary in form "class" : [target class values] (list of ints or strings)

**Python Versions Supported**

    Python 2.7.x

**Usage**

    /tests/bayes_tests.py - example usage and tests for known 2-class classification problem in UCI Bank Train data set.

**Unit Tests**

    /code/test_classifier.py

**Test Data**

    UCI dataset: [Moro et al., 2014] S. Moro, P. Cortez and P. Rita. A Data-Driven Approach to Predict the Success of
    Bank Telemarketing. Decision Support Systems, Elsevier, 62:22-31, June 2014

**License**

* [MIT License](LICENSE.md)