text:
package com.example.cms.customersync.merge;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

import java.util.HashMap;
import java.util.Map;

import org.junit.Test;

public class MergerTest {

    Merger merger = new Merger();

    @Test
    public void testSingleNewLeft() {
        Map<String, String> anchestor = empty();
        Map<String, String> left = map("a", "foo");
        Map<String, String> right = empty();

        Map<String, String> result = merger.merge(anchestor, left, right);
        assertThat(result, equalTo(map("a", "foo")));
    }

    @Test
    public void testSingleNewRight() {
        Map<String, String> anchestor = empty();
        Map<String, String> left = empty();
        Map<String, String> right = map("a", "foo");

        Map<String, String> result = merger.merge(anchestor, left, right);
        assertThat(result, equalTo(map("a", "foo")));
    }

    @Test
    public void testSingleNewBothSame() {
        Map<String, String> anchestor = empty();
        Map<String, String> left = map("a", "foo");
        Map<String, String> right = map("a", "foo");

        Map<String, String> result = merger.merge(anchestor, left, right);
        assertThat(result, equalTo(map("a", "foo")));
    }

    @Test(expected = ConflictException.class)
    public void testSingleNewBothConflict() {
        Map<String, String> anchestor = empty();
        Map<String, String> left = map("a", "foo");
        Map<String, String> right = map("a", "bar");

        merger.merge(anchestor, left, right);
    }

    @Test
    public void testSingleDeleteLeft() {
        Map<String, String> anchestor = map("a", "foo");
        Map<String, String> left = empty();
        Map<String, String> right = map("a", "foo");

        Map<String, String> result = merger.merge(anchestor, left, right);
        assertThat(result, equalTo(empty()));
    }

    @Test
    public void testSingleDeleteRight() {
        Map<String, String> anchestor = map("a", "foo");
        Map<String, String> left = map("a", "foo");
        Map<String, String> right = empty();

        Map<String, String> result = merger.merge(anchestor, left, right);
        assertThat(result, equalTo(empty()));
    }

    @Test
    public void testSingleDeleteBoth() {
        Map<String, String> anchestor = map("a", "foo");
        Map<String, String> left = empty();
        Map<String, String> right = empty();

        Map<String, String> result = merger.merge(anchestor, left, right);
        assertThat(result, equalTo(empty()));
    }

    @Test(expected = ConflictException.class)
    public void testSingleDeleteLeftChangeRight() {
        Map<String, String> anchestor = map("a", "foo");
        Map<String, String> left = empty();
        Map<String, String> right = map("a", "bar");

        merger.merge(anchestor, left, right);
    }

    @Test
    public void testSingleNoChange() {
        Map<String, String> anchestor = map("a", "foo");
        Map<String, String> left = map("a", "foo");
        Map<String, String> right = map("a", "foo");

        Map<String, String> result = merger.merge(anchestor, left, right);
        assertThat(result, equalTo(map("a", "foo")));
    }

    @Test
    public void testSingleChangeLeft() {
        Map<String, String> anchestor = map("a", "foo");
        Map<String, String> left = map("a", "bar");
        Map<String, String> right = map("a", "foo");

        Map<String, String> result = merger.merge(anchestor, left, right);
        assertThat(result, equalTo(map("a", "bar")));
    }

    @Test
    public void testSingleChangeRight() {
        Map<String, String> anchestor = map("a", "foo");
        Map<String, String> left = map("a", "foo");
        Map<String, String> right = map("a", "bar");

        Map<String, String> result = merger.merge(anchestor, left, right);
        assertThat(result, equalTo(map("a", "bar")));
    }

    @Test
    public void testSingleChangeBothSame() {
        Map<String, String> anchestor = map("a", "foo");
        Map<String, String> left = map("a", "bar");
        Map<String, String> right = map("a", "bar");

        Map<String, String> result = merger.merge(anchestor, left, right);
        assertThat(result, equalTo(map("a", "bar")));
    }

    @Test(expected = ConflictException.class)
    public void testSingleChangeBothConflict() {
        Map<String, String> anchestor = map("a", "foo");
        Map<String, String> left = map("a", "bar");
        Map<String, String> right = map("a", "baz");

        merger.merge(anchestor, left, right);
    }

    @Test
    public void testMultiChange() {
        Map<String, String> anchestor = map("a", null, "b", "2", "c", "3");
        Map<String, String> left = map("a", "1", "b", "22", "c", "3");
        Map<String, String> right = map("a", "1", "b", "2", "c", null);

        Map<String, String> result = merger.merge(anchestor, left, right);
        assertThat(result, equalTo(map("a", "1", "b", "22")));
    }

    private Map<String, String> empty() {
        return new HashMap<>();
    }

    private Map<String, String> map(String k1, String v1) {
        HashMap<String, String> map = new HashMap<>();
        map.put(k1, v1);
        return map;
    }

    private Map<String, String> map(String k1, String v1, String k2, String v2) {
        Map<String, String> map = map(k1, v1);
        map.put(k2, v2);
        return map;
    }

    private Map<String, String> map(String k1, String v1, String k2, String v2, String k3, String v3) {
        Map<String, String> map = map(k1, v1, k2, v2);
        map.put(k3, v3);
        return map;
    }
}


text:
#import "AutoScalingResumeProcessesRequestMarshaller.h"

@implementation AutoScalingResumeProcessesRequestMarshaller

+(AmazonServiceRequest *)createRequest:(AutoScalingResumeProcessesRequest *)resumeProcessesRequest
{
    AmazonServiceRequest *request = [[AutoScalingRequest alloc] init];

    [request setParameterValue:@"ResumeProcesses"           forKey:@"Action"];
    [request setParameterValue:@"2011-01-01"   forKey:@"Version"];

    [request setDelegate:[resumeProcessesRequest delegate]];
    [request setCredentials:[resumeProcessesRequest credentials]];
    [request setEndpoint:[resumeProcessesRequest requestEndpoint]];
    [request setRequestTag:[resumeProcessesRequest requestTag]];

    if (resumeProcessesRequest != nil) {
        if (resumeProcessesRequest.autoScalingGroupName != nil) {
            [request setParameterValue:[NSString stringWithFormat:@"%@", resumeProcessesRequest.autoScalingGroupName] forKey:[NSString stringWithFormat:@"%@", @"AutoScalingGroupName"]];
        }
    }

    if (resumeProcessesRequest != nil) {
        int scalingProcessesListIndex = 1;
        for (NSString *scalingProcessesListValue in resumeProcessesRequest.scalingProcesses) {
            if (scalingProcessesListValue != nil) {
                [request setParameterValue:[NSString stringWithFormat:@"%@", scalingProcessesListValue] forKey:[NSString stringWithFormat:@"%@.member.%d", @"ScalingProcesses", scalingProcessesListIndex]];
            }

            scalingProcessesListIndex++;
        }
    }

    return [request autorelease];
}

@end

redpajama_set_name: RedPajamaGithub


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE775_Missing_Release_of_File_Descriptor_or_Handle__open_no_close_43.cpp
Label Definition File: CWE775_Missing_Release_of_File_Descriptor_or_Handle__open_no_close.label.xml
Template File: source-sinks-43.tmpl.cpp
*/
/*
 * @description
 * CWE: 775 Missing Release of File Descriptor or Handle After Effective Lifetime
 * BadSource:  Open a file using open()
 * Sinks:
 *    GoodSink: Close the file using close()
 *    BadSink : Do not close file
 * Flow Variant: 43 Data flow: data flows using a C++ reference from one function to another in the same source file
 *
 * */

#include "std_testcase.h"

#ifdef _WIN32
#define OPEN _open
#define CLOSE _close
#else
#include <unistd.h>
#define OPEN open
#define CLOSE close
#endif

namespace CWE775_Missing_Release_of_File_Descriptor_or_Handle__open_no_close_43
{

#ifndef OMITBAD

static void badSource(int &data)
{
    /* POTENTIAL FLAW: Open a file without closing it */
    data = OPEN("BadSource_open.txt", O_RDWR|O_CREAT, S_IREAD|S_IWRITE);
}

void bad()
{
    int data;
    /* Initialize data */
    data = -1;
    badSource(data);
    /* FLAW: No attempt to close the file */
    ; /* empty statement needed for some flow variants */
}

#endif /* OMITBAD */

#ifndef OMITGOOD

/* goodB2G() uses the BadSource with the GoodSink */
static void goodB2GSource(int &data)
{
    /* POTENTIAL FLAW: Open a file without closing it */
    data = OPEN("BadSource_open.txt", O_RDWR|O_CREAT, S_IREAD|S_IWRITE);
}

static void goodB2G()
{
    int data;
    /* Initialize data */
    data = -1;
    goodB2GSource(data);
    /* FIX: If the file is still opened, close it */
    if (data != -1)
    {
        CLOSE(data);
    }
}

void good()
{
    goodB2G();
}

#endif /* OMITGOOD */

} /* close namespace */

/* Below is the main(). It is only used when building this testcase on
   its own for testing or for building a binary to use in testing binary
   analysis tools. It is not used when compiling all the testcases as one
   application, which is how source code analysis tools are tested. */

#ifdef INCLUDEMAIN

using namespace CWE775_Missing_Release_of_File_Descriptor_or_Handle__open_no_close_43; /* so that we can use good and bad easily */

int main(int argc, char * argv[])
{
    /* seed randomness */
    srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
    printLine("Calling good()...");
    good();
    printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
    printLine("Calling bad()...");
    bad();
    printLine("Finished bad()");
#endif /* OMITBAD */
    return 0;
}

#endif


text: /* Add your custom CSS styles for the MOBI here */


text:
//package com.wisape.android.activity;
//
//import android.app.Activity;
//import android.content.Intent;
//import android.graphics.Color;
//import android.graphics.drawable.ColorDrawable;
//import android.os.Bundle;
//import android.os.Message;
//import android.support.v7.app.ActionBar;
//import android.support.v7.widget.LinearLayoutManager;
//import android.support.v7.widget.RecyclerView;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.ImageView;
//import android.widget.TextView;
//
//import com.wisape.android.R;
//import com.wisape.android.logic.MessageCenterLogic;
//import com.wisape.android.logic.UserLogic;
//import com.wisape.android.model.MessageInfo;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import butterknife.ButterKnife;
//import butterknife.InjectView;
//
///**
// * 消息列表
// * Created by hm on 2015/8/15.
// */
//public class MessageCenterActivity extends BaseActivity {
//
//    private static final int SYSTEM_MESSAGE = 2;
//
//    private static final int LOADER_MESSAGE_LIST = 1;
//
//    private static final String EXTRAS_USER_ID = "user_id";
//
//    @InjectView(R.id.message_list)
//    RecyclerView messageListRecyclerView;
//
//    @InjectView(R.id.imge_no_data)
//    ImageView imgNoData;
//
//    public static void launch(Activity activity) {
//        Intent intent = new Intent(activity.getApplicationContext(), MessageCenterActivity.class);
//        activity.startActivity(intent);
//    }
//
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_message_center);
//        ButterKnife.inject(this);
//        initView();
//    }
//
//    private void initView() {
//        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
//        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
//        messageListRecyclerView.setLayoutManager(linearLayoutManager);
//        ActionBar actionBar = getSupportActionBar();
//        if(null != actionBar){
//            getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#f5f5f5")));
//        }
//
//
//        Bundle args = new Bundle();
//        args.putLong(EXTRAS_USER_ID, UserLogic.instance().getUserInfoFromLocal().user_id);
//        startLoadWithProgress(LOADER_MESSAGE_LIST, args);
//
//    }
//
//    @Override
//    protected Message onLoadBackgroundRunning(int what, Bundle args) throws AsyncLoaderError {
//        Message msg = MessageCenterLogic.getInstance().messageList(args.getLong(EXTRAS_USER_ID));
//        msg.what = what;
//        return msg;
//    }
//
//    @Override
//    protected void onLoadCompleted(Message data) {
//        super.onLoadCompleted(data);
//        if(STATUS_SUCCESS == data.arg1){
//            List<MessageInfo> messageInfoList = (List<MessageInfo>)data.obj;
//            if(null == messageInfoList || messageInfoList.size() == 0){
//                imgNoData.setVisibility(View.VISIBLE);
//                messageListRecyclerView.setVisibility(View.GONE);
//            }else {
//                MessageListAdapter messageListAdapter = new MessageListAdapter(messageInfoList);
//                messageListRecyclerView.setAdapter(messageListAdapter);
//            }
//        }else{
//            showToast((String)data.obj);
//            imgNoData.setVisibility(View.VISIBLE);
//            messageListRecyclerView.setVisibility(View.GONE);
//        }
//    }
//
//    public class MessageListAdapter extends RecyclerView.Adapter<MessageListAdapter.MessageListHolder> {
//
//        private List<MessageInfo> messageInfoList = new ArrayList<>();
//
//        public MessageListAdapter(List<MessageInfo> messageInfos){
//            messageInfoList = messageInfos;
//        }
//
//        @Override
//        public int getItemCount() {
//            return messageInfoList.size();
//        }
//
//        @Override
//        public MessageListHolder onCreateViewHolder(ViewGroup parent, final int viewType) {
//            final View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_message_list,
//                    parent, false);
//            return new MessageListHolder(view);
//        }
//
//        @Override
//        public void onBindViewHolder(MessageListHolder holder, int position) {
//            final MessageInfo messageInfo = messageInfoList.get(position);
//            if (SYSTEM_MESSAGE == messageInfo.getType()) {
//                holder.messageType.setImageResource(R.mipmap.icon_operation);
//            } else {
//                holder.messageType.setImageResource(R.mipmap.icon_system);
//            }
//            holder.messageTitle.setText(messageInfo.getTitle());
//            holder.messageTime.setText(messageInfo.getParsetime());
//            String subject = messageInfo.getSubject();
//            if (null == subject || "".equals(subject)) {
//            }else{
//                holder.messageContent.setText(messageInfo.getSubject());
//            }
//            holder.itemView.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    messageInfo.getId();
//                    MessageCenterDetailActivity.launch(getApplicationContext(), messageInfo.getId());
//                }
//            });
//        }
//
//        public class MessageListHolder extends RecyclerView.ViewHolder{
//
//            @InjectView(R.id.img_message_list_type)
//            ImageView messageType;
//            @InjectView(R.id.tv_message_list_title)
//            TextView messageTitle;
//            @InjectView(R.id.tv_message_list_time)
//            TextView messageTime;
//            @InjectView(R.id.tv_message_list_content)
//            TextView messageContent;
//
//            View itemView;
//
//            public MessageListHolder(View view) {
//                super(view);
//                ButterKnife.inject(this, view);
//                itemView = view;
//            }
//        }
//    }
//}


text:
package org.jolokia.util;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.net.URL;
import java.util.*;

/**
 * A simple factory for creating services with no-arg constructors from a textual
 * descriptor. This descriptor, which must be a resource loadable by this class'
 * classloader, is a plain text file which looks like
 *
 *

 *   org.jolokia.detector.TomcatDetector,50
 *   !org.jolokia.detector.JettyDetector
 *   org.jolokia.detector.JBossDetector
 *   org.jolokia.detector.WebsphereDetector,1500
 *

 *
 * If a line starts with ! it is removed if it has been added previously.
 * The optional second numeric value is the order in which the services are returned.
 *
 * @author roland
 * @since 05.11.10
 */
public final class ServiceObjectFactory {

    private ServiceObjectFactory() {}

    /**
     * Create a list of services ordered according to the ordering given in the
     * service descriptor files. Note, that the descriptor will be looked up
     * in the whole classpath space, which can result in reading in multiple
     * descriptors with a single path. Note, that the reading order for multiple
     * resources with the same name is not defined.
     *
     * @param pDescriptorPaths a list of resource paths which are handle in the given order.
     *        Normally, default service should be given as first parameter so that custom
     *        descriptors have a chance to remove a default service.
     * @param <T> type of the service objects to create
     * @return a ordered list of created services.
     */
    public static <T> List<T> createServiceObjects(String... pDescriptorPaths) {
        try {
            ServiceEntry.initDefaultOrder();
            TreeMap<ServiceEntry,T> extractorMap = new TreeMap<ServiceEntry,T>();
            for (String descriptor : pDescriptorPaths) {
                readServiceDefinitions(extractorMap, descriptor);
            }
            ArrayList<T> ret = new ArrayList<T>();
            for (T service : extractorMap.values()) {
                ret.add(service);
            }
            return ret;
        } finally {
            ServiceEntry.removeDefaultOrder();
        }
    }

    private static <T> void readServiceDefinitions(Map<ServiceEntry, T> pExtractorMap, String pDefPath) {
        try {
            Enumeration<URL> resUrls = ServiceObjectFactory.class.getClassLoader().getResources(pDefPath);
            while (resUrls.hasMoreElements()) {
                readServiceDefinitionFromUrl(pExtractorMap, resUrls.nextElement());
            }
        } catch (IOException e) {
            throw new IllegalStateException("Cannot load extractor from " + pDefPath + ": " + e,e);
        }
    }

    private static <T> void readServiceDefinitionFromUrl(Map<ServiceEntry, T> pExtractorMap,URL pUrl) {
        String line = null;
        Exception error = null;
        LineNumberReader reader = null;
        try {
            reader = new LineNumberReader(new InputStreamReader(pUrl.openStream()));
            line = reader.readLine();
            while (line != null) {
                createOrRemoveService(pExtractorMap, line);
                line = reader.readLine();
            }
        } catch (ClassNotFoundException e) {
            error = e;
        } catch (InstantiationException e) {
            error = e;
        } catch (IllegalAccessException e) {
            error = e;
        } catch (ClassCastException e) {
            error = e;
        } catch (IOException e) {
            error = e;
        } finally {
            closeReader(reader);
            if (error != null) {
                throw new IllegalStateException("Cannot load service " + line + " defined in " +
                        pUrl + " : " + error + ". Aborting",error);
            }
        }
    }

    private static <T> void createOrRemoveService(Map<ServiceEntry, T> pExtractorMap, String pLine)
            throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        if (pLine.length() > 0) {
            ServiceEntry entry = new ServiceEntry(pLine);
            if (entry.isRemove()) {
                // Removing is a bit complex since we need to find out
                // the proper key since the order is part of equals/hash
                // so we cant fetch/remove it directly
                Set<ServiceEntry> toRemove = new HashSet<ServiceEntry>();
                for (ServiceEntry key : pExtractorMap.keySet()) {
                    if (key.getClassName().equals(entry.getClassName())) {
                       toRemove.add(key);
                    }
                }
                for (ServiceEntry key : toRemove) {
                    pExtractorMap.remove(key);
                }
            } else {
                Class<T> clazz = (Class<T>) ServiceObjectFactory.class.getClassLoader().loadClass(entry.getClassName());
                T ext = (T) clazz.newInstance();
                pExtractorMap.put(entry,ext);
            }
        }
    }

    private static void closeReader(LineNumberReader pReader) {
        if (pReader != null) {
            try {
                pReader.close();
            } catch (IOException e) {
                // Best effort
            }
        }
    }

    // =============================================================================

     static class ServiceEntry implements Comparable<ServiceEntry> {
        private String className;
        private boolean remove;
        private Integer order;

        private static ThreadLocal<Integer> defaultOrderHolder = new ThreadLocal<Integer>() {

            /**
             * Initialise with start value for entries without an explicite order. 100 in this case.
             *
             * @return 100
             */
            @Override
            protected Integer initialValue() {
                return Integer.valueOf(100);
            }
        };

        /**
         * Parse an entry in the service definition. This should be the full qualified classname
         * of a service, optional prefixed with "!" in which case the service is removed
         * from the defaul list. An order value can be appened after the classname with a comma for give a
         * indication for the ordering of services. If not given, 100 is taken for the first entry, counting up.
         *
         * @param pLine line to parse
         */
        public ServiceEntry(String pLine) {
            String[] parts = pLine.split(",");
            if (parts[0].startsWith("!")) {
                remove = true;
                className = parts[0].substring(1);
            } else {
                remove = false;
                className = parts[0];
            }
            if (parts.length > 1) {
                try {
                    order = Integer.parseInt(parts[1]);
                } catch (NumberFormatException exp) {
                    order = nextDefaultOrder();
                }
            } else {
                order = nextDefaultOrder();
            }
        }

        private Integer nextDefaultOrder() {
            Integer defaultOrder = defaultOrderHolder.get();
            defaultOrderHolder.set(defaultOrder + 1);
            return defaultOrder;
        }

        private static void initDefaultOrder() {
            defaultOrderHolder.set(100);
        }

        private static void removeDefaultOrder() {
            defaultOrderHolder.remove();
        }

        private String getClassName() {
            return className;
        }

        private boolean isRemove() {
            return remove;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) { return true; }
            if (o == null || getClass() != o.getClass()) { return false; }

            ServiceEntry that = (ServiceEntry) o;

            if (!className.equals(that.className)) { return false; }

            return true;
        }

        @Override
        public int hashCode() {
            return className.hashCode();
        }

        /** {@inheritDoc} */
        public int compareTo(ServiceEntry o) {
            return order - o.order;
        }
    }
}


text:
<?php

namespace App\DataWarehouseBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class DwBundle extends Bundle
{
}


text:
![cryptalk](/screenshot.png)

![Node.js CI](https://github.com/Hexagon/cryptalk/workflows/Node.js%20CI/badge.svg?branch=master)
[![npm version](https://badge.fury.io/js/cryptalk.svg)](https://badge.fury.io/js/cryptalk)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/753ef40cec1747c2b5025f834635375b)](https://www.codacy.com/gh/Hexagon/cryptalk/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Hexagon/cryptalk&utm_campaign=Badge_Grade)

# Cryptalk

Cyptalk is a HTML5/Node.js based, client side (E2EE) encrypted instant chat

## Features

*   Client side AES-256-CBC encryption/decryption (the server is just a messenger)
*   256 bit key derived from your passphrase using PBKDF2
*   Messages torched after a configurable delay, default is 600s.
*   Simple setup using npm, Docker or Heroku
*   Notification sounds (mutable)
*   Native popup notifications
*   Configurable page title
*   Nicknames, optional.
*   Quick-links using http://server/#Room:Passphrase, optional and insecure

## Installing

### Docker setup

To run latest cryptalk with docker, exposed on host port 80, simply run the following command to pull it from docker hub

```bash
sudo docker run -d --restart=always -p 80:8080 hexagon/cryptalk
```

### Heroku setup

Click the button below

[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/hexagon/cryptalk)

### Docker setup without using docker hub

Clone this repo, enter the new directory.

Build image
```bash
docker build . --tag="hexagon/cryptalk"
```

Run container, enable start on boot, expose to port 80 at host
```bash
sudo docker run -d --restart=always -p 80:8080 hexagon/cryptalk
```

Browse to ```http://<ip-of-server>/```

Done!

### npm setup

Install node.js, exact procedure is dependant on platform and distribution.

Install the app from npm
```bash
npm install cryptalk -g
````

Then issue the following to start the app

```bash
cryptalk
```

Browse to ```http://localhost:8080```

Done!

## Usage

```

Available commands:

Client:
	/key		StrongPassphrase	Sets encryption key
	/nick		NickName			Sets an optional nick
	/mute  							Audio on
	/unmute  						Audio off
	/clear							Clear on-screen buffer
	/help							This
	/title							Set your local page title
	/torch		AfterSeconds		Console messages are torched
									after this amount of seconds
									(default 600).

Room:
	/join		RoomId				Join a room
	/leave							Leave the room
	/count							Count participants

Host:
	/connect						Connect to host
	/disconnect						Disconnect from host

You can select any of the five last commands/messages with up/down key.

Due to security reasons, /key command is not saved, and command
history is  automatically cleared after one minute of inactivity.

It is highly recommended to use incognito mode while chatting,
to prevent browsers from keeping history or cache.

```

## Development

Install node.js (development require >=12.0), exact procedure is dependant on platform and distribution.

Clone this repo
```bash
git clone https://github.com/Hexagon/cryptalk.git
cd cryptalk
```

Pull dependencies from npm
```bash
npm install
```

Start server
```bash
npm run start
```

Browse to ```http://localhost:8080```

To work on the JavaScript, edit the code in ```client/source/```. To test the changes, first run ```npm run build``` to lint, build and minify the code. Then restart the server.


text:
//plugincontainer.h:

#ifndef _LIBROARPLUGINCONTAINER_H_
#define _LIBROARPLUGINCONTAINER_H_

#include "libroar.h"

struct roar_plugincontainer;

struct roar_plugincontainer_callbacks {
 /* prefree() is called before the container is freed.
  */
 int (*prefree)(struct roar_plugincontainer * cont, void ** userdata);

 /* freeuserdata() is called when the userdata needs to be freed.
  * This is the case then the container is freed.
  * It is not called when the current userdata is NULL.
  * If not set or userdata is still non-NULL after this call the userdata
  * is freed using roar_mm_free().
  */
 int (*freeuserdata)(struct roar_plugincontainer * cont, void ** userdata);

 /* freecontext() is called when the context needs to be freed.
  * It is not called when the current context is NULL.
  * If not set or context is still non-NULL after this call the context
  * is freed using roar_mm_free().
  */
 int (*freecontext)(struct roar_plugincontainer * cont, void ** context);

 /* preload() and postload() are called before and after a plugin is loaded.
  */
 int (*preload) (struct roar_plugincontainer * cont, void ** context,
                 const char * name, int flags, struct roar_dl_librarypara * para);
 int (*postload)(struct roar_plugincontainer * cont, void ** context, struct roar_dl_lhandle * lhandle,
                 const char * name, int flags, struct roar_dl_librarypara * para);

 /* preunload() and postunload() are called before and after a plugin is unloaded.
  * Those functions are also called if the plugin was loaded but ra_init was not yet done or failed.
  */
 int (*preunload) (struct roar_plugincontainer * cont, void ** context, struct roar_dl_lhandle * lhandle);
 int (*postunload)(struct roar_plugincontainer * cont, void ** context);

 /* prera_init() and postra_init() are called before and after a plugin is ra_init-ed.
  * This is also true if the plugin is ra_init-ed while being loaded.
  * Note the limits of roar_plugincontainer_ra_init() if this is used
  * with roar_plugincontainer_ra_init().
  * postra_init() is also called in case the ra_init failed.
  */
 int (*prera_init) (struct roar_plugincontainer * cont, void ** context, struct roar_dl_lhandle * lhandle,
                    struct roar_dl_librarypara * para);
 int (*postra_init)(struct roar_plugincontainer * cont, void ** context, struct roar_dl_lhandle * lhandle,
                    struct roar_dl_librarypara * para);
};

struct roar_plugincontainer_plugininfo {
 /* The name of the plugin.
  */
 const char * libname;
 /* The roardl's library handle.
  */
 struct roar_dl_lhandle * handle;
 /* The number of librarys/plugins depending on this plugin.
  */
 size_t rdepends;
 /* A pointer to the current user context.
  */
 void ** context;
};

/* Create a new plugin container.
 * Takes a default parameter set.
 */
struct roar_plugincontainer * roar_plugincontainer_new(struct roar_dl_librarypara * default_para);

/* Create a new plugin container.
 * Takes host application's appname and abiversion.
 */
struct roar_plugincontainer * roar_plugincontainer_new_simple(const char * appname, const char * abiversion);

// Increment the refrence counter.
int roar_plugincontainer_ref(struct roar_plugincontainer * cont);
/* Decrement the refrence counter.
 * Unloads all plugins and frees all resources when there are no refreneces left.
 */
int roar_plugincontainer_unref(struct roar_plugincontainer * cont);

/* Set Autoappsched.
 * If set the INIT and FREE appsched events are send automatically.
 */
int roar_plugincontainer_set_autoappsched(struct roar_plugincontainer * cont, int val);

/* Set callbacks.
 */
int roar_plugincontainer_set_callbacks(struct roar_plugincontainer * cont,
                                       const struct roar_plugincontainer_callbacks * callbacks);

/* Set container's userdata.
 */
int roar_plugincontainer_set_userdata(struct roar_plugincontainer * cont, void * userdata);

/* Get container's userdata.
 */
void * roar_plugincontainer_get_userdata(struct roar_plugincontainer * cont);

/* Get a lhandle by name of the loaded plugin.
 */
struct roar_dl_lhandle * roar_plugincontainer_get_lhandle_by_name (struct roar_plugincontainer * cont,
                                                                   const char * name);

/* Get infos about current state of plugin.
 */
struct roar_plugincontainer_plugininfo roar_plugincontainer_get_info_by_name (struct roar_plugincontainer * cont,
                                                                              const char * name);

// plugin loading and unloading:

// Load a plugin by name.
int                      roar_plugincontainer_load            (struct roar_plugincontainer * cont,
                                                               const char * name,
                                                               struct roar_dl_librarypara * para);

/* Load a plugin by name with extra options.
 * This is for advanced applications only.
 * NOTE: Using this handle after the plugin has been unloaded from the
 *       container results in undefind behavior.
 */
struct roar_dl_lhandle * roar_plugincontainer_load_lhandle    (struct roar_plugincontainer * cont,
                                                               const char * name,
                                                               int flags,
                                                               int ra_init,
                                                               struct roar_dl_librarypara * para);
/* Unload a plugin by name.
 * NOTE: The name here is from the plugin and may not match the name you load
 *       the plugin with.
 */
int                      roar_plugincontainer_unload          (struct roar_plugincontainer * cont,
                                                               const char * name);
/* Load a plugin by roardl handle.
 * This is for advanced applications only.
 */
int                      roar_plugincontainer_unload_lhandle  (struct roar_plugincontainer * cont,
                                                               struct roar_dl_lhandle * lhandle);
/* Post ra_init plugins not yet inited.
 * NOTE: This uses the default para,
 *       not the one given with roar_plugincontainer_load_lhandle().
 * This is for advanced applications only.
 */
int                      roar_plugincontainer_ra_init         (struct roar_plugincontainer * cont);

// appsched:
// Trigger an application schedule event on all plugins.
int                      roar_plugincontainer_appsched_trigger(struct roar_plugincontainer * cont, enum roar_dl_appsched_trigger trigger);

#endif

//ll


text:
@interface RCView ()

@property (nonatomic) UIImageView * backgroundImageView;

@end

@implementation RCView

- (instancetype)initWithFrame:(CGRect)frame radius:(CGFloat)radius borderWidth:(CGFloat)borderWidth backgroundColor:(UIColor *)backgroundColor borderColor:(UIColor *)borderColor {

    if (self = [super initWithFrame:frame]) {
        _radius = radius;
        _borderWidth = borderWidth;
        _cornerBackgroundColor = backgroundColor;
        _borderColor = borderColor;
        _backgroundImageView = nil;
        [self reloadBackgroundImageView];
    }
    return self;
}

- (void)setRadius:(CGFloat)radius {
    _radius = radius;
    [self reloadBackgroundImageView];
}

- (void)setBorderWidth:(CGFloat)borderWidth {
    _borderWidth = borderWidth;
    [self reloadBackgroundImageView];
}

- (void)setCornerBackgroundColor:(UIColor *)cornerBackgroundColor {
    _cornerBackgroundColor = cornerBackgroundColor;
    [self reloadBackgroundImageView];
}

- (void)setBorderColor:(UIColor *)borderColor {
    _borderColor = borderColor;
    [self reloadBackgroundImageView];
}

- (void)reloadBackgroundImageView {
    if (self.backgroundImageView) {
        [self.backgroundImageView removeFromSuperview];
        self.backgroundImageView = nil;
    }
    self.backgroundImageView = [self addCornerWithRadius:self.radius borderWidth:self.borderWidth backgroundColor:self.cornerBackgroundColor borderColor:self.borderColor];
}

@end

@implementation RCLabel

- (instancetype)initWithFrame:(CGRect)frame radius:(CGFloat)radius borderWidth:(CGFloat)borderWidth backgroundColor:(UIColor *)backgroundColor borderColor:(UIColor *)borderColor {

    if (self = [super initWithFrame:frame radius:radius borderWidth:borderWidth backgroundColor:backgroundColor borderColor:borderColor]) {
        self.label = [[UILabel alloc] initWithFrame:self.bounds];
        [self addSubview:self.label];
    }
    return self;
}

@end

@implementation RCImageView

- (instancetype)initWithFrame:(CGRect)frame radius:(CGFloat)radius{
    if (self = [super initWithFrame:frame]) {
        _radius = radius;
    }
    return self;
}

- (void)setRadius:(CGFloat)radius {
    _radius = radius;
    [self reloadImage];
}

- (void)setRcImage:(UIImage *)rcImage {
    _rcImage = rcImage;
    [self reloadImage];
}

- (void)reloadImage {
    self.image = self.rcImage;
    [self addCornerWithRadius:self.radius];
}

@end


text:
class SimpleCalendarMigrationsGenerator < Rails::Generator::Base
	def manifest
		record do |m|
      @migration_directory = "#{RAILS_ROOT}/db/migrate"
      %w{create_simple_calendars
         create_simple_calendar_entries
         }.each do |x|
           if migration_exists?("#{x}").empty?
		         m.migration_template "#{x}.rb", "db/migrate",
                                  :migration_file_name => x,
                                  :assigns => {:class_name => x.camelize}
           else
             puts "#{x} migration already exists ... skipping."
           end
      end
    end
	end

  def migration_exists?(file_name)
    Dir.glob("#{@migration_directory}/[0-9]*_*.rb").grep(/[0-9]+_#{file_name}.rb$/)
  end
end


text:
local storyboard = require( "storyboard" )

local scene = storyboard.newScene()

-- Called when the scene's view does not exist:
function scene:createScene( event )
	dprint( 10, "createScene-CountdownScreen" )

	local group = self.view
	local spriteGroup = display.newGroup()
	spriteGroup.anchorChildren = true
	spriteGroup.anchorX = 0
	spriteGroup.anchorY = 0

	local function getSprite( n, y0 )
		local bg
		if( n == 1 ) then
			bg = display.newImage( "assets/conppr_red.jpg" )
		elseif( n == 2 ) then
			bg = display.newImage( "assets/conppr_orange.jpg" )
		elseif( n == 3 ) then
			bg = display.newImage( "assets/conppr_yellow.jpg" )
		end
		bg.x = display.contentWidth * 0.50
		bg.y = y0
		bg.width = display.contentWidth
		bg.height = display.contentHeight
		spriteGroup:insert( bg )
		local txt = display.newText({
			text = n,
			font = native.systemFontBold,
			fontSize = 96,
		})
		txt.x = display.contentWidth * 0.50
		txt.y = y0
		txt:setFillColor( 0,0,0 )
		spriteGroup:insert( txt )
	end

	local y = display.contentHeight * 0.50
	local s3 = getSprite( 3, y )
	local s2 = getSprite( 2, 3*y )
	local s1 = getSprite( 1, 5*y )

	group:insert( spriteGroup )
	group.spriteGroup = spriteGroup

end

-- Called immediately after scene has moved onscreen:
function scene:enterScene( event )
	dprint( 10, "enterScene-CountdownScreen" )

	local group = self.view

	group.spriteGroup.y = 0

	transition.to( group.spriteGroup, {
		time = 3000,
		y = -2*display.contentHeight,
		onComplete = function(e)
			if( settings.game == "Puzzle" ) then
				storyboard.gotoScene( "scripts.PuzzleScreen" )
			elseif( settings.game == "Rotate" ) then
				storyboard.gotoScene( "scripts.RotateScreen" )
			elseif( settings.game == "Toggle" ) then
				storyboard.gotoScene( "scripts.ToggleScreen" )
			end
		end
	} )

end

-- Called when scene is about to move offscreen:
function scene:exitScene( event )
	dprint( 10, "exitScene-CountdownScreen" )

	local group = self.view

end

-- Called prior to the removal of scene's "view" (display group)
function scene:destroyScene( event )
	dprint( 10, "destroyScene-CountdownScreen" )

	local group = self.view

	-----------------------------------------------------------------------------

	--	INSERT code here (e.g. remove listeners, widgets, save state, etc.)

	-----------------------------------------------------------------------------

end

---------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
---------------------------------------------------------------------------------

-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )

-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )

-- "exitScene" event is dispatched before next scene's transition begins
scene:addEventListener( "exitScene", scene )

-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )

---------------------------------------------------------------------------------

return scene


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.github.scarviz.flightctrl4unity" >

    <uses-feature android:name="android.hardware.type.watch" />

    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.DeviceDefault" >
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <uses-library
            android:name="com.google.android.wearable"
            android:required="false" />

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.DeviceDefault.Light" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <service
            android:name=".SensorService"
            android:enabled="true"
            android:exported="false" >
        </service>
    </application>

</manifest>


text:
package com.intellij.debugger.settings;

import com.intellij.debugger.engine.JVMNameUtil;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiAnnotationMemberValue;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiParameter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

public final class CaptureSettingsProvider {
  private static final Logger LOG = Logger.getInstance(CaptureSettingsProvider.class);

  private static final KeyProvider THIS_KEY = new StringKeyProvider("this");
  private static final String ANY = "*";

  @NotNull
  public static Properties getPointsProperties(@Nullable Project project) {
    Properties res = new Properties();
    if (Registry.is("debugger.capture.points.agent.annotations")) {
      int idx = 0;
      for (CaptureSettingsProvider.AgentPoint point : getAnnotationPoints(project)) {
        res.setProperty((point.isCapture() ? "capture" : "insert") + idx++,
                        point.myClassName + AgentPoint.SEPARATOR +
                        point.myMethodName + AgentPoint.SEPARATOR +
                        point.myMethodDesc + AgentPoint.SEPARATOR +
                        point.myKey.asString());
      }
    }
    return res;
  }

  private static List<AgentPoint> getAnnotationPoints(@Nullable Project project) {
    return ReadAction.compute(() -> {
      List<AgentPoint> annotationPoints = new ArrayList<>();
      CaptureConfigurable.processCaptureAnnotations(project, (capture, e, annotation) -> {
        PsiMethod method;
        KeyProvider keyProvider;
        if (e instanceof PsiMethod) {
          method = (PsiMethod)e;
          keyProvider = THIS_KEY;
        }
        else if (e instanceof PsiParameter) {
          PsiParameter psiParameter = (PsiParameter)e;
          method = (PsiMethod)psiParameter.getDeclarationScope();
          keyProvider = param(method.getParameterList().getParameterIndex(psiParameter));
        }
        else {
          return;
        }
        String classVMName = JVMNameUtil.getClassVMName(method.getContainingClass());
        if (classVMName == null) {
          LOG.warn("Unable to find VM class name for annotated method: " + method.getName());
          return;
        }
        String className = classVMName.replaceAll("\\.", "/");
        String methodName = JVMNameUtil.getJVMMethodName(method);
        String methodDesc = ANY;
        try {
          methodDesc = JVMNameUtil.getJVMSignature(method).getName(null);
        }
        catch (EvaluateException ex) {
          LOG.error(ex);
        }

        PsiAnnotationMemberValue keyExpressionValue = annotation.findAttributeValue("keyExpression");
        if (keyExpressionValue != null && !"\"\"".equals(keyExpressionValue.getText())) {
          keyProvider = new FieldKeyProvider(className, StringUtil.unquoteString(keyExpressionValue.getText())); //treat as a field
        }
        AgentPoint point = capture ?
                           new AgentCapturePoint(className, methodName, methodDesc, keyProvider) :
                           new AgentInsertPoint(className, methodName, methodDesc, keyProvider);
        annotationPoints.add(point);
      });
      return annotationPoints;
    });
  }

  private static abstract class AgentPoint {
    public final String myClassName;
    public final String myMethodName;
    public final String myMethodDesc;
    public final KeyProvider myKey;

    private static final String SEPARATOR = " ";

    AgentPoint(String className, String methodName, String methodDesc, KeyProvider key) {
      assert !className.contains(".") : "Classname should not contain . here";
      myClassName = className;
      myMethodName = methodName;
      myMethodDesc = methodDesc;
      myKey = key;
    }

    public abstract boolean isCapture();

    @Override
    public String toString() {
      return myClassName + "." + myMethodName + " " + myKey.asString();
    }
  }

  private static class AgentCapturePoint extends AgentPoint {
    AgentCapturePoint(String className, String methodName, String methodDesc, KeyProvider key) {
      super(className, methodName, methodDesc, key);
    }

    @Override
    public boolean isCapture() {
      return true;
    }
  }

  private static class AgentInsertPoint extends AgentPoint {
    AgentInsertPoint(String className, String methodName, String methodDesc, KeyProvider key) {
      super(className, methodName, methodDesc, key);
    }

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

  private interface KeyProvider {
    String asString();
  }

  private static KeyProvider param(int idx) {
    return new StringKeyProvider(Integer.toString(idx));
  }

  private static class StringKeyProvider implements KeyProvider {
    private final String myValue;

    StringKeyProvider(String value) {
      myValue = value;
    }

    @Override
    public String asString() {
      return myValue;
    }
  }

  private static class FieldKeyProvider implements KeyProvider {
    private final String myClassName;
    private final String myFieldName;

    FieldKeyProvider(String className, String fieldName) {
      myClassName = className;
      myFieldName = fieldName;
    }

    @Override
    public String asString() {
      return myClassName + AgentPoint.SEPARATOR + myFieldName;
    }
  }
}


text:
package tw.edu.sinica.iis.SSHadoop;

public class SSHadoopCmd {
	private String userBase = "";
	private String serverSpecialCmd = "";
	private String binaryLocation = "";

	private class cmd {
		final static String cd = "cd ";
		final static String sh = "sh ";
		final static String ls = "ls ";
		final static String rm = "rm ";
		final static String cat = "cat ";
		final static String tail = "tail ";
		final static String wget = "wget ";
		final static String grep = "grep ";
		final static String mkdir = "mkdir ";
		final static String pkill = "pkill ";
		final static String touch = "touch ";
	}

	private class hdpCmd {
		final static String ls = "hadoop fs -ls ";
		final static String put = "hadoop fs -put ";
		final static String get = "hadoop fs -get ";
		final static String rmr = "hadoop fs -rmr ";
		final static String mfl = "hadoop fs -moveFromLocal ";
		final static String cfl = "hadoop fs -copyFromLocal ";
		final static String mtl = "hadoop fs -moveToLocal ";
		final static String ctl = "hadoop fs -copyToLocal ";

		final static String getmerge = "hadoop fs -getmerge ";
		final static String mkdir = "hadoop fs -mkdir ";

		final static String jar = "hadoop jar ";

		final static String job_status = "hadoop job -status ";
	}

	public void setServerSpecialCmd(final String specialCmd) {
		serverSpecialCmd = specialCmd;
	}

	public void setBinaryLocation(final String binLoc) {
		binaryLocation = binLoc;
	}

	public void setUserBase(final String baseName) {
		if (!"".equals(baseName))
			userBase = baseName + "/";
	}

	public SSHadoopCmd() {
	}

	public SSHadoopCmd(final String userBase, final String specialCmd) {
		setUserBase(userBase);
		setServerSpecialCmd(specialCmd);
	}

	public String ls(final String dir) {
		return cmd.ls + userBase + dir;
	}

	public String cat(final String filePath) {
		return cmd.cat + userBase + filePath;
	}

	public String mkdir(final String filePath, final boolean recursive) {
		String recurMode = "";
		if (recursive) {
			recurMode = "-p ";
		}
		return cmd.mkdir + recurMode + userBase + filePath;
	}

	public String touch(final String filePath) {
		return cmd.touch + userBase + filePath;
	}

	public String rm(final String filePath) {
		return cmd.rm + userBase + filePath;
	}

	public String lsHdp(final String dir) {
		return serverSpecialCmd + "; " + hdpCmd.ls + userBase + dir;
	}

	public String putHdp(final String localDir, final String remoteDir) {
		return serverSpecialCmd + "; " + hdpCmd.put + " " + userBase + localDir
				+ " " + userBase + remoteDir;
	}

	public String getHdp(final String remoteDir, final String localDir) {
		return serverSpecialCmd + "; " + hdpCmd.get + " " + userBase
				+ remoteDir + " " + userBase + localDir;
	}

	public String rmrHdp(final String remoteDir) {
		return serverSpecialCmd + "; " + hdpCmd.rmr + userBase + remoteDir;
	}

	public String moveFromLocalHdp(final String localDir, final String remoteDir) {
		return serverSpecialCmd + "; " + hdpCmd.mfl + " " + userBase + localDir
				+ " " + userBase + remoteDir;
	}

	public String copyFromLocalHdp(final String localDir, final String remoteDir) {
		return serverSpecialCmd + "; " + hdpCmd.cfl + " " + userBase + localDir
				+ " " + userBase + remoteDir;
	}

	public String moveToLocalHdp(final String remoteDir, final String localDir) {
		return serverSpecialCmd + "; " + hdpCmd.mtl + " " + userBase
				+ remoteDir + " " + userBase + localDir;
	}

	public String copyToLocalHdp(final String remoteDir, final String localDir) {
		return serverSpecialCmd + "; " + hdpCmd.ctl + " " + userBase
				+ remoteDir + " " + userBase + localDir;
	}

	public String getMergeRstHdp(final String remoteRstDir,
			final String localFile) {
		return serverSpecialCmd + "; " + hdpCmd.getmerge + " " + userBase
				+ remoteRstDir + " " + userBase + localFile;
	}

	public String mkdirHdp(final String filePath, final String userName,
			final boolean recursive) {
		String recurMode = "";
		if (recursive) {
			recurMode = "-p ";
		}
		return serverSpecialCmd + "; " + hdpCmd.mkdir + recurMode + "/user/"
				+ userName + "/" + userBase + filePath;
	}

	public String jarHdp(final String jarPath, final String jarClsName,
			final String params) {
		return serverSpecialCmd + "; " + hdpCmd.jar + " " + jarPath + " "
				+ jarClsName + " " + params;
	}

	public String jobStatusHdp(final String jobId) {
		return serverSpecialCmd + "; " + hdpCmd.job_status + " " + jobId;
	}

	public String CBStepAndId(final String workDir, final String logFile,
			final int tailLineCnt) {
		String count = "";
		if (tailLineCnt > 0) {
			count = "-n " + tailLineCnt + " ";
		}
		return cmd.tail + count + userBase + workDir + "/" + logFile;
	}

	public String CBKillJob(final String UID) {
		return cmd.pkill + "-f " + UID;
	}

	public String OCIRun(final String shellScript, final String logFile) {
		return "cd " + binaryLocation + "; " + cmd.sh + " ./" + shellScript
				+ " >" + logFile;
	}

	public String OCILog(final String logFile, final int tailLineCnt) {
		String count = "";
		if (tailLineCnt > 0) {
			count = "-n " + tailLineCnt + " ";
		}
		return cmd.grep + " \"^\\(---- \\[\\).*\" " + logFile + " | "
				+ cmd.tail + count;
	}

	public String OCIClenup(final String location) {
		return cmd.rm + " -rf " + location;
	}

	public String PPIRun(final String installCmd, final String shellFile,
			final String logFile) {
		return cmd.cd + binaryLocation + "; " + cmd.rm + "plugins/* ;"
				+ cmd.wget + shellFile + " -P plugins/ ; " + cmd.sh + " ./"
				+ installCmd + " > " + logFile;
	}

	public String PPIStatus(final String shellScript, final String pidFilePath) {
		return "cd " + binaryLocation + "; " + cmd.sh + " ./" + shellScript
				+ " " + pidFilePath;
	}

	public String PPILog(final String logFile, final int tailLineCnt) {
		String count = "";
		if (tailLineCnt > 0) {
			count = "-n " + tailLineCnt + " ";
		}
		return cmd.grep + " \"^[^\\r\\n]\" " + logFile + " | " + cmd.tail
				+ count;
	}
}


text:
@class MWMWelcomePageController;
@class MWMMapViewControlsManager;
@class MWMAPIBar;
@class MWMPlacePageData;
@class EAGLView;
@class MWMMapDownloadDialog;
@protocol MWMLocationModeListener;

@interface MapViewController : MWMViewController

+ (MapViewController *)sharedController;
- (void)addListener:(id<MWMLocationModeListener>)listener;
- (void)removeListener:(id<MWMLocationModeListener>)listener;

// called when app is terminated by system
- (void)onTerminate;
- (void)onGetFocus:(BOOL)isOnFocus;

- (void)updateStatusBarStyle;

- (void)performAction:(NSString *)action;

- (void)openBookmarks;
- (void)openMapsDownloader:(MWMMapDownloaderMode)mode;
- (void)openEditor;
- (void)openHotelFacilities;
- (void)openBookmarkEditorWithData:(MWMPlacePageData *)data;
- (void)openFullPlaceDescriptionWithHtml:(NSString *)htmlString;
- (void)showUGCAuth;
- (void)showBookmarksLoadedAlert:(UInt64)categoryId;
- (void)openCatalogAnimated:(BOOL)animated utm:(MWMUTM)utm;
- (void)openCatalogDeeplink:(NSURL *)deeplinkUrl animated:(BOOL)animated utm:(MWMUTM)utm;
- (void)openCatalogAbsoluteUrl:(NSURL *)url animated:(BOOL)animated utm:(MWMUTM)utm;
- (void)searchText:(NSString *)text;
- (void)openDrivingOptions;

- (void)showRemoveAds;
- (void)setPlacePageTopBound:(CGFloat)bound;

+ (void)setViewport:(double)lat lon:(double)lon zoomLevel:(int)zoomlevel;

- (void)initialize;
- (void)enableCarPlayRepresentation;
- (void)disableCarPlayRepresentation;

@property(nonatomic, readonly) MWMMapViewControlsManager * controlsManager;
@property(nonatomic) MWMAPIBar * apiBar;
@property(nonatomic) MWMWelcomePageController * welcomePageController;
@property(nonatomic, readonly) MWMMapDownloadDialog * downloadDialog;

@property(nonatomic) MWMMyPositionMode currentPositionMode;
@property(strong, nonatomic) IBOutlet EAGLView * _Nonnull mapView;
@property(strong, nonatomic) IBOutlet UIView * _Nonnull controlsView;

@end


text:
package com.android.build.gradle.model;

import com.android.annotations.NonNull;
import com.android.build.gradle.managed.NdkConfig;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;

import java.util.List;
import java.util.Set;

/**
 * Implementation of NdkConfig.
 * Used in AndroidBinary, which is currently not a Managed type.
 */
public class NdkConfigImpl implements NdkConfig {

    String moduleName;

    String toolchain;

    String toolchainVersion;

    Set<String> abiFilters = Sets.newHashSet();

    List<String> cFlags = Lists.newArrayList();

    List<String> cppFlags = Lists.newArrayList();

    List<String> ldFlags = Lists.newArrayList();

    List<String> ldLibs = Lists.newArrayList();

    String stl;

    Boolean isDebuggable;

    Boolean renderscriptNdkMode;

    @Override
    public String getModuleName() {
        return moduleName;
    }

    @Override
    public void setModuleName(@NonNull String moduleName) {
        this.moduleName = moduleName;
    }

    @Override
    public String getToolchain() {
        return toolchain;
    }

    @Override
    public void setToolchain(@NonNull String toolchain) {
        this.toolchain = toolchain;
    }

    @Override
    public String getToolchainVersion() {
        return toolchainVersion;
    }

    @Override
    public void setToolchainVersion(@NonNull String toolchainVersion) {
        this.toolchainVersion = toolchainVersion;
    }

    @Override
    public Set<String> getAbiFilters() {
        return abiFilters;
    }

    @Override
    public void setAbiFilters(@NonNull Set<String> abiFilters) {
        throw new UnsupportedOperationException("Field should not be set.");
    }

    @Override
    public List<String> getCFlags() {
        return cFlags;
    }

    @Override
    public void setCFlags(@NonNull List<String> cFlags) {
        throw new UnsupportedOperationException("Field should not be set.");
    }

    @Override
    public List<String> getCppFlags() {
        return cppFlags;
    }

    @Override
    public void setCppFlags(@NonNull List<String> cppFlags) {
        throw new UnsupportedOperationException("Field should not be set.");
    }

    @Override
    public List<String> getLdFlags() {
        return ldFlags;
    }

    @Override
    public void setLdFlags(@NonNull List<String> ldFlags) {
        throw new UnsupportedOperationException("Field should not be set.");
    }

    @Override
    public List<String> getLdLibs() {
        return ldLibs;
    }

    @Override
    public void setLdLibs(@NonNull List<String> ldLibs) {
        throw new UnsupportedOperationException("Field should not be set.");
    }

    @Override
    public String getStl() {
        return stl;
    }

    @Override
    public void setStl(@NonNull String stl) {
        this.stl = stl;
    }

    @Override
    public Boolean getDebuggable() {
        return isDebuggable;
    }

    @Override
    public void setDebuggable(Boolean isDebuggable) {
        this.isDebuggable = isDebuggable;
    }

    @Override
    public Boolean getRenderscriptNdkMode() {
        return renderscriptNdkMode;
    }

    @Override
    public void setRenderscriptNdkMode(Boolean renderscriptNdkMode) {
        this.renderscriptNdkMode = renderscriptNdkMode;
    }
}


text:
import * as React from 'react';
import classNames from 'classnames/dedupe'; // eslint-disable-line import/default
import {CommonProps} from './common-prop-types';

type ControlProps = React.SelectHTMLAttributes<HTMLSelectElement>;
type ControlPropsCleaned = Omit<ControlProps, 'id' | 'name'>;

interface SelectOption {
  value: string;
  label: string;
  group?: string;
}

interface Props extends CommonProps, ControlPropsCleaned {
  options: SelectOption[];
  multiple: boolean;
  elementRef: React.RefObject<HTMLSelectElement>;
}

type State = Record<string, unknown>;

class SelectControl extends React.Component<Props, State> {
  public static defaultProps = {
    multiple: false,
    elementRef: React.createRef<HTMLSelectElement>(),
  };

  public constructor(props) {
    super(props);
  }

  private renderOption = (item: SelectOption, key: string): JSX.Element => {
    const {label, value, ...rest} = item;
    const option = (
      <option key={key} value={value} {...rest}>
        {label}
      </option>
    );
    return option;
  };

  public render(): JSX.Element {
    const {options} = this.props;

    let groups = options
      .filter((item): string => (item.group ? item.group : ''))
      .map((item): string => (item.group ? item.group : ''));

    // Get the unique items in group.
    const onlyUnique = (value, index, self): boolean => {
      return self.indexOf(value) === index;
    };

    groups = groups.filter(onlyUnique);

    let optionNodes: React.ReactNode[];

    if (groups.length === 0) {
      optionNodes = options.map((item, index) => {
        return this.renderOption(item, `${index}`);
      });
    } else {
      // For items without groups.
      const itemsWithoutGroup = options.filter((item): boolean => !item.group);

      optionNodes = itemsWithoutGroup.map((item, index) => {
        return this.renderOption(item, `no-group-${index}`);
      });

      groups.forEach((group, groupIndex): void => {
        const groupItems = options.filter(
          (item): boolean => item.group === group,
        );

        const groupOptionNodes = groupItems.map((item, index) =>
          this.renderOption(item, `${groupIndex}-${index}`),
        );

        optionNodes.push(
          <optgroup label={group} key={groupIndex}>
            {groupOptionNodes}
          </optgroup>,
        );
      });
    }

    const {className, elementRef, ...selectProps} = this.props;
    //delete selectProps.options;

    return (
      <select
        {...selectProps}
        className={classNames(['custom-select', className])}
        ref={elementRef}>
        {optionNodes}
      </select>
    );
  }
}

export {Props};
export default SelectControl;


text:
package org.springframework.social.linkedin.api.impl.json;

import java.util.List;

import org.springframework.social.linkedin.api.Comment;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
abstract class CommentsMixin extends LinkedInObjectMixin {

	@JsonCreator
	CommentsMixin(
		@JsonProperty("values") List<Comment> comments) {}

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Event.Owner (RestFB)</title>
<meta name="date" content="2014-01-27">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.restfb.types

Class Event.Owner

java.lang.Object

com.restfb.types.Event.Owner

All Implemented Interfaces:

Serializable

Enclosing class:

Event

public static class Event.Owner
extends Object
implements Serializable

Represents the Event Owner Graph API type.

Since:

1.6.13

Author:

Mark Allen

See Also:

Serialized Form

Constructor Summary

Constructors

Constructor and Description

Event.Owner()

Method Summary

Methods

Modifier and Type
Method and Description

boolean
equals(Object that)

String
getCategory()

The category for this owner.

List<Event.Category>
getCategoryList()

List of other categories for this owner.

String
getId()

The unique identifier for this owner.

String
getName()

The name of this owner.

int
hashCode()

String
toString()

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Constructor Detail

Event.Owner

public Event.Owner()

Method Detail

hashCode

public int hashCode()

Overrides:

hashCode in class Object

See Also:

Object.hashCode()

equals

public boolean equals(Object that)

Overrides:

equals in class Object

See Also:

Object.equals(java.lang.Object)

toString

public String toString()

Overrides:

toString in class Object

See Also:

Object.toString()

getId

public String getId()

The unique identifier for this owner.

Returns:

The unique identifier for this owner.

getName

public String getName()

The name of this owner.

Returns:

The name of this owner.

getCategory

public String getCategory()

The category for this owner.

Returns:

The category for this owner.

getCategoryList

public List<Event.Category> getCategoryList()

List of other categories for this owner.

Returns:

List of other categories for this owner.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

RestFB 1.6.14. Copyright © 2010-2013 Mark Allen. All Rights Reserved.


text:
{MESSAGES}

		<form action="{URI|htmlspecialchars}" method="post" enctype="multipart/form-data" id="add_new_file">

Do you want to overwrite file {OVERWRITE_FILE.filename}?

			<fieldset class="confirmOverwrite">
				<input type="hidden" name="filename" value="{OVERWRITE_FILE.filename}" />
				<input type="hidden" name="save_dir" value="{OVERWRITE_FILE.save_dir}" />
				<input type="hidden" name="temp_file" value="{OVERWRITE_FILE.temp_file}" />
				<button type="submit" name="overwrite" value="overwrite" title="Overwrite file {OVERWRITE_FILE.filename}?">Yes, overwrite it.</button>
			</fieldset>

				<fieldset class="addFolder single">

						{FOLDER_HEAD} <input id="add-folder-input" type="text" name="new_folder" value="{GET.new_folder}" placeholder="New Folder Name" />
						<button type="submit" name="create" value="create" class="create">Create</button>

				</fieldset>

				<fieldset class="addNew single dropzone-wrap">

Drop files here

						Max. {MAX_FILES} files, {MAX_FILE_SIZE}MB each

						<input id="add-file-input" type="file" name="file" class="file multi" multiple />
						<button type="submit" name="create" value="create">Submit File</button> Max size: {MAX_FILE_SIZE} MB

				</fieldset>

				<fieldset style="padding-top: 20px;">

Please select a folder on the left or create a new folder. You are not allowed to upload any assets to the root folder.

				</fieldset>

			<input type="hidden" name="open" value="{GET.open}" />

		<input type="hidden" name="csrf_token" value="{CSRF_TOKEN}" />
</form>

		Please wait, uploading 0 file(s)...

		<progress value="0" max="100">0%</progress>

					{ITEM.name|str_replace('_', ' ', %s)}

					View
					Download
					View more details

					{FILE_USAGE}x

					Use

					Delete
					Import this ...

This folder is empty. Do you want to remove this folder? Yes, delete?


text:
package it.mediv.controller.rest;

import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;

import it.mediv.controller.adapter.MessageResp;

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class AnonymousControllerTest {

	@Autowired
	private TestRestTemplate restTemplate;

	@Test
	public void createClient() {
		ResponseEntity<MessageResp> responseEntity = restTemplate.getForEntity("/anonymous/greetings",
				MessageResp.class);
		MessageResp client = responseEntity.getBody();
		assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
		assertEquals("Hey!!! How is going???", client.getResponce());

	}
}


text:
package com.myapp.tracyweather.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class WeatherDbOpenHelper extends SQLiteOpenHelper{

	//province±í½¨±íÓï¾ä
	public static final String CREATE_PROVINCE="create table Province ("
			+"id integer primary key autoincrement, "
			+"province_name text,"
			+"province_code text)";

	public static final String CREATE_CITY="create table City("
			+"id integer primary key autoincrement,"
			+"city_name text,"
			+"city_code,"
			+"province_id integer)";

	public static final String CREATE_COUNTY="create table County("
			+"id integer primary key autoincrement,"
			+"county_name text,"
			+"county_code text,"
			+"city_id integer)";

	public WeatherDbOpenHelper(Context context, String name, CursorFactory factory, int version) {
		super(context, name, factory, version);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		db.execSQL(CREATE_PROVINCE);
		db.execSQL(CREATE_CITY);
		db.execSQL(CREATE_COUNTY);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub

	}

}


text:
exopy.tasks.tasks.logic.loop_task module
=======================================

.. automodule:: exopy.tasks.tasks.logic.loop_task
    :members:
    :undoc-members:
    :show-inheritance:


text:
package org.simpleds;

import static java.lang.System.out;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import com.google.appengine.api.datastore.Entity;
import org.junit.Test;
import org.simpleds.exception.RequiredFieldException;
import org.simpleds.functions.EntityToKeyFunction;
import org.simpleds.testdb.*;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

public class EntityManagerTest extends AbstractEntityManagerTest {

	@Test
	public void testSinglePutSuccess() {
		// root entity
		Dummy1 dummy = Dummy1.create();
		entityManager.put(dummy);
		assertNotNull(dummy.getKey());

		// parent-child
		Dummy2 dummy2 = createDummy2();
		entityManager.put(dummy.getKey(), dummy2);
		assertEquals(dummy2.getKey(), entityManager.findChildrenKeys(dummy.getKey(), Dummy2.class).get(0));
	}

	@Test
	public void testSingleGet() {
		Dummy1 dummy = Dummy1.create();
		entityManager.put(dummy);
		Dummy1 retrieved = entityManager.get(dummy.getKey());
		assertNotNull(retrieved);
		assertEquals(dummy.getKey(),  retrieved.getKey());
		assertEquals("foobar", dummy.getBigString());
	}

	@Test
	public void testEmptyGet() {
		assertEquals(ImmutableMap.of(), entityManager.get(Collections.EMPTY_LIST));
	}

	@Test
	public void testEmptyPut() {
		entityManager.put(Collections.EMPTY_LIST);
	}

	@Test
	public void testMultipleGet() {
		Dummy1 dummy1 = Dummy1.create();
		dummy1.setName("dummy1");
		Dummy1 dummy2 = Dummy1.create();
		dummy2.setName("dummy2");
		ImmutableList<Dummy1> dummies = ImmutableList.of(dummy1, dummy2);
		entityManager.put(dummies);

		Map<Key, Dummy1> retrieved = entityManager.get(Collections2.transform(dummies, new EntityToKeyFunction<Dummy1>(Dummy1.class)));
		assertEquals("dummy1", retrieved.get(dummy1.getKey()).getName());
		assertEquals("dummy2", retrieved.get(dummy2.getKey()).getName());
	}

	@Test
	public void testMixedGetAndPut() {
		Dummy1 dummy1 = Dummy1.create();
		Dummy3 dummy3 = new Dummy3();
		dummy3.setKey(KeyFactory2.createKey(Dummy3.class, 1));
		CacheableEntity cacheableEntity = CacheableEntity.create();
		BasicVersionedClass vc = new BasicVersionedClass();

		List l = ImmutableList.of(dummy3, dummy1, cacheableEntity, vc);
		entityManager.put(l);

		// modify the datastore value to check it is using the cached version
        Entity e = entityManager.javaToDatastore(cacheableEntity);
        e.setProperty(Attrs.NAME, "xxx");
        datastoreService.put(e);
		assertEquals((Long) 0L, vc.getVersion());

		Collection keys = Collections2.transform(l, new EntityToKeyFunction());
		Map<Key, ?> retrieved = entityManager.get(keys);
		Dummy3 retrievedDummy3 = (Dummy3) retrieved.get(dummy3.getKey());
		Dummy1 retrievedDummy1 = (Dummy1) retrieved.get(dummy1.getKey());
		CacheableEntity retrievedCacheableEntity = (CacheableEntity) retrieved.get(cacheableEntity.getKey());
		BasicVersionedClass retrievedVC = (BasicVersionedClass) retrieved.get(vc.getKey());

		assertEquals(dummy3.getKey(), retrievedDummy3.getKey());
		assertEquals(dummy1.getKey(), retrievedDummy1.getKey());
		assertEquals(dummy1.getName(), retrievedDummy1.getName());
		assertEquals(dummy1.getBigString(), retrievedDummy1.getBigString());
		assertEquals("foo", retrievedCacheableEntity.getName());
		assertEquals(vc.getKey(), retrievedVC.getKey());
		assertEquals((Long) 0L, retrievedVC.getVersion());

		entityManager.put(l);
		retrieved = entityManager.get(keys);
		retrievedVC = (BasicVersionedClass) retrieved.get(vc.getKey());
		assertEquals((Long) 1L, retrievedVC.getVersion());
	}

	@Test
	public void testVersionedWithPK() {
		BasicVersionedClass vc = new BasicVersionedClass();
		vc.setKey(KeyFactory2.createKey(BasicVersionedClass.class, 10));
		List l = ImmutableList.of(vc);
		entityManager.put(l);
		assertEquals((Long) 0L, vc.getVersion());

		BasicVersionedClass vc2 = new BasicVersionedClass();
		vc.setKey(KeyFactory2.createKey(BasicVersionedClass.class, 11));
		entityManager.put(vc2);
		assertEquals((Long) 0L, vc2.getVersion());

	}

	@Test
	public void testMultipleGetFail() {
		entityManager.get(ImmutableList.of(KeyFactory2.createKey(Dummy1.class, 1)));
	}

	@Test
	@SuppressWarnings("cast")
	public void testMultiplePutWithKeysSuccess() {
		// root entities
		Key key = KeyFactory.createKey(Kinds.DUMMY1, 1);
		Dummy1 dummy1 = Dummy1.create();
		dummy1.setKey(key);
		Dummy1 dummy2 = Dummy1.create();
		dummy2.setKey(KeyFactory.createKey(Kinds.DUMMY1, 2));
		entityManager.put(Arrays.asList(dummy1, dummy2));

		// parent-childs
		entityManager.put(key, Arrays.asList(createDummy2(), createDummy2(), createDummy2()));
		assertEquals(3, entityManager.findChildrenKeys(key, Dummy2.class).size());
	}

	@Test
	@SuppressWarnings("cast")
	public void testMultiplePutWithoutKeysSuccess() {
		// root entities
		Dummy1 dummy1 = Dummy1.create();
		Dummy1 dummy2 = Dummy1.create();
		Dummy1 dummy3 = Dummy1.create();
		dummy3.setKey(Dummy1.createDummyKey());
		entityManager.put(Arrays.asList(dummy1, dummy2, dummy3));
		assertNotNull(dummy1.getKey());
		assertNotNull(dummy2.getKey());
		assertNotNull(dummy3.getKey());

		// parent-childs
		List<Dummy2> children = Arrays.asList(createDummy2(), createDummy2(), createDummy2());
		entityManager.put(dummy1.getKey(), children);
		assertNotNull(children.get(0).getKey());
	}

	@Test
	public void testPutParentFail() throws Exception {
		// root entity with a parent
		putShouldFail(Dummy1.createDummyKey(), new Root());

		// child entity with wrong parent
		putShouldFail(Dummy1.createDummyKey(), new Child());

		// child entity without parent
		putShouldFail(null, new Child());
	}

	@Test
	public void testGetParentFail() throws Exception {
		// same for searches
		findShouldFail(Dummy1.createDummyKey(), Root.class);
		findShouldFail(Dummy1.createDummyKey(), Child.class);
	}

	@Test
	public void testPutMissingRequiredKey() {
		// dummy3 has not especified @GeneratedValue
		Dummy3 dummy3 = createDummy3();
		putShouldFail(null, dummy3);
	}

	@Test
	public void testPutMissingRequiredFields() {
		Dummy1 dummy = new Dummy1();
		putShouldFail(null, dummy);
	}

	@Test
	public void testFind() {
		Dummy1  dummy = Dummy1.create();
		entityManager.put(dummy);
		SimpleQuery query = entityManager.createQuery(Dummy1.class).equal(Attrs.NAME, "foo");
		List<Dummy1> result = entityManager.find(query);
		assertTrue(result.size() >= 1);
		assertEquals("foo", result.get(0).getName());
	}

	@Test(expected=IllegalArgumentException.class)
	public void testFindByUnmappedProperty() throws Exception {
		entityManager.find(entityManager.createQuery(Dummy1.class).equal("xxx", "foo"));
	}

	@Test
	public void testValidateParentPass() throws Exception {
		Root  root = new Root();
		Child child = new Child();
		List<Child> childList = Arrays.asList(new Child(), new Child());
		List<Root> rootList = Arrays.asList(new Root(), new Root());

		// generate root keys
		entityManager.put(root);
		entityManager.put(rootList);

		// generate children keys
		entityManager.put(root.getKey(), child);
		entityManager.put(root.getKey(), childList);

		// pre-assigned children keys
		entityManager.put(child);
		entityManager.put(childList);

		// search
		entityManager.findChildren(root.getKey(), Child.class);
		entityManager.find(entityManager.createQuery(Root.class));
		entityManager.find(entityManager.createQuery(Child.class));
	}

	@Test
	public void testRefresh() {
		Dummy1 dummy = Dummy1.create();
		entityManager.put(dummy);
		Dummy1 dummy2 = new Dummy1();
		dummy2.setKey(dummy.getKey());
		entityManager.refresh(dummy2);
		assertEquals(dummy.getKey(), dummy2.getKey());
		assertEquals(dummy.getName(), dummy2.getName());
		assertEquals(dummy.getOverridenNameDate(), dummy2.getOverridenNameDate());
		assertEquals(dummy.getBigString(), dummy2.getBigString());
	}

	private void putShouldFail(Key parentKey, Object instance) {
		try {
			entityManager.put(parentKey, instance);
			fail("Put operation should fail");
		} catch (RequiredFieldException e) {
			out.println(e);
		} catch (IllegalArgumentException e) {
			out.println(e);
		}
		try {
			entityManager.put(parentKey, Arrays.asList(instance));
			fail("Put operation should fail");
		} catch (RequiredFieldException e) {
			out.println(e);
		} catch (IllegalArgumentException e) {
			out.println(e);
		}
	}

	private void findShouldFail(Key parentKey, Class clazz) {
		try {
			entityManager.find(entityManager.createQuery(parentKey, clazz));
			fail("find operation should fail");
		} catch (IllegalArgumentException e) {
			out.println(e);
		}
	}

	private Dummy2 createDummy2() {
		Dummy2 dummy2 = new Dummy2();
		return dummy2;
	}

	private Dummy3 createDummy3() {
		Dummy3 dummy3 = new Dummy3();
		return dummy3;
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<artifactId>araqne-logdb-pom</artifactId>
		<groupId>org.araqne</groupId>
		<version>1.0.0</version>
	</parent>
	<artifactId>araqne-logdb-jmx</artifactId>
	<version>0.2.0</version>
	<packaging>bundle</packaging>
	<name>Araqne LogDB JMX</name>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Bundle-SymbolicName>org.araqne.logdb.jmx
						</Bundle-SymbolicName>
						<Export-Package>
							org.araqne.logdb.jmx;version=${project.version}
						</Export-Package>
						<Import-Package>org.araqne.log.api;version="3.4.0",*</Import-Package>
						<Private-Package>org.araqne.logdb.jmx.impl</Private-Package>
					</instructions>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-ipojo-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>ipojo-bundle</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>pl.project13.maven</groupId>
				<artifactId>git-commit-id-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.ipojo</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.ipojo.annotations
			</artifactId>
		</dependency>
		<dependency>
			<groupId>org.araqne</groupId>
			<artifactId>araqne-api</artifactId>
			<version>3.0.6</version>
		</dependency>
		<dependency>
			<groupId>org.araqne</groupId>
			<artifactId>araqne-log-api</artifactId>
			<version>3.10.4</version>
		</dependency>
		<dependency>
			<groupId>com.sun</groupId>
			<artifactId>tools</artifactId>
			<version>1.6</version>
		</dependency>
	</dependencies>
</project>


text:
package com.google.common.collect;

import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSetMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.SortedSetMultimap;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.stream.Collector;
import java.util.stream.Stream;

public class Multimaps
{
    protected Multimaps() {}
    public static <K, V, M extends Multimap<K, V>> M invertFrom(Multimap<? extends V, ? extends K> p0, M p1){ return null; }
    public static <K, V1, V2> ListMultimap<K, V2> transformEntries(ListMultimap<K, V1> p0, Maps.EntryTransformer<? super K, ? super V1, V2> p1){ return null; }
    public static <K, V1, V2> ListMultimap<K, V2> transformValues(ListMultimap<K, V1> p0, Function<? super V1, V2> p1){ return null; }
    public static <K, V1, V2> Multimap<K, V2> transformEntries(Multimap<K, V1> p0, Maps.EntryTransformer<? super K, ? super V1, V2> p1){ return null; }
    public static <K, V1, V2> Multimap<K, V2> transformValues(Multimap<K, V1> p0, Function<? super V1, V2> p1){ return null; }
    public static <K, V> ImmutableListMultimap<K, V> index(Iterable<V> p0, Function<? super V, K> p1){ return null; }
    public static <K, V> ImmutableListMultimap<K, V> index(Iterator<V> p0, Function<? super V, K> p1){ return null; }
    public static <K, V> ListMultimap<K, V> filterKeys(ListMultimap<K, V> p0, Predicate<? super K> p1){ return null; }
    public static <K, V> ListMultimap<K, V> newListMultimap(Map<K, Collection<V>> p0, Supplier<? extends List<V>> p1){ return null; }
    public static <K, V> ListMultimap<K, V> synchronizedListMultimap(ListMultimap<K, V> p0){ return null; }
    public static <K, V> ListMultimap<K, V> unmodifiableListMultimap(ImmutableListMultimap<K, V> p0){ return null; }
    public static <K, V> ListMultimap<K, V> unmodifiableListMultimap(ListMultimap<K, V> p0){ return null; }
    public static <K, V> Map<K, Collection<V>> asMap(Multimap<K, V> p0){ return null; }
    public static <K, V> Map<K, List<V>> asMap(ListMultimap<K, V> p0){ return null; }
    public static <K, V> Map<K, Set<V>> asMap(SetMultimap<K, V> p0){ return null; }
    public static <K, V> Map<K, SortedSet<V>> asMap(SortedSetMultimap<K, V> p0){ return null; }
    public static <K, V> Multimap<K, V> filterEntries(Multimap<K, V> p0, Predicate<? super Map.Entry<K, V>> p1){ return null; }
    public static <K, V> Multimap<K, V> filterKeys(Multimap<K, V> p0, Predicate<? super K> p1){ return null; }
    public static <K, V> Multimap<K, V> filterValues(Multimap<K, V> p0, Predicate<? super V> p1){ return null; }
    public static <K, V> Multimap<K, V> newMultimap(Map<K, Collection<V>> p0, Supplier<? extends Collection<V>> p1){ return null; }
    public static <K, V> Multimap<K, V> synchronizedMultimap(Multimap<K, V> p0){ return null; }
    public static <K, V> Multimap<K, V> unmodifiableMultimap(ImmutableMultimap<K, V> p0){ return null; }
    public static <K, V> Multimap<K, V> unmodifiableMultimap(Multimap<K, V> p0){ return null; }
    public static <K, V> SetMultimap<K, V> filterEntries(SetMultimap<K, V> p0, Predicate<? super Map.Entry<K, V>> p1){ return null; }
    public static <K, V> SetMultimap<K, V> filterKeys(SetMultimap<K, V> p0, Predicate<? super K> p1){ return null; }
    public static <K, V> SetMultimap<K, V> filterValues(SetMultimap<K, V> p0, Predicate<? super V> p1){ return null; }
    public static <K, V> SetMultimap<K, V> forMap(Map<K, V> p0){ return null; }
    public static <K, V> SetMultimap<K, V> newSetMultimap(Map<K, Collection<V>> p0, Supplier<? extends Set<V>> p1){ return null; }
    public static <K, V> SetMultimap<K, V> synchronizedSetMultimap(SetMultimap<K, V> p0){ return null; }
    public static <K, V> SetMultimap<K, V> unmodifiableSetMultimap(ImmutableSetMultimap<K, V> p0){ return null; }
    public static <K, V> SetMultimap<K, V> unmodifiableSetMultimap(SetMultimap<K, V> p0){ return null; }
    public static <K, V> SortedSetMultimap<K, V> newSortedSetMultimap(Map<K, Collection<V>> p0, Supplier<? extends SortedSet<V>> p1){ return null; }
    public static <K, V> SortedSetMultimap<K, V> synchronizedSortedSetMultimap(SortedSetMultimap<K, V> p0){ return null; }
    public static <K, V> SortedSetMultimap<K, V> unmodifiableSortedSetMultimap(SortedSetMultimap<K, V> p0){ return null; }
    public static <T, K, V, M extends Multimap<K, V>> Collector<T, ? extends Object, M> flatteningToMultimap(Function<? super T, ? extends K> p0, Function<? super T, ? extends Stream<? extends V>> p1, Supplier<M> p2){ return null; }
    public static <T, K, V, M extends Multimap<K, V>> Collector<T, ? extends Object, M> toMultimap(Function<? super T, ? extends K> p0, Function<? super T, ? extends V> p1, Supplier<M> p2){ return null; }
}


text:
package manuel

import scala.util.parsing.input.{ NoPosition, Position }
import com.tristanhunt.knockoff.{ Block, Span }

case class RichHeader(level: Int,
                      attrs: Map[String, String],
                      spans: Seq[Span],
                      position: Position) extends Block

case class RichParagraph(attrs: Map[String, String],
                         spans: Seq[Span],
                         position: Position) extends Block


text:
const { dest, series, parallel, src, symlink } = require('gulp');
const del = require('del');
const inject = require('gulp-inject');
const map = require('map-stream')
const path = require('path');
const rename = require('gulp-rename');
const replace = require('gulp-replace');
const sort = require('gulp-sort');
const through2 = require('through2');
const File = require('vinyl')
const fs = require('fs');

function deleteComponentSymlinks() {
    return del(['components/modules/ROOT/pages/*', '!components/modules/ROOT/pages/index.adoc']);
}

function deleteComponentImageSymlinks() {
    return del(['components/modules/ROOT/assets/images/*']);
}

function createComponentSymlinks() {
    return src(['../core/camel-base/src/main/docs/*.adoc', '../core/camel-jaxp/src/main/docs/*.adoc', '../components/{*,*/*}/src/main/docs/*.adoc'])
        .pipe(map((file, done) => {
            // this flattens the output to just .../pages/....adoc
            // instead of .../pages/camel-.../src/main/docs/....adoc
            file.base = path.dirname(file.path);
            done(null, file);
        }))
        // Antora disabled symlinks, there is an issue open
        // https://gitlab.com/antora/antora/issues/188
        // to reinstate symlink support, until that's resolved
        // we'll simply copy over instead of creating symlinks
        // .pipe(symlink('components/modules/ROOT/pages/', {
        //     relativeSymlinks: true
        // }));
        // uncomment above .pipe() and remove the .pipe() below
        // when antora#188 is resolved
        .pipe(insertSourceAttribute())
        .pipe(dest('components/modules/ROOT/pages/'));
}

function createComponentImageSymlinks() {
    return src('../components/{*,*/*}/src/main/docs/*.png')
        .pipe(map((file, done) => {
            // this flattens the output to just .../pages/....adoc
            // instead of .../pages/camel-.../src/main/docs/....adoc
            file.base = path.dirname(file.path);
            done(null, file);
        }))
        // Antora disabled symlinks, there is an issue open
        // https://gitlab.com/antora/antora/issues/188
        // to reinstate symlink support, until that's resolved
        // we'll simply copy over instead of creating symlinks
        // .pipe(symlink('components/modules/ROOT/pages/', {
        //     relativeSymlinks: true
        // }));
        // uncomment above .pipe() and remove the .pipe() below
        // when antora#188 is resolved
        .pipe(dest('components/modules/ROOT/assets/images/'));
}

function deleteUserManualSymlinks() {
    return del(['user-manual/modules/ROOT/pages/*-eip.adoc', 'user-manual/modules/ROOT/pages/*-language.adoc']);
}

function createUserManualSymlinks() {
    return src(['../core/camel-base/src/main/docs/*.adoc', '../core/camel-jaxp/src/main/docs/*.adoc', '../core/camel-core-engine/src/main/docs/eips/*.adoc'])
        // Antora disabled symlinks, there is an issue open
        // https://gitlab.com/antora/antora/issues/188
        // to reinstate symlink support, until that's resolved
        // we'll simply copy over instead of creating symlinks
        // .pipe(symlink('user-manual/modules/ROOT/pages/', {
        //     relativeSymlinks: true
        // }));
        // uncomment above .pipe() and remove the .pipe() below
        // when antora#188 is resolved
        .pipe(insertSourceAttribute())
        .pipe(dest('user-manual/modules/ROOT/pages/'));
}

function titleFrom(file) {
    const maybeName = /(?:=|#) (.*)/.exec(file.contents.toString())
    if (maybeName == null) {
        throw new Error(`${file.path} doesn't contain Asciidoc heading ('= <Title>') or ('# <Title')`);
    }

    return maybeName[1];
}

function insertGeneratedNotice() {
    return inject(src('./generated.txt'), {
               name: 'generated',
               removeTags: true,
               transform: (filename, file) => {
                   return file.contents.toString('utf8');
               }
           });
}

function insertSourceAttribute() {
    return replace(/^= .+/m, function(match) {
        return `${match}\n:page-source: ${path.relative('..', this.file.path)}`;
    });
}

function createComponentNav() {
    return src('component-nav.adoc.template')
        .pipe(insertGeneratedNotice())
        .pipe(inject(src(['../core/camel-base/src/main/docs/*-component.adoc', '../components/{*,*/*}/src/main/docs/*.adoc']).pipe(sort()), {
            removeTags: true,
            transform: (filename, file) => {
                const filepath = path.basename(filename);
                const title = titleFrom(file);
                return `* xref:${filepath}[${title}]`;
            }
        }))
        .pipe(rename('nav.adoc'))
        .pipe(dest('components/modules/ROOT/'))
}

function createUserManualNav() {
    return src('user-manual-nav.adoc.template')
        .pipe(insertGeneratedNotice())
        .pipe(inject(src('../core/camel-base/src/main/docs/*.adoc').pipe(sort()), {
            removeTags: true,
            name: 'languages',
            transform: (filename, file) => {
                const filepath = path.basename(filename);
                const title = titleFrom(file);
                return ` ** xref:${filepath}[${title}]`;
            }
        }))
        .pipe(inject(src('../core/camel-core-engine/src/main/docs/eips/*.adoc').pipe(sort()), {
            removeTags: true,
            name: 'eips',
            transform: (filename, file) => {
                const filepath = path.basename(filename);
                const title = titleFrom(file);
                return ` ** xref:${filepath}[${title}]`;
            }
        }))
        .pipe(rename('nav.adoc'))
        .pipe(dest('user-manual/modules/ROOT/'))
}

const extractExamples = function(file, enc, next) {
    const asciidoc = file.contents.toString();
    const includes = /(?:include::\{examplesdir\}\/)([^[]+)/g;
    let example;
    let exampleFiles = new Set()
    while (example = includes.exec(asciidoc)) {
        let examplePath = path.resolve(path.join('..', example[1]));
        exampleFiles.add(examplePath);
    }

    exampleFiles.forEach(examplePath => this.push(new File({
        base: path.resolve('..'),
        path: examplePath,
        contents: fs.createReadStream(examplePath)
    })));

    return next();
}

function deleteExamples(){
    return del(['user-manual/modules/ROOT/examples/', 'components/modules/ROOT/examples/']);
}

function createUserManualExamples() {
    return src('user-manual/modules/ROOT/**/*.adoc')
        .pipe(through2.obj(extractExamples))
        .pipe(dest('user-manual/modules/ROOT/examples/'));
}

function createComponentExamples() {
    return src('../components/{*,*/*}/src/main/docs/*.adoc')
        .pipe(through2.obj(extractExamples))
        .pipe(dest('components/modules/ROOT/examples/'));
}

const symlinks = parallel(
  series(deleteComponentSymlinks, createComponentSymlinks),
  series(deleteComponentImageSymlinks, createComponentImageSymlinks),
  series(deleteUserManualSymlinks, createUserManualSymlinks)
);
const nav = parallel(createComponentNav, createUserManualNav);
const examples = series(deleteExamples, createUserManualExamples, createComponentExamples);

exports.symlinks = symlinks;
exports.nav = nav;
exports.examples = examples;
exports.default = series(symlinks, nav, examples);


text:
module.exports = (message) => {
    message.channel.createMessage("https://discordapp.com/oauth2/authorize?permissions=268435488&scope=bot&client_id=254387001556598785");
};


text:
if [ -z "$DO_TOKEN" ];then
	>&2 echo "DO_TOKEN environment variable required"
	exit 1
fi

BASEDIR=$(dirname $0)

$BASEDIR/../do-dns-edit \
	-recordType="TXT" \
	-token="$DO_TOKEN" \
	-domain="$CERTBOT_DOMAIN" \
	-recordName="_acme-challenge" \
	-recordData="$CERTBOT_VALIDATION" \
	-create="true" \


text:
#pragma once

#include <modules/plotting/plottingmoduledefine.h>  // for IVW_MODULE_PLOTTING_API

#include <inviwo/core/properties/boolcompositeproperty.h>      // for BoolCompositeProperty
#include <inviwo/core/properties/invalidationlevel.h>          // for InvalidationLevel, Invalid...
#include <inviwo/core/properties/ordinalproperty.h>            // for FloatProperty, FloatVec4Pr...
#include <inviwo/core/properties/propertysemantics.h>          // for PropertySemantics, Propert...
#include <inviwo/core/properties/stringproperty.h>             // for StringProperty
#include <inviwo/core/util/glmvec.h>                           // for vec2, vec4
#include <modules/fontrendering/properties/fontproperty.h>     // for FontProperty
#include <modules/plotting/datastructures/plottextsettings.h>  // for PlotTextSettings

#include <string>       // for string
#include <string_view>  // for string_view

namespace inviwo {
class FontSettings;

namespace plot {

class IVW_MODULE_PLOTTING_API PlotTextProperty : public PlotTextSettings,
                                                 public BoolCompositeProperty {
public:
    virtual std::string getClassIdentifier() const override;
    static const std::string classIdentifier;

    PlotTextProperty(std::string_view identifier, std::string_view displayName,
                     bool checked = false,
                     InvalidationLevel invalidationLevel = InvalidationLevel::InvalidOutput,
                     PropertySemantics semantics = PropertySemantics::Default);
    PlotTextProperty(const PlotTextProperty& rhs);
    virtual PlotTextProperty* clone() const override;
    virtual ~PlotTextProperty() = default;

    StringProperty title_;
    FloatVec4Property color_;
    FloatProperty position_;  //!< position along axis [0,1]
    FloatProperty offset_;    //!< offset from axis
    FloatProperty rotation_;  //!< Counter-clockwise rotation in degrees,
                              //!  0 degrees means horizontal orientation
    FontProperty font_;

    // Inherited via PlotTextSettings
    virtual bool isEnabled() const override;
    virtual vec4 getColor() const override;
    virtual float getPosition() const override;
    virtual vec2 getOffset() const override;
    virtual float getRotation() const override;
    virtual const FontSettings& getFont() const override;
};

}  // namespace plot

}  // namespace inviwo