text:
// Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include"leveldb/raw_key_operator.h"

#include <sys/time.h>
#include <iostream>

#include "util/testharness.h"

namespace leveldb {

void print_bytes(const char* str, int len) {
    for (int i = 0; i < len; ++i) {
        printf("%x ", str[i]);
    }
    printf("\n");
}

int64_t get_micros() {
    struct timeval tv;
    gettimeofday(&tv, NULL);
    return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
}

class RawKeyOperatorTest {};

TEST(RawKeyOperatorTest, ReadableEncodeTeraKey) {
    const RawKeyOperator* key_operator = ReadableRawKeyOperator();
    std::string key("row_key");
    std::string column("column");
    std::string qualifier("qualifier");
    int64_t timestamp = 0x0001020304050607;

    std::string tera_key1;
    std::string tera_key2;

    key_operator->EncodeTeraKey(key, column, qualifier, timestamp,
                                TKT_VALUE, &tera_key1);
    key_operator->EncodeTeraKey(key, column, qualifier, timestamp,
                                TKT_DEL, &tera_key2);

    size_t len = key.size() + column.size() + qualifier.size() + sizeof(timestamp) + 3;
    ASSERT_EQ(tera_key1.size(), len);

    std::string raw1("row_key\0column\0qualifier\0\xFE\xFD\xFC\xFB\xFA\xF9\xF8\x05", len);
    ASSERT_TRUE(tera_key1 == raw1);
//    print_bytes(tera_key1.data(), tera_key1.size());
//    print_bytes(raw1.data(), raw1.size());

    std::string raw2("row_key\0column\0qualifier\0\xFE\xFD\xFC\xFB\xFA\xF9\xF8\x01", len);
    ASSERT_TRUE(tera_key2 == raw2);

    ASSERT_TRUE(tera_key1.compare(tera_key2) > 0);
}

TEST(RawKeyOperatorTest, ReadableExtractTeraKey) {
    const RawKeyOperator* key_operator = ReadableRawKeyOperator();
    std::string tera_key1;
    std::string row_key1 = "row";
    std::string column1 = "column";
    std::string qualifier1 = "qualifier";
    int64_t timestamp1 = time(NULL);
    key_operator->EncodeTeraKey(row_key1, column1,qualifier1,
                              timestamp1, TKT_VALUE, &tera_key1);

    Slice row_key2;
    Slice column2;
    Slice qualifier2;
    int64_t timestamp2;
    TeraKeyType type2;
    ASSERT_TRUE(key_operator->ExtractTeraKey(tera_key1, &row_key2, &column2,
                                           &qualifier2, &timestamp2, &type2));

    ASSERT_EQ(row_key1, row_key2.ToString());
    ASSERT_EQ(column1, column2.ToString());
    ASSERT_EQ(qualifier1, qualifier2.ToString());
    ASSERT_EQ(timestamp1, timestamp2);
    ASSERT_EQ(type2, TKT_VALUE);
}

TEST(RawKeyOperatorTest, BinaryEncodeTeraKey) {
    const RawKeyOperator* key_operator = BinaryRawKeyOperator();
    std::string key("row_key");
    std::string column("column");
    std::string qualifier("qualifier");
    int64_t timestamp = 0x01020304050607;

    std::string tera_key1;
    std::string tera_key2;

    key_operator->EncodeTeraKey(key, column, qualifier, timestamp,
                                TKT_VALUE, &tera_key1);
    key_operator->EncodeTeraKey(key, column, qualifier, timestamp,
                                TKT_DEL, &tera_key2);

    size_t len = key.size() + column.size() + qualifier.size() + sizeof(timestamp) + 5;
    ASSERT_EQ(tera_key1.size(), len);

    std::string raw1("row_keycolumn\0qualifier\xFE\xFD\xFC\xFB\xFA\xF9\xF8\x5\x0\x7\x0\x9", len);
    ASSERT_TRUE(tera_key1 == raw1);
//    print_bytes(tera_key1.data(), tera_key1.size());
//    print_bytes(raw1.data(), raw1.size());

    std::string raw2("row_keycolumn\0qualifier\xFE\xFD\xFC\xFB\xFA\xF9\xF8\x01\x0\x7\x0\x9", len);
    ASSERT_TRUE(tera_key2 == raw2);

    ASSERT_TRUE(tera_key1.compare(tera_key2) > 0);

}

TEST(RawKeyOperatorTest, BinaryExtractTeraKey) {
    const RawKeyOperator* key_operator = BinaryRawKeyOperator();
    std::string tera_key1;
    std::string row_key1 = "row";
    std::string column1 = "column";
    std::string qualifier1 = "qualifier";
    key_operator->EncodeTeraKey(row_key1, column1,qualifier1,
                              0, TKT_VALUE, &tera_key1);

    Slice row_key2;
    Slice column2;
    Slice qualifier2;
    int64_t timestamp2;
    TeraKeyType type2;
    ASSERT_TRUE(key_operator->ExtractTeraKey(tera_key1, &row_key2, &column2,
                                           &qualifier2, &timestamp2, &type2));

    ASSERT_EQ(row_key1, row_key2.ToString());
    ASSERT_EQ(column1, column2.ToString());
    ASSERT_EQ(qualifier1, qualifier2.ToString());
    ASSERT_EQ(timestamp2, 0);
    ASSERT_EQ(type2, TKT_VALUE);
}

void GenTestString(int64_t len, std::string* output) {
    for (int i = 0; i < len; ++i) {
        output->append("a");
    }
}

TEST(RawKeyOperatorTest, TestBigRow) {
    const RawKeyOperator* key_operator = BinaryRawKeyOperator();
    std::string test_str_60K;
    GenTestString(60000, &test_str_60K);

    std::string tera_key1;
    std::string row_key1 = test_str_60K;
    std::string column1 = test_str_60K;
    std::string qualifier1 = test_str_60K;
    key_operator->EncodeTeraKey(row_key1, column1,qualifier1,
                                0, TKT_VALUE, &tera_key1);
    ASSERT_EQ(tera_key1.size(), 180013u);

    Slice row_key2;
    Slice column2;
    Slice qualifier2;
    int64_t timestamp2;
    TeraKeyType type2;
    ASSERT_TRUE(key_operator->ExtractTeraKey(tera_key1, &row_key2, &column2,
                                             &qualifier2, &timestamp2, &type2));

    ASSERT_EQ(row_key1, row_key2.ToString());
    ASSERT_EQ(column1, column2.ToString());
    ASSERT_EQ(qualifier1, qualifier2.ToString());
    ASSERT_EQ(timestamp2, 0);
    ASSERT_EQ(type2, TKT_VALUE);
}

TEST(RawKeyOperatorTest, Compare) {
    const RawKeyOperator* key_operator = BinaryRawKeyOperator();
    std::string tera_key1, tera_key2;
    std::string key1, key2;
    std::string column1, column2;
    std::string qualifier1, qualifier2;
    int64_t ts1, ts2;
    TeraKeyType type1, type2;

    key1 = "row";
    column1 = "column";
    qualifier1 = "qualifier";
    ts1 = 0;
    type1 = TKT_VALUE;
    key_operator->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key1);

    key2 = "row";
    column2 = "column";
    qualifier2 = "qualifier";
    ts2 = 0;
    type2 = TKT_VALUE;
    key_operator->EncodeTeraKey(key2, column2, qualifier2, ts2, type2, &tera_key2);
    ASSERT_EQ(key_operator->Compare(tera_key1, tera_key2), 0);

    key2 = "row1";
    column2 = "column";
    qualifier2 = "qualifier";
    ts2 = 0;
    type2 = TKT_VALUE;
    key_operator->EncodeTeraKey(key2, column2, qualifier2, ts2, type2, &tera_key2);
    ASSERT_LT(key_operator->Compare(tera_key1, tera_key2), 0);

    key2 = "ro";
    column2 = "column";
    qualifier2 = "qualifier";
    ts2 = 0;
    type2 = TKT_VALUE;
    key_operator->EncodeTeraKey(key2, column2, qualifier2, ts2, type2, &tera_key2);
    ASSERT_GT(key_operator->Compare(tera_key1, tera_key2), 0);

    key2 = "row";
    column2 = "columny";
    qualifier2 = "qualifier";
    ts2 = 0;
    type2 = TKT_VALUE;
    key_operator->EncodeTeraKey(key2, column2, qualifier2, ts2, type2, &tera_key2);
    ASSERT_LT(key_operator->Compare(tera_key1, tera_key2), 0);

    key2 = "row";
    column2 = "column";
    qualifier2 = "qualifierr";
    ts2 = 0;
    type2 = TKT_VALUE;
    key_operator->EncodeTeraKey(key2, column2, qualifier2, ts2, type2, &tera_key2);
    ASSERT_LT(key_operator->Compare(tera_key1, tera_key2), 0);

    key2 = "row";
    column2 = "column";
    qualifier2 = "qualifier";
    ts2 = 1;
    type2 = TKT_VALUE;
    key_operator->EncodeTeraKey(key2, column2, qualifier2, ts2, type2, &tera_key2);
    ASSERT_GT(key_operator->Compare(tera_key1, tera_key2), 0);

    key2 = "row";
    column2 = "column";
    qualifier2 = "qualifier";
    ts2 = 0;
    type2 = TKT_DEL;
    key_operator->EncodeTeraKey(key2, column2, qualifier2, ts2, type2, &tera_key2);
    ASSERT_GT(key_operator->Compare(tera_key1, tera_key2), 0);

    //
    type1 = TKT_DEL_COLUMN;
    key_operator->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key1);

    key2 = "row";
    column2 = "column";
    qualifier2 = "qualifier";
    ts2 = 0;
    type2 = TKT_VALUE;
    key_operator->EncodeTeraKey(key2, column2, qualifier2, ts2, type2, &tera_key2);
    ASSERT_LT(key_operator->Compare(tera_key1, tera_key2), 0);

    key2 = "row";
    column2 = "column";
    qualifier2 = "qualifier";
    ts2 = 1;
    type2 = TKT_VALUE;
    key_operator->EncodeTeraKey(key2, column2, qualifier2, ts2, type2, &tera_key2);
    ASSERT_GT(key_operator->Compare(tera_key1, tera_key2), 0);
}

void EncodeTeraKeyPerformanceTest(const RawKeyOperator* key_operator,
                                   const std::string& row,
                                   const std::string& col,
                                   const std::string& qual,
                                   int64_t ts,
                                   TeraKeyType type,
                                   const std::string& desc) {
    std::string tera_key;
    int64_t start = get_micros();
    for (int i = 0; i < 10000000; ++i) {
        key_operator->EncodeTeraKey(row, col, qual, ts, type, &tera_key);
    }
    int64_t end = get_micros();
    std::cout << "[Encode TeraKey Performance ("
        << desc << ")] cost: " << (end - start) / 1000 << "ms\n";
}

TEST(RawKeyOperatorTest, EncodeTeraKeyPerformace) {
    const RawKeyOperator* keyop_bin = BinaryRawKeyOperator();
    std::string tera_key, row, col, qual;
    int64_t ts;
    TeraKeyType type;
    row = "row";
    col = "col";
    qual = "qual";
    ts = 123456789;
    type = TKT_VALUE;

    EncodeTeraKeyPerformanceTest(keyop_bin, row, col, qual, ts, type, "binary short");

    row = "rowrowrowrowrowrowrowrowrowrowrowrowrowrowrowrowrowrowrowrow";
    col = "colcolcolcolcolcolcolcolcolcolcolcolcolcolcolcolcolcolcolcolcol";
    qual = "qualqualqualqualqualqualqualqualqualqualqualqualqualqualqualqual";
    EncodeTeraKeyPerformanceTest(keyop_bin, row, col, qual, ts, type, "binary long");
    EncodeTeraKeyPerformanceTest(keyop_bin, row, col, qual, ts, type, "binary long qualnull");
}

void ExtractTeraKeyPerformanceTest(const RawKeyOperator* key_operator,
                                   const std::string& key,
                                   const std::string& desc) {
    Slice row, col, qual;
    int64_t ts;
    TeraKeyType type;
    int64_t start = get_micros();
    for (int i = 0; i < 10000000; ++i) {
        key_operator->ExtractTeraKey(key, &row, &col, &qual, &ts, &type);
    }
    int64_t end = get_micros();
    std::cout << "[Extract TeraKey Performance ("
        << desc << ")] cost: " << (end - start) / 1000 << "ms\n";
}

TEST(RawKeyOperatorTest, ExtractTeraKeyPerformace) {
    const RawKeyOperator* keyop_bin = BinaryRawKeyOperator();
    std::string tera_key, row, col, qual;
    row = "row";
    col = "col";
    qual = "qual";
    keyop_bin->EncodeTeraKey(row, col, qual, 0, TKT_VALUE, &tera_key);
    ExtractTeraKeyPerformanceTest(keyop_bin, tera_key, "binary short");

    row = "rowrowrowrowrowrowrowrowrowrowrowrowrowrowrowrowrowrowrowrow";
    col = "colcolcolcolcolcolcolcolcolcolcolcolcolcolcolcolcolcolcolcolcol";
    qual = "qualqualqualqualqualqualqualqualqualqualqualqualqualqualqualqual";
    keyop_bin->EncodeTeraKey(row, col, qual, 0, TKT_VALUE, &tera_key);
    ExtractTeraKeyPerformanceTest(keyop_bin, tera_key, "binary long");

    keyop_bin->EncodeTeraKey(row, col, "", 0, TKT_VALUE, &tera_key);
    ExtractTeraKeyPerformanceTest(keyop_bin, tera_key, "binary long qualnull");
}

void ComparePerformanceTest(const RawKeyOperator* key_operator,
                     const std::string& key1,
                     const std::string& key2,
                     const std::string& desc) {
    int64_t start = get_micros();
    for (int i = 0; i < 10000000; ++i) {
        key_operator->Compare(key1, key2);
    }
    int64_t end = get_micros();
    std::cout << "[Compare Performance ("
        << desc << ")] cost: " << (end - start) / 1000 << "ms\n";
}

TEST(RawKeyOperatorTest, ComparePerformace) {
    const RawKeyOperator* keyop_bin = BinaryRawKeyOperator();
    const RawKeyOperator* keyop_read = ReadableRawKeyOperator();
    std::string tera_key1, tera_key2;
    std::string key1, key2;
    std::string column1, column2;
    std::string qualifier1, qualifier2;
    int64_t ts1, ts2;
    TeraKeyType type1;

    key1 = "rowrowrowrowrowrowrowrowrowrowrowrowrowrowrowrow";
    column1 = "columncolumncolumncolumn";
    qualifier1 = "qualifierqualifierqualifier";
    ts1 = 123456789;
    type1 = TKT_VALUE;
    key2 = "row";
    column2 = "column";
    qualifier2 = "qualifier";
    ts2 = 987654321;

    keyop_bin->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key1);
    keyop_bin->EncodeTeraKey(key2, column2, qualifier2, ts2, type1, &tera_key2);
    ComparePerformanceTest(keyop_bin, tera_key1, tera_key2, "binary long same none");

    keyop_bin->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key1);
    keyop_bin->EncodeTeraKey(key1, column2, qualifier2, ts2, type1, &tera_key2);
    ComparePerformanceTest(keyop_bin, tera_key1, tera_key2, "binary long same row");

    keyop_bin->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key1);
    keyop_bin->EncodeTeraKey(key1, column1, qualifier2, ts2, type1, &tera_key2);
    ComparePerformanceTest(keyop_bin, tera_key1, tera_key2, "binary long same row/col");

    keyop_bin->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key1);
    keyop_bin->EncodeTeraKey(key1, column1, qualifier1, ts2, type1, &tera_key2);
    ComparePerformanceTest(keyop_bin, tera_key1, tera_key2, "binary long same row/col/qu");

    keyop_bin->EncodeTeraKey(key1, column1, "", ts1, type1, &tera_key1);
    keyop_bin->EncodeTeraKey(key1, column1, "", ts2, type1, &tera_key2);
    ComparePerformanceTest(keyop_bin, tera_key1, tera_key2, "binary long same row/col/null");

    keyop_bin->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key1);
    keyop_bin->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key2);
    ComparePerformanceTest(keyop_bin, tera_key1, tera_key2, "binary long same all");

    keyop_bin->EncodeTeraKey(key2, column2, qualifier2, ts1, type1, &tera_key1);
    keyop_bin->EncodeTeraKey(key2, column2, qualifier2, ts1, type1, &tera_key2);
    ComparePerformanceTest(keyop_bin, tera_key1, tera_key2, "binary short");

    keyop_read->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key1);
    keyop_read->EncodeTeraKey(key2, column2, qualifier2, ts2, type1, &tera_key2);
    ComparePerformanceTest(keyop_read, tera_key1, tera_key2, "readable long same none");

    keyop_read->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key1);
    keyop_read->EncodeTeraKey(key1, column2, qualifier2, ts2, type1, &tera_key2);
    ComparePerformanceTest(keyop_read, tera_key1, tera_key2, "readable long same row");

    keyop_read->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key1);
    keyop_read->EncodeTeraKey(key1, column1, qualifier2, ts2, type1, &tera_key2);
    ComparePerformanceTest(keyop_read, tera_key1, tera_key2, "readable long same row/col");

    keyop_read->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key1);
    keyop_read->EncodeTeraKey(key1, column1, qualifier1, ts2, type1, &tera_key2);
    ComparePerformanceTest(keyop_read, tera_key1, tera_key2, "readable long same row/col/qu");

    keyop_read->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key1);
    keyop_read->EncodeTeraKey(key1, column1, qualifier1, ts1, type1, &tera_key2);
    ComparePerformanceTest(keyop_read, tera_key1, tera_key2, "readable long same all");

    keyop_read->EncodeTeraKey(key2, column2, qualifier2, ts1, type1, &tera_key1);
    keyop_read->EncodeTeraKey(key2, column2, qualifier2, ts1, type1, &tera_key2);
    ComparePerformanceTest(keyop_read, tera_key1, tera_key2, "readable short");
}
}  // namespace leveldb

int main(int argc, char* argv[]) {
    return leveldb::test::RunAllTests();
}

/* vim: set expandtab ts=4 sw=4 sts=4 tw=100: */


text:
package org.apache.log4j.chainsaw;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;

import org.apache.log4j.Logger;
import org.apache.log4j.chainsaw.help.HelpManager;

/**
 * A simple About box telling people stuff about this project
 *
 * @author Paul Smith <psmith@apache.org>
 *
 */
class ChainsawAbout extends JDialog {
    private static final Logger LOG = Logger.getLogger(ChainsawAbout.class);

    private final JEditorPane editPane = new JEditorPane("text/html", "");

    private final JScrollPane scrollPane = new JScrollPane(editPane,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    private final String url = ChainsawAbout.class.getName().replace('.', '/')
            + ".html";

    private boolean sleep = false;

    private final Object guard = new Object();

    ChainsawAbout(JFrame parent) {
        super(parent, "About Chainsaw v2", true);
        // setResizable(false);
        setBackground(Color.white);
        getContentPane().setLayout(new BorderLayout());

        JButton closeButton = new JButton(" Close ");
        closeButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
            }
        });
        closeButton.setDefaultCapable(true);

        try {
            editPane.setPage(this.getClass().getClassLoader().getResource(url));
        } catch (Exception e) {
            throw new RuntimeException("Failed to find the About panel HTML", e);
        }
        getContentPane().add(scrollPane, BorderLayout.CENTER);
        getContentPane().add(closeButton, BorderLayout.SOUTH);
        JTextComponentFormatter.applySystemFontAndSize(editPane);

        editPane.setEditable(false);
        editPane.addHyperlinkListener(
                new HyperlinkListener() {
                    public void hyperlinkUpdate(HyperlinkEvent e) {
                      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                          HelpManager.getInstance().setHelpURL(e.getURL());
                      }
                    }
                  });

        setSize(320, 240);
        new Thread(new Scroller()).start();
        scrollPane.getViewport().setViewPosition(new Point(0, 0));

        setLocationRelativeTo(parent);
    }

    private class Scroller implements Runnable {

        public void run() {
            while (true) {
                try {
                    if (sleep) {
                        synchronized (guard) {
                            guard.wait();
                        }
                            SwingUtilities.invokeLater(new Runnable() {
                                public void run() {
                                    scrollPane.getViewport().setViewPosition(
                                            new Point(0, 0));
                                }
                            });
                        continue;
                    }
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            scrollPane.getViewport().setViewPosition(
                                    new Point(0, scrollPane.getViewport()
                                            .getViewPosition().y + 1));
                        }
                    });
                    Thread.sleep(100);
                } catch (Exception e) {
                    LOG.error("Error during scrolling", e);
                }

            }
        }
    }

    public void setVisible(boolean visible) {
        super.setVisible(visible);
        sleep = !visible;
        synchronized (guard) {
            guard.notifyAll();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
Here are assumptions about the user and his device:
* The user acts reasonably and in good faith. This means that the user is conscious of the limits of the security of Lawncipher and acts accordingly. This includes to not share the password or root key with a potential attacker.
* To protect his Lawncipher database, the user sets a strong password or a randomly generated 32 bytes root key
* The user's device is not infected by malware that can read the main memory or that can monitor the execution and method calls inside a program
* The user's device executes Lawncipher's code correctly
* __The user doesn't use sensitive information as document identifiers__
* __The user doesn't use sensitive information in the name of indexed fields__

Here are some assumptions about the world:
* The security assumptions of XSalsa20, Poly1305 MAC and Scrypt are correct
* The implementations of the above mentionned algorithms in Libsodium are correct
* The compiled and/or bound versions of the algorithms, as used in Lawncipher, are correct. This means that we assume:
  * For Libsodium.js, Emscripten's compiles C code to JavaScript correctly and that the Libsodium.js wrappers are correct
  * The cordova-plugin-minisodium bindings for iOS and Android are correct

Here is what an attacker is able to achieve:
* The attacker is able to read from/write to the device's file system
* The attacker can monitor changes in the device's file system, such as the last modification dates, file sizes, file addition or deletion
* The attacker is able to see the name of the available collections and their indexed fields
* The attacker is able to roughly estimate the total size of the data stored in a given collection
* For each document that has a blob, the attacker is able to read its document ID.


text:
require 'spec_helper'

describe 'audit::upload' do
  context 'When all attributes are default, on an unspecified platform' do
    let(:chef_run) do
      runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '14.04')
      runner.converge(described_recipe)
    end

    it 'converges successfully' do
      expect { chef_run }.to_not raise_error
    end
  end

  context 'When server and refresh_token are specified' do
    let(:chef_run) do
      ChefSpec::ServerRunner.new(platform: 'centos', version: '6.9') do |node|
        node.override['audit']['collector'] = 'chef-compliance'
        node.override['audit']['profiles'] = [ {'name': 'admin/myprofile', 'path': '/some/path.tar.gz' } ]
        node.override['audit']['server'] = 'https://my.compliance.test/api'
        node.override['audit']['refresh_token'] = 'abcdefg'
        node.override['audit']['insecure'] = true
        node.override['audit']['owner'] = 'admin'
      end.converge(described_recipe)
    end

    it 'uploads compliance_profile[myprofile]' do
      expect(chef_run).to upload_compliance_profile('myprofile').with(
        server: 'https://my.compliance.test/api',
        owner: 'admin',
        path: '/some/path.tar.gz',
        insecure: true,
        overwrite: true
      )
    end

    it 'converges successfully' do
      expect { chef_run }.to_not raise_error
    end
  end
end


text:
package main

import (
	"bufio"
	"encoding/json"
	"errors"
	"fmt"
	pr "github.com/fclairamb/m2mp/go/m2mp-protocol"
	"net"
	"os"
	"strings"
	"time"
)

type Client struct {
	Conn      *pr.ProtoHandler
	Recv      chan interface{}
	Send      chan interface{}
	Connected bool
	ticker    *time.Ticker
	Ident     string
	status    map[string]string
	settings  map[string]string
}

func NewClient(target, ident string) *Client {
	conn, _ := net.Dial("tcp", target)
	handler := pr.NewProtoHandlerClient(conn)
	clt := &Client{Conn: handler, Ident: ident, Recv: make(chan interface{}), Send: make(chan interface{}), ticker: time.NewTicker(time.Minute), status: make(map[string]string)}

	clt.status["cap"] = "sen"

	if err := clt.loadSettings(); err != nil {
		log.Critical("Settings: %v", err)
	}

	return clt
}

func (c *Client) considerAction() error {
	if !c.Connected {
		return c.Conn.Send(&pr.MessageIdentRequest{Ident: c.Ident})
	} else {

	}

	return nil
}

func (c *Client) runRecv() {
	for {
		msg := c.Conn.Recv()
		switch m := msg.(type) {
		case *pr.EventDisconnected:
			return
		case *pr.MessageDataArray:
			if m.Channel == "_sta" { // If we are on the status channel, we handle things directly
				requestType := string(m.Data[0])
				if requestType == "g" {
					name := string(m.Data[1])
					value := c.status[name]
					msg := pr.NewMessageDataArray(m.Channel)
					msg.AddString("g")
					msg.AddString(fmt.Sprintf("%s=%s", name, value))
					c.Conn.Send(msg)
				} else if requestType == "ga" {
					msg := pr.NewMessageDataArray(m.Channel)
					msg.AddString("g")
					for name, value := range c.status {
						msg.AddString(fmt.Sprintf("%s=%s", name, value))
					}
				}
			} else if m.Channel == "_set" { // if we are on the settings channnel, we also handle things directly
				requestType := string(m.Data[0])
				set := strings.Contains(requestType, "s")
				get := strings.Contains(requestType, "g")
				all := strings.Contains(requestType, "a")

				var response *pr.MessageDataArray

				if get {
					response = pr.NewMessageDataArray(m.Channel)
					response.AddString("g")
				} else {
					response = nil
				}
				if all {
					for name, value := range c.settings {
						response.AddString(fmt.Sprintf("%s=%s", name, value))
					}
				} else {
					for _, v := range m.Data[1:] {
						spl := strings.SplitN(string(v), "=", 2)
						name := spl[0]
						if set && len(spl) == 2 {
							value := spl[1]
							c.setSetting(name, value)
						}
						if get {
							value := c.settings[name]
							response.AddString(fmt.Sprintf("%s=%s", name, value))
						}
					}
				}

				if response != nil {
					c.Conn.Send(response)
				}
			} else if m.Channel == "_cmd" { // If we are on the command channel, we will *try* to handle things directly
				requestType := string(m.Data[0])
				if requestType == "e" {
					command := m.Data[2:]
					response, err := c.handleCommand(command)

					if err == nil { // If we could actually handle this...
						responseMsg := pr.NewMessageDataArray(m.Channel)
						responseMsg.AddString("a")
						responseMsg.Add(m.Data[1])
						if response != nil {
							responseMsg.Data = append(responseMsg.Data, response...)
						}
						c.Conn.Send(responseMsg)
						break
					} else {
						log.Warning("Error processing command \"%s\"", command)
					}
				} else {
					log.Warning("Unknow request type: %s", requestType)
				}
			}
		}
		c.Recv <- msg
	}
}

func (this *Client) sendAllSettings() {
	msg := pr.NewMessageDataArray("_set")
	msg.AddString("g")
	for name, value := range this.settings {
		msg.AddString(fmt.Sprintf("%s=%s", name, value))
	}
	this.Send <- msg
}

func (c *Client) handleCommand(array [][]byte) ([][]byte, error) {
	cmd := string(array[0])
	if cmd == "reset" {
		c.settings = make(map[string]string)
		return nil, c.saveSettings()
	} else if cmd == "settings" {
		c.sendAllSettings()
		return nil, nil
	}
	return nil, errors.New(fmt.Sprintf("Unknow command \"%s\"", cmd))
}

const SETTINGS_FILE = "settings.json"

func (c *Client) loadSettings() error {
	// We open the file
	fi, err := os.Open(SETTINGS_FILE)
	if err != nil {
		log.Warning("Recreating settings...")
		c.settings = make(map[string]string)
		return err
	}
	defer fi.Close()

	// Create a reader
	r := bufio.NewReader(fi)

	// Create a decode
	dec := json.NewDecoder(r)

	// Load the settings
	err = dec.Decode(&c.settings)

	return err
}

func (c *Client) saveSettings() error {
	// We open the file
	fi, err := os.Create(SETTINGS_FILE)
	if err != nil {
		return err
	}
	defer fi.Close()

	// Create a writer
	w := bufio.NewWriter(fi)
	defer w.Flush()

	// Create an encoder
	enc := json.NewEncoder(w)

	// Save the settings
	return enc.Encode(c.settings)
}

func (c *Client) setSetting(name, value string) error {
	c.settings[name] = value
	return c.saveSettings()
}

// Core go routine
// This is the only method that is allowed to send data (use c.Conn.Send) in a safe way.
func (c *Client) runCore() {
	for {
		if err := c.considerAction(); err != nil {
			log.Error("considerAction: %s", err)
			break
		}
		select {
		case msg := <-c.Recv:
			{
				switch m := msg.(type) {
				case *pr.EventDisconnected:
					{
						log.Error("We got disconnected !")
						break
					}
				case *pr.MessageIdentResponse:
					{
						c.Connected = m.Ok

						if c.Connected {
							log.Notice("We are identified to %s !", c.Conn)
						} else {
							log.Warning("We got refused !")
						}
					}
				case *pr.MessagePingRequest:
					{
						c.Conn.Send(&pr.MessagePingResponse{Data: m.Data})
					}
				case *pr.MessageDataSimple:
					{
						switch m.Channel {
						case "echo":
							{
								log.Info("Echo from server: %s", string(m.Data))
							}
						}
					}
				}
			}
		case <-c.ticker.C:
			{
				log.Debug("Ticking...")
			}
		case msg := <-c.Send:
			{
				log.Debug("Sending %v", msg)
				c.Conn.Send(msg)
			}
		}
	}
}

func (c *Client) Start() {
	go c.runRecv()
	go c.runCore()
}


text:
shared_examples 'an oauth2 strategy' do
  describe '#client' do
    it 'should be initialized with symbolized client_options' do
      @options = { :client_options => { 'authorize_url' => 'https://example.com' } }
      subject.client.options[:authorize_url].should == 'https://example.com'
    end
  end

  describe '#authorize_params' do
    it 'should include any authorize params passed in the :authorize_params option' do
      @options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
      subject.authorize_params['foo'].should eq('bar')
      subject.authorize_params['baz'].should eq('zip')
    end

    it 'should include top-level options that are marked as :authorize_options' do
      @options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
      subject.authorize_params['scope'].should eq('bar')
      subject.authorize_params['foo'].should eq('baz')
    end
  end

  describe '#token_params' do
    it 'should include any token params passed in the :token_params option' do
      @options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
      subject.token_params['foo'].should eq('bar')
      subject.token_params['baz'].should eq('zip')
    end

    it 'should include top-level options that are marked as :token_options' do
      @options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
      subject.token_params['scope'].should eq('bar')
      subject.token_params['foo'].should eq('baz')
    end
  end
end


text:
// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
//
// 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.

#ifndef __ESP_SPIRAM_H
#define __ESP_SPIRAM_H

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"

typedef enum {
    ESP_SPIRAM_SIZE_32MBITS = 0,   /*!< SPI RAM size is 32 MBits */
    ESP_SPIRAM_SIZE_64MBITS = 1,   /*!< SPI RAM size is 64 MBits */
    ESP_SPIRAM_SIZE_INVALID,       /*!< SPI RAM size is invalid */
} esp_spiram_size_t;

/**
 * @brief get SPI RAM size
 * @return
 *     - ESP_SPIRAM_SIZE_INVALID if SPI RAM not enabled or not valid
 *     - SPI RAM size
 */
esp_spiram_size_t esp_spiram_get_chip_size();

/**
 * @brief Initialize spiram interface/hardware. Normally called from cpu_start.c.
 *
 * @return ESP_OK on success
 */
esp_err_t esp_spiram_init();

/**
 * @brief Configure Cache/MMU for access to external SPI RAM.
 *
 * Normally this function is called from cpu_start, if CONFIG_SPIRAM_BOOT_INIT
 * option is enabled. Applications which need to enable SPI RAM at run time
 * can disable CONFIG_SPIRAM_BOOT_INIT, and call this function later.
 *
 * @attention this function must be called with flash cache disabled.
 */
void esp_spiram_init_cache();

/**
 * @brief Memory test for SPI RAM. Should be called after SPI RAM is initialized and
 * (in case of a dual-core system) the app CPU is online. This test overwrites the
 * memory with crap, so do not call after e.g. the heap allocator has stored important
 * stuff in SPI RAM.
 *
 * @return true on success, false on failed memory test
 */
bool esp_spiram_test();

/**
 * @brief Add the initialized SPI RAM to the heap allocator.
 */
esp_err_t esp_spiram_add_to_heapalloc();

/**
 * @brief Get the size of the attached SPI RAM chip selected in menuconfig
 *
 * @return Size in bytes, or 0 if no external RAM chip support compiled in.
 */
size_t esp_spiram_get_size();

/**
 * @brief Force a writeback of the data in the SPI RAM cache. This is to be called whenever
 * cache is disabled, because disabling cache on the ESP32 discards the data in the SPI
 * RAM cache.
 *
 * This is meant for use from within the SPI flash code.
 */
void esp_spiram_writeback_cache();

/**
 * @brief Reserve a pool of internal memory for specific DMA/internal allocations
 *
 * @param size Size of reserved pool in bytes
 *
 * @return
 *          - ESP_OK on success
 *          - ESP_ERR_NO_MEM when no memory available for pool
 */
esp_err_t esp_spiram_reserve_dma_pool(size_t size);

#endif


text:
using System.Net;
using System.Security.Cryptography.X509Certificates;

namespace Bdt.Client.Configuration
{
	public class TrustAllCertificatePolicy : ICertificatePolicy
	{
		public bool CheckValidationResult(ServicePoint sp, X509Certificate cert, WebRequest req, int problem)
		{
			return true;
		}
	}
}


text:
The best way to learn a new language is to look at some examples. Below is a list of some useful
commands you might use in your games.

## Running Examples

Make sure you have built the project first.

```bash
cargo run --release
```

Pass in any example to the program to see the output.

```
MACRO=$( cat examples/bad-heal-check.ttml ) ttml-parser -vv "$MACRO"
```

## Examples

 - [Attack Enemy Token with Saving Roll](attack-enemy-token-with-saving-roll.ttml) - Roll to attack
an enemy token, but allow the enemy to perform a saving throw. If the saving throw fails, roll
another d20 for damage.
 - [Bad Heal Check](bad-heal-check.ttml) - Heal a player on successful healing check, otherwise do
damage
 - [Roll Initiative](roll-initiative.ttml) - List players and roll a d20 for each one

## Contributing

Feel free to [submit a pull request](https://github.com/UnicornHeartClub/tabletop-macro-language/issues/new)
if you want to add a new example or think an existing one can be improved.


text:
package quickstart.component;

import javafx.event.Event;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import org.jacpfx.api.annotations.Resource;
import org.jacpfx.api.annotations.component.View;
import org.jacpfx.api.annotations.lifecycle.PostConstruct;
import org.jacpfx.api.annotations.lifecycle.PreDestroy;
import org.jacpfx.api.message.Message;
import org.jacpfx.api.util.ToolbarPosition;
import org.jacpfx.rcp.component.FXComponent;
import org.jacpfx.rcp.componentLayout.FXComponentLayout;
import org.jacpfx.rcp.components.managedFragment.ManagedFragmentHandler;
import org.jacpfx.rcp.components.toolBar.JACPToolBar;
import org.jacpfx.rcp.context.Context;
import quickstart.configuration.BaseConfiguration;
import quickstart.fragments.FragmentOne;

import java.util.ResourceBundle;
import java.util.logging.Logger;

/**
 * A simple JacpFX UI component
 *
 * @author Andy Moncsek
 */
@View(id = BaseConfiguration.COMPONENT_TWO,
        name = "SimpleView",
        active = true,
        resourceBundleLocation = "bundles.languageBundle",
        initialTargetLayoutId = BaseConfiguration.TARGET_CONTAINER_MAIN)
public class ComponentTwo implements FXComponent {
    private VBox pane;
    private Logger log = Logger.getLogger(ComponentTwo.class.getName());
    @Resource
    private Context context;

    @Override
    /**
     * The handle method always runs outside the main application thread. You can create new nodes, execute long running tasks but you are not allowed to manipulate existing nodes here.
     */
    public Node handle(final Message<Event, Object> message) {
        // runs in worker thread
        return null;
    }

    @Override
    /**
     * The postHandle method runs always in the main application thread.
     */
    public Node postHandle(final Node arg0,
                           final Message<Event, Object> message) {
        // runs in FX application thread
        return this.pane;
    }

    @PostConstruct
    /**
     * The @OnStart annotation labels methods executed when the component switch from inactive to active state
     * @param arg0
     * @param resourceBundle
     */
    public void onStartComponent(final FXComponentLayout layout,
                                 final ResourceBundle resourceBundle) {
        pane = (VBox) createUI();
        HBox lastRow = new HBox();
        ManagedFragmentHandler<FragmentOne> fragment = context.getManagedFragmentHandler(FragmentOne.class);
        lastRow.getChildren().addAll(fragment.getFragmentNode());
        pane.getChildren().add(lastRow);
        JACPToolBar toolbar = layout.getRegisteredToolBar(ToolbarPosition.NORTH);
    }

    @PreDestroy
    /**
     * The @OnTearDown annotations labels methods executed when the component is set to inactive
     * @param arg0
     */
    public void onTearDownComponent(final FXComponentLayout arg0) {
        this.log.info("run on tear down of ComponentLeft ");

    }

    /**
     * create the UI on first call
     *
     * @return
     */
    private Node createUI() {
        final VBox pane = new VBox();
        HBox.setHgrow(pane, Priority.ALWAYS);
        final HBox top = new HBox();
        top.setPrefHeight(100);
        top.setPrefWidth(200);
        Label firstName = new Label("First name:");
        firstName.setFont(new Font(29.0));
        HBox.setMargin(firstName, new Insets(15, 5, 0, 5));
        TextField firstNameText = new TextField();
        firstNameText.setPrefHeight(50);
        firstNameText.setPadding(new Insets(10, 0, 0, 0));
        HBox.setHgrow(firstNameText, Priority.ALWAYS);
        HBox.setMargin(firstNameText, new Insets(10, 5, 0, 0));
        top.getChildren().addAll(firstName, firstNameText);

        final HBox bottom = new HBox();
        bottom.setPrefHeight(100);
        bottom.setPrefWidth(200);
        Label lastName = new Label("Last name:");
        lastName.setFont(new Font(29.0));
        HBox.setMargin(lastName, new Insets(15, 5, 0, 5));
        TextField lastNameText = new TextField();
        lastNameText.setPrefHeight(50);
        lastNameText.setPadding(new Insets(10, 0, 0, 0));
        HBox.setHgrow(lastNameText, Priority.ALWAYS);
        HBox.setMargin(lastNameText, new Insets(10, 5, 0, 0));
        bottom.getChildren().addAll(lastName, lastNameText);

        pane.getChildren().addAll(top, bottom);
        return pane;
    }

}


text:
(function(window, document, $, angular) {
  'use strict';
  angular.module('angularapp.angularui.bootstrap', ['ui.bootstrap'])
    .controller('AlertDemoController', function($scope) {
      $scope.alerts = $scope.model.alerts;

      $scope.addAlert = function() {
        $scope.alerts.push({
          msg: 'Another alert!'
        });
      };

      $scope.closeAlert = function(index) {
        $scope.alerts.splice(index, 1);
      };
    })
    .controller('ButtonsDemoController', function($scope) {
      $scope.singleModel = $scope.model.buttons.singleModel;
      $scope.radioModel = $scope.model.buttons.radioModel;
      $scope.checkModel = $scope.model.buttons.checkModel;
    }).controller('CarouselDemoController', function($scope) {
      $scope.myInterval = $scope.model.carousel.myInterval;
      var slides = $scope.slides = [];
      $scope.addSlide = function() {
        var newWidth = 600 + slides.length + 1;
        slides.push({
          image: 'http://placekitten.com/' + newWidth + '/300',
          text: ['More', 'Extra', 'Lots of', 'Surplus'][slides.length % 4] + ' ' + ['Cats', 'Kittys', 'Felines', 'Cutes'][slides.length % 4]
        });
      };
      for (var i = 0; i < 4; i++) {
        $scope.addSlide();
      }
    }).controller('CollapseDemoController', function($scope) {
      $scope.isCollapsed = $scope.model.collapse.isCollapsed;
    }).controller('DatepickerDemoController', function($scope) {
      $scope.today = function() {
        $scope.dt = new Date();
      };
      $scope.today();

      $scope.clear = function() {
        $scope.dt = null;
      };

      // Disable weekend selection
      $scope.disabled = function(date, mode) {
        return (mode === 'day' && (date.getDay() === 0 || date.getDay() === 6));
      };

      $scope.toggleMin = function() {
        $scope.minDate = $scope.minDate ? null : new Date();
      };
      $scope.toggleMin();

      $scope.open = function($event) {
        $event.preventDefault();
        $event.stopPropagation();

        $scope.opened = true;
      };

      $scope.dateOptions = {
        formatYear: 'yy',
        startingDay: 1
      };

      $scope.formats = $scope.model.datepicker.formats;
      $scope.format = $scope.formats[0];
    }).controller('DropdownDemoController', function($scope, $log) {
      $scope.toggled = function(open) {
        $log.log('Dropdown is now: ', open);
      };

      $scope.toggleDropdown = function($event) {
        $event.preventDefault();
        $event.stopPropagation();
        $scope.status.isopen = !$scope.status.isopen;
      };
    }).controller('ModalDemoController', function($scope, $modal, $log) {

      $scope.items = $scope.model.modal.items;
      $scope.animationsEnabled = true;
      $scope.open = function(size) {

        var modalInstance = $modal.open({
          animation: $scope.animationsEnabled,
          templateUrl: 'myModalContent.html',
          controller: 'ModalInstanceController',
          size: size,
          resolve: {
            items: function() {
              return $scope.items;
            }
          }
        });

        modalInstance.result.then(function(selectedItem) {
          $scope.selected = selectedItem;
        }, function() {
          $log.info('Modal dismissed at: ' + new Date());
        });

        $scope.toggleAnimation = function() {
          $scope.animationsEnabled = !$scope.animationsEnabled;
        };
      };

    }).controller('ModalInstanceController', function($scope, $modalInstance, items) {
      // Please note that $modalInstance represents a modal window (instance) dependency.
      // It is not the same as the $modal service used above.
      $scope.items = items;
      $scope.selected = {
        item: $scope.items[0]
      };

      $scope.ok = function() {
        $modalInstance.close($scope.selected.item);
      };

      $scope.cancel = function() {
        $modalInstance.dismiss('cancel');
      };
    }).controller('PaginationDemoController', function($scope, $log) {
      $scope.totalItems = $scope.model.pagination.totalItems;
      $scope.currentPage = $scope.model.pagination.currentPage;
      $scope.maxSize = $scope.model.pagination.maxSize;
      $scope.bigTotalItems = $scope.model.pagination.bigTotalItems;
      $scope.bigCurrentPage = $scope.model.pagination.bigCurrentPage;

      $scope.setPage = function(pageNo) {
        $scope.currentPage = pageNo;
      };

      $scope.pageChanged = function() {
        $log.log('Page changed to: ' + $scope.currentPage);
      };
    }).controller('PopoverDemoController', function($scope) {
      $scope.dynamicPopover = $scope.model.popover.dynamicPopover;
      $scope.dynamicPopoverTitle = $scope.model.popover.dynamicPopoverTitle;
    }).controller('ProgressbarDemoController', function($scope) {

      $scope.max = $scope.model.progressbar.max;

      $scope.random = function() {
        var value = Math.floor((Math.random() * 100) + 1);
        var type;

        if (value < 25) {
          type = 'success';
        } else if (value < 50) {
          type = 'info';
        } else if (value < 75) {
          type = 'warning';
        } else {
          type = 'danger';
        }

        $scope.showWarning = (type === 'danger' || type === 'warning');

        $scope.dynamic = value;
        $scope.type = type;
      };
      $scope.random();

      $scope.randomStacked = function() {
        $scope.stacked = [];
        var types = ['success', 'info', 'warning', 'danger'];

        for (var i = 0, n = Math.floor((Math.random() * 4) + 1); i < n; i++) {
          var index = Math.floor((Math.random() * 4));
          $scope.stacked.push({
            value: Math.floor((Math.random() * 30) + 1),
            type: types[index]
          });
        }
      };
      $scope.randomStacked();
    }).controller('RatingDemoController', function($scope) {
      $scope.rate = $scope.model.rating.rate;
      $scope.max = $scope.model.rating.max;
      $scope.isReadonly = $scope.model.rating.isReadonly;
      $scope.ratingStates = $scope.model.rating.ratingStates;

      $scope.hoveringOver = function(value) {
        $scope.overStar = value;
        $scope.percent = 100 * (value / $scope.max);
      };
    }).controller('TabsDemoController', function($scope, $window) {
      $scope.tabs = $scope.model.tabs;

      $scope.alertMe = function() {
        setTimeout(function() {
          $window.alert('You\'ve selected the alert tab!');
        });
      };
    }).controller('TimepickerDemoController', function($scope, $log) {
      $scope.mytime = new Date();

      $scope.hstep = $scope.model.timepicker.hstep;
      $scope.mstep = $scope.model.timepicker.mstep;
      $scope.options = $scope.model.timepicker.options;
      $scope.ismeridian = $scope.model.timepicker.ismeridian;

      $scope.toggleMode = function() {
        $scope.ismeridian = !$scope.ismeridian;
      };

      $scope.update = function() {
        var d = new Date();
        d.setHours(14);
        d.setMinutes(0);
        $scope.mytime = d;
      };

      $scope.changed = function() {
        $log.log('Time changed to: ' + $scope.mytime);
      };

      $scope.clear = function() {
        $scope.mytime = null;
      };
    }).controller('TooltipDemoController', function($scope) {
      $scope.dynamicTooltip = $scope.model.tooltip.dynamicTooltip;
      $scope.dynamicTooltipText = $scope.model.tooltip.dynamicTooltipText;
      $scope.htmlTooltip = $scope.model.tooltip.htmlTooltip;
    }).controller('TypeaheadDemoController', function($scope) {
      $scope.states = $scope.model.typeahead.states;
      $scope.statesWithFlags = $scope.model.typeahead.statesWithFlags;
      $scope.selected = undefined;
      // Any function returning a promise object can be used to load values asynchronously
      $scope.getLocation = function(val) {
        return $http.get('http://maps.googleapis.com/maps/api/geocode/json', {
          params: {
            address: val,
            sensor: false
          }
        }).then(function(response) {
          return response.data.results.map(function(item) {
            return item.formatted_address;
          });
        });
      };

    });

})(window, document, jQuery, angular);


text:
package synergynetframework.appsystem.contentsystem.items;

import java.awt.Color;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

import synergynetframework.appsystem.contentsystem.ContentSystem;
import synergynetframework.appsystem.contentsystem.items.implementation.interfaces.IDropDownListImplementation;

/**
 * The Class DropDownList.
 */
public class DropDownList extends Window implements IDropDownListImplementation {

	/**
	 * The Class DropDownListItem.
	 */
	public class DropDownListItem {

		/** The image resource. */
		private URL imageResource;

		/** The item button. */
		private SimpleButton itemButton;

		/** The title. */
		private String title;

		/** The value. */
		private String value;

		/**
		 * Instantiates a new drop down list item.
		 *
		 * @param title
		 *            the title
		 * @param value
		 *            the value
		 */
		public DropDownListItem(String title, String value) {
			this.title = title;
			this.value = value;
			this.itemButton = (SimpleButton) contentSystem
					.createContentItem(SimpleButton.class);
			this.itemButton.setText(this.title);
		}

		/**
		 * Instantiates a new drop down list item.
		 *
		 * @param imageResource
		 *            the image resource
		 * @param width
		 *            the width
		 * @param height
		 *            the height
		 * @param value
		 *            the value
		 */
		public DropDownListItem(URL imageResource, int width, int height,
				String value) {
			this.title = imageResource.toString();
			this.imageResource = imageResource;
			this.value = value;
			this.itemButton = (SimpleButton) contentSystem
					.createContentItem(SimpleButton.class);
			this.itemButton.setBorderSize(0);
			this.itemButton.setAutoFitSize(false);
			this.itemButton.setWidth(width);
			this.itemButton.setHeight(height);
			this.itemButton.drawImage(imageResource);
		}

		/**
		 * Instantiates a new drop down list item.
		 *
		 * @param imageResource
		 *            the image resource
		 * @param value
		 *            the value
		 */
		public DropDownListItem(URL imageResource, String value) {
			this.title = imageResource.toString();
			this.imageResource = imageResource;
			this.value = value;
			this.itemButton = (SimpleButton) contentSystem
					.createContentItem(SimpleButton.class);
			this.itemButton.setBorderSize(0);
			this.itemButton.setAutoFitSize(false);
			this.itemButton.setWidth(DropDownList.this.width);
			this.itemButton.setHeight(itemHeight);
			this.itemButton.drawImage(imageResource);
		}

		/**
		 * Gets the image resource.
		 *
		 * @return the image resource
		 */
		public URL getImageResource() {
			return imageResource;
		}

		/**
		 * Gets the item button.
		 *
		 * @return the item button
		 */
		public SimpleButton getItemButton() {
			return itemButton;
		}

		/**
		 * Gets the title.
		 *
		 * @return the title
		 */
		public String getTitle() {
			return title;
		}

		/**
		 * Gets the value.
		 *
		 * @return the value
		 */
		public String getValue() {
			return value;
		}

		/**
		 * Sets the item button.
		 *
		 * @param itemButton
		 *            the new item button
		 */
		public void setItemButton(SimpleButton itemButton) {
			this.itemButton = itemButton;
		}

		/**
		 * Sets the title.
		 *
		 * @param title
		 *            the new title
		 */
		public void setTitle(String title) {
			this.title = title;
		}

		/**
		 * Sets the value.
		 *
		 * @param value
		 *            the new value
		 */
		public void setValue(String value) {
			this.value = value;
		}

	}

	/**
	 * The listener interface for receiving dropDownList events. The class that
	 * is interested in processing a dropDownList event implements this
	 * interface, and the object created with that class is registered with a
	 * component using the component's
	 * <code>addDropDownListListener<code> method. When
	 * the dropDownList event occurs, that object's appropriate
	 * method is invoked.
	 *
	 * @see DropDownListEvent
	 */
	public interface DropDownListListener {

		/**
		 * Item selected.
		 *
		 * @param item
		 *            the item
		 */
		public void itemSelected(DropDownListItem item);
	}

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 4456150243917776154L;

	/** The item height. */
	protected int itemHeight = 25;

	/** The line space. */
	protected int lineSpace = 2;

	/** The list items. */
	protected List<DropDownListItem> listItems = new ArrayList<DropDownListItem>();

	/** The selected item. */
	protected DropDownListItem selectedItem = null;

	/**
	 * Instantiates a new drop down list.
	 *
	 * @param contentSystem
	 *            the content system
	 * @param name
	 *            the name
	 */
	public DropDownList(ContentSystem contentSystem, String name) {
		super(contentSystem, name);
		this.height = 30;
		this.width = 350;
		this.backGround.setBgColour(Color.white);
		this.border.setBorderColour(Color.gray);
	}

	/*
	 * (non-Javadoc)
	 * @see
	 * synergynetframework.appsystem.contentsystem.items.implementation.interfaces
	 * .IDropDownListImplementation#addDropDownListListener(synergynetframework.
	 * appsystem.contentsystem.items.DropDownList.DropDownListListener)
	 */
	@Override
	public void addDropDownListListener(DropDownListListener listener) {
		((IDropDownListImplementation) this.contentItemImplementation)
				.addDropDownListListener(listener);
	}

	/*
	 * (non-Javadoc)
	 * @see
	 * synergynetframework.appsystem.contentsystem.items.implementation.interfaces
	 * .IDropDownListImplementation#addListItem(synergynetframework.appsystem.
	 * contentsystem.items.DropDownList.DropDownListItem)
	 */
	public void addListItem(DropDownList.DropDownListItem item) {
		listItems.add(item);
		((IDropDownListImplementation) this.contentItemImplementation)
				.addListItem(item);
	}

	/**
	 * Adds the list item.
	 *
	 * @param title
	 *            the title
	 * @param value
	 *            the value
	 */
	public void addListItem(String title, String value) {

		DropDownListItem item = new DropDownListItem(title, value);
		listItems.add(item);
		((IDropDownListImplementation) this.contentItemImplementation)
				.addListItem(item);

	}

	/**
	 * Adds the list item.
	 *
	 * @param imageResource
	 *            the image resource
	 * @param width
	 *            the width
	 * @param height
	 *            the height
	 * @param value
	 *            the value
	 */
	public void addListItem(URL imageResource, int width, int height,
			String value) {

		DropDownListItem item = new DropDownListItem(imageResource, width,
				height, value);
		listItems.add(item);
		((IDropDownListImplementation) this.contentItemImplementation)
				.addListItem(item);

	}

	/**
	 * Adds the list item.
	 *
	 * @param imageResource
	 *            the image resource
	 * @param value
	 *            the value
	 */
	public void addListItem(URL imageResource, String value) {

		DropDownListItem item = new DropDownListItem(imageResource, value);
		listItems.add(item);
		((IDropDownListImplementation) this.contentItemImplementation)
				.addListItem(item);

	}

	/**
	 * Clear.
	 */
	public void clear() {
		for (DropDownListItem item : listItems) {
			((IDropDownListImplementation) this.contentItemImplementation)
					.removeItem(item);
		}

		listItems.clear();
	}

	/**
	 * Contains value.
	 *
	 * @param value
	 *            the value
	 * @return true, if successful
	 */
	public boolean containsValue(String value) {
		for (DropDownListItem item : this.listItems) {
			if (item.getValue().equals(value)) {
				return true;
			}
		}
		return false;
	}

	/**
	 * Gets the item height.
	 *
	 * @return the item height
	 */
	public int getItemHeight() {
		return itemHeight;
	}

	/**
	 * Gets the line space.
	 *
	 * @return the line space
	 */
	public int getLineSpace() {
		return lineSpace;
	}

	/**
	 * Gets the list items.
	 *
	 * @return the list items
	 */
	public List<DropDownListItem> getListItems() {
		return listItems;
	}

	/**
	 * Gets the selected item.
	 *
	 * @return the selected item
	 */
	public DropDownListItem getSelectedItem() {
		return selectedItem;
	}

	/**
	 * Gets the selected title.
	 *
	 * @return the selected title
	 */
	public String getSelectedTitle() {
		return this.selectedItem.getTitle();
	}

	/**
	 * Gets the selected value.
	 *
	 * @return the selected value
	 */
	public String getSelectedValue() {
		if (selectedItem != null) {
			return this.selectedItem.getValue();
		} else {
			return null;
		}
	}

	/*
	 * (non-Javadoc)
	 * @see
	 * synergynetframework.appsystem.contentsystem.items.implementation.interfaces
	 * .
	 * IDropDownListImplementation#removeDropDownListListener(synergynetframework
	 * .appsystem.contentsystem.items.DropDownList.DropDownListListener)
	 */
	@Override
	public void removeDropDownListListener(DropDownListListener listener) {
		((IDropDownListImplementation) this.contentItemImplementation)
				.removeDropDownListListener(listener);
	}

	/*
	 * (non-Javadoc)
	 * @see
	 * synergynetframework.appsystem.contentsystem.items.implementation.interfaces
	 * .IDropDownListImplementation#removeDropDownListListeners()
	 */
	@Override
	public void removeDropDownListListeners() {
		((IDropDownListImplementation) this.contentItemImplementation)
				.removeDropDownListListeners();
	}

	/*
	 * (non-Javadoc)
	 * @see
	 * synergynetframework.appsystem.contentsystem.items.implementation.interfaces
	 * .IDropDownListImplementation#removeItem(synergynetframework.appsystem.
	 * contentsystem.items.DropDownList.DropDownListItem)
	 */
	public void removeItem(DropDownList.DropDownListItem item) {
		((IDropDownListImplementation) this.contentItemImplementation)
				.removeItem(item);
		listItems.remove(item);
	}

	/**
	 * Sets the item height.
	 *
	 * @param itemHeight
	 *            the new item height
	 */
	public void setItemHeight(int itemHeight) {
		this.itemHeight = itemHeight;
	}

	/*
	 * (non-Javadoc)
	 * @see
	 * synergynetframework.appsystem.contentsystem.items.implementation.interfaces
	 * .IDropDownListImplementation#setLineSpace(int)
	 */
	public void setLineSpace(int lineSpace) {
		this.lineSpace = lineSpace;
	}

	/*
	 * (non-Javadoc)
	 * @see
	 * synergynetframework.appsystem.contentsystem.items.implementation.interfaces
	 * .
	 * IDropDownListImplementation#setSelectedItem(synergynetframework.appsystem
	 * .contentsystem.items.DropDownList.DropDownListItem)
	 */
	public void setSelectedItem(DropDownListItem selectedItem) {
		this.selectedItem = selectedItem;
		((IDropDownListImplementation) this.contentItemImplementation)
				.setSelectedItem(selectedItem);
	}

}


text:
Kubernetes is the _de facto_ platform for running modern applications: its broad adoption in 2017 and the velocity of the project made it so and it's been accepted as the standard for many companies, from small to planet scale. It was impossible that such an extensible platform would be left out the serverless party, so here are the 4 main players offering FaaS to be run via k8s.

### A premise
If you're new to serverless and FaaS and all the previous buzzwords sound like cacophony to your ears, I really recommend reading [this post](https://martinfowler.com/articles/serverless.html) and watching [this talk](https://www.youtube.com/watch?v=LAWjdZYrUgI). You could also notice how I put FaaS and serverless under the same hat here, this is just a personal opinion although some might argue that FaaS is a subset of serverless: historically I approached the serverless world using AWS Lambda, and I really tied the idea of writing functions and let someone else manage the infrastructure to the _serverless_ concept. Also Sam Newman gave a [good talk on serverless](https://youtu.be/CrS0HVQZiQI) that I really recommend watching.

### Why serverless on k8s
It seems like a natural evolution for distributed systems to be composed by smaller and smaller parts. When moving from SOA to microservices the size of the service was reduced to enable development of more fine-grained functionalities into smaller and more maintainable components; taken to the extreme, you can reduce a microservice to be dedicated to just one task or to be  made of just one function, that's where FaaS fits into. Kubernetes is a great activator for such modularity as it creates a very powerful abstraction over infrastructure, so when developing a function as a separate module of a distributed system you can scale both vertically and horizontally any building block, each one independently from another, or you could even let Kubernetes manage that (think [Horizontal Pod Autoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)).

### Four players offering FaaS on k8s

* [OpenFaaS](https://github.com/openfaas/faas)
* [Fission](https://github.com/fission/fission)
* [Kubeless](https://github.com/kubeless/kubeless)
* [Fn Project](https://github.com/fnproject/fn)

Now there might be others, but this 4 are the ones I mostly heard of in the last 6 months, so they must be the right ones 😁.

#### Comparison criteria
This is not a technical benchmark on the capabilities of this 4 frameworks: it's a _"look Ma, I can serverless on k8s"_ post where I try and highlight the pros and cons of adopting one or the other; the criteria will be  installation methodology (client and server), languages support, cluster interoperability and developer experience, voted from 0 to 5 the higher the better.
I will use Kubernetes 1.8.6 that is, at the moment of writing, the latest available stable version.

The target function to deploy will be a super-serious analytics and business intelligence tool that will read the incoming HTTP request body and save it in a JSON document alongside with a timestamp. The JSON will be stored on a REDIS using a random UUIDv4 as key. All the code that will be deployed as functions is in [Github](https://github.com/inge4pres/blog/tree/master/serverless-on-kubernetes), while for installing the GCP cluster and REDIS I used the following

```
gcloud beta container --project "${GCP_PROJECT}" clusters create "serverless-k8s" \
  --zone "europe-west2-c" --username "admin" --cluster-version "1.8.6-gke.0" \
  --machine-type "g1-small" --image-type "COS" --disk-size "50" --num-nodes "3"

gcloud container clusters get-credentials serverless-k8s \
  --zone europe-west2-c --project "${GCP_PROJECT}"

helm init

helm install stable/redis
```

#### Fn Project
###### Features

* function configuration via YAML
* local development server via `fn start` and `fn run`
* uses DockerHub to store functions as containers
* web UI with function monitoring

###### Client installation: 4
The [installation instructions](https://github.com/fnproject/fn#install-cli-tool) are easy to read and execute, multiple platforms supported out of the box. User is required to set an environment variable with a DockerHub handle

```
export FN_REGISTRY=<DOCKERHUB_USERNAME>
```

###### Server installation: 3
A Helm chart is provided under [fn-helm](https://github.com/fnproject/fn-helm) but it's not immediately linked to the project's page. The installation requires the user to export an environment variable with the command

```
export FN_API_URL=http://$(kubectl get svc --namespace default fn-release-fn-api -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):80
```

###### Language support: 5
Built-in support for Java, Ruby, Go, Python. Runs any docker container as a function.

###### Cluster interoperability: 2
It requires a LoadBalancer resource, so you won't be able to run it on `minikube` out of the box. It has MySQL and REDIS as dependency services and uses a [DaemonSet](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/) for the API controller, which might impact node's performance. No monitoring provided for the in-cluster components.

###### Developer experience: 3
Very extensive CLI interface. Functions are pipes: they should read Stdin and write to Stdout; some environment variables are injected to the running code to detect request URL and other configurations. I was able to complete my function deployment in roughly 1 hour after digging the docs a while to find out how to add custom configurations to the functions via environment variables.

#### OpenFaaS
###### Features

* sponsored by CNCF
* function grouping configuration via YAML ([stack file](https://github.com/openfaas/faas-cli#use-a-yaml-stack-file))
* public function repository
* Web UI with function monitoring
* runs any docker container as a function

###### Client installation: 2
The [CLI installation](https://github.com/openfaas/faas-cli#get-started-install-the-cli) is straight-forward for Linux and Mac users but it's not immediately available for Windows. I cannot find an easy way to set the cluster address to point the CLI to.

###### Server installation: 1
Helm chart provided under [faas-netes/helm](https://github.com/openfaas/faas-netes/blob/master/HELM.md) but it's failing the first time because of RBAC property not set and not rolling back, so I'm forced to delete and recreate the release.
Even when installation is completed I cannot connect to the FaaS gateway as the service NodePort 31112, and the LoadBalancer creation errors out with
```
Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
The Service "gateway" is invalid: spec.ports[0].nodePort: Invalid value: 31112: provided port is already allocated
```

###### Language support: 5
Built-in support for NodeJS, Ruby, Go, Python, C#, generic Dockerfile. Runs any docker container as a function.

###### Cluster interoperability: 4
OpenFaas provides Prometheus monitoring with alerting out of the box, plus the architecture is very lean: just 2 pods that serve the API gateway and the function runner. Each function runs as a `Deployment` object and therefore can be scaled independently.

###### Developer experience: 2
After 2 hours trying to complete the setup on Kubernetes I'm still not able to run any function on my cluster; I run a port-froward to the OpenFaaS gateway `kubectl port-forward gateway-pod-id 31112:8080` so I can run `faas-cli deploy -f samples.yml --gateway http://127.0.0.1:31112` inside the just cloned `faas-cli` repository and see some function in action.

#### Fission
###### Features

* only 100ms function cold start (more on the topic [here](https://serverless.com/blog/keep-your-lambdas-warm/))
* natively built for Kubernetes

###### Client installation: 3
[Guide](http://fission.io/docs/0.4.0/installation/#install-the-fission-cli) suggests to download a binary distribution via `curl` and place the binary§ under `/usr/local/bin`, very straightforward for Linux and OSX. Windows support is via WSL or using a binary `fission.exe` with download link provided. Some environment variables need to be setup to point to the cluster, but the [instructions](http://fission.io/docs/0.4.0/installation/#cloud-setups) are very well written.

###### Server installation: 5
[Also guide](http://fission.io/docs/0.4.0/installation/#cloud-hosted-clusters-gke-aws-azure-etc): a single `helm` command installs all the components in a dedicated namespace `fission`.

###### Language support: 4
Built-in support for Linux binaries, Go, .NET, NodeJS, Perl, PHP 7, Python 3, Ruby as reported in the [concepts section](https://github.com/fission/fission#fission-concepts). Custom environment can be built and pushed to the cluster as containers.

###### Cluster interoperability: 2
No monitoring at all and no UI provided to verify the functions state of execution or list, CLI is the only source of truth I can get and it's not easy to understand the architecture.

###### Developer experience: 2
Setup is very straightforward but then the development looks cumbersome (at least for Go): environment variables [cannot be set](https://github.com/fission/fission/issues/356) yet, so this means hard-coded values in the code to connect to external services. Plus logging and function debugging is really hard, after 1 hour digging in documentation and trying to understand a cryptic `Internal server error (fission)` message, I am not able to run my Go function, and it's tough to tell why.

#### Kubeless
###### Features

* natively built for kubernetes
* web UI with function monitoring
* [serverless framework plugin](https://github.com/serverless/serverless-kubeless) available

###### Client installation: 5
Binary distribution available for Linux, OSX and Windows in [Github release page](https://github.com/kubeless/kubeless/releases). No fuss, no hassle: download and run.

###### Server installation: 3
[Documentation](https://github.com/kubeless/kubeless#installation) warns to create a namespace `kubeless` and use that. Same release page offers 3 options to install: Kubernetes with or without RBAC and Openshift. Applying the YAML with `kubectl apply -f kubeless-...` gets the server part up and running, but if I'd like to install in a different namespace I would need to change the whole file. Providing a Helm chart is the standard Kubernetes packaging way so why not having one?

###### Language support: 3
Currently only Python, NodeJS, Ruby and .NET Core are supported. [Custom runtimes](https://github.com/kubeless/kubeless/blob/master/docs/runtimes.md#custom-runtime-alpha) in the form of docker containers need to be built to run other languages, a feature in alpha which I'm forced to explore to run my Go app.

###### Cluster interoperability: 4
Monitoring provided via Prometheus integration; all backend services are run into dedicated namespace while functions are exposed using regular namespaces. It uses a StatefulSet to host Kafka and Zookeeper, they keep the functions state and there is a controller talking with Kubernetes API. I really like that it leverages Kubernetes-native primitives such as `ConfigMaps` and `Secrets` to manage function environment. It also uses a `CustomResourceDefinition` called `functions` so you can `kubectl get functions -o yaml`. What I don't like instead is the use of the cluster's etcd to store functions code when deploying from file.

###### Developer experience: 5
Everything worked great even when running an experimental feature such as custom environment: I was able to inject configuration via environment variables, get the function logs either via `kubeless` CLI or `kubectl` and debug my way out of the configuration error I put into my first image. Second deploy I did I was able to call my function and I validated the results connecting to REDIS afterwards.

### Wrapping up
There are lots of people investing in serverless right now, almost as many as there are for Kubernetes; the integrations between the two will bring a new exciting technology scenario in the next years. To my experience building this post none of the previously listed framework is ready for production usage, to be honest most of them are not even ready for the average developer weekend project usage. You need to know Kubernetes quite a bit to troubleshoot issues happening during deployment and/or execution of your functions and this makes the whole serverless idea crumble, as you'll be forced to dig into infrastructure details to have your code running.

If I'd have to bet on one of the project I tried so far, I'd do so on Kubeless; it's been definitely the smoothest setup  among all and the tight Kubernetes integration makes it a perfect candidate for community-driven growth. If you know any other framework that should be in this post please let me know it in the comments! I am always curious to see what's around in all things serverless so don't keep it for yourself!


text:
require_relative 'p05_hash_map'
require_relative 'p04_linked_list'

class LRUCache
  attr_reader :count
  def initialize(max, prc)
    @map = HashMap.new
    @store = LinkedList.new
    @max = max
    @prc = prc
  end

  def count
    @map.count
  end

  def get(key)
    if @map[key]
      update_link!(@map[key])
      @map[key].val
    else
      calc!(key)
    end
  end

  def to_s
    "Map: " + @map.to_s + "\n" + "Store: " + @store.to_s
  end

  private

  def calc!(key)
    # suggested helper method; insert an (un-cached) key
    val = @prc.call(key)
    new_link = @store.append(key, val)
    @map[key] = new_link
    eject! if count > @max
    val
  end

  def update_link!(link)
    # suggested helper method; move a link to the end of the list
    link.remove
    @store.append(link.key, link.val)
  end

  def eject!
    link = @store.first
    link.remove
    @map.delete(link.key)
    nil
  end
end


text:
Changelog
=========

A lot of changes and bug fixes since last commit.

1.21
 - Changed and ported from haxe 2.10 and NME to haxe 3.0 and OpenFL.
 - Now a DfContentDef object will be passed to the DfRenderer object instancing.
 - A lot of bug fixes on DfAnimation and DfSprite to grant animations consistency.


text:
ACCEPTED

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

#### Published in
J. Asiat. Soc. Bengal 21:171. 1852

#### Original name
null

### Remarks
null


text:
/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#define VTK_WRAPPING_CXX
#define VTK_STREAMS_FWD_ONLY
#include <nan.h>

#include "vtkTableAlgorithmWrap.h"
#include "vtkStatisticsAlgorithmWrap.h"
#include "vtkObjectWrap.h"
#include "vtkAlgorithmOutputWrap.h"
#include "vtkDataObjectWrap.h"
#include "vtkStringArrayWrap.h"
#include "../../plus/plus.h"

using namespace v8;

extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap;
Nan::Persistent<v8::FunctionTemplate> VtkStatisticsAlgorithmWrap::ptpl;

VtkStatisticsAlgorithmWrap::VtkStatisticsAlgorithmWrap()
{ }

VtkStatisticsAlgorithmWrap::VtkStatisticsAlgorithmWrap(vtkSmartPointer<vtkStatisticsAlgorithm> _native)
{ native = _native; }

VtkStatisticsAlgorithmWrap::~VtkStatisticsAlgorithmWrap()
{ }

void VtkStatisticsAlgorithmWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkStatisticsAlgorithm").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("StatisticsAlgorithm").ToLocalChecked(), ConstructorGetter);
}

void VtkStatisticsAlgorithmWrap::ConstructorGetter(
	v8::Local<v8::String> property,
	const Nan::PropertyCallbackInfo<v8::Value>& info)
{
	InitPtpl();
	info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction());
}

void VtkStatisticsAlgorithmWrap::InitPtpl()
{
	if (!ptpl.IsEmpty()) return;
	v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
	VtkTableAlgorithmWrap::InitPtpl( );
	tpl->Inherit(Nan::New<FunctionTemplate>(VtkTableAlgorithmWrap::ptpl));
	tpl->SetClassName(Nan::New("VtkStatisticsAlgorithmWrap").ToLocalChecked());
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

	Nan::SetPrototypeMethod(tpl, "AddColumn", AddColumn);
	Nan::SetPrototypeMethod(tpl, "addColumn", AddColumn);

	Nan::SetPrototypeMethod(tpl, "AddColumnPair", AddColumnPair);
	Nan::SetPrototypeMethod(tpl, "addColumnPair", AddColumnPair);

	Nan::SetPrototypeMethod(tpl, "GetAssessNames", GetAssessNames);
	Nan::SetPrototypeMethod(tpl, "getAssessNames", GetAssessNames);

	Nan::SetPrototypeMethod(tpl, "GetAssessOption", GetAssessOption);
	Nan::SetPrototypeMethod(tpl, "getAssessOption", GetAssessOption);

	Nan::SetPrototypeMethod(tpl, "GetClassName", GetClassName);
	Nan::SetPrototypeMethod(tpl, "getClassName", GetClassName);

	Nan::SetPrototypeMethod(tpl, "GetDeriveOption", GetDeriveOption);
	Nan::SetPrototypeMethod(tpl, "getDeriveOption", GetDeriveOption);

	Nan::SetPrototypeMethod(tpl, "GetLearnOption", GetLearnOption);
	Nan::SetPrototypeMethod(tpl, "getLearnOption", GetLearnOption);

	Nan::SetPrototypeMethod(tpl, "GetTestOption", GetTestOption);
	Nan::SetPrototypeMethod(tpl, "getTestOption", GetTestOption);

	Nan::SetPrototypeMethod(tpl, "IsA", IsA);
	Nan::SetPrototypeMethod(tpl, "isA", IsA);

	Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance);
	Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance);

	Nan::SetPrototypeMethod(tpl, "RequestSelectedColumns", RequestSelectedColumns);
	Nan::SetPrototypeMethod(tpl, "requestSelectedColumns", RequestSelectedColumns);

	Nan::SetPrototypeMethod(tpl, "ResetAllColumnStates", ResetAllColumnStates);
	Nan::SetPrototypeMethod(tpl, "resetAllColumnStates", ResetAllColumnStates);

	Nan::SetPrototypeMethod(tpl, "ResetRequests", ResetRequests);
	Nan::SetPrototypeMethod(tpl, "resetRequests", ResetRequests);

	Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast);
	Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast);

	Nan::SetPrototypeMethod(tpl, "SetAssessNames", SetAssessNames);
	Nan::SetPrototypeMethod(tpl, "setAssessNames", SetAssessNames);

	Nan::SetPrototypeMethod(tpl, "SetAssessOption", SetAssessOption);
	Nan::SetPrototypeMethod(tpl, "setAssessOption", SetAssessOption);

	Nan::SetPrototypeMethod(tpl, "SetColumnStatus", SetColumnStatus);
	Nan::SetPrototypeMethod(tpl, "setColumnStatus", SetColumnStatus);

	Nan::SetPrototypeMethod(tpl, "SetDeriveOption", SetDeriveOption);
	Nan::SetPrototypeMethod(tpl, "setDeriveOption", SetDeriveOption);

	Nan::SetPrototypeMethod(tpl, "SetInputModel", SetInputModel);
	Nan::SetPrototypeMethod(tpl, "setInputModel", SetInputModel);

	Nan::SetPrototypeMethod(tpl, "SetInputModelConnection", SetInputModelConnection);
	Nan::SetPrototypeMethod(tpl, "setInputModelConnection", SetInputModelConnection);

	Nan::SetPrototypeMethod(tpl, "SetLearnOption", SetLearnOption);
	Nan::SetPrototypeMethod(tpl, "setLearnOption", SetLearnOption);

	Nan::SetPrototypeMethod(tpl, "SetLearnOptionParameterConnection", SetLearnOptionParameterConnection);
	Nan::SetPrototypeMethod(tpl, "setLearnOptionParameterConnection", SetLearnOptionParameterConnection);

	Nan::SetPrototypeMethod(tpl, "SetLearnOptionParameters", SetLearnOptionParameters);
	Nan::SetPrototypeMethod(tpl, "setLearnOptionParameters", SetLearnOptionParameters);

	Nan::SetPrototypeMethod(tpl, "SetTestOption", SetTestOption);
	Nan::SetPrototypeMethod(tpl, "setTestOption", SetTestOption);

#ifdef VTK_NODE_PLUS_VTKSTATISTICSALGORITHMWRAP_INITPTPL
	VTK_NODE_PLUS_VTKSTATISTICSALGORITHMWRAP_INITPTPL
#endif
	ptpl.Reset( tpl );
}

void VtkStatisticsAlgorithmWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	if(!info.IsConstructCall())
	{
		Nan::ThrowError("Constructor not called in a construct call.");
		return;
	}

	if(info.Length() == 0)
	{
		Nan::ThrowError("Cannot create instance of abstract class.");
		return;
	}
	else
	{
		if(info[0]->ToObject() != vtkNodeJsNoWrap )
		{
			Nan::ThrowError("Parameter Error");
			return;
		}
	}

	info.GetReturnValue().Set(info.This());
}

void VtkStatisticsAlgorithmWrap::AddColumn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->AddColumn(
			*a0
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::AddColumnPair(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
		if(info.Length() > 1 && info[1]->IsString())
		{
			Nan::Utf8String a1(info[1]);
						if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			native->AddColumnPair(
				*a0,
				*a1
			);
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::GetAssessNames(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	vtkStringArray * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetAssessNames();
	VtkStringArrayWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkStringArrayWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkStringArrayWrap *w = new VtkStringArrayWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkStatisticsAlgorithmWrap::GetAssessOption(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	bool r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetAssessOption();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkStatisticsAlgorithmWrap::GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	char const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetClassName();
	info.GetReturnValue().Set(Nan::New(r).ToLocalChecked());
}

void VtkStatisticsAlgorithmWrap::GetDeriveOption(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	bool r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetDeriveOption();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkStatisticsAlgorithmWrap::GetLearnOption(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	bool r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetLearnOption();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkStatisticsAlgorithmWrap::GetTestOption(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	bool r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetTestOption();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkStatisticsAlgorithmWrap::IsA(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
		int r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->IsA(
			*a0
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	vtkStatisticsAlgorithm * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->NewInstance();
	VtkStatisticsAlgorithmWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkStatisticsAlgorithmWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkStatisticsAlgorithmWrap *w = new VtkStatisticsAlgorithmWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkStatisticsAlgorithmWrap::RequestSelectedColumns(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->RequestSelectedColumns();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkStatisticsAlgorithmWrap::ResetAllColumnStates(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->ResetAllColumnStates();
}

void VtkStatisticsAlgorithmWrap::ResetRequests(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->ResetRequests();
}

void VtkStatisticsAlgorithmWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectWrap::ptpl))->HasInstance(info[0]))
	{
		VtkObjectWrap *a0 = ObjectWrap::Unwrap<VtkObjectWrap>(info[0]->ToObject());
		vtkStatisticsAlgorithm * r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->SafeDownCast(
			(vtkObject *) a0->native.GetPointer()
		);
		VtkStatisticsAlgorithmWrap::InitPtpl();
		v8::Local<v8::Value> argv[1] =
			{ Nan::New(vtkNodeJsNoWrap) };
		v8::Local<v8::Function> cons =
			Nan::New<v8::FunctionTemplate>(VtkStatisticsAlgorithmWrap::ptpl)->GetFunction();
		v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
		VtkStatisticsAlgorithmWrap *w = new VtkStatisticsAlgorithmWrap();
		w->native = r;
		w->Wrap(wo);
		info.GetReturnValue().Set(wo);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::SetAssessNames(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkStringArrayWrap::ptpl))->HasInstance(info[0]))
	{
		VtkStringArrayWrap *a0 = ObjectWrap::Unwrap<VtkStringArrayWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetAssessNames(
			(vtkStringArray *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::SetAssessOption(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsBoolean())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetAssessOption(
			info[0]->BooleanValue()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::SetColumnStatus(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
		if(info.Length() > 1 && info[1]->IsInt32())
		{
						if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			native->SetColumnStatus(
				*a0,
				info[1]->Int32Value()
			);
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::SetDeriveOption(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsBoolean())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetDeriveOption(
			info[0]->BooleanValue()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::SetInputModel(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkDataObjectWrap::ptpl))->HasInstance(info[0]))
	{
		VtkDataObjectWrap *a0 = ObjectWrap::Unwrap<VtkDataObjectWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetInputModel(
			(vtkDataObject *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::SetInputModelConnection(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkAlgorithmOutputWrap::ptpl))->HasInstance(info[0]))
	{
		VtkAlgorithmOutputWrap *a0 = ObjectWrap::Unwrap<VtkAlgorithmOutputWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetInputModelConnection(
			(vtkAlgorithmOutput *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::SetLearnOption(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsBoolean())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetLearnOption(
			info[0]->BooleanValue()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::SetLearnOptionParameterConnection(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkAlgorithmOutputWrap::ptpl))->HasInstance(info[0]))
	{
		VtkAlgorithmOutputWrap *a0 = ObjectWrap::Unwrap<VtkAlgorithmOutputWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetLearnOptionParameterConnection(
			(vtkAlgorithmOutput *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::SetLearnOptionParameters(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkDataObjectWrap::ptpl))->HasInstance(info[0]))
	{
		VtkDataObjectWrap *a0 = ObjectWrap::Unwrap<VtkDataObjectWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetLearnOptionParameters(
			(vtkDataObject *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkStatisticsAlgorithmWrap::SetTestOption(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkStatisticsAlgorithmWrap *wrapper = ObjectWrap::Unwrap<VtkStatisticsAlgorithmWrap>(info.Holder());
	vtkStatisticsAlgorithm *native = (vtkStatisticsAlgorithm *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsBoolean())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetTestOption(
			info[0]->BooleanValue()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}


text:
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';

import { NgbdDatepickerHebrew } from './datepicker-hebrew';

@NgModule({
  imports: [BrowserModule, FormsModule, NgbModule],
  declarations: [NgbdDatepickerHebrew],
  exports: [NgbdDatepickerHebrew],
  bootstrap: [NgbdDatepickerHebrew]
})
export class NgbdDatepickerHebrewModule {}


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

-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Config\Model\Config\Structure\SearchInterface" type="Magento\Config\Model\Config\Structure" />
    <preference for="Magento\Config\Model\Config\Backend\File\RequestData\RequestDataInterface" type="Magento\Config\Model\Config\Backend\File\RequestData" />
    <type name="Magento\Config\Model\Config\Structure\Element\Iterator\Tab" shared="false" />
    <type name="Magento\Config\Model\Config\Structure\Element\Iterator\Section" shared="false" />
</config>


text:
                      <?php
                    if( isset($errors) ){
                        echo $errors;
                    }
                    ?>

Add Book

                    <row>
                        <col-md-12>
                        <form role="form" class="" method="post" enctype="multipart/form-data" >

                                    <input class="form-control" type="book_name"  placeholder="Book's name" autofocus="" id="book_name" name="book_name"/>

                                    <input class="form-control" type="book_author"  placeholder="Author" autofocus="" id="book_author" name="book_author"/>

                                    <input class="form-control" type="book_desc"  placeholder="Description" autofocus="" id="book_desc" name="book_desc"/>

                                    <input type="file" id="pic" name="pic"/>

                                    Cancel
                                    <button type="submit" class="btn btn-primary"> Add book

                                    </button>

                        </form>

                        </col-md-12>
                    </row>

<?php
if( isset($saved) && $saved==TRUE ){
?>

<?php
}
?>


text:
import React from 'react';

import DialogActionCreators from '../../actions/DialogActionCreators';

import LoginStore from '../../stores/LoginStore';
import PeerStore from '../../stores/PeerStore';
import DialogStore from '../../stores/DialogStore';
import InviteUserActions from '../../actions/InviteUserActions';

import AvatarItem from '../common/AvatarItem.react';
import InviteUser from '../modals/InviteUser.react';
import GroupProfileMembers from './GroupProfileMembers.react';

const getStateFromStores = (groupId) => {
  const thisPeer = PeerStore.getGroupPeer(groupId);
  return {
    thisPeer: thisPeer,
    isNotificationsEnabled: DialogStore.isNotificationsEnabled(thisPeer)
  };
};

class GroupProfile extends React.Component {
  static propTypes = {
    group: React.PropTypes.object.isRequired
  };

  componentWillMount() {
    DialogStore.addNotificationsListener(this.whenNotificationChanged);
  }

  componentWillUnmount() {
    DialogStore.removeNotificationsListener(this.whenNotificationChanged);
  }

  componentWillReceiveProps(newProps) {
    this.setState(getStateFromStores(newProps.group.id));
  }

  constructor(props) {
    super(props);

    this.onNotificationChange = this.onNotificationChange.bind(this);

    this.state = getStateFromStores(this.props.group.id);
  }

  onAddMemberClick(group) {
    InviteUserActions.modalOpen(group);
  }

  onLeaveGroupClick(groupId) {
    DialogActionCreators.leaveGroup(groupId);
  }

  onNotificationChange(event) {
    DialogActionCreators.changeNotificationsEnabled(this.state.thisPeer, event.target.checked);
  }

  whenNotificationChanged = () => {
    this.setState(getStateFromStores(this.props.group.id));
  };

  render() {
    const group = this.props.group;
    const myId = LoginStore.getMyId();
    const isNotificationsEnabled = this.state.isNotificationsEnabled;

    let memberArea;
    let adminControls;

    if (group.adminId === myId) {
      adminControls = (

          Delete group

      );
    }

    if (DialogStore.isGroupMember(group)) {
      memberArea = (

            Enable Notifications

              <input checked={isNotificationsEnabled} id="notifications" onChange={this.onNotificationChange.bind(this)} type="checkbox"/>

          <GroupProfileMembers groupId={group.id} members={group.members}/>

              Add member

              Leave group

              {adminControls}

          {/*

            Add member
            Leave group

           */}

          <InviteUser/>

      );
    }

    return (

          <AvatarItem image={group.bigAvatar}
                      placeholder={group.placeholder}
                      size="medium"
                      title={group.name}/>

{group.name}

        {memberArea}

    );
  }
}

export default GroupProfile;


text:
import ZeroFrame from 'zeroframe';

export default class ZeroAPI extends ZeroFrame {
  function getBooks() {
    var books;
    this.cmd("DbQuery", ["SELECT b.isbn,b.title, b.subtitle, b.lang, b.publisher, b.magnet, b.year, a.name, a.surname,e.name, e.surname FROM  books b, authors a, editors e, book_authors ba,book_editors be WHERE b.isbn = ba.bookID AND ba.authorID = a.id AND b.isbn = be.bookID AND be.editorID = e.id "], (query) => {
      books = query;
    });
    return books;
  };
}


text: A docker container to run a monero full node