text:
package audio.processing.delay;

import javax.sound.sampled.AudioFormat;
import org.trianacode.taskgraph.Unit;
import triana.types.audio.MultipleAudio;

/**
 * Comb-filter delay Unit which allows user to add multiple delayed signals onto the original by creating a Comb Filter
 * with both a feedforward and a feedback loop. The user can set the level of attenuation of the delayed signal and also
 * adjust the delay time by adjusting the settings using the GUI.
 *
 * @author Eddie Al-Shakarchi
 * @version $Revision: 2921 $
 * @see CombFilterEffect
 */

public class CombFilter extends Unit {

    // parameter data type definitions
    private float delayInMs; // In milliseconds
    private int feedback;
    private String filterType;
    private boolean chunked;
    float sampleRate;
    CombFilterEffect comb = null;
    int oldSize = 0;
    int tempLength = 0;
    int noOfChannels;

    /*
     * Called whenever there is data for the unit to process
     */

    public void process() throws Exception {

        MultipleAudio input = (MultipleAudio) getInputAtNode(0);
        MultipleAudio output = new MultipleAudio(input.getChannels());
        Object in;

        AudioFormat af = input.getAudioFormat();
        float sampleRate = af.getSampleRate();
        noOfChannels = af.getChannels();
        System.out.println("noOfChannels = " + noOfChannels);

        // This line converts the delay in ms to number of samples and calls it delayOffset

        double loopGain = (double) (20 * (Math.log(((double) feedback / 100)) / (Math.log(10.0))));
        System.out.println("loopGain = " + loopGain);
        double decay60dbTime = (double) ((60 / -loopGain) * delayInMs);
        System.out.println("decay60dbTime = " + decay60dbTime);
        int delayOffset = ((int) (decay60dbTime * sampleRate) / 1000);
        System.out.println("delayOffset = " + delayOffset);

        if (comb == null) {
            comb = new CombFilterEffect(feedback, filterType, chunked, delayInMs, sampleRate, noOfChannels);
        }

        // For each channel
        for (int i = 0; i < input.getChannels(); ++i) {

            in = input.getChannel(i);
            short[] out; // Creates a short array for output data

            // If 16bit data
            if (in instanceof short[]) {

                short[] temp = (short[]) in;
                tempLength = temp.length;

                if (chunked == true) {

                    if (tempLength == oldSize || oldSize == 0) {
                        out = comb.process(temp);
                        oldSize = temp.length;
                    } else {
                        short[] blankArray = new short[delayOffset];
                        for (int n = 0; n < delayOffset; ++n) {
                            blankArray[n] = 0;
                        }
                        out = comb.process(blankArray);
                        System.out.println("*********End of file reached here*******");
                    }
                } else {
                    out = comb.process(temp);
                }
                output.setChannel(i, out, input.getChannelFormat(i));
            }// Close if statement
        } // Close for loop

        output(output);
    } // Close process () method

    /**
     * Called when the unit is created. Initialises the unit's properties and parameters.
     */
    public void init() {
        super.init();

        // Initialise node properties
        setDefaultInputNodes(1);
        setMinimumInputNodes(1);
        setMaximumInputNodes(1);

        setDefaultOutputNodes(1);
        setMinimumOutputNodes(0);
        setMaximumOutputNodes(Integer.MAX_VALUE);

        // Initialise parameter update policy
        setParameterUpdatePolicy(IMMEDIATE_UPDATE);

        // Initialise pop-up description and help file location
        setPopUpDescription("");
        setHelpFileLocation("CombDelay.html");

        // Define initial value and type of parameters
        defineParameter("delayInMs", "100", USER_ACCESSIBLE);
        defineParameter("feedback", "25", USER_ACCESSIBLE);
        defineParameter("filterType", "Standard Feedback Filter", USER_ACCESSIBLE);
        defineParameter("chunked", "false", USER_ACCESSIBLE);

        // Initialise GUI builder interface
        String guilines = "";
        guilines += "Delay In Milliseconds $title delayInMs Scroller 0 2000 100 false\n";
        guilines += "Feedback Level (%) $title feedback IntScroller 0 100 25 false\n";
        guilines += "Delay Filter Type $title filterType Choice [Standard Feedback Filter] [Feedback Loop Only]\n";
        guilines += "Chunked Data? $title chunked Checkbox false\n";
        setGUIBuilderV2Info(guilines);
    }

    /**
     * Called when the unit is reset. Restores the unit's variables to values specified by the parameters.
     */
    public void reset() {
        // Set unit variables to the values specified by the parameters
        delayInMs = new Float((String) getParameter("delayInMs")).floatValue();
        feedback = new Integer((String) getParameter("feedback")).intValue();
        filterType = (String) getParameter("filterType");
        chunked = new Boolean((String) getParameter("chunked")).booleanValue();
    }

    /**
     * Called when the unit is disposed of.
     */
    public void dispose() {
        // Insert code to clean-up CombFilter (e.g. close open files)
    }

    /**
     * Called a parameters is updated (e.g. by the GUI)
     */
    public void parameterUpdate(String paramname, Object value) {
        // Code to update local variables
        if (paramname.equals("delayInMs")) {
            delayInMs = new Float((String) value).floatValue();
            if (comb != null) {
                comb.setDelayOffset(delayInMs);
                System.out.println("delayInMS - is it changing? -> " + delayInMs);
            }
        }

        if (paramname.equals("feedback")) {
            feedback = new Integer((String) value).intValue();
            if (comb != null) {
                comb.setFeedback(feedback);
            }
        }

        if (paramname.equals("filterType")) {
            filterType = (String) value;
            if (comb != null) {
                comb.setFilterType(filterType);
            }
        }

        if (paramname.equals("chunked")) {
            chunked = new Boolean((String) value).booleanValue();
        }
        {
            if (comb != null) {
                comb.setChunked(chunked);
            }
        }
    }

    /**
     * @return an array of the input types for CombFilter
     */
    public String[] getInputTypes() {
        return new String[]{"triana.types.audio.MultipleAudio"};
    }

    /**
     * @return an array of the output types for CombFilter
     */
    public String[] getOutputTypes() {
        return new String[]{"triana.types.audio.MultipleAudio"};
    }
}


text:
package mcjty.rftoolsdim.items;

import mcjty.lib.varia.SoundTools;
import mcjty.rftoolsdim.config.GeneralConfiguration;
import mcjty.rftoolsdim.dimensions.dimlets.DimletRandomizer;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.*;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.List;
import java.util.Random;

public class DimletParcelItem extends GenericRFToolsItem {
    public DimletParcelItem() {
        super("dimlet_parcel");
        setMaxStackSize(64);
    }

    private Random random = new Random();

    @Override
    public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
        ItemStack stack = player.getHeldItem(hand);
        if (hand != EnumHand.MAIN_HAND) {
            return new ActionResult<>(EnumActionResult.PASS, stack);
        }
        if (!world.isRemote) {
            player.inventory.decrStackSize(player.inventory.currentItem, 1);
            int amount = random.nextInt(GeneralConfiguration.maxParcelContents - GeneralConfiguration.minParcelContents + 1) + GeneralConfiguration.minParcelContents;
            if (amount > 0) {
                SoundTools.playSound(world, SoundEvent.REGISTRY.getObject(new ResourceLocation("entity.player.levelup")), player.posX, player.posY, player.posZ, 1.0f, 1.0f);
                for (int i = 0 ; i < amount ; i++) {
                    ItemStack part = DimletRandomizer.getRandomPart(random);
                    if (!player.inventory.addItemStackToInventory(part.copy())) {
                        player.entityDropItem(part.copy(), 1.05f);
                    }
                }
            }
            player.openContainer.detectAndSendChanges();
        }
        return new ActionResult<>(EnumActionResult.SUCCESS, stack);
    }

    @SideOnly(Side.CLIENT)
    @Override
    public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag whatIsThis) {
        super.addInformation(itemStack, player, list, whatIsThis);
        list.add(TextFormatting.GREEN + "A present for you! Use it well");
        list.add(TextFormatting.GREEN + "Right click to get the gifts");
    }

}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Mute\Pinba;

use RuntimeException;

class Writer
{
    /**
     * @var resource
     */
    protected $resource;

    /**
     * @var resource|null
     */
    private $local_resource;

    public function __construct($resource=null)
    {
        if (!$resource) {
            $this->local_resource = $resource = fopen('php://memory', 'wb');
        }
        $this->resource = $resource;
    }

    public function __destruct()
    {
        if ($this->local_resource) {
            fclose($this->local_resource);
        }
    }

    public function buffer()
    {
        fseek($this->resource, 0, SEEK_SET);

        return stream_get_contents($this->resource);
    }

    public function writeString($value)
    {
        $bytes = $value;
        $length = strlen($bytes);
        $this->writeInteger($length);

        return $this->write($bytes, $length);
    }

    public function writeFloat($value)
    {
        static $packer;

        if (!$packer) {
            list(, $result) = unpack('L', pack('V', 1));
            $packer = ($result === 1)
                ? function ($value) { return pack('f*', $value); }
                : function ($value) { return strrev(pack('f*', $value)); };
        }
        $bytes = $packer($value);

        return $this->write($bytes, 4);
    }

    public function writeInteger($value)
    {
        if ($value < 0x80) {

            return $this->write(chr($value), 1);
        }

        $values = array('C*');
        do {
            $values[] = 0x80 | ($value & 0x7f);
            $value = $value >> 7;
        } while ($value > 0);

        // last MSB flag removal
        end($values);
        $values[key($values)] &= 0x7f;

        $bytes = call_user_func_array('pack', $values);
        $length = strlen($bytes);

        return $this->write($bytes, $length);
    }

    public function write($bytes, $length)
    {
        fwrite($this->resource, $bytes, $length);

        return $this;
    }

    public function stringField($field_id, $field_value)
    {
        $this->writeInteger($field_id << 3 | 2);
        $this->writeString($field_value);

        return $this;
    }

    public function integerField($field_id, $field_value)
    {
        $this->writeInteger($field_id << 3 | 0);
        $this->writeInteger($field_value);

        return $this;
    }

    public function floatField($field_id, $field_value)
    {
        $this->writeInteger($field_id << 3 | 5);
        $this->writeFloat($field_value);

        return $this;
    }
}


text:
#include "../StroikaPreComp.h"

#include <thread>

#include "Thread.h"

#include "SpinLock.h"

using namespace Stroika::Foundation;
using namespace Stroika::Foundation::Execution;


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Treemap - TreeMap with on-demand nodes</title>

<link type="text/css" href="../css/base.css" rel="stylesheet" />
<link type="text/css" href="../css/Treemap.css" rel="stylesheet" />

TreeMap with on-demand nodes

            This example shows how you can use the request controller method to create a TreeMap with on demand nodes

            This example makes use of native Canvas text and shadows, but can be easily adapted to use HTML like the other examples.

            There should be only one level shown at a time.

            Clicking on a band should show a new TreeMap with its most listened albums.

            Squarified

            <input type="radio" id="r-sq" name="layout" checked="checked" value="left" />

            Strip

            <input type="radio" id="r-st" name="layout" value="top" />

            SliceAndDice

           <input type="radio" id="r-sd" name="layout" value="bottom" />

Go to Parent

See the Example Code


text:
from __future__ import unicode_literals

from django.db import models

from django_evolution.tests.evolutions_app.models import EvolutionsAppTestModel

class EvolutionsApp2TestModel(models.Model):
    char_field = models.CharField(max_length=10)
    fkey = models.ForeignKey(EvolutionsAppTestModel,
                             on_delete=models.CASCADE,
                             null=True)

class EvolutionsApp2TestModel2(models.Model):
    fkey = models.ForeignKey(EvolutionsApp2TestModel,
                             on_delete=models.CASCADE,
                             null=True)
    int_field = models.IntegerField(default=100)


text:
+++
Title = "Propose"
Type = "event"
Description = "Propose a talk for devopsdays Detroit 2020"
+++

    {{< cfp_dates >}}

<hr/>

# DevopsDays Detroit cfp will be opening soon
## What we're looking this year

Types of Accepted Proposals

- Ignite Talks: 5-minute, auto-forwarding talk.
- Presentations: A 30-minute talk on a topic of your choice, with some time for questions.
- Open Spaces: 45-minute discussions driven by topics suggested by you! What attendees want to talk about.

The Ignite Talks are 5 minute talks with 20 slides (max., 15 seconds per slide) which auto-advance. If you are not familiar with the Ignite Talk format, good examples can be found at: http://ignitetalks.io/.

## Guidelines

- Use demos and examples to help tell a story (Show, don't tell!)
- Multiple entries are welcome (maximum of 3 please)
- Submissions must be made by one of the presenters; we do not accept proposals submitted on behalf of others.
- All presentations must conform to the DevOpsDays code of conduct.

## Ideas

- What are the most powerful feedback loops in your organization? How do you measure their efficacy? (e.g., developers on call for their own applications)
- Have you implemented devops practices that radically changed your organization's productivity? (e.g., we did $X and now we deploy to production 10,000 times per year)
- What kind of innovation is happening in your delivery pipeline? What have you automated that in prior years no one thought could be automated?
- How has machine learning or artificial intelligence changed workflows in your devops approach?
- How have you solved security control testing in your organization? How has security influenced your organizational culture?
- Do you run stateful applications that incorporate continuous deployment practices or are deployed in a containerized environment? How do you handle data durability, security, backups, and other aspects?
- Does your organization practice modern quality assurance methods like chaos or other stress testing methods through continuous integration and deployment processes or other avenues?
- Has container technology risen above the hype in your organization? Tell us about your experience.
- What leadership hacks made your team(s) more effective this year? (team org, roles, new specializations, etc)

## Our main criteria to make it to the top selection are:

- Broad appeal: How will your talk play out in a room of people with a variety of backgrounds? Technical deep dives need more levels to provide value for the whole room, some of whom might not use your specific tool.
- New local presenters: You are the only one who can tell your story. We are very interested in the challenges and successes in the Metro Detroit area.
- Underrepresented voices: We want to hear all voices, including those that may speak less frequently at similar events. Whether you're in a field not typically thought of as a technology field, you're in a large, traditional organization, or you're the only person at your organization with your background, we are interested in your unique experience.
- Original content: We will consider talks that have already been presented elsewhere, but we prefer talks that the local area isn't likely to have already seen.
- No third-party submissions. This is a small community-driven event, and speakers need to be directly engaged with the organizers and attendees.
- No vendor pitches: As much as we value vendors and sponsors, we are not going to accept a talk that appears to be a pitch for your product. You can demo at your table or during Open Spaces. But if you want to share about how your team solved problems to build or host your product at scale, we want to hear about that.
- Open Space Fodder: Will this talk help generate discussion in the Open Spaces?


text:
/**
 *  \file begin_code.h
 *
 *  This file sets things up for C dynamic library function definitions,
 *  static inlined functions, and structures aligned at 4-byte alignment.
 *  If you don't like ugly C preprocessor code, don't look at this file. :)
 */

/* This shouldn't be nested -- included it around code only. */
#ifdef _begin_code_h
#error Nested inclusion of begin_code.h
#endif
#define _begin_code_h

#ifndef SDL_DEPRECATED
#  if (__GNUC__ >= 4)  /* technically, this arrived in gcc 3.1, but oh well. */
#    define SDL_DEPRECATED __attribute__((deprecated))
#  else
#    define SDL_DEPRECATED
#  endif
#endif

#ifndef SDL_UNUSED
#  ifdef __GNUC__
#    define SDL_UNUSED __attribute__((unused))
#  else
#    define SDL_UNUSED
#  endif
#endif

/* Some compilers use a special export keyword */
#ifndef DECLSPEC
# if defined(__WIN32__) || defined(__WINRT__)
#  ifdef __BORLANDC__
#   ifdef BUILD_SDL
#    define DECLSPEC
#   else
#    define DECLSPEC    __declspec(dllimport)
#   endif
#  else
#   define DECLSPEC __declspec(dllexport)
#  endif
# else
#  if defined(__GNUC__) && __GNUC__ >= 4
#   define DECLSPEC __attribute__ ((visibility("default")))
#  else
#   define DECLSPEC
#  endif
# endif
#endif

/* By default SDL uses the C calling convention */
#ifndef SDLCALL
#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
#define SDLCALL __cdecl
#else
#define SDLCALL
#endif
#endif /* SDLCALL */

/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
#ifdef __SYMBIAN32__
#undef DECLSPEC
#define DECLSPEC
#endif /* __SYMBIAN32__ */

/* Force structure packing at 4 byte alignment.
   This is necessary if the header is included in code which has structure
   packing set to an alternate value, say for loading structures from disk.
   The packing is reset to the previous value in close_code.h
 */
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
#ifdef _MSC_VER
#pragma warning(disable: 4103)
#endif
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
#ifdef _M_X64
/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
/* winemaker: #pragma pack(push,8) */
#include <pshpack8.h>
#else
/* winemaker: #pragma pack(push,4) */
#include <pshpack4.h>
#endif
#endif /* Compiler needs structure packing set */

#ifndef SDL_INLINE
#if defined(__GNUC__)
#define SDL_INLINE __inline__
#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
      defined(__DMC__) || defined(__SC__) || \
      defined(__WATCOMC__) || defined(__LCC__) || \
      defined(__DECC)
#define SDL_INLINE __inline
#ifndef __inline__
#define __inline__ __inline
#endif
#else
#define SDL_INLINE inline
#ifndef __inline__
#define __inline__ inline
#endif
#endif
#endif /* SDL_INLINE not defined */

#ifndef SDL_FORCE_INLINE
#if defined(_MSC_VER)
#define SDL_FORCE_INLINE __forceinline
#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
#else
#define SDL_FORCE_INLINE static SDL_INLINE
#endif
#endif /* SDL_FORCE_INLINE not defined */

/* Apparently this is needed by several Windows compilers */
#if !defined(__MACH__)
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif /* NULL */
#endif /* ! Mac OS X - breaks precompiled headers */


text:
package com.maddob.data;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.vertx.core.shareddata.Shareable;

import java.time.LocalDate;
import java.util.UUID;

/**
 * Class Article
 *
 * Represents a blog article
 *
 * Created by martindobrev on 1/17/17.
 */
public class Article implements Shareable {

    /** Unique id of the article */
    private UUID id;

    /** Title of the article */
    private String title;

    /** Timestamp of the creation */
    @JsonFormat(pattern = "dd.MM.yyyy")
    private LocalDate created;

    /** Flag to publish the article */
    private boolean published;

    /** Main article content - usually markdown or html */
    private String content;

    ////////////////////////// GETTERS & SETTERS /////////////////////////

    public UUID getId() {
        return id;
    }

    public void setId(UUID id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public LocalDate getCreated() {
        return created;
    }

    public void setCreated(LocalDate createdAt) {
        this.created = createdAt;
    }

    public boolean isPublished() {
        return published;
    }

    public void setPublished(boolean published) {
        this.published = published;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
}


text:
<?php
//$allemployee = file_get_contents('http://morahrd.moratelindo.co.id/karyawan/index.php/employeeRestserver/employees');
$allemployee = file_get_contents(base_url().'text/allEmployee.json');
?>
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">

    <title>AppMaster Menu</title>

    <link href="assets/css/bootstrap.css" rel="stylesheet">

    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="assets/js/bootstrap-datepicker/css/datepicker.css" />
    <link rel="stylesheet" type="text/css" href="assets/js/bootstrap-daterangepicker/daterangepicker.css" />

    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/style-responsive.css" rel="stylesheet">

            AppMaster Menu

<a class="logout" href="<?php echo base_url().'myprofile';?>">Exit

App Master

                          create group

                          create manu

                          promote admin

create group

                      <form class="form-inline" role="form" id="formcreategroup">

                            <input type="text" class="form-control" id="groupname" placeholder="group name">
                            <input type="text" class="form-control" id="moderator" placeholder="moderator name" style="min-width:300px;">

                          <button type="button" id="btncreategroup" class="btn btn-theme">create group</button>
                      </form>

create menu

                      <form class="form-inline" role="form" id="formcreatemenu">

                            <input type="text" class="form-control" id="menuname" placeholder="menu name">
                            <input type="text" class="form-control" id="admin" placeholder="admin name" style="min-width:300px;">
                            <input type="checkbox" id="checkbox"> set profile?

                          <button type="button" id="btncreatemenu" class="btn btn-theme">create menu</button>
                      </form>

promote admin department

                      <form class="form-inline" role="form" id="formpromoteadmin">

                            <input type="text" class="form-control" id="deptname" placeholder="department" disabled>
                            <input type="text" class="form-control" id="admindept" placeholder="admin name" style="min-width:300px;">

                          <button type="button" id="btnpromoteadmin" class="btn btn-theme">promote</button>
                      </form>


text:
// Constant definitions
const char * KinectSkeletonMapper::c_SkelRootIdPatternPreffix = "Skel%d:";
const char *KinectSkeletonMapper::c_jointTypePropertyDefaultName = "JointType";
const std::shared_ptr<HierarchyNodeDefinition> KinectSkeletonMapper::c_defaultNodeHierarchy = GetDefaultHierarchyNodeDefinition();
const JointType KinectSkeletonMapper::c_kinectRootJointType = JointType_SpineBase;
const float KinectSkeletonMapper::c_rotationContinuityMaxOffset = 180;
const float KinectSkeletonMapper::c_positionalScalingFactor = 60;
const char *KinectSkeletonMapper::c_DefaultRootJointName = "Reference";

/// <summary>
/// Map current frame of Kinect Body to FBX scene
/// </summary>
/// <param name="pScene">FBX Scene</param>
/// <param name="frameTime">Current frame time</param>
/// <param name="kBody">Kinect Body</param>
void KinectSkeletonMapper::map(FbxScene* pScene, INT64 frameTime ,IBody *kBody) {

	FbxString bodyRootName = getPreffixedNodeName(kBody, c_DefaultRootJointName);

	FbxNode *skelNode;
	// Check whether skeleton has already been added to the scene
	skelNode = pScene->FindNodeByName(bodyRootName);

	// Get Kinect Joint Information
	Joint joints[JointType_Count];
	JointOrientation orientations[JointType_Count];

	HRESULT hr;
	hr = kBody->GetJoints(_countof(joints), joints);
	// If we successfully retrieved the Joint array
	if (!SUCCEEDED(hr)) {
		return;
	}

	hr = kBody->GetJointOrientations(_countof(orientations), orientations);
	// If we successfully retrieved the JointOrientation array
	if (!SUCCEEDED(hr)) {
		return;
	}

	if (!skelNode) {
		// Initialize body
		skelNode = init(pScene, kBody);

		// Set translation scale value
		//setTransScaling(skelNode, joints);

		// Set body initial alignment
		setInitialAlignmentRules(skelNode, joints, orientations);
	}

	// Add key information to curves
	addAnimationKeys(pScene, skelNode, frameTime, joints, orientations);

};

/// <summary>
/// Initialize body , by adding its corresponding skeleton to the FBX scene
/// </summary>
/// <param name="pScene">FBX scene</param>
/// <param name="kBody">Kinect body to be initialized</param>
/// <returns>Pointer to skeleton root node</returns>
FbxNode * KinectSkeletonMapper::init(FbxScene*  pScene, IBody *kBody) {

	FbxString bodyRootName = getPreffixedNodeName(kBody, c_DefaultRootJointName);

	// Create skeleton root Node
	FbxSkeleton* lSkeletonRootAttribute = FbxSkeleton::Create(pScene, bodyRootName);
	lSkeletonRootAttribute->SetSkeletonType(FbxSkeleton::eRoot);
	FbxNode* lSkeletonRoot = FbxNode::Create(pScene, bodyRootName);
	lSkeletonRoot->SetNodeAttribute(lSkeletonRootAttribute);

	// Add skeleton root Node to scene
	pScene->GetRootNode()->AddChild(lSkeletonRoot);

	// Create Joint Hierarchy
	createHierarchy(pScene, kBody, lSkeletonRoot, c_defaultNodeHierarchy);

	// Keyframes for T-pose at time 0
	keyInCurrentOrientation(pScene, lSkeletonRoot);

	return lSkeletonRoot;
}

/// <summary>
/// Add keys for orientation at time t
/// </summary>
/// <param name="pScene">Fbx Scene</param>
/// <param name="pNode">Fbx root Node</param>
void KinectSkeletonMapper::keyInCurrentOrientation(FbxScene *pScene, FbxNode *pNode, FbxTime time) {

	FbxAnimStack *baseAnimStack = pScene->GetCurrentAnimationStack();

	// Anim Stack invalid
	if (!baseAnimStack)
		return;

	FbxAnimLayer *baseAnimLayer = baseAnimStack->GetMember<FbxAnimLayer>();

	// Retrieve node joint type
	JointType nodeJointType = getJointTypeProperty(pNode);

	// Translation only for the root joint
	if (nodeJointType == c_kinectRootJointType) {
		FbxDouble3 trans = pNode->LclTranslation.Get();
		applyTransformation(baseAnimLayer, pNode, trans, time, true);
	}

	FbxDouble3 rot = pNode->LclRotation.Get();
	applyTransformation(baseAnimLayer, pNode, rot, time, false);

	int childCount = pNode->GetChildCount();
	// Repeat for children
	for (int i = 0; i < childCount; i++) {
		FbxNode *childNode = pNode->GetChild(i);
		keyInCurrentOrientation(pScene, childNode, time);
	}
}

/// <summary>
/// Recursive function that creates a FBX node hierarchy on the scene, based on a given definitons
/// </summary>
/// <param name="pScene">Current FBX scene</param>
/// <param name="kBody">Kinect Body</param>
/// <param name="fNode">Current FBX node</param>
/// <param name="hNode">Hierarchical definition</param>
void KinectSkeletonMapper::createHierarchy(FbxScene *pScene, IBody *kBody ,FbxNode *fNode, const std::shared_ptr<HierarchyNodeDefinition> &hNode) {

	// Create new limb attribute
	FbxString nodeName = getPreffixedNodeName(kBody, hNode->m_fNodeName);
	FbxSkeleton* lSkeletonLimbAttribute = FbxSkeleton::Create(pScene, nodeName);
	lSkeletonLimbAttribute->SetSkeletonType(FbxSkeleton::eLimbNode);

	// Create new limb node
	FbxNode* lSkeletonLimb = FbxNode::Create(pScene, nodeName);
	lSkeletonLimb->SetNodeAttribute(lSkeletonLimbAttribute);

	// Set joint initial orientation
	lSkeletonLimb->LclTranslation.Set(hNode->m_translation);
	lSkeletonLimb->LclRotation.Set(hNode->m_rotation);

	// Pre Rotation is active for this joint
	if (hNode->m_preRot != FbxDouble3()) {
		lSkeletonLimb->SetRotationActive(true);
		lSkeletonLimb->SetPreRotation(FbxNode::eSourcePivot, hNode->m_preRot);
	}

	// Set color attribute ( yellow )
	lSkeletonLimbAttribute->SetLimbNodeColor(FbxColor(1,1,0));

	// Set joint ype
	if ( hNode->m_kTwin < JointType_Count)
		setJointTypeProperty(lSkeletonLimb, hNode->m_kTwin);

	// Add node to hierarchy
	fNode->AddChild(lSkeletonLimb);

	// Traverse node children to add remaining nodes
	for (auto &it : hNode->m_children) {
		createHierarchy(pScene, kBody, lSkeletonLimb, it);
	}

}

/// <summary>
/// Gets pre-fixed name of a node
/// </summary>
/// <param name="inKBody">Kinect body for which the preffix will be retrieved</param>
/// <param name="nodeName">Node name without preffix</param>
/// <param name="outName">Variable where name will be written to</param>
FbxString KinectSkeletonMapper::getPreffixedNodeName(IBody *inKBody, const FbxString nodeName) {

	UINT64 bodyTrackingId;
	char nameBuffer[20];

	// Get body tracking  id
	inKBody->get_TrackingId(&bodyTrackingId);
	sprintf_s(nameBuffer, c_SkelRootIdPatternPreffix, bodyTrackingId);

	FbxString prefixedName(nameBuffer);
	prefixedName += nodeName;

	return prefixedName;
}

/// <summary>
/// Gets joint type property, based on Kinect's JointType
/// </summary>
/// <param name="fNode">Node to have type set</param>
/// <return>Type of the corresponding node, in case property is not found, returns JointType_Count</return>
JointType KinectSkeletonMapper::getJointTypeProperty(FbxNode *fNode) {

	// Node is not valid
	if (!fNode)
		return JointType_Count;

	JointType propertyReturn;

	FbxProperty lProperty = fNode->FindProperty(c_jointTypePropertyDefaultName);
	if (lProperty.IsValid()) {
		int jointTypeNum = (int)lProperty.Get<FbxInt>();
		propertyReturn = JointType(jointTypeNum);
	}
	else {
		propertyReturn = JointType_Count;
	}

	return propertyReturn;
}

/// <summary>
/// Sets joint type property, based on Kinect's JointType
/// </summary>
/// <param name="fNode">Node to have type set</param>
/// <param name="kType">Kinect joint type</param>
void KinectSkeletonMapper::setJointTypeProperty(FbxNode *fNode, JointType kType) {
	FbxProperty lProperty = fNode->FindProperty(c_jointTypePropertyDefaultName);

	if (!lProperty.IsValid()) {
		lProperty = FbxProperty::Create(fNode, fbxsdk::FbxIntDT, c_jointTypePropertyDefaultName, c_jointTypePropertyDefaultName);
	}
	lProperty.Set(FbxInt(kType));
}

/// <summary>
/// A new frame has been received, add animation corresponding to the motion
/// </summary>
/// <param name="pScene">FBX scene</param>
/// <param name="rootNode">FBX root node</param>
/// <param name="frameTime">Current frame time</param>
/// <param name="kBody">Kinect body to have animation extracted</param>
void KinectSkeletonMapper::addAnimationKeys(FbxScene*  pScene, FbxNode *rootNode, INT64 frameTime, IBody *kBody) {
	// Get Kinect Joint Information
	Joint joints[JointType_Count];
	JointOrientation orientations[JointType_Count];

	HRESULT hr;
	hr = kBody->GetJoints(_countof(joints), joints);
	// If we successfully retrieved the Joint array
	if (!SUCCEEDED(hr)) {
		return;
	}

	hr = kBody->GetJointOrientations(_countof(orientations), orientations);
	// If we successfully retrieved the JointOrientation array
	if (!SUCCEEDED(hr)) {
		return;
	}
	addAnimationKeys(pScene, rootNode, frameTime, joints, orientations);
}
/// <summary>
/// A new frame has been received, add animation corresponding to the motion
/// </summary>
/// <param name="pScene">FBX scene</param>
/// <param name="rootNode">FBX root node</param>
/// <param name="frameTime">Current frame time</param>
/// <param name="joints">Kinect joint position array</param>
/// <param name="orientations">Kinect joint orientation array</param>
void KinectSkeletonMapper::addAnimationKeys(FbxScene*  pScene, FbxNode *rootNode, INT64 frameTime, Joint *joints, JointOrientation *orientations) {

	FbxAnimStack *baseAnimStack = pScene->GetCurrentAnimationStack();

	// Anim Stack invalid
	if (!baseAnimStack)
		return;

	FbxAnimLayer *baseAnimLayer = baseAnimStack->GetMember<FbxAnimLayer>();

	//Anim layer invalid
	if (!baseAnimLayer)
		return;

	int childCount = rootNode->GetChildCount();
	for (int i = 0; i < childCount; i++) {
		FbxNode *childNode = rootNode->GetChild(i);
		animateHierarchy(baseAnimLayer, childNode, frameTime, joints, orientations);
	}

}

/// <summary>
/// Recursively add animation keys to each node in the hierarchy
/// </summary>
/// <param name="pLayer">FBX  animation layer</param>
/// <param name="fNode">FBX node to be animated</param>
/// <param name="frameTime">Current frame time</param>
/// <param name="kJoints">Kinect joints to bild animation</param>
/// <param name="kJointOrientations">Kinect joint orientations to build animation</param>
/// <param name="accumulator">Auxiliary matrix that helps converting from absolute orientation to relative. Defaults to identity</param>
void KinectSkeletonMapper::animateHierarchy(FbxAnimLayer*  pLayer, FbxNode *fNode, INT64 frameTime, Joint *kJoints, JointOrientation *kOrientations, FbxAMatrix accumullator) {

	// Retrieve node joint type
	JointType nodeJointType = getJointTypeProperty(fNode);

	// Number of children this node has
	int childCount = fNode->GetChildCount();

	// Check if joint type is valid
	if (nodeJointType < JointType_Count && childCount > 0 ) {

		// This is the root joint in Kinect
		if (nodeJointType == c_kinectRootJointType) {
			addTranslationKeys(pLayer, fNode, frameTime, kJoints[nodeJointType]);
		}

		// Set the orientation of this joint
		FbxNode *childNode = fNode->GetChild(0);
		JointType childJointType = getJointTypeProperty(childNode);

		if (childJointType < JointType_Count) {
			if ( childCount == 1  ) {
				if (!isOrientationNull(kOrientations[childJointType])) {
					// Orientation for Kinect joints is always related to the parent bone
					addRotationKeys(pLayer, fNode, frameTime, kOrientations[childJointType], accumullator);
				}
				else { // The trickiest case, no orientation information for the last bone
					// We can estimate it ourselves, but there will not be roll rotation
					FbxQuaternion ori = estimateBoneOri(childNode, kJoints[nodeJointType], kJoints[childJointType]);
					addRotationKeys(pLayer, fNode, frameTime, ori, accumullator);
				}
			}
			else {
				addRotationKeys(pLayer, fNode, frameTime, kOrientations[nodeJointType], accumullator);
			}
		}

	}

	// Add animations keys for the rest of hierarchy
	for (int i = 0; i < childCount; i++) {
		FbxNode *childNode = fNode->GetChild(i);
		animateHierarchy(pLayer, childNode, frameTime, kJoints, kOrientations,accumullator);
	}

}

/// <summary>
/// Extracts translation information from kinect, and add it as a key to our animation layer
/// </summary>
/// <param name="pLayer">FBX  animation layer</param>
/// <param name="fNode">FBX node to be animated</param>
/// <param name="frameTime">Current frame time</param>
/// <param name="kJoint">Kinect joint to have position extracted from</param>
void KinectSkeletonMapper::addTranslationKeys(FbxAnimLayer*  pLayer, FbxNode *fNode, INT64 frameTime, Joint &kJoint) {

	// Define X, Y and Z coordinates
	FbxDouble3 originalPos = fNode->LclTranslation.Get();
	float scalingFactor = c_positionalScalingFactor;
	//float scalingFactor = getTranslationScaleProperty(fNode);
	float Xpos, Ypos, Zpos;
	Xpos = ((-kJoint.Position.X)*scalingFactor) + ((float)originalPos[0]);
	Ypos = (kJoint.Position.Y*scalingFactor) + ((float)originalPos[1]);
	Zpos = ((kJoint.Position.Z)*scalingFactor) + ((float)originalPos[2]);

	// Set key timestamp
	FbxTime ltime;
	ltime.SetMilliSeconds(frameTime);

	applyTransformation(pLayer, fNode, FbxDouble3(Xpos, Ypos, Zpos), ltime, true);
}

/// <summary>
/// Extracts rotation information from kinect, and add it as a key to our animation layer
/// </summary>
/// <param name="pLayer">FBX  animation layer</param>
/// <param name="fNode">FBX node to be animated</param>
/// <param name="frameTime">Current frame time</param>
/// <param name="kOrientation">Kinect joint orientation</param>
/// <param name="accumullator">Used to compute orientations based on parent joint</param>
void KinectSkeletonMapper::addRotationKeys(FbxAnimLayer*  pLayer, FbxNode *fNode, INT64 frameTime, JointOrientation &kOrientation, FbxAMatrix &accumullator) {

	// Joint orientation, represented as a quaternion
	fbxsdk::FbxQuaternion qRot;

	//Extract quaternion from kinect
	qRot = fbxsdk::FbxQuaternion(kOrientation.Orientation.x,
		kOrientation.Orientation.y, kOrientation.Orientation.z, kOrientation.Orientation.w);

	addRotationKeys(pLayer, fNode, frameTime, qRot, accumullator);
}

/// <summary>
/// Extracts rotation information from kinect, and add it as a key to our animation layer
/// </summary>
/// <param name="pLayer">FBX  animation layer</param>
/// <param name="fNode">FBX node to be animated</param>
/// <param name="frameTime">Current frame time</param>
/// <param name="qRot">Joint orientation as quaternion</param>
/// <param name="accumullator">Used to compute orientations based on parent joint</param>
void KinectSkeletonMapper::addRotationKeys(FbxAnimLayer*  pLayer, FbxNode *fNode, INT64 frameTime, FbxQuaternion qRot, FbxAMatrix &accumullator) {

	// Decompose it into euler angles ( make sure to convert from absolute orientation to relative )
	fbxsdk::FbxAMatrix localOriMat, qMat;
	qMat.SetQ(qRot);
	localOriMat = accumullator.Inverse() * qMat;
	FbxVector4 euler = localOriMat.GetR();

	// Make sure rotation is continuous (switched to post-processing filter)
	//if (rotationCurveX->KeyGetCount() > 0) {
	//	FbxVector4 previousEulerRotation = getEulerRotation(rotationCurveX->KeyGetCount()-1, rotationCurveX, rotationCurveY, rotationCurveZ);
	//	euler = makeRotationContinuous(previousEulerRotation, euler);
	//}

	// Set key timestamp
	FbxTime ltime;
	ltime.SetMilliSeconds(frameTime);

	applyTransformation(pLayer, fNode, euler, ltime, false);

	// Update accumulator, based on local orientation
	accumullator = accumullator * localOriMat;
}

/// <summary>
/// Applies post processing filters to our motion data
/// </summary>
/// <param name="pScene">FBX  scene</param>
void KinectSkeletonMapper::applyPostProcessingFilters(FbxScene*  pScene) {

	FbxAnimStack *baseAnimStack = pScene->GetCurrentAnimationStack();

	// Anim Stack invalid
	if (!baseAnimStack)
		return;

	FbxAnimLayer *baseAnimLayer = baseAnimStack->GetMember<FbxAnimLayer>();

	//Anim layer invalid
	if (!baseAnimLayer)
		return;

	// Apply unroll filter to the whole hierarchy
	// This will ensure we get rid of discontinuity errors caused by euler conversion ( Euler sucks! )
	FbxAnimCurveFilterUnroll lUnrollFilter;

	// Apply filter for each skeleton in scene
	int sceneChildrenCount = pScene->GetRootNode()->GetChildCount();
	for (int i = 0; i < sceneChildrenCount; i++)  {
		FbxNode *fNode =  pScene->GetRootNode()->GetChild(i);
		FbxNodeAttribute *fNodeAttribute =  fNode->GetNodeAttribute();
		if (fNodeAttribute && (fNodeAttribute->GetAttributeType() == FbxNodeAttribute::eSkeleton ) ) {
			applyFilterHierarchically(lUnrollFilter, fNode->GetChild(0));
		}
	}

}

/// <summary>
/// Gets euler rotation for key with certain index
/// </summary>
/// <param name="keyIndex">Index of the desired key</param>
/// <param name="rotationCurveX">Rotation curve X</param>
/// <param name="rotationCurveY">Rotation curve Y</param>
/// <param name="rotationCurveZ">Rotation curve Z</param>
/// <return>Rotation in euler angles</return>
FbxVector4 KinectSkeletonMapper::getEulerRotation(int keyIndex, FbxAnimCurve *rotationCurveX, FbxAnimCurve *rotationCurveY, FbxAnimCurve *rotationCurveZ) {
	FbxVector4 eulerAngles;

	eulerAngles[0] = rotationCurveX->KeyGet(keyIndex).GetValue();
	eulerAngles[1] = rotationCurveY->KeyGet(keyIndex).GetValue();
	eulerAngles[2] = rotationCurveZ->KeyGet(keyIndex).GetValue();
	return eulerAngles;
}

/// <summary>
/// Make sure rotation in Euler angles is continuous
/// </summary>
/// <param name="previousEuler">Rotation for the previous frame</param>
/// <param name="currentEuler">Rotaion for the current frame</param>
/// <return>Continuous rotation, in euler angles</return>
FbxVector4 KinectSkeletonMapper::makeRotationContinuous(FbxVector4 previousEuler, FbxVector4 currentEuler) {
	FbxVector4 resultingRotation;

	// For each coordinate
	for (int i = 0; i < 3; i++) {
		resultingRotation[i] = currentEuler[i];

		// Curve is non-continuous, fix it
		while (abs(resultingRotation[i] - previousEuler[i]) > c_rotationContinuityMaxOffset) {
			if (resultingRotation[i] < previousEuler[i])
				resultingRotation[i] += c_rotationContinuityMaxOffset;
			else
				resultingRotation[i] -= c_rotationContinuityMaxOffset;
		}

	}
	return resultingRotation;
}

/// <summary>
/// Defines how translation values will be calculated
/// </summary>
/// <param name="fNode">Root FBX  node</param>
/// <param name="kJoints">Kinect joint position info</param>
void KinectSkeletonMapper::setTransScaling(FbxNode *fNode, Joint *joints) {

	int childCount = fNode->GetChildCount();

	if (childCount != 1)
		return;

	FbxNode *rootChild = fNode->GetChild(0);
	FbxNode *cChild = rootChild->GetChild(0);

	JointType  rType = getJointTypeProperty(rootChild);
	JointType  cType = getJointTypeProperty(cChild);

	// Invalid joint type
	if (rType >= JointType_Count || cType >= JointType_Count)
		return;

	CameraSpacePoint pr = joints[rType].Position;
	CameraSpacePoint pc = joints[cType].Position;

	// Estimate the difference between real distance and the modelled
	FbxVector4 modelV = cChild->LclTranslation.Get();
	FbxVector4 realV(pc.X - pr.X, pc.Y - pr.Y, pc.Z - pr.Z);
	double scale = modelV.Length() / realV.Length();

	setTranslationScaleProperty(rootChild, float(scale));
}

/// <summary>
/// Sets some initial alignment rules, based on assumptions about the sensor
/// </summary>
/// <param name="fNode">Root FBX  node</param>
/// <param name="kJoints">Kinect joint position info</param>
/// <param name="kOrientations">Kinect joint orientation info</param>
void KinectSkeletonMapper::setInitialAlignmentRules(FbxNode *fNode, Joint *joints, JointOrientation *orientations) {

	int childCount = fNode->GetChildCount();

	if (childCount != 1)
		return;

	FbxNode *rootChild = fNode->GetChild(0);

	JointType  jType = getJointTypeProperty(rootChild);

	// Invalid joint type
	if (jType >= JointType_Count)
		return;

	Vector4 jOri = orientations[jType].Orientation;

	FbxAMatrix initOriM;
	initOriM.SetQ(FbxQuaternion(jOri.x, jOri.y, jOri.z, jOri.w));

	// We need to account for reference node initial alignment
	FbxAMatrix refAlignM;
	refAlignM.SetR(FbxDouble3(0, 180, 0));

	// Obtain global orientation
	initOriM = refAlignM * initOriM;

	FbxVector4 initOriEuler = initOriM.GetR();
	initOriEuler[1] = initOriEuler[2] = 0; // We just need to compensate for the x axis

	// Let us compensate for inclination added by sensor
	rootChild->SetRotationActive(true);
	rootChild->SetPreRotation(FbxNode::eSourcePivot, initOriEuler);
}

/// <summary>
/// Estimates rotation between parent joint and hild joint. Used to compensate for missing Kinect info
/// </summary>
/// <param name="cNode">Child FBX Node</param>
/// <param name="pJoint">Parent Kinect Joint</param>
/// <param name="cJoint">Child Kinect Joint</param>
FbxQuaternion KinectSkeletonMapper::estimateBoneOri(FbxNode *cNode, const Joint &pJoint, const Joint &cJoint) {

	FbxVector4 ref = cNode->LclTranslation.Get();
	ref.Normalize();
	FbxVector4 goal(cJoint.Position.X - pJoint.Position.X, cJoint.Position.Y - pJoint.Position.Y, cJoint.Position.Z - pJoint.Position.Z);
	goal.Normalize();

	// We got our axis-angle ( Not supported by FBX, convert to quaternion )
	FbxVector4 axisAngle = ref.CrossProduct(goal);
	axisAngle.Normalize();
	double angle = acos(ref.DotProduct(goal));
	axisAngle[3] = angle;

		// To quaternion
	FbxQuaternion quat = axisAngleToQuat(axisAngle);
	return quat;
}


text:
/*
 * Created on Dec 22, 2005
 *
 */
package com.gemstone.gemfire.internal.cache;

/**
 * @author rreja
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public  class PRSystemPropertyGetter
{
  public static int parseInt(String i, int defaultValue)
  {
    if (i == null || i.equals("")) {
      return defaultValue;
    }
    try {
      return (Integer.parseInt(i));
    }
    catch (NumberFormatException nfe) {
      return defaultValue;
    }
  }

  public static long parseLong(String l, long defaultValue)
  {
    if (l == null || l.equals("")) {
      return defaultValue;
    }
    try {
      return (Long.parseLong(l));
    }
    catch (NumberFormatException nfe) {
      return defaultValue;
    }
  }

  public static boolean booleanvalueOf(String s, boolean defaultValue)
  {
    if (s == null) {
      return defaultValue;
    }
    try {
      return (Boolean.valueOf(s).booleanValue());
    }
    catch (NumberFormatException nfe) {
      return defaultValue;
    }

  }
}


text:
+++
date = "2016-09-09T22:24:21-04:00"
next = "/reference/"
prev = "/basics/create-tyche-json/"
title = "Studies"
toc = true
weight = 5

+++

Studies are a concept in tyche that allow you to define certain files
that should be watched for changes and if a task hasn't been run by the
time a commit or push is attempted, then it should tell the user they
need to perform those tasks. This is installed into a repository by
running `tyche init`

{{% notice info %}}
This feature is currently only supported in git. You are welcome to open
an issue and/or pull request if you'd like to see this feature extended
to other version control systems.
{{% /notice %}}

For example, if you'd like to watch the folder `src` for changes and
require that tests be run before allowing a commit, it would look
something like:

``` json
{
    "study": [
        {
            "on": "commit",
            "watch": [
                "./src"
            ],
            "message": {
                "error": "It looks like you forgot to test the code before committing, please do so"
            },
            "reset": [
                "test"
            ]
        }
    ]
}
```

Once a task named `test` is run, it will reset the error and allow the
commit into source control.


text:
package com.jumi.fbx.objects.definitions;

import com.jumi.scene.objects.JUMISkinDeformer;
import com.jumi.scene.objects.JUMISubDeformer;
import com.jumi.fbx.objects.FBXProperty;
import java.util.ArrayList;

/**
 * FBXSkinDeformerDefinition
 *
 * Container for holding information on a model's skin.
 *
 * @author Richard Greenlees
 */
public class FBXSkinDeformerDefinition extends FBXObjectDefinition {

    public float linkDeformAccuracy = 0.f;

    public ArrayList<FBXClusterDefinition> clusters = new ArrayList();

    public FBXSkinDeformerDefinition(long inUID, String inName) {
        super(inUID, inName);
    }

    public FBXSkinDeformerDefinition(long inUID) {
        super(inUID);
    }

    @Override
    public void readNestedObject(String nestedName, FBXProperty[] properties) {
        if (nestedName.equals("Link_DeformAcuracy")) {
            linkDeformAccuracy = properties[0].asLong();
        }
    }

    @Override
    public void readEmbeddedProperty(FBXProperty[] properties) {

    }

    public FBXLimbNodeDefinition getRootNode() {
        for (FBXClusterDefinition a : clusters) {
            if (a.limbNode != null) {
                return a.limbNode.getRoot();
            }
        }
        return null;
    }

    public JUMISkinDeformer createSkinDeformer() {
        JUMISkinDeformer result = new JUMISkinDeformer(name);

        result.deformers = new JUMISubDeformer[clusters.size()];

        for (int i = 0; i < clusters.size(); i++) {
            result.deformers[i] = clusters.get(i).createSubDeformer();
        }

        return result;
    }

    @Override
    public void connect(FBXModelDefinition inModel) {
        inModel.deformer = this;
    }

    @Override
    public void connect(FBXClusterDefinition inCluster) {
        clusters.add(inCluster);
    }

}


text:
Module("IrcWrapper", function (m) {
  var IRCMock = Class('IRCMock', {
    has : {
      listeners : {
        is : "ro",
        init : function () { return []; }
      },
      serverListeners : {
        init : function () { return {}; }
      },
      receivedLog : {
        init : function () { return {}; }
      }
    },
    methods : {
      initialize : function (args) {
        if (IRCMock.serverListeners) {
          for (var i= 0; i < IRCMock.serverListeners.length; i++) {
            var v = IRCMock.serverListeners[i];
            this.addServerListener(v.raw, v.callback);
          }
        }
        this.nick(args.nick);
        delete IRCMock.serverListeners;
      },
      addServerListener : function (raw, callback) {
        this.serverListeners[raw] = this.serverListeners[raw] || [];
        this.serverListeners[raw].push(callback);
      },
      _onServerGet : function (raw, params) {
        this.receivedLog[raw] = this.receivedLog[raw] || [];
        this.receivedLog[raw].push(params);
        this.serverListeners[raw] = this.serverListeners[raw] || [];
        for (var i = 0; i < this.serverListeners[raw].length; i++) {
          this.serverListeners[raw][i](params);
        }
      },
      getReceivedLog : function (raw) {
        this.receivedLog[raw] = this.receivedLog[raw] || [];
        return this.receivedLog[raw];
      },

      // Client to server.
      connect : function () {

      },
      privmsg : function (location, message) {
        this._onServerGet("privmsg", { location : location, message : message});
      },
      join : function (channel, password) {
        this._onServerGet("join", { location : channel, password : password || "" });
      },
      part : function (channel) {
        this._onServerGet("part", { location : channel });
      },
      nick : function (newNick) {
        this._onServerGet("nick", { newNick : newNick });
      },
      quit : function (message) {
        this._onServerGet("quit", { message : message });
      },
      user : function () {
        this._onServerGet("user", arguments);
      },

      // Server to client.
      addListener : function (raw, callback) {
        this.listeners.push({
          raw : raw,
          callback : callback
        });
      },
      sendRaw : function (raw, e) {
        if (typeof raw !== "string") {
            throw new Error("IRCMock: sendRaw: raw must be a string.");
        }
        for (var i = 0; i < this.listeners.length; i++) {
          var listener = this.listeners[i];
          if (listener.raw === raw) {
            listener.callback(e);
          }
        }
      },
      // Nick already taken.
      send433 : function (serverName, nick) {
        this.sendRaw("433", {
          servername : serverName,
          command : "433",
          params : ["*", nick, "Nickname is already in use."]
        });
      },
      // Connect
      send001 : function (nick) {
        this.sendRaw("001", {
          params : [nick, "Welcome message!"]
        });
      },
      // Names list
      send353 : function (mehash, chan, nicks) {
        this.sendRaw("353", {
          servername : "server.name",
          command : "353",
          params : [
            mehash.nick,
            "=",
            chan,
            [mehash.nick].concat(nicks).join(" ")
          ]
        });
      },
      sendPrivmsg : function (location, message, person) {
        if (person === undefined) {
          throw new Error("sendPrivmsg: need to specify person.");
        }
        this.sendRaw("privmsg", {
          person : person,
          params : [location, message]
        });
      },
      sendJoin : function (location, person) {
        if (person === undefined) {
          throw new Error("sendJoin: need to specify person.");
        }
        this.sendRaw("join", {
          person : person,
          params : [location]
        });
      },
      sendPart : function (location, person) {
        if (person === undefined) {
          throw new Error("sendPart: need to specify person.");
        }
        this.sendRaw("part", {
          person : person,
          params : [location]
        });
      },
      sendQuit : function (person) {
        this.sendRaw("quit", {
          person : person,
          params : ["Quit message!"]
        });
      },
      sendClientQuit : function (person) {
        this.sendRaw("quit", {
          person : person,
          command : "QUIT",
          params : ["Client Quit"]
        });
      },
      sendNick : function (person, newNick) {
        this.sendRaw("nick", {
          person : person,
          command : 'NICK',
          params : [newNick]
        });
      }
    }
  });
});


text:
import Component from '@ember/component';
import { inject as service } from '@ember/service';
import { task } from 'ember-concurrency';
import { computed } from '@ember/object';

export default Component.extend({
  flashes: service(),

  tagName: 'button',
  classNames: ['switch'],
  classNameBindings: ['active', 'key'],

  attributeBindings: ['aria-checked', 'role'],

  role: 'switch',

  reverse: false,

  'aria-checked': computed('active', function () {
    if (this.active) {
      return 'true';
    } else {
      return 'false';
    }
  }),

  save: task(function* () {
    try {
      // try saving with the new state, only change local state if successful
      const futureState = !this.active;
      yield this.repo.saveSetting(this.key, this.reverse ? !futureState : futureState);
      this.toggleProperty('active');
    } catch (e) {
      this.flashes.error('There was an error while saving your settings. Please try again.');
    }
  }).drop(),

  click() {
    this.save.perform();
  }
});


text:
<?php defined('SYSPATH') or die('No direct script access.');

abstract class Kohana_Log_Writer {

	/**
	 * Write an array of messages.
	 *
	 * @param   array  messages
	 * @return  void
	 */
	abstract public function write(array $messages);

	/**
	 * Allows the object to have a unique key in associative arrays.
	 *
	 * @return  string
	 */
	final public function __toString()
	{
		return spl_object_hash($this);
	}

} // End Kohana_Log_Writer


text:
	{block name=content}{/block}

Команда сайта ivacuum.ru
Если у вас есть вопросы, напишите нам письмо


text:
require 'rubygems'
require 'bundler/setup'

require File.expand_path(File.dirname(__FILE__) + "/../lib/ve")
require 'minitest/autorun'
require 'mocha'

class MiniTest::Unit::TestCase
  private

  def assert_parses_into_words(parse_klass, expected, text, raw)
    parse = parse_klass.new(text, raw)
    words = parse.words
    tokens = parse.tokens

    assert_equal expected[:words], words.collect(&:word)
    assert_equal expected[:lemmas], words.collect(&:lemma)
    assert_equal expected[:pos], words.collect(&:part_of_speech)
    assert_equal expected[:extra], words.collect(&:extra)

    words.each_with_index do |word, i|
      assert_equal tokens[expected[:tokens][i]], word.tokens
    end
  end

end


text:
package org.hisp.dhis.tracker.domain;

import java.time.Instant;
import java.util.ArrayList;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import org.hisp.dhis.tracker.TrackerType;
import org.locationtech.jts.geom.Geometry;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * @author Morten Olav Hansen <mortenoh@gmail.com>
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TrackedEntity
    implements TrackerDto
{
    @JsonProperty
    private String trackedEntity;

    @JsonProperty
    private MetadataIdentifier trackedEntityType;

    @JsonProperty
    private Instant createdAt;

    @JsonProperty
    private Instant createdAtClient;

    @JsonProperty
    private Instant updatedAt;

    @JsonProperty
    private Instant updatedAtClient;

    @JsonProperty
    private MetadataIdentifier orgUnit;

    @JsonProperty
    private boolean inactive;

    @JsonProperty
    private boolean deleted;

    @JsonProperty
    private boolean potentialDuplicate;

    @JsonProperty
    private Geometry geometry;

    @JsonProperty
    private String storedBy;

    @JsonProperty
    private User createdBy;

    @JsonProperty
    private User updatedBy;

    @JsonProperty
    @Builder.Default
    private List<Relationship> relationships = new ArrayList<>();

    @JsonProperty
    @Builder.Default
    private List<Attribute> attributes = new ArrayList<>();

    @JsonProperty
    @Builder.Default
    private List<Enrollment> enrollments = new ArrayList<>();

    @Override
    public String getUid()
    {
        return this.trackedEntity;
    }

    @Override
    public TrackerType getTrackerType()
    {
        return TrackerType.TRACKED_ENTITY;
    }
}


text:
import soot.Value;
import soot.jimple.AbstractStmtSwitch;
import soot.jimple.AssignStmt;

import java.io.IOException;

/**
 * Created by fire on 5/1/17.
 */
public class UIInferenceVisitor extends AbstractStmtSwitch {
    private LogWriter logWriter;

    /**
     * constructor
     */
    public UIInferenceVisitor() {
        try {
            this.logWriter = new LogWriter(this.getClass().getSimpleName());
        } catch (IOException e) {
            System.err.println("InferenceVisitor: Declaring LogWriter Failed");
            if(Constants.PRINT_ST) {
                e.printStackTrace();
            }
        }
    }

    /**
     * in case of assignment statment
     * @param stmt the assignement statment
     */
    @Override
    public void caseAssignStmt(AssignStmt stmt) {
        Value left = stmt.getLeftOp();
        Value right = stmt.getRightOp();
        String msg = String.format("<%s> = <%s>", left.toString(), right.toString());
        this.logWriter.write_parse(LogType.OUT, msg);
    }

}


text:
db.abc.insert({a:"hello world\n"});
print (db.abc.find().next().a);


text:
namespace CIB.Exchange.Model
{
    public enum OrderState
    {
        New,
        RejectedByExchange,
        Accepted,
        CancelPending,
        CancelReject,
        Cancelled
    }
}


text:
<resources>

    <style name="dashboard_button">
       <!-- <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">match_parent</item>-->
        <item name="android:background">@drawable/dashboard_button_background</item>
        <item name="android:clickable">true</item>
        <item name="android:scaleType">center</item>
        <item name="android:elevation">4dp</item>
        <item name="android:theme">@style/Theme.AppCompat</item>
        <item name="android:adjustViewBounds">true</item>
        <item name="layout_columnWeight">1</item>
        <item name="android:layout_margin">8dp</item>
    </style>

    <style name="ActionMode">
        <item name="android:theme">@style/Theme.AppCompat</item>
    </style>

    <style name="bottom_button" parent="Widget.AppCompat.Button">
        <item name="android:layout_width">0dp</item>
        <item name="android:layout_weight">1</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:lines">1</item>
        <item name="android:background">?selectableItemBackgroundBorderless</item>
        <item name="android:textColor">@color/bottom_button_text</item>
        <item name="android:button">@null</item>
    </style>
</resources>


text:
package com.springCore.autoWiring.CDPlayer;

public interface MediaPlayer {

  void play();

}


text:
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

#ifndef __smgen_h__
#define __smgen_h__

#include <windows.h>
#include <assert.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>

#include "smcommon.h"

#define MAX_NUM_STATES   (1 << (sizeof(SM_STATE_ID)*8))
#define MAX_CELL_COUNT   420
#define SM_BUFFER_SIZE   (sizeof(SMState)*MAX_NUM_STATES + sizeof(JumpTableCell)*MAX_CELL_COUNT)   // Change to a formular of  MAX_NUM_STATES and MAX_CELL_COUNT

class SMGen;  // Forward declaration of SMGen

// The struct representing an edge in the state machine.
struct SMGenDestStateDesc
{
    SMGenDestStateDesc *   next;      // Linkage
    SM_OPCODE              opcode;
    SM_STATE_ID            destState;
};

// The struct representing a state in a state machine.
class  SMGenState
{
public:

    SM_STATE_ID   id;                      // the ID of the state
    bool          term;                    // does this state terminate a code sequence?
    BYTE          length;                  // the length of currently matched opcodes
    SM_STATE_ID   longestTermState;        // the ID of the longest matched terminate state

    SM_STATE_ID   prevState;               // previous state
    SM_OPCODE     opc;                     // opcode that leads from the previous state to current state

    SMGenDestStateDesc * destStateList;    // the list of outgoing edges

    // Given an opcode, get the next state the machine will jump to.
    SM_STATE_ID   getDestState(SM_OPCODE opcode);

    // Given an opcode, set where the next state the machine should jump to.
    void          setDestState(SM_OPCODE opcode, SM_STATE_ID destState);
};

// The state machine generator
class   SMGen
{
public :

    SM_STATE_ID      lastStateID;
    SMGenState       States[MAX_NUM_STATES];

    SMState *        pAllStates;
    JumpTableCell *  pAllJumpTables;
    JumpTableCell *  pJumpTableMax;
    unsigned         totalCellNeeded;

    unsigned         emitBufferSize;
    BYTE             emitBuffer[SM_BUFFER_SIZE];

    SMGen();
    ~SMGen();

    void           ProcessSeq(SM_OPCODE * CodeSeq);
    void           Emit();
    void           EmitDone();
    unsigned short JumpTableSet(SM_STATE_ID id);
    bool           bJumpTableFit(JumpTableCell * pTable, SM_STATE_ID id);
    void           JumpTableFill(JumpTableCell * pTable, SM_STATE_ID id);
    char *         StateDesc(SM_STATE_ID stateID);
};

#endif /* __smgen_h__ */


text:
package stallone.complex.io;

import stallone.complex.io.OutputUtil;
import stallone.api.complex.IComplexArray;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

import java.util.logging.Level;
import java.util.logging.Logger;
import stallone.api.complex.Complex;

/**
 * Write out a vector, either as column or row.
 *
 * @author  Martin Senne
 */
public class DenseAsciiVectorWriter {
    private IComplexArray vector;
    private String filename;
    private Alignment alignment;

    private boolean allPurelyReal;

    public enum Alignment {
        ROW,
        COLUMN
    }

    public DenseAsciiVectorWriter(IComplexArray vector, String filename) {
        this( vector, filename, Alignment.COLUMN );
    }

    public DenseAsciiVectorWriter(IComplexArray vector, String filename, Alignment alignment ) {
        this.vector = vector;
        this.filename = filename;
        this.alignment = alignment;

        allPurelyReal = vector.isReal();
    }

    public void perform() {
        BufferedWriter writer = null;

        try {
            writer = new BufferedWriter(new FileWriter(filename));

            int n = vector.size();

            for (int i = 0; i < n; i++) {
                double re = vector.getRe(i);
                double im = vector.getIm(i);

                if (alignment.equals(Alignment.COLUMN)) {
                    writer.write( OutputUtil.scalarToEasyString(re,im) );
                    writer.newLine();
                } else {
                    writer.write( OutputUtil.scalarToEasyString(re,im) );
                    writer.write(" ");
                }

            }

            writer.newLine();
            writer.close();
        } catch (IOException ex) {
            Logger.getLogger(DenseAsciiVectorWriter.class.getName()).log(Level.SEVERE, null, ex);
        } finally {

            try {
                writer.close();
            } catch (IOException ex) {
                Logger.getLogger(DenseAsciiVectorWriter.class.getName()).log(Level.SEVERE, null, ex);
            }
        } // end try-catch-finally
    }

    public static void main(String[] args) {
        IComplexArray v1 = Complex.create.array(3);
        v1.set(0, 1.0d);
        v1.set(1, 2.0d, -3.0d);
        v1.set(2, 0.0d, 5.0d);

        DenseAsciiVectorWriter writer = new DenseAsciiVectorWriter(v1, "/home/fischbac/vector.dat");
        writer.perform();

    }
}


text:
var arg0 = %GetImplFromInitializedIntlObject(new Intl.v8BreakIterator());
%BreakIteratorBreakType(arg0);


text:
<?php declare(strict_types=1);

namespace App\Security\Util;

/**
 *
 * This class provides some security related functions.
 *
 * @copyright Jacques Archimède
 *
 */
class SecurityFunction {

	public static function isPasswordStrong(string $password): bool {
		$uppercase = preg_match('@[A-Z]@', $password);
		$lowercase = preg_match('@[a-z]@', $password);
		$number    = preg_match('@[0-9]@', $password);
		$specialChars = preg_match('@[^\w]@', $password);

		return $uppercase && $lowercase && $number && $specialChars && strlen($password) >= 8;
	}

	public static function canonicalize(string $str): ?string {
		if (null === $str) {
			return null;
		}
		$encoding = mb_detect_encoding($str);
		$result = $encoding
			? mb_convert_case($str, MB_CASE_LOWER, $encoding)
			: mb_convert_case($str, MB_CASE_LOWER);

		return $result;
	}

	public static function generateToken(): string {
		return rtrim(strtr(base64_encode(random_bytes(32)), '+/', '-_'), '=');
	}

}


text:
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'Properties'
        db.create_table(u'wheelcms_properties_properties', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('main', self.gf('django.db.models.fields.related.ForeignKey')(related_name='properties', to=orm['wheelcms_axle.Configuration'])),
        ))
        db.send_create_signal(u'wheelcms_properties', ['Properties'])

        # Adding model 'PropertyForm'
        db.create_table(u'wheelcms_properties_propertyform', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('conf', self.gf('django.db.models.fields.related.ForeignKey')(related_name='forms', to=orm['wheelcms_properties.Properties'])),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=60)),
            ('form', self.gf('django.db.models.fields.TextField')(default='[]')),
            ('types', self.gf('django.db.models.fields.TextField')(default='')),
        ))
        db.send_create_signal(u'wheelcms_properties', ['PropertyForm'])

    def backwards(self, orm):
        # Deleting model 'Properties'
        db.delete_table(u'wheelcms_properties_properties')

        # Deleting model 'PropertyForm'
        db.delete_table(u'wheelcms_properties_propertyform')

    models = {
        u'wheelcms_axle.configuration': {
            'Meta': {'object_name': 'Configuration'},
            'analytics': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}),
            'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
            'head': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'mailto': ('django.db.models.fields.EmailField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}),
            'sender': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}),
            'sendermail': ('django.db.models.fields.EmailField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}),
            'theme': ('django.db.models.fields.CharField', [], {'default': "'default'", 'max_length': '256', 'blank': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'})
        },
        u'wheelcms_properties.properties': {
            'Meta': {'object_name': 'Properties'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'main': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'properties'", 'to': u"orm['wheelcms_axle.Configuration']"})
        },
        u'wheelcms_properties.propertyform': {
            'Meta': {'object_name': 'PropertyForm'},
            'conf': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'forms'", 'to': u"orm['wheelcms_properties.Properties']"}),
            'form': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
            'types': ('django.db.models.fields.TextField', [], {'default': "''"})
        }
    }

    complete_apps = ['wheelcms_properties']


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

    <gradient
        android:angle="90"
        android:centerColor="#0000FF"
        android:endColor="#0000FF"
        android:startColor="#0000FF" />

    <corners android:radius="1dp" />

    <stroke
        android:width="1dp"
        android:color="#0000FF" />
    <stroke
        android:width="1dp"
        android:color="#0000FF" />

</shape>


text:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to="SXF4J">
	<inherits name="com.google.gwt.core.Core" />
	<inherits name="com.google.web.bindery.autobean.AutoBean" />

	<source path="sxf4j" />
</module>


text:
#include <linux/module.h>
#include <linux/linkage.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/user.h>
#include <linux/elfcore.h>
#include <linux/in6.h>
#include <linux/interrupt.h>

#include <asm/pgalloc.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/semaphore.h>
#include <asm/checksum.h>
#include <asm/current.h>

extern void *trap_table;
EXPORT_SYMBOL (trap_table);

/* platform dependent support */
EXPORT_SYMBOL (kernel_thread);
EXPORT_SYMBOL (__bug);

/* Networking helper routines. */
EXPORT_SYMBOL (csum_partial_copy_nocheck);
EXPORT_SYMBOL (csum_partial_copy_from_user);
EXPORT_SYMBOL (ip_compute_csum);
EXPORT_SYMBOL (ip_fast_csum);

/* string / mem functions */
EXPORT_SYMBOL (memset);
EXPORT_SYMBOL (memcpy);
EXPORT_SYMBOL (memmove);

/* semaphores */
EXPORT_SYMBOL (__down);
EXPORT_SYMBOL (__down_interruptible);
EXPORT_SYMBOL (__down_trylock);
EXPORT_SYMBOL (__up);

/*
 * libgcc functions - functions that are used internally by the
 * compiler...  (prototypes are not correct though, but that
 * doesn't really matter since they're not versioned).
 */
extern void __ashldi3 (void);
extern void __ashrdi3 (void);
extern void __lshrdi3 (void);
extern void __muldi3 (void);
extern void __negdi2 (void);

EXPORT_SYMBOL (__ashldi3);
EXPORT_SYMBOL (__ashrdi3);
EXPORT_SYMBOL (__lshrdi3);
EXPORT_SYMBOL (__muldi3);
EXPORT_SYMBOL (__negdi2);


text:
from ..engine.default import DefaultDialect
from .. import util
import re
import collections
import contextlib
from .. import event
from sqlalchemy.schema import _DDLCompiles
from sqlalchemy.engine.util import _distill_params

class AssertRule(object):

    is_consumed = False
    errormessage = None
    consume_statement = True

    def process_statement(self, execute_observed):
        pass

    def no_more_statements(self):
        assert False, 'All statements are complete, but pending '\
            'assertion rules remain'

class SQLMatchRule(AssertRule):
    pass

class CursorSQL(SQLMatchRule):
    consume_statement = False

    def __init__(self, statement, params=None):
        self.statement = statement
        self.params = params

    def process_statement(self, execute_observed):
        stmt = execute_observed.statements[0]
        if self.statement != stmt.statement or (
                self.params is not None and self.params != stmt.parameters):
            self.errormessage = \
                "Testing for exact SQL %s parameters %s received %s %s" % (
                    self.statement, self.params,
                    stmt.statement, stmt.parameters
                )
        else:
            execute_observed.statements.pop(0)
            self.is_consumed = True
            if not execute_observed.statements:
                self.consume_statement = True

class CompiledSQL(SQLMatchRule):

    def __init__(self, statement, params=None):
        self.statement = statement
        self.params = params

    def _compare_sql(self, execute_observed, received_statement):
        stmt = re.sub(r'[\n\t]', '', self.statement)
        return received_statement == stmt

    def _compile_dialect(self, execute_observed):
        return DefaultDialect()

    def _received_statement(self, execute_observed):
        """reconstruct the statement and params in terms
        of a target dialect, which for CompiledSQL is just DefaultDialect."""

        context = execute_observed.context
        compare_dialect = self._compile_dialect(execute_observed)
        if isinstance(context.compiled.statement, _DDLCompiles):
            compiled = \
                context.compiled.statement.compile(dialect=compare_dialect)
        else:
            compiled = (
                context.compiled.statement.compile(
                    dialect=compare_dialect,
                    column_keys=context.compiled.column_keys,
                    inline=context.compiled.inline)
            )
        _received_statement = re.sub(r'[\n\t]', '', util.text_type(compiled))
        parameters = execute_observed.parameters

        if not parameters:
            _received_parameters = [compiled.construct_params()]
        else:
            _received_parameters = [
                compiled.construct_params(m) for m in parameters]

        return _received_statement, _received_parameters

    def process_statement(self, execute_observed):
        context = execute_observed.context

        _received_statement, _received_parameters = \
            self._received_statement(execute_observed)
        params = self._all_params(context)

        equivalent = self._compare_sql(execute_observed, _received_statement)

        if equivalent:
            if params is not None:
                all_params = list(params)
                all_received = list(_received_parameters)
                while all_params and all_received:
                    param = dict(all_params.pop(0))

                    for idx, received in enumerate(list(all_received)):
                        # do a positive compare only
                        for param_key in param:
                            # a key in param did not match current
                            # 'received'
                            if param_key not in received or \
                                    received[param_key] != param[param_key]:
                                break
                        else:
                            # all keys in param matched 'received';
                            # onto next param
                            del all_received[idx]
                            break
                    else:
                        # param did not match any entry
                        # in all_received
                        equivalent = False
                        break
                if all_params or all_received:
                    equivalent = False

        if equivalent:
            self.is_consumed = True
            self.errormessage = None
        else:
            self.errormessage = self._failure_message(params) % {
                'received_statement': _received_statement,
                'received_parameters': _received_parameters
            }

    def _all_params(self, context):
        if self.params:
            if util.callable(self.params):
                params = self.params(context)
            else:
                params = self.params
            if not isinstance(params, list):
                params = [params]
            return params
        else:
            return None

    def _failure_message(self, expected_params):
        return (
            'Testing for compiled statement %r partial params %r, '
            'received %%(received_statement)r with params '
            '%%(received_parameters)r' % (
                self.statement, expected_params
            )
        )

class RegexSQL(CompiledSQL):
    def __init__(self, regex, params=None):
        SQLMatchRule.__init__(self)
        self.regex = re.compile(regex)
        self.orig_regex = regex
        self.params = params

    def _failure_message(self, expected_params):
        return (
            'Testing for compiled statement ~%r partial params %r, '
            'received %%(received_statement)r with params '
            '%%(received_parameters)r' % (
                self.orig_regex, expected_params
            )
        )

    def _compare_sql(self, execute_observed, received_statement):
        return bool(self.regex.match(received_statement))

class DialectSQL(CompiledSQL):
    def _compile_dialect(self, execute_observed):
        return execute_observed.context.dialect

    def _received_statement(self, execute_observed):
        received_stmt, received_params = super(DialectSQL, self).\
            _received_statement(execute_observed)
        for real_stmt in execute_observed.statements:
            if real_stmt.statement == received_stmt:
                break
        else:
            raise AssertionError(
                "Can't locate compiled statement %r in list of "
                "statements actually invoked" % received_stmt)
        return received_stmt, execute_observed.context.compiled_parameters

    def _compare_sql(self, execute_observed, received_statement):
        stmt = re.sub(r'[\n\t]', '', self.statement)

        # convert our comparison statement to have the
        # paramstyle of the received
        paramstyle = execute_observed.context.dialect.paramstyle
        if paramstyle == 'pyformat':
            stmt = re.sub(
                r':([\w_]+)', r"%(\1)s", stmt)
        else:
            # positional params
            repl = None
            if paramstyle == 'qmark':
                repl = "?"
            elif paramstyle == 'format':
                repl = r"%s"
            elif paramstyle == 'numeric':
                repl = None
            stmt = re.sub(r':([\w_]+)', repl, stmt)

        return received_statement == stmt

class CountStatements(AssertRule):

    def __init__(self, count):
        self.count = count
        self._statement_count = 0

    def process_statement(self, execute_observed):
        self._statement_count += 1

    def no_more_statements(self):
        if self.count != self._statement_count:
            assert False, 'desired statement count %d does not match %d' \
                % (self.count, self._statement_count)

class AllOf(AssertRule):

    def __init__(self, *rules):
        self.rules = set(rules)

    def process_statement(self, execute_observed):
        for rule in list(self.rules):
            rule.errormessage = None
            rule.process_statement(execute_observed)
            if rule.is_consumed:
                self.rules.discard(rule)
                if not self.rules:
                    self.is_consumed = True
                break
            elif not rule.errormessage:
                # rule is not done yet
                self.errormessage = None
                break
        else:
            self.errormessage = list(self.rules)[0].errormessage

class Or(AllOf):

    def process_statement(self, execute_observed):
        for rule in self.rules:
            rule.process_statement(execute_observed)
            if rule.is_consumed:
                self.is_consumed = True
                break
        else:
            self.errormessage = list(self.rules)[0].errormessage

class SQLExecuteObserved(object):
    def __init__(self, context, clauseelement, multiparams, params):
        self.context = context
        self.clauseelement = clauseelement
        self.parameters = _distill_params(multiparams, params)
        self.statements = []

class SQLCursorExecuteObserved(
    collections.namedtuple(
        "SQLCursorExecuteObserved",
        ["statement", "parameters", "context", "executemany"])
):
    pass

class SQLAsserter(object):
    def __init__(self):
        self.accumulated = []

    def _close(self):
        self._final = self.accumulated
        del self.accumulated

    def assert_(self, *rules):
        rules = list(rules)
        observed = list(self._final)

        while observed and rules:
            rule = rules[0]
            rule.process_statement(observed[0])
            if rule.is_consumed:
                rules.pop(0)
            elif rule.errormessage:
                assert False, rule.errormessage

            if rule.consume_statement:
                observed.pop(0)

        if not observed and rules:
            rules[0].no_more_statements()
        elif not rules and observed:
            assert False, "Additional SQL statements remain"

@contextlib.contextmanager
def assert_engine(engine):
    asserter = SQLAsserter()

    orig = []

    @event.listens_for(engine, "before_execute")
    def connection_execute(conn, clauseelement, multiparams, params):
        # grab the original statement + params before any cursor
        # execution
        orig[:] = clauseelement, multiparams, params

    @event.listens_for(engine, "after_cursor_execute")
    def cursor_execute(conn, cursor, statement, parameters,
                       context, executemany):
        if not context:
            return
        # then grab real cursor statements and associate them all
        # around a single context
        if asserter.accumulated and \
                asserter.accumulated[-1].context is context:
            obs = asserter.accumulated[-1]
        else:
            obs = SQLExecuteObserved(context, orig[0], orig[1], orig[2])
            asserter.accumulated.append(obs)
        obs.statements.append(
            SQLCursorExecuteObserved(
                statement, parameters, context, executemany)
        )

    try:
        yield asserter
    finally:
        event.remove(engine, "after_cursor_execute", cursor_execute)
        event.remove(engine, "before_execute", connection_execute)
        asserter._close()


text:
package vn.getgreen.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.EditText;

public class GEditText extends EditText {

	public GEditText(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}

	public GEditText(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
	}

	public GEditText(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		// TODO Auto-generated constructor stub
	}

}


text:
+++
draft = false
author = "mwahl"
description = "Last week's Pony news, reported this week."
categories = [
    "Last Week in Pony",
]
title = "Last Week in Pony - May 20, 2018"
date = "2018-05-20T22:00:00+02:00"
+++
_Last Week In Pony_ is a weekly blog post to catch you up on the latest news for the Pony programming language. To learn more about Pony check out [our website](https://ponylang.io), our Twitter account [@ponylang](https://twitter.com/ponylang), or our [Zulip community](https://ponylang.zulipchat.com).

Got something you think should be featured? There's a GitHub issue for that! Add a comment to the [open "Last Week in Pony" issue](https://github.com/ponylang/ponylang.github.io/issues?q=is%3Aissue+is%3Aopen+label%3Alast-week-in-pony).
<!--more-->

## Items of Note

* GitHub User [d-led](https://github.com/d-led) provided an example for [Vaughn Vernons Domain Driven Design with Actors](https://github.com/VaughnVernon/DDDwithActors) in [Pony](https://github.com/d-led/DDDwithActorsPony). This is a quite good comparison between the different actor system languages and libraries out there.
* A new version of [ponycheck](https://github.com/mfelsche/ponycheck), the property-based testing library for Pony, has been released. Version [0.4.0](https://github.com/mfelsche/ponycheck/releases/tag/0.4.0) brings partial Generators and some simplification of the Generator API, for more details, see the [Release Notes](https://github.com/mfelsche/ponycheck/releases/tag/0.4.0).

## RFCs

### Under Discussion

* [Formal Viewpoint Adaptation](https://github.com/ponylang/rfcs/pull/122)

* [Use Site Variance and Implicit Interfaces for Generic Types.](https://github.com/ponylang/rfcs/pull/123)

* [Trust boundary specification](https://github.com/ponylang/rfcs/pull/124)

Interested in making a change, or keeping up with changes to Pony? Check out the [RFC repo](https://github.com/ponylang/rfcs). Contributors welcome!


text:
// ----------------------------------------------------------------------------------
//
// Copyright 2011 Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

namespace Microsoft.WindowsAzure.Management.SqlDatabase.Test.UnitTests.Database.Cmdlet
{
    using System;
    using System.Collections.ObjectModel;
    using System.Globalization;
    using System.Management.Automation;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Microsoft.WindowsAzure.Management.CloudService.Test;
    using Microsoft.WindowsAzure.Management.SqlDatabase.Test.UnitTests.MockServer;

    [TestClass]
    public class RemoveAzureSqlDatabaseTests : TestBase
    {
        [TestCleanup]
        public void CleanupTest()
        {
            DatabaseTestHelper.SaveDefaultSessionCollection();
        }

        [TestMethod]
        public void RemoveAzureSqlDatabaseWithSqlAuth()
        {
            using (System.Management.Automation.PowerShell powershell =
                System.Management.Automation.PowerShell.Create())
            {
                // Create a context
                NewAzureSqlDatabaseServerContextTests.CreateServerContextSqlAuth(
                    powershell,
                    "$context");
                // Create 2 test databases
                NewAzureSqlDatabaseTests.CreateTestDatabasesWithSqlAuth(
                    powershell,
                    "$context");

                HttpSession testSession = DatabaseTestHelper.DefaultSessionCollection.GetSession(
                    "UnitTests.RemoveAzureSqlDatabaseWithSqlAuth");
                DatabaseTestHelper.SetDefaultTestSessionSettings(testSession);
                testSession.RequestValidator =
                    new Action<HttpMessage, HttpMessage.Request>(
                        (expected, actual) =>
                        {
                            Assert.AreEqual(expected.RequestInfo.Method, actual.Method);
                            Assert.AreEqual(expected.RequestInfo.UserAgent, actual.UserAgent);
                            switch (expected.Index)
                            {
                                // Request 0-3: Remove database requests
                                case 0:
                                case 1:
                                case 2:
                                case 3:
                                // Request 4: Get all database request
                                case 4:
                                    DatabaseTestHelper.ValidateHeadersForODataRequest(
                                        expected.RequestInfo,
                                        actual);
                                    break;
                                default:
                                    Assert.Fail("No more requests expected.");
                                    break;
                            }
                        });

                using (AsyncExceptionManager exceptionManager = new AsyncExceptionManager())
                {
                    // Create context with both ManageUrl and ServerName overriden
                    Collection<PSObject> databases;
                    using (new MockHttpServer(
                        exceptionManager,
                        MockHttpServer.DefaultServerPrefixUri,
                        testSession))
                    {
                        powershell.InvokeBatchScript(
                            @"Remove-AzureSqlDatabase " +
                            @"-Context $context " +
                            @"-DatabaseName testdb1 " +
                            @"-Force");
                        powershell.InvokeBatchScript(
                            @"Remove-AzureSqlDatabase " +
                            @"-Context $context " +
                            @"-DatabaseName testdb2 " +
                            @"-Force");

                        databases = powershell.InvokeBatchScript(
                            @"Get-AzureSqlDatabase " +
                            @"-Context $context");
                    }

                    Assert.AreEqual(0, powershell.Streams.Error.Count, "Errors during run!");
                    Assert.AreEqual(0, powershell.Streams.Warning.Count, "Warnings during run!");
                    powershell.Streams.ClearStreams();

                    Assert.AreEqual(1, databases.Count, "Expecting only master database object");
                }
            }
        }
    }
}


text:
(typeof describe === 'function') && describe("Sensor", function() {
    const winston = require('winston');
    const should = require("should");
    const {
        OyaMist,
    } = require("../index");

    it("locationField(loc,fieldPrefix) returns field for location", function() {
        should(OyaMist.locationField(OyaMist.LOC_INTERNAL,'temp')).equal('tempInternal');
        should(OyaMist.locationField(OyaMist.LOC_INTERNAL,'ec')).equal('ecInternal');
        should(OyaMist.locationField(OyaMist.LOC_AMBIENT,'abc')).equal('abcAmbient');
        should(OyaMist.locationField(OyaMist.LOC_CANOPY,'abc')).equal('abcCanopy');
    });
    it("localDate(date) returns 00:00 of local date", function() {
        var now = new Date();
        var date = OyaMist.localDate(now);
        should(date.getHours()).equal(0);
        should(date.getMinutes()).equal(0);
        should(date.getSeconds()).equal(0);
        should(date.getMilliseconds()).equal(0);
        should(date.getFullYear()).equal(now.getFullYear());
        should(date.getMonth()).equal(now.getMonth());
        should(date.getDate()).equal(now.getDate());

        var date2 = OyaMist.localDate();
        should.deepEqual(date2, date);

        var date3 = OyaMist.localDate(new Date(2017,10,05)); // local
        var date4 = OyaMist.localDate("2017-11-05"); // local (but Date would parse it as gmt)
        should.deepEqual(date4, date3);
    });
})


text:
title: NextJs Create Blog Post with Starter Template
date: '2021-12-30T02:26:37.018Z'
tags: ['NextJs', 'Blog', 'Tailwind']
draft: false
summary: Create NextJs Blog Post with Tailwind NextJs Starter Blog
images: []
layout: PostLayout
---

# Create NextJs Blog Post using [Tailwind Nextjs Starter Blog](https://github.com/timlrx/tailwind-nextjs-starter-blog)

## Quict Start

```bash
npx degit https://github.com/timlrx/tailwind-nextjs-starter-blog.git my-blog
```

## Install Dependencies using npm or yarn

```bash
npm install
# or
yarn install
```

## Start development server

```bash
npm run dev
# or
yarn dev
```

## Let's see the website

```bash
open http://localhost:3000
```

### Example

![Demo Cli](/images/demo-script.png)

### Dark Theme template

![Dark Theme](/images/dark-theme.png)

### Light Theme template

![Light Theme](/images/light-theme.png)


text:
function vol = niak_part2vol(part,mask);
%
% _________________________________________________________________________
% SUMMARY OF NIAK_PART2VOL
%
% Convert a partition of N individual regions into 3D maps of clusters.
%
% SYNTAX:
% VOL = NIAK_PART2VOL(PART,MASK)
%
% _________________________________________________________________________
%
% INPUTS:
%
% PART
%       (vector) PART(I) is the number of the cluster of region I.
%
% MASK
%       (3D volume) MASK==I is a binary mask of region I.
% _________________________________________________________________________
% OUTPUTS:
%
% VOL
%       (3D volume) VOL==K is a binary mask of the Kth cluster.
%
% _________________________________________________________________________
% SEE ALSO:
%
% _________________________________________________________________________
% COMMENTS:
% This function will work with any vector of scalar values PART. This means
% that in MASK, region K will be replaced by the values found in PART(K)
% whatever that value is, integer or scalar.
%
% PART have multiple rows and columns. In this case, VOL will be a 4D array
% where each volume will correspond to one row of PART. (Think as colums of
% PART as time series and VOL as a 3D+t dataset).
%
% Copyright (c) Pierre Bellec, McConnell Brain Imaging Center, Montreal
%               Neurological Institute, McGill University, 2007.
% Maintainer : pbellec@bic.mni.mcgill.ca
% See licensing information in the code.
% Keywords : partition, roi

% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
% copies of the Software, and to permit persons to whom the Software is
% furnished to do so, subject to the following conditions:
%
% The above copyright notice and this permission notice shall be included in
% all copies or substantial portions of the Software.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
% THE SOFTWARE.
if size(part,1)>1 && size(part,2)>1
    vol = zeros([size(mask) size(part,1)]);
    for num_v = 1:size(part,1)
        vol_tmp = zeros(size(mask));
        vol_tmp(mask>0) = part(num_v,mask(mask>0));
        vol(:,:,:,num_v) = vol_tmp;
    end
else
    vol = zeros(size(mask));
    vol(mask>0) = part(mask(mask>0));
end