text:
ColorizeBlock::ColorizeBlock(MainController* controller, QString uid)
    : InOutBlock(controller, uid)
    , m_stepsNode(nullptr)
    , m_stepCount(this, "stepCount", 2, 2, 999)
    , m_smooth(this, "smooth", true)
    , m_horizontal(this, "horizontal", true)
{
    m_stepsNode = createInputNode("stepsNode");
    m_outputNode->addNodeSharingRequestedSize(m_inputNode);
    connect(&m_stepCount, &IntegerAttribute::valueChanged, this, &ColorizeBlock::updateRequestedSize);
    connect(&m_smooth, &BoolAttribute::valueChanged, this, &ColorizeBlock::updateOutput);
    connect(&m_horizontal, &BoolAttribute::valueChanged, this, &ColorizeBlock::updateOutput);
    connect(m_stepsNode, &NodeBase::dataChanged, this, &ColorizeBlock::updateOutput);
    connect(m_inputNode, &NodeBase::dataChanged, this, &ColorizeBlock::updateOutput);
    updateRequestedSize();
}

void ColorizeBlock::updateOutput() {
    auto out = RgbDataModifier(m_outputNode);
    const ColorMatrix& input = m_inputNode->constData();
    const ColorMatrix& steps = m_stepsNode->constData();
    int stepCount = steps.width();
    if (input.width() < out.width || input.height() < out.height) {
        qWarning() << "ColorizeBlock: Input too small.";
        return;
    }
    if (stepCount < 2) {
        qWarning() << "ColorizeBlock: Too few steps.";
        return;
    }

    if (m_horizontal) {

        if (stepCount >= out.width) {
            // there are equal or more steps than output pixels
            // -> apply colors using a very simple approach:
            for (int x = 0; x < out.width; ++x) {
                for (int y = 0; y < out.height; ++y) {
                    RGB mix = steps.getRgbAt(x % stepCount, 0);
                    mix = mix * input.getHsvAt(x, y).v;
                    out.set(x, y, mix);
                }
            }
        } else {
            // more pixels than steps -> interpolate between steps:
            double div = (out.width - 1) / double(stepCount - 1);
            bool smooth = m_smooth;
            for (int x = 0; x < out.width; ++x) {
                for (int y = 0; y < out.height; ++y) {
                    int l = int(x / div);
                    int r = qMin(l + 1, stepCount - 1);
                    double ratio = fmod(x / div, 1.0);
                    RGB mix;
                    if (smooth) {
                        mix = steps.getRgbAt(l, 0) * (1 - ratio);
                        mix = mix + (steps.getRgbAt(r, 0) * ratio);
                    } else {
                        mix = steps.getRgbAt( (ratio <= 0.5) ? l : r , 0);
                    }
                    double colMax = qMax(mix.r, qMax(mix.g, mix.b));
                    if (colMax > 0) {
                        mix = mix * (input.getHsvAt(x, y).v / colMax);
                    }
                    out.set(x, y, mix);
                }
            }
        }

    } else {  // vertical

        if (stepCount >= out.height) {
            // there are equal or more steps than output pixels
            // -> apply colors using a very simple approach:
            for (int x = 0; x < out.width; ++x) {
                for (int y = 0; y < out.height; ++y) {
                    RGB mix = steps.getRgbAt(y % stepCount, 0);
                    mix = mix * input.getHsvAt(x, y).v;
                    out.set(x, y, mix);
                }
            }
        } else {
            // more pixels than steps -> interpolate between steps:
            double div = (out.height - 1) / double(stepCount - 1);
            bool smooth = m_smooth;
            for (int x = 0; x < out.width; ++x) {
                for (int y = 0; y < out.height; ++y) {
                    int l = int(y / div);
                    int r = qMin(l + 1, stepCount - 1);
                    double ratio = fmod(y / div, 1.0);
                    RGB mix;
                    if (smooth) {
                        mix = steps.getRgbAt(l, 0) * (1 - ratio);
                        mix = mix + (steps.getRgbAt(r, 0) * ratio);
                    } else {
                        mix = steps.getRgbAt( (ratio <= 0.5) ? l : r , 0);
                    }
                    double colMax = qMax(mix.r, qMax(mix.g, mix.b));
                    if (colMax > 0) {
                        mix = mix * (input.getHsvAt(x, y).v / colMax);
                    }
                    out.set(x, y, mix);
                }
            }
        }

    }
}

void ColorizeBlock::updateRequestedSize() {
    m_stepsNode->setRequestedSize(Size(m_stepCount, 1));
}


text:
Clu's repl is called **lepr**. The `loon evaluator and printer`, of course.

It wouldn't be Lispy without one revolting component name...

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace RK\ShowRoomModule\Entity;

use RK\ShowRoomModule\Entity\Base\AbstractStoryAlbumEntity as BaseEntity;
use Doctrine\ORM\Mapping as ORM;

/**
 * Entity class that defines the entity structure and behaviours.
 *
 * This is the concrete entity class for story album entities.
 * @ORM\Entity(repositoryClass="RK\ShowRoomModule\Entity\Repository\StoryAlbumRepository")
 * @ORM\Table(name="rk_showroom_storyalbum",
 *     indexes={
 *         @ORM\Index(name="workflowstateindex", columns={"workflowState"})
 *     }
 * )
 */
class StoryAlbumEntity extends BaseEntity
{
    // feel free to add your own methods here
}


text:
/**
 * Dummy package for testing package configurations.
 * Is used by test {@link net.lkrnac.lib.patere.PatereTest}
 *
 * @author lubos krnac
 *
 */
package dummypackage.dummysubpackage.dummysubpackage;


text:
% gaussianfits : fit data to Gaussian curves
%
% Usage:
%   >> [params,yfit]=gaussianfit(x,y,guess,options);
%function [params,yfit]=gaussianfits(x,y,Npeaks,guess,options)
function [param,fit]=gaussianfits(x,y,varargin)

% handle input
assert(nargin>=2,'ERROR: insufficient number of inputs');
assert(numel(x)==numel(y),'ERROR: inconsistent data arrays');

Narg=numel(varargin);
assert(rem(Narg,2),'ERROR: unmatched name/value pair');
peaks=1;
guess=[];
separation=(max(x)-min(x))/(numel(x)-1);
options=optimset('TolX',1e-6,'TolFun',1e-6);
for n=1:2:Narg
    name=varargin{n};
    value=varargin{n+1};
    switch name
        case 'guess'
            guess=value;
        case 'options'
            options=value;
        case 'separation'
            separation=value;
        case 'peaks'
            peaks=value;
        otherwise
            error('ERROR: invalid name');
    end
end

if isempty(guess)
    [~,index]=max(y);
    xp=x(index);
    xtemp=reshape(x-xp,size(y));
    sigma=sqrt(sum(y.*xtemp.^2)/sum(y));
    guess=[xp sigma];
    guess=repmat(guess,[1 Npeaks]);
end

% error checking
assert(isnumeric(peaks) && isscalar(peaks),...
    'ERROR: invalid number of peaks');
peaks=round(peaks);
assert(peaks>=1,'ERROR: invalid number of peaks');

assert(numel(guess)==(2*peaks),'ERROR: invalid guess')

assert(isnumeric(separation) && isscalar(separation),...
    'ERROR: invalid number of separation');
separation=round(separation);
assert(separation>=1,'ERROR: invalid separation');

% scale data
x=x(:);
y=y(:);
numpoints=numel(x);

x0=min(x);
Lx=max(x)-x0;
x=(x-x0)/Lx;

y0=min(y);
Ly=max(y)-y0;
y=(y-y0)/Ly;

guess(1:2:end)=(guess(1:2:end)-x0)/Lx;
guess(2:2:end)=guess(2:2:end)/Lx;

% TRANSITION TO FIXED WIDTHS?

% perform nonlinear optimization
    function [chi2,param,fit]=residual(NLparam)
        xp=NLparam(1:2:end);
        sigma=NLparam(2:2:end);
        matrix=nan(numpoints,peaks);
        reference=1:peaks;
        for m=1:peaks
            if (m==1) || all(abs(xp(m)-xp(1:m-1)))
                matrix(:,m)=exp(-(x-xp(m)).^2/2/sigma(m)^2);
            else
                reference=find(~isnan(matrix(1,1:m-1),1,'last'));
            end
        end
        keep=~isnan(matrix(1,:));
        matrix=matrix(:,keep);

    end
fitness=@(NLparams) residual(NLparams,x,y);
[NLparams,fval]=fminsearch(fitness,guess,options);
[chi2,params,yfit]=residual(NLparams,x,y);

% convert results to original scale
params(1)=y0+Ly*params(1);
params(2)=Ly*params(2);
params(3)=x0+Lx*params(3);
params(4)=Lx*params(4);
yfit=y0+Ly*yfit;

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% nonlinear least squares residual function %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [chi2,params,yfit]=residual_old(NLparams,x,y)

% extract nonlinear least square parameters
if any(isnan(NLparams))
    chi2=inf;
    return;
end
xp=NLparams(1);
sigma=NLparams(2);
if (xp<x(1)) || (xp>x(end))
    chi2=inf;
    return
end

% determine linear least square parameters
Ndata=numel(x);
M=ones(Ndata,2);
M(:,2)=exp(-(x-xp).^2/(2*sigma^2));

Lparams=M\y(:);
y0=Lparams(1);
A=Lparams(2);

% combine parameters
params=[y0 A xp sigma];

% calculate residual error
yfit=y0+A*M(:,2);
chi2=sum((y(:)-yfit).^2);

end


text:
var inquirer = require('inquirer')

// local dependencies
var enduro_instance = require('../../index').quick_init()
var enduro_configurator = require(enduro.enduro_path + '/libs/configuration/enduro_configurator')
var logger = require(enduro.enduro_path + '/libs/logger')

module.exports = {
	command: 'juicebox',
	desc: 'turns juicebox off and on',
	builder: (yargs) => {
		return yargs
			.usage('enduro juice juicebox')
	},
	handler: function (cli_arguments) {
		logger.init('setting up juicebox')

		var turning_on = true

		enduro_configurator.read_config()
			.then((config) => {
				if (config.juicebox_enabled) {
					turning_on = false
					return inquirer.prompt([
						{
							name: 'juicebox_enabled',
							message: 'Juicebox enabled, do you want to disable it?',
							type: 'confirm',
							default: true,
						},
					])
				} else {
					turning_on = true
					return inquirer.prompt([
						{
							name: 'juicebox_enabled',
							message: 'Juicebox disabled, do you want to enable it?',
							type: 'confirm',
							default: true,
						},
					])
				}
			})
			.then((answers) => {
				if (!turning_on) {
					answers.juicebox_enabled = !answers.juicebox_enabled
				}
				turning_on = answers.juicebox_enabled
				return enduro_configurator.set_config(answers)
			})
			.then(() => {
				logger.line()
				if (turning_on) {
					logger.log('Juicebox enabled successfully')
				} else {
					logger.log('Juicebox disabled successfully')
				}
				logger.end()
			})
	}
}


text:
#import <Xcode3UI/PBXSingletonBuildPhaseWrapper.h>

@interface PBXHeadersBuildPhaseWrapper : PBXSingletonBuildPhaseWrapper
{
}

@end


text:
package org.apache.ambari.server.agent.stomp.dto;

import java.util.List;
import java.util.TreeMap;

import org.apache.ambari.server.agent.CommandReport;

import com.fasterxml.jackson.annotation.JsonProperty;

public class CommandStatusReports {

  @JsonProperty("clusters")
  private TreeMap<String, List<CommandReport>> clustersComponentReports;

  public CommandStatusReports() {
  }

  public TreeMap<String, List<CommandReport>> getClustersComponentReports() {
    return clustersComponentReports;
  }

  public void setClustersComponentReports(TreeMap<String, List<CommandReport>> clustersComponentReports) {
    this.clustersComponentReports = clustersComponentReports;
  }
}


text:
package io.quarkus.it.panache.reactive;

import static org.hamcrest.Matchers.is;

import org.junit.jupiter.api.Test;

import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;

/**
 * Test various Panache operations running in Quarkus
 */
@QuarkusTest
public class PanacheFunctionalityTest {

    @Test
    public void tests() {
        RestAssured.when().get("/test/store3fruits").then().body(is("OK"));
        RestAssured.when().get("/test/load3fruits").then().body(is("OK"));
    }

}


text:
"""The TensorBoard Text plugin."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import json

import bleach
# pylint: disable=g-bad-import-order
# Google-only: import markdown_freewisdom
import markdown
# pylint: enable=g-bad-import-order
from werkzeug import wrappers

from mxconsole.summary import text_summary
from mxconsole.backend import http_util
from mxconsole.plugins import base_plugin

# The prefix of routes provided by this plugin.
PLUGIN_PREFIX_ROUTE = 'text'

# HTTP routes
RUNS_ROUTE = '/runs'
TEXT_ROUTE = '/text'

ALLOWED_TAGS = [
    'ul',
    'ol',
    'li',
    'p',
    'pre',
    'code',
    'blockquote',
    'h1',
    'h2',
    'h3',
    'h4',
    'h5',
    'h6',
    'hr',
    'br',
    'strong',
    'em',
    'a',
    'img',
    'table',
    'thead',
    'tbody',
    'td',
    'tr',
    'th',
]

ALLOWED_ATTRIBUTES = {'a': ['href', 'title'], 'img': ['src', 'title', 'alt']}

def markdown_and_sanitize(markdown_string):
  """Takes a markdown string and converts it into sanitized html.

  It uses the table extension; while that's not a part of standard
  markdown, it is sure to be useful for TensorBoard users.

  The sanitizer uses the allowed_tags and attributes specified above. Mostly,
  we ensure that our standard use cases like tables and links are supported.

  Args:
    markdown_string: Markdown string to sanitize

  Returns:
    a string containing sanitized html for input markdown
  """
  # Convert to utf-8 because we get a bytearray in python3
  if not isinstance(markdown_string, str):
    markdown_string = markdown_string.decode('utf-8')
  string_html = markdown.markdown(
      markdown_string, extensions=['markdown.extensions.tables'])
  string_sanitized = bleach.clean(
      string_html, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES)
  return string_sanitized

def process_string_tensor_event(event):
  """Convert a TensorEvent into a JSON-compatible response."""
  return {
      'wall_time': event.wall_time,
      'step': event.step,
      'text': markdown_and_sanitize(event.tensor_proto.string_val[0]),
  }

class TextPlugin(base_plugin.TBPlugin):
  """Text Plugin for TensorBoard."""

  def index_impl(self):
    run_to_series = {}
    name = text_summary.TextSummaryPluginAsset.plugin_name
    run_to_assets = self.multiplexer.PluginAssets(name)

    for run, assets in run_to_assets.items():
      if 'tensors.json' in assets:
        tensors_json = self.multiplexer.RetrievePluginAsset(
            run, name, 'tensors.json')
        tensors = json.loads(tensors_json)
        run_to_series[run] = tensors
    return run_to_series

  @wrappers.Request.application
  def runs_route(self, request):
    index = self.index_impl()
    return http_util.Respond(request, index, 'application/json')

  def text_impl(self, run, tag):
    try:
      text_events = self.multiplexer.Tensors(run, tag)
    except KeyError:
      text_events = []
    responses = [process_string_tensor_event(ev) for ev in text_events]
    return responses

  @wrappers.Request.application
  def text_route(self, request):
    run = request.args.get('run')
    tag = request.args.get('tag')
    response = self.text_impl(run, tag)
    return http_util.Respond(request, response, 'application/json')

  def get_plugin_apps(self, multiplexer, unused_logdir):
    self.multiplexer = multiplexer
    return {
        RUNS_ROUTE: self.runs_route,
        TEXT_ROUTE: self.text_route,
    }


text:
.team-member {
    width: 50%;
    border: 1px black solid;
    display: inline-block;
}


text:
using System.Collections.Generic;
using System.Net.Test.Common;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;

namespace System.Net.Http.Functional.Tests
{
    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public class PlatformHandler_HttpClientHandler : HttpClientHandlerTestBase
    {
        protected override bool UseSocketsHttpHandler => false;

        public PlatformHandler_HttpClientHandler(ITestOutputHelper output) : base(output) { }

        [Theory]
        [InlineData(false)]
        [InlineData(true)]
        [PlatformSpecific(TestPlatforms.Windows)]
        public async Task GetAsync_TrailingHeaders_Ignored(bool includeTrailerHeader)
        {
           await LoopbackServer.CreateServerAsync(async (server, url) =>
            {
                using (HttpClient client = CreateHttpClient())
                {
                    Task<HttpResponseMessage> getResponseTask = client.GetAsync(url);
                    await TestHelper.WhenAllCompletedOrAnyFailed(
                        getResponseTask,
                        server.AcceptConnectionSendCustomResponseAndCloseAsync(
                            "HTTP/1.1 200 OK\r\n" +
                            "Connection: close\r\n" +
                            "Transfer-Encoding: chunked\r\n" +
                            (includeTrailerHeader ? "Trailer: MyCoolTrailerHeader\r\n" : "") +
                            "\r\n" +
                            "4\r\n" +
                            "data\r\n" +
                            "0\r\n" +
                            "MyCoolTrailerHeader: amazingtrailer\r\n" +
                            "\r\n"));

                    using (HttpResponseMessage response = await getResponseTask)
                    {
                        Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                        if (includeTrailerHeader)
                        {
                            Assert.Contains("MyCoolTrailerHeader", response.Headers.GetValues("Trailer"));
                        }
                        Assert.False(response.Headers.Contains("MyCoolTrailerHeader"), "Trailer should have been ignored");

                        string data = await response.Content.ReadAsStringAsync();
                        Assert.Contains("data", data);
                        Assert.DoesNotContain("MyCoolTrailerHeader", data);
                        Assert.DoesNotContain("amazingtrailer", data);
                    }
                }
            });
        }
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandler_Asynchrony_Test : HttpClientHandler_Asynchrony_Test
    {
        public PlatformHandler_HttpClientHandler_Asynchrony_Test(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpProtocolTests : HttpProtocolTests
    {
        public PlatformHandler_HttpProtocolTests(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpProtocolTests_Dribble : HttpProtocolTests_Dribble
    {
        public PlatformHandler_HttpProtocolTests_Dribble(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_DiagnosticsTest : DiagnosticsTest
    {
        public PlatformHandler_DiagnosticsTest(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClient_SelectedSites_Test : HttpClient_SelectedSites_Test
    {
        public PlatformHandler_HttpClient_SelectedSites_Test(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientEKUTest : HttpClientEKUTest
    {
        public PlatformHandler_HttpClientEKUTest(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

#if NETCOREAPP
    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandler_Decompression_Tests : HttpClientHandler_Decompression_Test
    {
        public PlatformHandler_HttpClientHandler_Decompression_Tests(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test : HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test
    {
        public PlatformHandler_HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }
#endif

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandler_ClientCertificates_Test : HttpClientHandler_ClientCertificates_Test
    {
        public PlatformHandler_HttpClientHandler_ClientCertificates_Test(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandler_DefaultProxyCredentials_Test : HttpClientHandler_DefaultProxyCredentials_Test
    {
        public PlatformHandler_HttpClientHandler_DefaultProxyCredentials_Test(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandler_MaxConnectionsPerServer_Test : HttpClientHandler_MaxConnectionsPerServer_Test
    {
        public PlatformHandler_HttpClientHandler_MaxConnectionsPerServer_Test(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandler_ServerCertificates_Test : HttpClientHandler_ServerCertificates_Test
    {
        public PlatformHandler_HttpClientHandler_ServerCertificates_Test(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_PostScenarioTest : PostScenarioTest
    {
        public PlatformHandler_PostScenarioTest(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_ResponseStreamTest : ResponseStreamTest
    {
        public PlatformHandler_ResponseStreamTest(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandler_SslProtocols_Test : HttpClientHandler_SslProtocols_Test
    {
        public PlatformHandler_HttpClientHandler_SslProtocols_Test(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandler_Proxy_Test : HttpClientHandler_Proxy_Test
    {
        public PlatformHandler_HttpClientHandler_Proxy_Test(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_SchSendAuxRecordHttpTest : SchSendAuxRecordHttpTest
    {
        public PlatformHandler_SchSendAuxRecordHttpTest(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandlerTest : HttpClientHandlerTest
    {
        public PlatformHandler_HttpClientHandlerTest(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandlerTest_AutoRedirect : HttpClientHandlerTest_AutoRedirect
    {
        public PlatformHandlerTest_AutoRedirect(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_DefaultCredentialsTest : DefaultCredentialsTest
    {
        public PlatformHandler_DefaultCredentialsTest(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_IdnaProtocolTests : IdnaProtocolTests
    {
        public PlatformHandler_IdnaProtocolTests(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
        // WinHttp on Win7 does not support IDNA
        protected override bool SupportsIdna => !PlatformDetection.IsWindows7;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpRetryProtocolTests : HttpRetryProtocolTests
    {
        public PlatformHandler_HttpRetryProtocolTests(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandlerTest_Cookies : HttpClientHandlerTest_Cookies
    {
        public PlatformHandlerTest_Cookies(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandlerTest_Cookies_Http11 : HttpClientHandlerTest_Cookies_Http11
    {
        public PlatformHandlerTest_Cookies_Http11(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandler_MaxResponseHeadersLength_Test : HttpClientHandler_MaxResponseHeadersLength_Test
    {
        public PlatformHandler_HttpClientHandler_MaxResponseHeadersLength_Test(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandler_Cancellation_Test : HttpClientHandler_Cancellation_Test
    {
        public PlatformHandler_HttpClientHandler_Cancellation_Test(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandler_HttpClientHandler_Authentication_Test : HttpClientHandler_Authentication_Test
    {
        public PlatformHandler_HttpClientHandler_Authentication_Test(ITestOutputHelper output) : base(output) { }
        protected override bool UseSocketsHttpHandler => false;
    }

    // Enable this to run HTTP2 tests on platform handler
#if PLATFORM_HANDLER_HTTP2_TESTS
    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    public sealed class PlatformHandlerTest_Http2 : HttpClientHandlerTest_Http2
    {
        protected override bool UseSocketsHttpHandler => false;
    }

    // Test only WinHttpHandler since the CurlHandler was removed
    [PlatformSpecific(TestPlatforms.Windows)]
    [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))]
    public sealed class PlatformHandlerTest_Cookies_Http2 : HttpClientHandlerTest_Cookies
    {
        protected override bool UseSocketsHttpHandler => false;
        protected override bool UseHttp2LoopbackServer => true;
    }
#endif
}


text:
#Homework: Conditional Statements
##Problem 1. Exchange If Greater

Write an if-statement that takes two double variables a and b and exchanges their values if the first one is greater than the second one. As a result print the values a and b, separated by a space.
Examples:

a	b	result
5	2	2 5
3	4	3 4
5.5	4.5	4.5 5.5
##Problem 2. Bonus Score

Write a program that applies bonus score to given score in the range [1…9] by the following rules:
If the score is between 1 and 3, the program multiplies it by 10.
If the score is between 4 and 6, the program multiplies it by 100.
If the score is between 7 and 9, the program multiplies it by 1000.
If the score is 0 or more than 9, the program prints "invalid score".
Examples:

score	result
2	20
4	400
9	9000
-1	invalid score
10	invalid score
##Problem 3. Check for a Play Card

Classical play cards use the following signs to designate the card face: `2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K and A. Write a program that enters a string and prints "yes" if it is a valid card sign or "no" otherwise. Examples:
character	Valid card sign?
5	yes
1	no
Q	yes
q	no
P	no
10	yes
500	no
##Problem 4. Multiplication Sign

Write a program that shows the sign (+, - or 0) of the product of three real numbers, without calculating it.
Use a sequence of if operators.
Examples:

a	b	c	result
5	2	2	+
-2	-2	1	+
-2	4	3	-
0	-2.5	4	0
-1	-0.5	-5.1	-
##Problem 5. The Biggest of 3 Numbers

Write a program that finds the biggest of three numbers.
Examples:

a	b	c	biggest
5	2	2	5
-2	-2	1	1
-2	4	3	4
0	-2.5	5	5
-0.1	-0.5	-1.1	-0.1
##Problem 6. The Biggest of Five Numbers

Write a program that finds the biggest of five numbers by using only five if statements.
Examples:

a	b	c	d	e	biggest
5	2	2	4	1	5
-2	-22	1	0	0	1
-2	4	3	2	0	4
0	-2.5	0	5	5	5
-3	-0.5	-1.1	-2	-0.1	-0.1
##Problem 7. Sort 3 Numbers with Nested Ifs

Write a program that enters 3 real numbers and prints them sorted in descending order.
Use nested if statements.
Note: Don't use arrays and the built-in sorting functionality.

Examples:

a	b	c	result
5	1	2	5 2 1
-2	-2	1	1 -2 -2
-2	4	3	4 3 -2
0	-2.5	5	5 0 -2.5
-1.1	-0.5	-0.1	-0.1 -0.5 -1.1
10	20	30	30 20 10
1	1	1	1 1 1
##Problem 8. Digit as Word

Write a program that asks for a digit (0-9), and depending on the input, shows the digit as a word (in English).
Print "not a digit" in case of invalid input.
Use a switch statement.
Examples:

d	result
2	two
1	one
0	zero
5	five
-0.1	not a digit
hi	not a digit
9	nine
10	not a digit
##Problem 9. Play with Int, Double and String

Write a program that, depending on the user's choice, inputs an int, double or string variable.
If the variable is int or double, the program increases it by one.
If the variable is a string, the program appends * at the end.
Print the result at the console. Use switch statement.
Example 1:

program	user
Please choose a type:
1 --> int
2 --> double	3
3 --> string
Please enter a string:	hello
hello*
Example 2:

program	user
Please choose a type:
1 --> int
2 --> double	2
3 --> string
Please enter a double:	1.5
2.5
##Problem 10.* Beer Time

A beer time is after 1:00 PM and before 3:00 AM.
Write a program that enters a time in format "hh:mm tt" (an hour in range [01...12], a minute in range [00…59] and AM / PM designator) and prints beer time or non-beer time according to the definition above or invalid time if the time cannot be parsed. Note: You may need to learn how to parse dates and times.
Examples:

time	result
1:00 PM	beer time
4:30 PM	beer time
10:57 PM	beer time
8:30 AM	non-beer time
02:59 AM	beer time
03:00 AM	non-beer time
03:26 AM	non-beer time
##Problem 11.* Number as Words

Write a program that converts a number in the range [0…999] to words, corresponding to the English pronunciation.
Examples:

numbers	number as words
0	Zero
9	Nine
10	Ten
12	Twelve
19	Nineteen
25	Twenty five
98	Ninety eight
98	Ninety eight
273	Two hundred and seventy three
400	Four hundred
501	Five hundred and one
617	Six hundred and seventeen
711	Seven hundred and eleven
999	Nine hundred and ninety nine
##Problem 12.* Zero Subset

We are given 5 integer numbers. Write a program that finds all subsets of these numbers whose sum is 0.
Assume that repeating the same subset several times is not a problem.
Examples:

numbers	result
3 -2 1 1 8	-2 + 1 + 1 = 0
3 1 -7 35 22	no zero subset
1 3 -4 -2 -1	1 + -1 = 0
1 + 3 + -4 = 0
3 + -2 + -1 = 0
1 1 1 -1 -1	1 + -1 = 0
1 + 1 + -1 + -1 = 0
0 0 0 0 0	0 + 0 + 0 + 0 + 0 = 0
Hint: you may check for zero each of the 32 subsets with 32 if statements.


text:
var tile = require('./tile.js')

module.exports = {
  'move': {
    up: function (creature, world) {
      if (creature.position.y > 0) {
        if (world.world[creature.position.x][creature.position.y - 1] != tile.wall) {
          creature.position.y -= 1;
        }
      }
    },

    down: function (creature, world) {
      if (creature.position.y < world.size-1) {
        if (world.world[creature.position.x][creature.position.y + 1] != tile.wall) {
          creature.position.y += 1
        }
      }
    },

    left: function (creature, world) {
      if (creature.position.x > 1) {
        if (world.world[creature.position.x - 1][creature.position.y] != tile.wall) {
          creature.position.x -= 1
        }
      }
    },

    right: function (creature, world) {
      if (creature.position.x < world.size - 1) {
        if (world.world[creature.position.x + 1][creature.position.y] != tile.wall) {
          creature.position.x += 1
        }
      }
    }
  },

  eat: function (creature, world) {
    if (world.world[creature.position.x][creature.position.y] == tile.food) {
      creature.energy += 10;
    }
  }
}


text:
from .resource import Resource
from .location import Location
from .error import Error, ErrorException
from .group_item import GroupItem
from .application import Application
from .iosmam_policy import IOSMAMPolicy
from .android_mam_policy import AndroidMAMPolicy
from .mam_policy_app_id_or_group_id_payload import MAMPolicyAppIdOrGroupIdPayload
from .mam_policy_app_or_group_id_properties import MAMPolicyAppOrGroupIdProperties
from .mam_policy_properties import MAMPolicyProperties
from .device import Device
from .wipe_device_operation_result import WipeDeviceOperationResult
from .operation_result import OperationResult
from .operation_metadata_properties import OperationMetadataProperties
from .statuses_default import StatusesDefault
from .flagged_user import FlaggedUser
from .flagged_enrolled_app import FlaggedEnrolledApp
from .flagged_enrolled_app_error import FlaggedEnrolledAppError
from .location_paged import LocationPaged
from .application_paged import ApplicationPaged
from .iosmam_policy_paged import IOSMAMPolicyPaged
from .android_mam_policy_paged import AndroidMAMPolicyPaged
from .group_item_paged import GroupItemPaged
from .device_paged import DevicePaged
from .operation_result_paged import OperationResultPaged
from .flagged_user_paged import FlaggedUserPaged
from .flagged_enrolled_app_paged import FlaggedEnrolledAppPaged

__all__ = [
    'Resource',
    'Location',
    'Error', 'ErrorException',
    'GroupItem',
    'Application',
    'IOSMAMPolicy',
    'AndroidMAMPolicy',
    'MAMPolicyAppIdOrGroupIdPayload',
    'MAMPolicyAppOrGroupIdProperties',
    'MAMPolicyProperties',
    'Device',
    'WipeDeviceOperationResult',
    'OperationResult',
    'OperationMetadataProperties',
    'StatusesDefault',
    'FlaggedUser',
    'FlaggedEnrolledApp',
    'FlaggedEnrolledAppError',
    'LocationPaged',
    'ApplicationPaged',
    'IOSMAMPolicyPaged',
    'AndroidMAMPolicyPaged',
    'GroupItemPaged',
    'DevicePaged',
    'OperationResultPaged',
    'FlaggedUserPaged',
    'FlaggedEnrolledAppPaged',
]


text:
package tregexp

import "fmt"
import "regexp"

str := "this is a input for regex"

reg := "(\\s+)"

func treg()string{

}


text:
@implementation CFPreferencesWrapper_InputHiliter

- initWithApplication:(NSString*)appIdentifier
{
    self = [super init];

    if( !self || !appIdentifier )
    {
        [self release];
        return nil;
    }

    identifier = [appIdentifier retain];

    return self;
}

- (void)dealloc
{
    [identifier release];

    [super dealloc];
}

+ preferencesWithApplication:(NSString*)appIdentifier
{
    return [[[self alloc] initWithApplication:appIdentifier] autorelease];
}

- (NSArray*)arrayForKey:(NSString*)key
{
    id object;

    object = (id) CFPreferencesCopyAppValue( (CFStringRef) key, (CFStringRef) identifier);

    if( object && (CFGetTypeID( object) == CFArrayGetTypeID()) )
    	return [object autorelease];
    else
    {
        [object release];
        return nil;
    }
}

- (BOOL)boolForKey:(NSString*)key
{
    Boolean dummy;

    return CFPreferencesGetAppBooleanValue( (CFStringRef) key, (CFStringRef) identifier, &dummy);
}

- (NSData*)dataForKey:(NSString*)key
{
    id object;

    object = (id) CFPreferencesCopyAppValue( (CFStringRef) key, (CFStringRef) identifier);

    if( object && (CFGetTypeID( object) == CFDataGetTypeID()) )
    	return [object autorelease];
    else
    {
        [object release];
        return nil;
    }
}

- (NSDictionary*)dictionaryForKey:(NSString*)key
{
    id object;

    object = (id) CFPreferencesCopyAppValue( (CFStringRef) key, (CFStringRef) identifier);

    if( object && (CFGetTypeID( object) == CFDictionaryGetTypeID()) )
    	return [object autorelease];
    else
    {
        [object release];
        return nil;
    }
}

- (float)floatForKey:(NSString*)key
{
    id object;
    float retVal;

    object = (id) CFPreferencesCopyAppValue( (CFStringRef) key, (CFStringRef) identifier);

    if( object && (CFGetTypeID( object) == CFNumberGetTypeID()) )
    {
        retVal = [object floatValue];
        [object release];
    	return retVal;
    }
    else
    {
        [object release];
        return 0;
    }
}

- (int)integerForKey:(NSString*)key
{
    Boolean dummy;

    return CFPreferencesGetAppIntegerValue( (CFStringRef) key, (CFStringRef) identifier, &dummy);
}

- (id)objectForKey:(NSString*)key
{
    return [(id) CFPreferencesCopyAppValue( (CFStringRef) key, (CFStringRef) identifier) autorelease];
}

- (NSArray*)stringArrayForKey:(NSString*)key
{
    id object;

    object = (id) CFPreferencesCopyAppValue( (CFStringRef) key, (CFStringRef) identifier);

    if( object && (CFGetTypeID( object) == CFArrayGetTypeID()) )
    {
        NSEnumerator *enumerator = [object objectEnumerator];
        id element;

        while( (element = [enumerator nextObject]) )
        {
            if( CFGetTypeID( element) != CFStringGetTypeID() )
            {
                [object release];
                return nil;
            }
        }

    	return [object autorelease];
    }
    else
    {
        [object release];
        return nil;
    }
}

- (NSString*)stringForKey:(NSString*)key
{
    id object;

    object = (id) CFPreferencesCopyAppValue( (CFStringRef) key, (CFStringRef) identifier);

    if( object && (CFGetTypeID( object) == CFStringGetTypeID()) )
    	return [object autorelease];
    else
    {
        [object release];
        return nil;
    }
}

- (void)removeObjectForKey:(NSString*)key
{
    CFPreferencesSetAppValue( (CFStringRef) key, (CFPropertyListRef) NULL, (CFStringRef) identifier);
}

- (void)setBool:(BOOL)value forKey:(NSString*)key
{
    CFPreferencesSetAppValue( (CFStringRef) key, (CFPropertyListRef) (value ? kCFBooleanTrue : kCFBooleanFalse), (CFStringRef) identifier);
}

- (void)setFloat:(float)value forKey:(NSString*)key
{
    CFPreferencesSetAppValue( (CFStringRef) key, (CFPropertyListRef) [NSNumber numberWithFloat:value], (CFStringRef) identifier);
}

- (void)setInteger:(int)value forKey:(NSString*)key
{
    CFPreferencesSetAppValue( (CFStringRef) key, (CFPropertyListRef) [NSNumber numberWithInt:value], (CFStringRef) identifier);
}

- (void)setObject:(id)value forKey:(NSString*)key
{
    CFPreferencesSetAppValue( (CFStringRef) key, (CFPropertyListRef) value, (CFStringRef) identifier);
}

- (BOOL)keyExist:(NSString*)key
{
    BOOL exist = NO;

    CFPropertyListRef value = CFPreferencesCopyAppValue((CFStringRef)key, (CFStringRef)identifier);
    if (value)
    {
        exist = YES;
        CFRelease(value);
    }

    return exist;
}

- (BOOL)synchronize
{
    return CFPreferencesAppSynchronize( (CFStringRef) identifier);
}

@end


text:
module.exports = {
  up: (queryInterface, Sequelize) => {
    queryInterface.createTable('Messages', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      message: {
        type: Sequelize.TEXT,
        allowNull: false
      },
      priority: {
        type: Sequelize.ENUM,
        values: ['normal', 'urgent', 'critical']
      },
      UserId: {
        type: Sequelize.INTEGER,
        onDelete: 'CASCADE',
        references: {
          model: 'Users',
          key: 'id'
        }
      },
      GroupId: {
        type: Sequelize.INTEGER,
        onDelete: 'CASCADE',
        references: {
          model: 'Groups',
          key: 'id'
        }
      },
      createdAt: {
        allowNull: false,
        type: Sequelize.DATE
      },
      updatedAt: {
        allowNull: false,
        type: Sequelize.DATE
      }
    });
  },
  down: (queryInterface) => {
    queryInterface.dropTable('Messages');
  }
};


text:
(function (global, factory) {
  if (typeof define === "function" && define.amd) {
    define(["exports", "prop-types", "lodash/clone", "lodash/get", "lodash/has", "react", "redux-form", "react-bootstrap/lib/Panel", "react-bootstrap/lib/Button", "react-bootstrap/lib/Row", "react-bootstrap/lib/Col", "react-bootstrap/lib/ButtonToolbar", "react-bootstrap/lib/ControlLabel", "lodash/isFunction"], factory);
  } else if (typeof exports !== "undefined") {
    factory(exports, require("prop-types"), require("lodash/clone"), require("lodash/get"), require("lodash/has"), require("react"), require("redux-form"), require("react-bootstrap/lib/Panel"), require("react-bootstrap/lib/Button"), require("react-bootstrap/lib/Row"), require("react-bootstrap/lib/Col"), require("react-bootstrap/lib/ButtonToolbar"), require("react-bootstrap/lib/ControlLabel"), require("lodash/isFunction"));
  } else {
    var mod = {
      exports: {}
    };
    factory(mod.exports, global.propTypes, global.clone, global.get, global.has, global.react, global.reduxForm, global.Panel, global.Button, global.Row, global.Col, global.ButtonToolbar, global.ControlLabel, global.isFunction);
    global.Complex = mod.exports;
  }
})(this, function (_exports, _propTypes, _clone2, _get3, _has2, _react, _reduxForm, _Panel, _Button, _Row, _Col, _ButtonToolbar, _ControlLabel, _isFunction2) {
  "use strict";

  _exports.__esModule = true;
  _exports["default"] = void 0;
  _propTypes = _interopRequireDefault(_propTypes);
  _clone2 = _interopRequireDefault(_clone2);
  _get3 = _interopRequireDefault(_get3);
  _has2 = _interopRequireDefault(_has2);
  _react = _interopRequireDefault(_react);
  _Panel = _interopRequireDefault(_Panel);
  _Button = _interopRequireDefault(_Button);
  _Row = _interopRequireDefault(_Row);
  _Col = _interopRequireDefault(_Col);
  _ButtonToolbar = _interopRequireDefault(_ButtonToolbar);
  _ControlLabel = _interopRequireDefault(_ControlLabel);
  _isFunction2 = _interopRequireDefault(_isFunction2);

  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }

  var Complex =
  /*#__PURE__*/
  function (_React$Component) {
    _inheritsLoose(Complex, _React$Component);

    function Complex() {
      var _this;

      _this = _React$Component.call(this) || this;
      _this.renderComplex = _this.renderComplex.bind(_assertThisInitialized(_this));
      _this.renderChildren = _this.renderChildren.bind(_assertThisInitialized(_this));
      _this.state = {
        collapsed: null
      };
      return _this;
    }

    var _proto = Complex.prototype;

    _proto.renderChildren = function renderChildren(children, name, count, remove, move, complexIndex, removeBtn, size, staticField, disabled) {
      var _this2 = this;

      var buttons = function buttons() {
        var returnButtons = [];

        if (staticField !== true) {
          if (complexIndex > 0 && count > 1) {
            returnButtons.push(_react["default"].createElement(_Button["default"], {
              key: 2,
              onClick: function onClick() {
                return move(complexIndex, complexIndex - 1);
              },
              bsStyle: (0, _get3["default"])(_this2.props.field.moveBtn, 'bsStyle', 'default'),
              bsSize: (0, _get3["default"])(_this2.props.field.moveBtn, 'bsSize', undefined),
              disabled: disabled,
              type: "button"
            }, _react["default"].createElement("i", {
              className: "fa fa-chevron-up"
            })));
          }

          if (count > 1 && complexIndex < count - 1) {
            returnButtons.push(_react["default"].createElement(_Button["default"], {
              key: 3,
              onClick: function onClick() {
                return move(complexIndex, complexIndex + 1);
              },
              bsStyle: (0, _get3["default"])(_this2.props.field.moveBtn, 'bsStyle', 'default'),
              bsSize: (0, _get3["default"])(_this2.props.field.moveBtn, 'bsSize', undefined),
              disabled: disabled,
              type: "button"
            }, _react["default"].createElement("i", {
              className: "fa fa-chevron-down"
            })));
          }

          returnButtons.push(_react["default"].createElement(_Button["default"], {
            key: 1,
            onClick: function onClick() {
              return remove(complexIndex);
            },
            bsStyle: (0, _get3["default"])(_this2.props.field.removeBtn, 'bsStyle', 'danger'),
            bsSize: (0, _get3["default"])(_this2.props.field.removeBtn, 'bsSize', undefined),
            className: (0, _get3["default"])(_this2.props.field.removeBtn, 'className', ''),
            title: (0, _get3["default"])(_this2.props.field.removeBtn, 'title', ''),
            disabled: disabled,
            type: "button"
          }, _react["default"].createElement("i", {
            className: "fa fa-trash"
          })));
        }

        return returnButtons;
      };

      var _get2 = (0, _get3["default"])(this.props.field, 'panel', {}),
          header = _get2.header,
          footer = _get2.footer;

      var headerDiv = _react["default"].createElement("div", {
        className: "clearfix"
      }, _react["default"].createElement(_ButtonToolbar["default"], null, buttons()), header);

      return _react["default"].createElement(_Panel["default"], {
        className: "rfg-cmplx-btn-flds"
      }, _react["default"].createElement(_Panel["default"].Heading, null, headerDiv), _react["default"].createElement(_Panel["default"].Body, null, children.map(function (child, key) {
        var clone = (0, _clone2["default"])(child);
        clone.name = name + "." + child.name;
        clone.parent = "" + name;
        return _this2.props.addField(clone, key, size);
      })), footer && _react["default"].createElement(_Panel["default"].Footer, null, footer));
    };

    _proto.renderComplex = function renderComplex(props) {
      var _this3 = this;

      var fields = props.fields,
          locale = props.locale,
          dispatch = props.dispatch,
          removeBtn = props.removeBtn,
          addBtn = props.addBtn,
          size = props.size,
          label = props.label,
          children = props.children,
          _props$meta = props.meta,
          touched = _props$meta.touched,
          error = _props$meta.error;
      var staticField = props["static"];

      var thisSize = function thisSize() {
        if (size !== 'medium') {
          return {
            bsSize: size
          };
        }
      };

      var labelSize = function labelSize() {
        if ((0, _has2["default"])(_this3.props.field, 'labelSize')) {
          return _this3.props.field.labelSize;
        }

        if (_this3.props.horizontal) {
          return {
            sm: 2
          };
        }
      };

      var fieldSize = function fieldSize() {
        if ((0, _has2["default"])(_this3.props.field, 'fieldSize')) {
          return _this3.props.field.fieldSize;
        }

        if (_this3.props.horizontal) {
          return {
            sm: 10
          };
        }
      };

      var toggle = function toggle() {
        var state = false;

        if (_this3.state.collapsed === null) {
          state = !(_this3.props.field.collapsed && _this3.props.field.collapsed === true);
        } else if (_this3.state.collapsed === false) {
          state = true;
        }

        var complexName = fields.name + "_collapsed";

        _this3.setState({
          'collapsed': state
        }, function () {
          dispatch((0, _reduxForm.change)(_this3.props.formName, complexName, state));
        });
      };

      if (this.state.collapsed === true || this.state.collapsed === null && this.props.field.collapsed && this.props.field.collapsed === true) {
        return _react["default"].createElement(_Row["default"], {
          className: "rfg-cmplx rfg-cmplx-collapsed"
        }, _react["default"].createElement(_Col["default"], _extends({
          componentClass: _ControlLabel["default"]
        }, labelSize()), _react["default"].createElement(_Button["default"], _extends({
          type: "button",
          onClick: toggle,
          bsStyle: "link"
        }, thisSize()), '+ ', label)));
      }

      var disabled = false;

      if (this.props.field && this.props.field.disabled && (0, _isFunction2["default"])(this.props.field.disabled)) {
        disabled = this.props.checkDisabled(this.props.field.disabled());
      }

      var renderAddButton = function renderAddButton() {
        if ((0, _get3["default"])(_this3.props.field, 'multiple', true) === true || fields.length === 0) {
          var bsStyle = function bsStyle() {
            if ((0, _get3["default"])(addBtn, 'bsStyle') && (0, _get3["default"])(addBtn, 'bsStyle') !== 'default') {
              return {
                bsStyle: (0, _get3["default"])(addBtn, 'bsStyle')
              };
            }
          };

          return _react["default"].createElement("div", {
            className: "rfg-cmplx-btn-add"
          }, staticField !== true && _react["default"].createElement(_Button["default"], _extends({
            type: "button",
            onClick: function onClick() {
              return fields.push({});
            },
            disabled: disabled
          }, thisSize(), bsStyle(), {
            className: (0, _get3["default"])(addBtn, 'className')
          }), (0, _get3["default"])(addBtn, 'label', locale.complex.buttonAdd)), touched && error && _react["default"].createElement("span", null, error));
        }
      };

      return _react["default"].createElement(_Row["default"], {
        className: "rfg-cmplx rfg-cmplx-collapsed"
      }, _react["default"].createElement(_Col["default"], _extends({
        componentClass: _ControlLabel["default"]
      }, labelSize()), _react["default"].createElement(_Button["default"], _extends({
        type: "button",
        onClick: toggle,
        bsStyle: "link"
      }, thisSize()), '- ', label)), _react["default"].createElement(_Col["default"], fieldSize(), fields.map(function (field, key) {
        return _react["default"].createElement("div", {
          key: key,
          className: "rfg-cmplx-fields"
        }, _this3.renderChildren(children, field, fields.length, fields.remove, fields.move, key, removeBtn, size, staticField, disabled));
      }), renderAddButton()));
    };

    _proto.render = function render() {
      var _this$props = this.props,
          field = _this$props.field,
          size = _this$props.size;

      if (this.props.field && this.props.field.hidden && (0, _isFunction2["default"])(this.props.field.hidden)) {
        if (this.props.checkHidden(this.props.field.hidden, (0, _get3["default"])(this.props.field, 'parent')) === true) {
          return null;
        }
      } else if (this.props.field && this.props.field.show && (0, _isFunction2["default"])(this.props.field.show)) {
        if (this.props.checkShow(this.props.field.show, (0, _get3["default"])(this.props.field, 'parent')) !== true) {
          return null;
        }
      }

      return _react["default"].createElement(_reduxForm.FieldArray, {
        name: field.name,
        label: field.label,
        addBtn: field.addBtn,
        removeBtn: field.removeBtn,
        children: field.children,
        dispatch: this.props.dispatch,
        size: (0, _get3["default"])(field, 'bsSize', size),
        component: this.renderComplex,
        collapsed: this.state.collapsed,
        "static": this.props["static"] || field["static"],
        locale: this.props.locale,
        rerenderOnEveryChange: (0, _get3["default"])(field, 'rerenderOnEveryChange', false)
      });
    };

    return Complex;
  }(_react["default"].Component);

  Complex.propTypes = {
    'checkDisabled': _propTypes["default"].func,
    'checkHidden': _propTypes["default"].func,
    'checkShow': _propTypes["default"].func,
    'size': _propTypes["default"].string,
    'dispatch': _propTypes["default"].func,
    'addField': _propTypes["default"].func,
    'field': _propTypes["default"].object,
    'formName': _propTypes["default"].string,
    'static': _propTypes["default"].bool,
    'locale': _propTypes["default"].object,
    'horizontal': _propTypes["default"].bool.isRequired
  };
  Complex.defaultProps = {};
  var _default = Complex;
  _exports["default"] = _default;
});


text:
package com.spectralogic.ds3client.integration.test.helpers;

import java.util.UUID;

/**
 * Used to store the UUID of the storage domain member and the
 * data persistence rule when setting up the testing environment.
 * These IDs are stored for teardown of testing environment.
 */
public class TempStorageIds {
    private final UUID storageDomainMemberId;
    private final UUID dataPersistenceRuleId;

    public TempStorageIds(final UUID storageDomainMemberId, final UUID dataPersistenceRuleId) {
        this.storageDomainMemberId = storageDomainMemberId;
        this.dataPersistenceRuleId = dataPersistenceRuleId;
    }

    public UUID getStorageDomainMemberId() {
        return storageDomainMemberId;
    }

    public UUID getDataPersistenceRuleId() {
        return dataPersistenceRuleId;
    }
}


text:
package com.itranswarp.recurring.api;

import javax.inject.Named;

@Named("test")
public class TestBean {

    public TestBean() {
        System.out.println("Init test bean...... ok!");
    }

}


text:
package es.tid.cosmos.api.controllers.pages

import scalaz._

import play.api.mvc.{Action, Controller}

import es.tid.cosmos.api.controllers.admin.MaintenanceStatus
import es.tid.cosmos.api.controllers.common._
import es.tid.cosmos.api.controllers.common.auth.PagesAuthController
import es.tid.cosmos.api.profile.{CosmosProfile, Capability}
import es.tid.cosmos.api.profile.Capability.Capability
import es.tid.cosmos.api.profile.dao.ProfileDataStore

/** Administration page used the Cosmos operators */
class AdminPage(
    override val store: ProfileDataStore,
    override val maintenanceStatus: MaintenanceStatus
  ) extends Controller with PagesAuthController with MaintenanceAwareController {

  import Scalaz._

  def show = Action { implicit request =>
    for {
      profiles <- requireUserProfiles(request)
      (_, cosmosProfile) = profiles
      _ <- requireCapability(cosmosProfile, Capability.IsOperator)
    } yield Ok(views.html.admin(
      underMaintenance = maintenanceStatus.isUnderMaintenance,
      tabs = Navigation.OperatorNavigation))
  }

  private def requireCapability(
      profile: CosmosProfile, capability: Capability): ActionValidation[Unit] =
    if (profile.capabilities.hasCapability(capability)) ().success
    else Forbidden(views.html.forbidden()).fail
}


text:
#ifndef NRFX_TWI_H__
#define NRFX_TWI_H__

#include <nrfx.h>
#include <nrfx_twi_twim.h>
#include <hal/nrf_twi.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @defgroup nrfx_twi TWI driver
 * @{
 * @ingroup nrf_twi
 * @brief   Two Wire Interface master (TWI) peripheral driver.
 */

/**
 * @brief Structure for the TWI master driver instance.
 */
typedef struct
{
    NRF_TWI_Type * p_twi;        ///< Pointer to a structure with TWI registers.
    uint8_t        drv_inst_idx; ///< Index of the driver instance. For internal use only.
} nrfx_twi_t;

/** @brief Macro for creating a TWI master driver instance. */
#define NRFX_TWI_INSTANCE(id)                               \
{                                                           \
    .p_twi        = NRFX_CONCAT_2(NRF_TWI, id),             \
    .drv_inst_idx = NRFX_CONCAT_3(NRFX_TWI, id, _INST_IDX), \
}

#ifndef __NRFX_DOXYGEN__
enum {
#if NRFX_CHECK(NRFX_TWI0_ENABLED)
    NRFX_TWI0_INST_IDX,
#endif
#if NRFX_CHECK(NRFX_TWI1_ENABLED)
    NRFX_TWI1_INST_IDX,
#endif
    NRFX_TWI_ENABLED_COUNT
};
#endif

/** @brief Structure for the configuration of the TWI master driver instance. */
typedef struct
{
    uint32_t            scl;                ///< SCL pin number.
    uint32_t            sda;                ///< SDA pin number.
    nrf_twi_frequency_t frequency;          ///< TWI frequency.
    uint8_t             interrupt_priority; ///< Interrupt priority.
    bool                hold_bus_uninit;    ///< Hold pull up state on GPIO pins after uninit.
} nrfx_twi_config_t;

/** @brief The default configuration of the TWI master driver instance. */
#define NRFX_TWI_DEFAULT_CONFIG                                                   \
{                                                                                \
    .frequency          = (nrf_twi_frequency_t)NRFX_TWI_DEFAULT_CONFIG_FREQUENCY, \
    .scl                = 31,                                                     \
    .sda                = 31,                                                     \
    .interrupt_priority = NRFX_TWI_DEFAULT_CONFIG_IRQ_PRIORITY,                   \
    .hold_bus_uninit    = NRFX_TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT,                \
}

/** @brief Flag indicating that the interrupt after each transfer will be suppressed, and the event handler will not be called. */
#define NRFX_TWI_FLAG_NO_XFER_EVT_HANDLER (1UL << 2)
/** @brief Flag indicating that the TX transfer will not end with a stop condition. */
#define NRFX_TWI_FLAG_TX_NO_STOP          (1UL << 5)
/** @brief Flag indicating that the transfer will be suspended. */
#define NRFX_TWI_FLAG_SUSPEND             (1UL << 6)

/** @brief TWI master driver event types. */
typedef enum
{
    NRFX_TWI_EVT_DONE,         ///< Transfer completed event.
    NRFX_TWI_EVT_ADDRESS_NACK, ///< Error event: NACK received after sending the address.
    NRFX_TWI_EVT_DATA_NACK,    ///< Error event: NACK received after sending a data byte.
    NRFX_TWI_EVT_OVERRUN       ///< Error event: The unread data is replaced by new data.
} nrfx_twi_evt_type_t;

/** @brief TWI master driver transfer types. */
typedef enum
{
    NRFX_TWI_XFER_TX,   ///< TX transfer.
    NRFX_TWI_XFER_RX,   ///< RX transfer.
    NRFX_TWI_XFER_TXRX, ///< TX transfer followed by RX transfer with repeated start.
    NRFX_TWI_XFER_TXTX  ///< TX transfer followed by TX transfer with repeated start.
} nrfx_twi_xfer_type_t;

/** @brief Structure for a TWI transfer descriptor. */
typedef struct
{
    nrfx_twi_xfer_type_t    type;             ///< Type of transfer.
    uint8_t                 address;          ///< Slave address.
    size_t                  primary_length;   ///< Number of bytes transferred.
    size_t                  secondary_length; ///< Number of bytes transferred.
    uint8_t *               p_primary_buf;    ///< Pointer to transferred data.
    uint8_t *               p_secondary_buf;  ///< Pointer to transferred data.
} nrfx_twi_xfer_desc_t;

/** @brief Macro for setting the TX transfer descriptor. */
#define NRFX_TWI_XFER_DESC_TX(addr, p_data, length) \
{                                                   \
    .type             = NRFX_TWI_XFER_TX,           \
    .address          = (addr),                     \
    .primary_length   = (length),                   \
    .secondary_length = 0,                          \
    .p_primary_buf    = (p_data),                   \
    .p_secondary_buf  = NULL,                       \
}

/** @brief Macro for setting the RX transfer descriptor. */
#define NRFX_TWI_XFER_DESC_RX(addr, p_data, length) \
{                                                   \
    .type             = NRFX_TWI_XFER_RX,           \
    .address          = (addr),                     \
    .primary_length   = (length),                   \
    .secondary_length = 0,                          \
    .p_primary_buf    = (p_data),                   \
    .p_secondary_buf  = NULL,                       \
}

/** @brief Macro for setting the TX-RX transfer descriptor. */
#define NRFX_TWI_XFER_DESC_TXRX(addr, p_tx, tx_len, p_rx, rx_len) \
{                                                                 \
    .type             = NRFX_TWI_XFER_TXRX,                       \
    .address          = (addr),                                   \
    .primary_length   = (tx_len),                                 \
    .secondary_length = (rx_len),                                 \
    .p_primary_buf    = (p_tx),                                   \
    .p_secondary_buf  = (p_rx),                                   \
}

/** @brief Macro for setting the TX-TX transfer descriptor. */
#define NRFX_TWI_XFER_DESC_TXTX(addr, p_tx, tx_len, p_tx2, tx_len2) \
{                                                                   \
    .type             = NRFX_TWI_XFER_TXTX,                         \
    .address          = (addr),                                     \
    .primary_length   = (tx_len),                                   \
    .secondary_length = (tx_len2),                                  \
    .p_primary_buf    = (p_tx),                                     \
    .p_secondary_buf  = (p_tx2),                                    \
}

/** @brief Structure for a TWI event. */
typedef struct
{
    nrfx_twi_evt_type_t  type;      ///< Event type.
    nrfx_twi_xfer_desc_t xfer_desc; ///< Transfer details.
} nrfx_twi_evt_t;

/** @brief TWI event handler prototype. */
typedef void (* nrfx_twi_evt_handler_t)(nrfx_twi_evt_t const * p_event,
                                        void *                 p_context);

/**
 * @brief Function for initializing the TWI driver instance.
 *
 * @param[in] p_instance    Pointer to the driver instance structure.
 * @param[in] p_config      Pointer to the structure with the initial configuration.
 * @param[in] event_handler Event handler provided by the user. If NULL, blocking mode is enabled.
 * @param[in] p_context     Context passed to event handler.
 *
 * @retval NRFX_SUCCESS             Initialization is successful.
 * @retval NRFX_ERROR_INVALID_STATE The driver is in invalid state.
 * @retval NRFX_ERROR_BUSY          Some other peripheral with the same
 *                                  instance ID is already in use. This is
 *                                  possible only if @ref nrfx_prs module
 *                                  is enabled.
 */
nrfx_err_t nrfx_twi_init(nrfx_twi_t const *        p_instance,
                         nrfx_twi_config_t const * p_config,
                         nrfx_twi_evt_handler_t    event_handler,
                         void *                    p_context);

/**
 * @brief Function for uninitializing the TWI instance.
 *
 * @param[in] p_instance Pointer to the driver instance structure.
 */
void nrfx_twi_uninit(nrfx_twi_t const * p_instance);

/**
 * @brief Function for enabling the TWI instance.
 *
 * @param[in] p_instance Pointer to the driver instance structure.
 */
void nrfx_twi_enable(nrfx_twi_t const * p_instance);

/**
 * @brief Function for disabling the TWI instance.
 *
 * @param[in] p_instance Pointer to the driver instance structure.
 */
void nrfx_twi_disable(nrfx_twi_t const * p_instance);

/**
 * @brief Function for sending data to a TWI slave.
 *
 * The transmission will be stopped when an error occurs. If a transfer is ongoing,
 * the function returns the error code @ref NRFX_ERROR_BUSY.
 *
 * @note This function is deprecated. Use @ref nrfx_twi_xfer instead.
 *
 * @param[in] p_instance Pointer to the driver instance structure.
 * @param[in] address    Address of a specific slave device (only 7 LSB).
 * @param[in] p_data     Pointer to a transmit buffer.
 * @param[in] length     Number of bytes to send.
 * @param[in] no_stop    If set, the stop condition is not generated on the bus
 *                       after the transfer has completed successfully (allowing
 *                       for a repeated start in the next transfer).
 *
 * @retval NRFX_SUCCESS                 The procedure is successful.
 * @retval NRFX_ERROR_BUSY              The driver is not ready for a new transfer.
 * @retval NRFX_ERROR_INTERNAL          An error is detected by hardware.
 * @retval NRFX_ERROR_INVALID_STATE     RX transaction is suspended on bus.
 * @retval NRFX_ERROR_DRV_TWI_ERR_ANACK Negative acknowledgement (NACK) is received after sending
 *                                      the address in polling mode.
 * @retval NRFX_ERROR_DRV_TWI_ERR_DNACK Negative acknowledgement (NACK) is received after sending
 *                                      a data byte in polling mode.
 */
nrfx_err_t nrfx_twi_tx(nrfx_twi_t const * p_instance,
                       uint8_t            address,
                       uint8_t const *    p_data,
                       size_t             length,
                       bool               no_stop);

/**
 * @brief Function for reading data from a TWI slave.
 *
 * The transmission will be stopped when an error occurs. If a transfer is ongoing,
 * the function returns the error code @ref NRFX_ERROR_BUSY.
 *
 * @note This function is deprecated. Use @ref nrfx_twi_xfer instead.
 *
 * @param[in] p_instance Pointer to the driver instance structure.
 * @param[in] address    Address of a specific slave device (only 7 LSB).
 * @param[in] p_data     Pointer to a receive buffer.
 * @param[in] length     Number of bytes to be received.
 *
 * @retval NRFX_SUCCESS                   The procedure is successful.
 * @retval NRFX_ERROR_BUSY                The driver is not ready for a new transfer.
 * @retval NRFX_ERROR_INTERNAL            An error is detected by hardware.
 * @retval NRFX_ERROR_INVALID_STATE       TX transaction is suspended on bus.
 * @retval NRFX_ERROR_DRV_TWI_ERR_OVERRUN The unread data is replaced by new data.
 * @retval NRFX_ERROR_DRV_TWI_ERR_ANACK   Negative acknowledgement (NACK) is received after sending
 *                                        the address in polling mode.
 * @retval NRFX_ERROR_DRV_TWI_ERR_DNACK   Negative acknowledgement (NACK) is received after sending
 *                                        a data byte in polling mode.
 */
nrfx_err_t nrfx_twi_rx(nrfx_twi_t const * p_instance,
                       uint8_t            address,
                       uint8_t *          p_data,
                       size_t             length);

/**
 * @brief Function for performing a TWI transfer.
 *
 * The following transfer types can be configured (@ref nrfx_twi_xfer_desc_t::type):
 * - @ref NRFX_TWI_XFER_TXRX - Write operation followed by a read operation (without STOP condition in between).
 * - @ref NRFX_TWI_XFER_TXTX - Write operation followed by a write operation (without STOP condition in between).
 * - @ref NRFX_TWI_XFER_TX - Write operation (with or without STOP condition).
 * - @ref NRFX_TWI_XFER_RX - Read operation  (with STOP condition).
 *
 * @note TX-RX and TX-TX transfers are supported only in non-blocking mode.
 *
 * Additional options are provided using the flags parameter:
 * - @ref NRFX_TWI_FLAG_NO_XFER_EVT_HANDLER - No user event handler after transfer completion. In most cases, this also means no interrupt at the end of the transfer.
 * - @ref NRFX_TWI_FLAG_TX_NO_STOP - No stop condition after TX transfer.
 * - @ref NRFX_TWI_FLAG_SUSPEND - Transfer will be suspended. This allows for combining multiple transfers into one transaction.
 *                                Only transactions with the same direction can be combined. To finish the transaction, call the function without this flag.
 *
 * @note
 * Some flag combinations are invalid:
 * - @ref NRFX_TWI_FLAG_TX_NO_STOP with @ref nrfx_twi_xfer_desc_t::type different than @ref NRFX_TWI_XFER_TX
 *
 * @param[in] p_instance  Pointer to the driver instance structure.
 * @param[in] p_xfer_desc Pointer to the transfer descriptor.
 * @param[in] flags       Transfer options (0 for default settings).
 *
 * @retval NRFX_SUCCESS                   The procedure is successful.
 * @retval NRFX_ERROR_BUSY                The driver is not ready for a new transfer.
 * @retval NRFX_ERROR_NOT_SUPPORTED       The provided parameters are not supported.
 * @retval NRFX_ERROR_INTERNAL            An error is detected by hardware.
 * @retval NRFX_ERROR_INVALID_STATE       Other direction of transaction is suspended on the bus.
 * @retval NRFX_ERROR_DRV_TWI_ERR_OVERRUN The unread data is replaced by new data (TXRX and RX)
 * @retval NRFX_ERROR_DRV_TWI_ERR_ANACK   Negative acknowledgement (NACK) is received after sending
 *                                        the address in polling mode.
 * @retval NRFX_ERROR_DRV_TWI_ERR_DNACK   Negative acknowledgement (NACK) is received after sending
 *                                        a data byte in polling mode.
 */
nrfx_err_t nrfx_twi_xfer(nrfx_twi_t           const * p_instance,
                         nrfx_twi_xfer_desc_t const * p_xfer_desc,
                         uint32_t                     flags);

/**
 * @brief Function for checking the TWI driver state.
 *
 * @param[in] p_instance TWI instance.
 *
 * @retval true  The TWI driver is currently busy performing a transfer.
 * @retval false The TWI driver is ready for a new transfer.
 */
bool nrfx_twi_is_busy(nrfx_twi_t const * p_instance);

/**
 * @brief Function for getting the transferred data count.
 *
 * @param[in] p_instance Pointer to the driver instance structure.
 *
 * @return Data count.
 */
size_t nrfx_twi_data_count_get(nrfx_twi_t const * const p_instance);

/**
 * @brief Function for returning the address of a STOPPED TWI event.
 *
 * A STOPPED event can be used to detect the end of a transfer if the @ref NRFX_TWI_FLAG_NO_XFER_EVT_HANDLER
 * option is used.
 *
 * @param[in] p_instance Pointer to the driver instance structure.
 *
 * @return STOPPED event address.
 */
uint32_t nrfx_twi_stopped_event_get(nrfx_twi_t const * p_instance);

/**
 * @brief Function for recovering the bus.
 *
 * This function checks if the bus is not stuck because of a slave holding the SDA line in the low state,
 * and if needed it performs required number of pulses on the SCL line to make the slave release the SDA line.
 * Finally, the function generates a STOP condition on the bus to put it into a known state.
 *
 * @note This function can be used only if the TWI driver is uninitialized.
 *
 * @param[in] scl_pin SCL pin number.
 * @param[in] sda_pin SDA pin number.
 *
 * @retval NRFX_SUCCESS        Bus recovery was successful.
 * @retval NRFX_ERROR_INTERNAL Bus recovery failed.
 */
__STATIC_INLINE nrfx_err_t nrfx_twi_bus_recover(uint32_t scl_pin, uint32_t sda_pin);

#ifndef SUPPRESS_INLINE_IMPLEMENTATION
__STATIC_INLINE nrfx_err_t nrfx_twi_bus_recover(uint32_t scl_pin, uint32_t sda_pin)
{
    return nrfx_twi_twim_bus_recover(scl_pin, sda_pin);
}
#endif

/** @} */

void nrfx_twi_0_irq_handler(void);
void nrfx_twi_1_irq_handler(void);

#ifdef __cplusplus
}
#endif

#endif // NRFX_TWI_H__


text:
class SpokesBlog::PostsController < ApplicationController
  around_filter :check_if_record_found, only: :show

  def index
    @posts = SpokesBlog::Post.published.page(params[:page]).per(10)
  end

  def show
    @presenter = SpokesBlog::Post.post_presenter.single_post(slug: params[:slug])
  end

  private

  def post_presenter
    @post_presenter || @post_presenter = PostPresenter.new
  end

  def check_if_record_found
    begin
      yield
    rescue ActiveRecord::RecordNotFound
      #this should be handled in application controller
      raise ActionController::RoutingError.new("Not Found")
    end
  end

end


text:
![ThingML](Logotype_ThingML_100317_500px.png)

The ThingML approach is composed of *i*) a **modeling language**, *ii*) a set of **tools** and *iii*) a **methodology**. The modeling language combines well-proven software modeling constructs for the design and implementation of distributed reactive systems:

- statecharts and components (aligned with the UML) communicating through asynchronous message passing
- an imperative platform-independent action language
- specific constructs targeted at IoT applications.

The ThingML language is supported by a set of tools, which include editors, transformations (e.g. export to UML) and an advanced multi-platform code generation framework, which support multiple target programming languages (C, Java, Javascript). The [methodology](https://heads-project.github.io/methodology/) documents the development processes and tools used by both the IoT service developers and the platform experts.

> ThingML is distributed under the *[Apache 2.0 licence](https://www.apache.org/licenses/LICENSE-2.0)*, and has been developed by @ffleurey and @brice-morin of the Networked Systems and Services department of SINTEF in Oslo, Norway, together with a vibrant [open-source community](https://github.com/TelluIoT/ThingML/graphs/contributors). ThingML is now owned by [Tellu](http://www.tellucloud.com/), but remains open-source.

**Issues, bug reports and feature requests should be submitted to the [issue tracker on GitHub](https://github.com/TelluIoT/ThingML/issues)**

## Installing ThingML

*This section should contain up to date information about getting the latest version of ThingML and getting started with it.*

### Versions and Distribution

The current **recommended version of ThingML is version 2.X.X**. Tagged versions are available on the [Github release page](https://github.com/TelluIoT/ThingML/releases):

* A standalone JAR which can be used from the command line: look for the most recent `*.jar` file on the releases page
* An eclipse update site to install the ThingML IDE in eclipse: look for the most revent `*.zip` on the releases page

> **Version 1.X.X** is not maintained and should not be used (maintenance was stopped in Q3 2017). Version 2.X.X introduces a complete rewrite of the parser and editors based on XText. A few syntactical changes make the ThingML programs written for version 1 not compatible with version 2. There are also a few constructs which were evaluated in version 1 and were not re-implemented in version 2 (e.g. groups, streams, etc).

### ThingML Command Line Compiler

The ThingML command line compiler is distributed as a standalone JAR. It **requires Java 8 or newer**. The latest version (`*.jar`) can be found on [the releases pages](https://github.com/TelluIoT/ThingML/releases)

The command line tool contains all the code generators and plugins which are part of this repository.

**Usage:** `java -jar ThingML2CLI.jar` will provide usage information and a list of options.

### ThingML Eclipse-Based IDE

1. Install "Eclipse IDE for Java and DSL Developers" from the [Eclipse website](https://www.eclipse.org/downloads/).
2. Download the most recent update site (`*.zip`) from [the releases pages](https://github.com/TelluIoT/ThingML/releases).
3. Launch Eclipse
4. Install the ThingML plugins from the `*.zip` file: `Help -> Install New Software... -> Add... -> Archive...`

**Usage:** Once ThingML plugins are installed, `*.thingml` files will open with the ThingML editors. Right-click on `*.thingml` files and use `HEADS / ThingML` sub-menu to compile a ThingML file. Generated code will be put in a `thingml-gen` folder at the root of the eclipse project. Remember that only ThingML files containing a `configuration` can be compiled.

### Docker-Based Distribution

> **Warning:** Currently the image on Dockerub is not automatically updated. You should build the image from the Dockerfile to get an up-to-date version of ThingML.

If you have docker, you can use the build container with Eclipse and ThingML at the [thingmleditor repository](https://github.com/madkira/thingmleditor) or the [thingmleditor docker hub](https://hub.docker.com/r/madkira/thingmleditor/)

## Sample ThingML programs

*The goal of this section is to give a list of example which should work out of the box*

> **Note:** over the years and versions, we have collected a lot of different samples and projects made with ThingML. However most of them are not maintained and updated to work with the latest version of ThingML. This might be confusing if you are getting started.

**Examples which should be working out of the box:**

* Basic Arduino examples: [https://github.com/ffleurey/ThingMLArduinoDemo](https://github.com/ffleurey/ThingMLArduinoDemo). The "1.Basics" folder contains a set of simple ThingML/Arduino programs dealing with digital IOs.

* Multi-platform Breakout game (Arduino, Posix C, Java and Javascript): [https://github.com/ffleurey/ThingML-PongTutorial](https://github.com/ffleurey/ThingML-PongTutorial). This example demonstrate how to create platform independent components with ThingML.

* Arduino <-> Java communication (Serial): [https://github.com/ffleurey/ThingML-PressureLogger](https://github.com/ffleurey/ThingML-PressureLogger). This program shows has to create 2 ThingML programs communicating over a serial port. One program is running on an Arduino and collects sensor measurement. The other is a running as a Java program collecting the measurement from the Arduino over the USB/Serial connection and displaying curves. This example is quite minimalistic but should be easy to customize for your own sensor/needs. It shows various features of ThingML like the Serial communication plugin and the possibility of adding Maven dependencies to your ThingML programs.

* Raspberry Pi GPIOs: [https://github.com/ffleurey/ThingML-RPI-Blink](https://github.com/ffleurey/ThingML-RPI-Blink)
A couple of very simple examples showing how to blink an LED on the Raspberry Pi using either C or NodeJS.

**Example having known incompatibilities:**

> **Note:** Some old samples may be easy to fix but other may use features which have been removed from ThingML.

* Example from the `org.thingml.samples` in this repository. This folder contains many samples which were made with various versions of ThingML. It is good to explore to see different things that can be done with ThingML but it is not the place to get working samples when getting started.

* Tutorials from the HEADS project: [https://github.com/HEADS-project/training/tree/master/1.ThingML_Basics](https://github.com/HEADS-project/training/tree/master/1.ThingML_Basics). This tutorial is based on ThingML v1.0 which is no longer maintained.

## Compiling ThingML Generated Code

*The ThingML compiler generate platform specific source code in C, Java, Javascript or Go. This section give short guidelines on how the generated code should be complied and executed.*

### JAVA / Maven
---

When compiling to Java, ThingML creates a complete Maven project which is ready to build with `mvn clean install` and execute with `mvn exec:java`.

**Prerequisites:**

- Make sure you have a proper [JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (a JRE is not sufficient)
- Install [Maven](http://maven.apache.org/)

**Using Eclipse:**

Configure Eclipse so that it uses the JDK: `Window -> Preferences -> Java -> Installed JREs` (make sure it points to a JDK)

- Right click on `pom.xml` (in `thingml-gen/java/your-configuration`)
- `Run as -> Maven build... `
- In `Goals` type: `clean install exec:java`

> If Maven claims it cannot find a `pom.xml` file, change the base directory in the `Run as -> Maven build...` window using the `Workspace...` button, so that it points to `thingml-gen/java/your-configuration`.

### javascript for web browsers
---

Nothing special. Open the generated `index.html` file in your System Browser (ideally Chrome or Firefox)

> Do not use the default web browser embedded into Eclipse!

### Javascript for Node.JS
---

ThingML creates a standard Node.js package.

**Prerequisites:**

- NodeJS: Install [Node.JS](https://nodejs.org/en/)

**Using Eclipse:**

From this update site: `Node.JS - http://www.nodeclipse.org/updates/enide-2015/`, install `Features included in Enide Studio .Features Set` and `Nodeclipse Node.js .Features Set	1.0.2.201509250223`

- Right click on `package.json` (in `thingml-gen/nodejs/your-configuration`)
- `Run as -> npm install `
- Right click on `main.js`
- `Run as -> Node Application`

### Visualize UML Diagrams (PlantUML)
---

The files generated by the UML generator are text files which uses the PlantUML format. PlantUML will perform the layout and export the diagrams as images.

**Prerequisites:**

- Install [Graphviz](http://www.graphviz.org/Download.php)
- Install [PlantUML](http://plantuml.com/) (not needed if using the Eclipse plugin)

**Using Eclipse:**

Install PlantUML plugins in Eclipse using this update site: `http://hallvard.github.io/plantuml/`

- `Window -> Show View -> Other... -> PlantUML`

> Make sure you have Graphviz installed. It is required by the Eclipse plugin. If you have issues getting PlantUML to work, follow the instructions from http://plantuml.com/eclipse

###  Posix C
---

The generated code is a complete C project which include a Makefile.

- Open a terminal in the filder containing the generated code
- Compile with `make`
- Run with `./your-configuration`

**Prerequisites:**

- Use a C-friendly OS (such as Linux)
- Install `gcc` and `make` + the libraries you are using.

> Note: Virtual box is an option. Ubuntu on Windows 10 works fine as long as there are no graphics/hardware drivers involved.

###  Arduino C
---

- Open the generated file in the Arduino IDE
- Compile
- Upload to your board

**Prerequisites:**

- Install [Arduino IDE](https://www.arduino.cc/en/Main/Software)
- Install any Arduino libraries which you are using from your ThingML program

> For more information about how to use the Arduino IDE and Arduino boards, have a look at [the Arduino documentation](https://www.arduino.cc/en/Guide/Environment).

###  Go
---

- Open a terminal at `thingml-gen/go/your-configuration`
- To run the program directly: `go run *.go`
- To compile to an executable file: `go build *.go`

**Prerequisites:**

- Install the appropriate [Go distribution](https://golang.org/doc/install)
- Install the [Go state-machine library used by ThingML](https://github.com/SINTEF-9012/gosm) `go get github.com/SINTEF-9012/gosm`

> For more information about Go package structures, have a look at the [Go documentation](https://golang.org/doc/code.html)

### Teensy C
---

> Teensy compiler has not be tested for some time. Expect some possible issues when trying it.

**Prerequisites:**

- Install [Teensyduino IDE](https://www.pjrc.com/teensy/td_download.html)

or

- Install [cross compiled arm toochain](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads)
- Install [teensy command line loader](https://www.pjrc.com/teensy/loader_cli.html)

##  Compile ThingML from the sources

> You need Git, Maven, and a proper JDK8+

```bash
git clone https://github.com/TelluIoT/ThingML.git
cd ThingML
mvn clean install
cd language
mvn clean install
```

The command-line interface JAR (containing all you need to compile ThingML files) can be found here:

```bash
cd compilers/registry/target
java -jar compilers.registry-2.0.0-SNAPSHOT-jar-with-dependencies.jar
 --- ThingML help ---
Typical usages:
    java -jar your-jar.jar -t <tool> -s <source> [-o <output-dir>] [--options <option>][-d]
Usage: <main class> [options]
  Options:
    --compiler, -c
      Compiler ID (Mandatory unless --tool (-t) is used)
    --create-dir, -d
      Create a new directory named after the configuration for the output
      Default: false
    --help, -h
      Display this message.
      Default: false
    --list-plugins
      Display the list of available plugins
      Default: false
    --options
      additional options for ThingML tools.
    --output, -o
      Optional output directory - by default current directory is used
    --source, -s
      A thingml file to compile (should include at least one configuration)
    --tool, -t
      Tool ID (Mandatory unless --compiler (-c) is used)

Compiler Id must belong to the following list:
 ??     sintefboard     - Generates C++ based in code for Arduino.
 ??     posixmt - Generates C code for Linux or other Posix runtime environments (GCC compiler).
 ??     java    - Generates plain Java code.
 ??     arduino - Generates C/C++ code for Arduino or other AVR microcontrollers (AVR-GCC compiler).
 ??     UML     - Generates UML diagrams in PlantUML
 ??     browser - Generates Javascript code that can run in common Web Browsers.
 ??     nodejsMT        - Generates Multi-Process Javascript code (one nodejs process per instance) for the NodeJS platform.
 ??     nodejs  - Generates Javascript code for the NodeJS platform.
 ??     posix   - Generates C/C++ code for Linux or other Posix runtime environments (GCC compiler).
 ??     debugGUI        - Generates html/js mock-up for other a ThingML external connector

Tool Id must belong to the following list:
 ??     testconfigurationgen    - Generates test configuration for things annnotated with @test "input # output".
```

## 🔷 FAQ

### 🔹 Where can ThingML code run?

*Nowhere*! Or almost *everywhere*, from microcontrollers to the cloud!

A ThingML file *per se* is a design-time specification of the structure (components) and behavior (state machines) of a reactive system. It cannot be directly executed.

A ThingML file can however be compiled (or transformed) to Java/JavaScript/C/Arduino source code, which can in turn be compiled and executed on a platform. Code generated from ThingML has been successfully executed on a large number of platforms: PC Windows/Linux, Raspberry Pi 1, 2 and 3, Intel Edison, Arduino Uno/Mega/Yun/Mini, ESP8266/ESP32, Trinket, Teensy, and probably others.

### 🔹 How to express *this* or *that* in ThingML?

A set of tutorials is available [here](https://github.com/HEADS-project/training/tree/master/1.ThingML_Basics). The tutorials describe the most common features of ThingML. In addition, [an extensive set of tests](testing/src/test/resources/tests/General) describes pretty much all the concepts available. Have a look there is you wonder how to express something. Should this information be insufficient, have a look below.

### 🔹 How is ThingML formalized?

The ThingML language is formalized into an EMF-based metamodel. The textual syntax is formalized as an [XText grammar](language/thingml/src/org/thingml/xtext/ThingML.xtext).

### 🔹 All that code is wonderful, but I need some Science... 📚

ThingML is backed by a set of scientific publications (PDFs can easily be found on *e.g.* Google Scholar):

- **Model-Based Software Engineering to Tame the IoT Jungle**
Brice Morin, Nicolas Harrand and Franck Fleurey
In *IEEE Software, Special Issue on Internet of Things*, 2017.
- **ThingML, A Language and Code Generation Framework for Heterogeneous Targets**
N. Harrand, F. Fleurey, B. Morin and K.E. Husa
In *MODELS'16: ACM/IEEE 19th International Conference on Model Driven Engineering Languages and Systems. Practice and Innovation track*. St Malo, France, October 2-7, 2016
- **MDE to Manage Communications with and between Resource-Constrained Systems**
F. Fleurey, B. Morin, A. Solberg and O. Barais.
In *MODELS'11: ACM/IEEE 14th International Conference on Model Driven Engineering Languages and Systems*. Wellington, New Zealand, October 2011.

ThingML has also been used together with other approaches:

- **Agile Development of Home Automation System with ThingML**
A. Vasilevskiy, B. Morin, Ø. Haugen and P. Evensen.
In *INDIN'16: 14th IEEE International Conference on Industrial Informatics*. Poitiers, France, July 18-21, 2016
- **A Generative Middleware for Heterogeneous and Distributed Services**
B. Morin, F. Fleurey, K.E. Husa, and O. Barais.
In *CBSE'16: 19th International ACM Sigsoft Symposium on Component-Based Software Engineering*. Venice, Italy, April 5-8, 2016

### 🔹 How to embed ThingML in my toolchain?

> This currently does not work. Pending a solution to Issue #241

Embed the command-line inteface JAR [described previously in this readme](#-compile-thingml-from-the-sources) in your classpath.

You can also include ThingML as a Maven dependency in your project:

```xml
<dependency>
     <groupId>org.thingml</groupId>
     <artifactId>compilers.registry</artifactId>
     <version>2.0.0-SNAPSHOT</version>
</dependency>

...

<repository>
    <id>thingml-snapshot</id>
    <name>thingml-snapshot</name>
    <url>http://maven.thingml.org/thingml-snapshot/</url>
</repository>

<repository>
    <id>thingml-release</id>
    <name>thingml-release</name>
    <url>http://maven.thingml.org/thingml-release/</url>
</repository>
```

### 🔹 The code generated by ThingML for Java/JS/C/Arduino does not exactly fit my needs

Rather than being monolithic blobs, compilers are implemented in a modular way around a set of extension points defined in the [ThingML Code Generation Framework](compilers/README.md).

### 🔹 Why can't I generate Python/Lua/Ruby/*you-name-it*?

Well, it is up to you to implement a compiler for whatever language that is not supported by default. What are you waiting for?

### 🔹 How can I programatically process ThingML models?

```java
File myFile = new File("source.thingml");
ThingMLModel myModel = ThingMLCompiler.loadModel(myFile);
//Do something
ThingMLCompiler.saveAsThingML(myModel, "target.thingml");
//or
ThingMLCompiler.saveAsXMI(myModel, "target.xmi");
```

>Protip1: Make sure you have a good understanding of the [ThingML metamodel](#-how-is-thingml-formalized)

>Protip2: Have a look at the [helper functions](language/thingml/src/org/thingml/xtext/helpers) which simplify some typical treatments

> Models saved this way will contain all the imports that the original file refered to in one big file

> This feature might currently be broken as we migrated to XText.

## 🔷 More

![ThingML is released under OSI-compliant Apache 2.0 license](https://opensource.org/files/osi_keyhole_100X100_90ppi.png "ThingML is released under OSI-compliant Apache 2.0 license")


text:
package acmi.l2.clientmod.l2pe;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.beans.binding.Bindings;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Scene;
import javafx.stage.Screen;
import javafx.stage.Stage;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.nio.file.Paths;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import java.util.prefs.Preferences;

public class L2PE extends Application {
    private static final Logger log = Logger.getLogger(L2PE.class.getName());

    private Stage stage;
    private String version;

    Stage getStage() {
        return stage;
    }

    public String getApplicationVersion() {
        return version;
    }

    @Override
    public void start(Stage stage) throws Exception {
        this.stage = stage;
        this.version = readAppVersion();

        FXMLLoader loader = new FXMLLoader(getClass().getResource("main.fxml"));
        stage.setScene(new Scene(loader.load()));

        Controller controller = loader.getController();
        controller.setApplication(this);
        stage.titleProperty().bind(Bindings.createStringBinding(() ->
                (controller.getEnvironment() != null ? controller.getEnvironment().getStartDir().getAbsolutePath() + " - " : "") + "L2PE " + version, controller.environmentProperty()));
        stage.setWidth(Double.parseDouble(windowPrefs().get("width", String.valueOf(stage.getWidth()))));
        stage.setHeight(Double.parseDouble(windowPrefs().get("height", String.valueOf(stage.getHeight()))));
        if (windowPrefs().getBoolean("maximized", stage.isMaximized())) {
            stage.setMaximized(true);
        } else {
            Rectangle2D bounds = new Rectangle2D(
                    Double.parseDouble(windowPrefs().get("x", String.valueOf(stage.getX()))),
                    Double.parseDouble(windowPrefs().get("y", String.valueOf(stage.getY()))),
                    stage.getWidth(),
                    stage.getHeight());
            if (Screen.getScreens()
                    .stream()
                    .map(Screen::getVisualBounds)
                    .anyMatch(r -> r.intersects(bounds))) {
                stage.setX(bounds.getMinX());
                stage.setY(bounds.getMinY());
            }
        }
        stage.show();

        Platform.runLater(() -> {
            InvalidationListener listener = observable -> {
                if (stage.isMaximized()) {
                    windowPrefs().putBoolean("maximized", true);
                } else {
                    windowPrefs().putBoolean("maximized", false);
                    windowPrefs().put("x", String.valueOf(Math.round(stage.getX())));
                    windowPrefs().put("y", String.valueOf(Math.round(stage.getY())));
                    windowPrefs().put("width", String.valueOf(Math.round(stage.getWidth())));
                    windowPrefs().put("height", String.valueOf(Math.round(stage.getHeight())));
                }
            };
            stage.xProperty().addListener(listener);
            stage.yProperty().addListener(listener);
            stage.widthProperty().addListener(listener);
            stage.heightProperty().addListener(listener);
        });
    }

    private String readAppVersion() throws IOException, URISyntaxException {
        try (JarFile jarFile = new JarFile(Paths.get(getClass().getProtectionDomain().getCodeSource().getLocation().toURI()).toFile())) {
            Manifest manifest = jarFile.getManifest();
            return manifest.getMainAttributes().getValue("Version");
        } catch (FileNotFoundException ignore) {
        } catch (IOException | URISyntaxException e) {
            log.log(Level.WARNING, "version info load error", e);
        }
        return "";
    }

    public static Preferences getPrefs() {
        return Preferences.userRoot().node("l2clientmod").node("l2pe");
    }

    private static Preferences windowPrefs() {
        return getPrefs().node("window");
    }

    public static void main(String[] args) {
        try (InputStream is = L2PE.class.getResourceAsStream("/logging.properties")) {
            LogManager.getLogManager().readConfiguration(is);
        } catch (IOException e) {
            System.err.println("Couldn't load logging.properties");
        }

        launch(args);
    }
}