text:
import SquashingBuffer from '../src/document/SquashingBuffer'
import Mutation from '../src/document/Mutation'

function add(sb, op) {
  const mut = new Mutation({
    mutations: [op],
  })
  sb.add(mut)
}

function patch(sb, patchDetails) {
  add(sb, {patch: patchDetails})
}

test('basic optimization of assignments to same, explicit key', () => {
  const sb = new SquashingBuffer({_id: '1', _type: 'test', a: 'A string value'})
  patch(sb, {id: '1', set: {a: 'A strong value'}})
  expect(sb.out.length === 0) // There should not be any stashed changes yet
  expect(sb.setOperations).toEqual({
    a: {
      patch: {
        id: '1',
        diffMatchPatch: {
          a: '@@ -2,9 +2,9 @@\n  str\n-i\n+o\n ng v\n',
        },
      },
    },
  })
  patch(sb, {id: '1', set: {a: 'A strange value'}})
  expect(Object.keys(sb.setOperations)).toEqual(['a']) // Should still only be one patch
  patch(sb, {id: '1', set: {a: 'A string value'}})
  expect(Object.keys(sb.setOperations)).toEqual([]) // Should not be any set operations, because that last one should occlude the preceding operations and also be eliminated
})

test('optimisation of assignments to same key with aliases', () => {
  const sb = new SquashingBuffer({_id: '1', _type: 'test', a: 'A string value'})
  patch(sb, {id: '1', set: {a: 'A strange value'}})
  patch(sb, {id: '1', set: {'..a': 'A strong value'}})
  patch(sb, {id: '1', set: {"['a']": 'A strict value'}})
  expect(Object.keys(sb.setOperations)).toEqual(['a']) //  Should only be one key, since every operation above hits the same concrete path
})

test('assigning non-string values to string field', () => {
  const initial = {_id: '1', _type: 'test', a: 'A string value'}
  const sb = new SquashingBuffer(initial)
  patch(sb, {id: '1', set: {a: 42}})
  const mut = sb.purge('txn_id')
  const final = mut.apply(initial)
  expect(final.a).toBe(42)
})

test('stashing of changes when unoptimizable operations arrive', () => {
  const initial = {_id: '1', _type: 'test', a: 'A string value', c: 'Some value'}
  const sb = new SquashingBuffer(initial)
  patch(sb, {id: '1', set: {a: 'Another value'}})
  patch(sb, {id: '1', set: {a: {b: 'A wrapped value'}}})
  expect(sb.out).toBeTruthy() // There should be a stashed mutation since that last patch was not optimisable
  expect(Object.keys(sb.setOperations)).toEqual([]) // All setOperation should be stashed now, so we should not see them in the optimization buffer

  patch(sb, {id: '1', set: {c: 'Change after stash'}})
  const mut = sb.purge('txn_id')
  const final = mut.apply(initial)
  expect(final).toEqual({
    _id: '1',
    _type: 'test',
    _rev: 'txn_id',
    a: {
      b: 'A wrapped value',
    },
    c: 'Change after stash',
  })
})

test('de-duplicate createIfNotExists', () => {
  const initial = {_id: '1', _type: 'test', a: 'A string value', c: 'Some value'}
  const sb = new SquashingBuffer(initial)
  add(sb, {createIfNotExists: {_id: '1', _type: 'test', a: 'A string value', c: 'Some value'}})
  patch(sb, {id: '1', set: {a: 'Another value'}})
  patch(sb, {id: '1', set: {a: {b: 'A wrapped value'}}})
  add(sb, {createIfNotExists: {_id: '1', _type: 'test', a: 'A string value', c: 'Changed'}})
  patch(sb, {id: '1', set: {a: 'Another value'}})
  patch(sb, {id: '1', set: {a: {b: 'A wrapped value'}}})

  const tx = sb.purge('txn_id')

  // Check that one of the creates were removed:
  const creates = tx.mutations.filter((mut) => !!mut.createIfNotExists)
  expect(1).toEqual(creates.length) // Only a single create mutation expected

  // And that the final state still applies:
  const final = tx.apply(initial)
  expect(final).toEqual({
    _id: '1',
    _type: 'test',
    _rev: 'txn_id',
    a: {
      b: 'A wrapped value',
    },
    c: 'Some value',
  })

  // Make sure a new patch is respected:
  add(sb, {createIfNotExists: {_id: '1', _type: 'test', a: 'A string value', c: 'Changed'}})
  const tx2 = sb.purge('txn_id')
  expect(tx2.mutations.length).toBe(1)
})

test('de-duplicate create respects deletes', () => {
  const initial = {_id: '1', _type: 'test', a: 'A string value', c: 'Some value'}
  const sb = new SquashingBuffer(initial)
  add(sb, {createIfNotExists: {_id: '1', _type: 'test', a: 'A string value', c: 'Some value'}})
  patch(sb, {id: '1', set: {a: 'Another value'}})
  patch(sb, {id: '1', set: {a: {b: 'A wrapped value'}}})
  add(sb, {delete: {id: '1'}})
  add(sb, {createIfNotExists: {_id: '1', _type: 'test', a: 'A string value', c: 'Changed'}})
  patch(sb, {id: '1', set: {a: 'Another value'}})
  patch(sb, {id: '1', set: {a: {b: 'A wrapped value'}}})

  const tx = sb.purge('txn_id')
  tx.params.timestamp = '2021-01-01T12:34:55Z'

  const creates = tx.mutations.filter((mut) => !!mut.createIfNotExists)
  expect(creates.length).toBe(2) // Only a single create mutation expected (note: bn - is this correct?)

  // And that the final state still applies:
  const final = tx.apply(initial)
  expect(final).toEqual({
    _id: '1',
    _type: 'test',
    _createdAt: '2021-01-01T12:34:55Z',
    _updatedAt: '2021-01-01T12:34:55Z',
    _rev: 'txn_id',
    a: {
      b: 'A wrapped value',
    },
    c: 'Changed',
  })
})

test('de-duplicate create respects rebasing', () => {
  const initial = {_id: '1', _type: 'test', a: 'A string value', c: 'Some value'}
  const sb = new SquashingBuffer(initial)
  add(sb, {createIfNotExists: {_id: '1', _type: 'test', a: 'A string value', c: 'Some value'}})
  sb.rebase(initial)

  add(sb, {createIfNotExists: {_id: '1', _type: 'test', a: 'A string value', c: 'Changed'}})
  patch(sb, {id: '1', set: {a: 'Another value'}})
  patch(sb, {id: '1', set: {a: {b: 'A wrapped value'}}})

  const tx = sb.purge('txn_id')
  const creates = tx.mutations.filter((mut) => !!mut.createIfNotExists)
  expect(creates.length).toBe(1) // Only a single create mutation expected
  const final = tx.apply(initial)
  expect(final).toEqual({
    _id: '1',
    _type: 'test',
    _rev: 'txn_id',
    a: {
      b: 'A wrapped value',
    },
    c: 'Some value',
  })
})

test('rebase with generated diff-match-patches', () => {
  const sb = new SquashingBuffer({_id: '1', _type: 'test', a: 'A string value'})
  patch(sb, {id: '1', set: {a: 'A strong value'}})
  const initial = {_id: '1', _type: 'test', a: 'A rebased string value!'}
  sb.rebase(initial)
  const mut = sb.purge('txn_id')
  const final = mut.apply(initial)
  expect(final).toEqual({
    _id: '1',
    _type: 'test',
    _rev: 'txn_id',
    a: 'A rebased strong value!',
  })
})

test('rebase with no local edits', () => {
  const sb = new SquashingBuffer({_id: '1', _type: 'test', a: 'A string value'})
  const initial = {_id: '1', _type: 'test', a: 'A rebased string value!'}
  sb.rebase(initial)
  const mut = sb.purge('txn_id')
  expect(mut).toBeFalsy() // purge should not return anything when there are no local changes
  expect(sb.PRESTAGE).toEqual({
    _id: '1',
    _type: 'test',
    a: 'A rebased string value!',
  })
})


text:
lib32disabled=yes
hostmakedepends+=" ruby-devel"
makedepends+=" ruby-devel"

redpajama_set_name: RedPajamaGithub


text:
'use strict';

const assert = require('assert');
const eslint = require('eslint');
const conf = require('../');

// The source files to lint.
const repoFiles = [
  'index.js',
  'test/test.js'
];

// Use the rules defined in this repo to test against.
const eslintOpts = {
  useEslintrc: false,
  envs: ['node', 'es6'],
  parserOptions: {ecmaVersion: 2018},
  plugins: ['promise', 'mocha'],
  rules: conf.rules
};

// Runs the linter on the repo files and asserts no errors were found.
const report = new eslint.CLIEngine(eslintOpts).executeOnFiles(repoFiles);
assert.equal(report.errorCount, 0);
assert.equal(report.warningCount, 0);
repoFiles.forEach((file, index) => {
  assert(report.results[index].filePath.endsWith(file));
});


text:
![30% center](fpga_test_shield.jpg)

```
mbed test -n "hal-tests-tests*fpga*" --app-config TESTS/configs/fpga.json
```

The `FPGA_FORCE_ALL_PORTS` macro can be defined to force all pinouts of all peripherals to be tested. Some FPGA tests only test one pinout of one peripheral by default, to save time.

```
mbed test -n "hal-tests-tests*fpga*" --app-config TESTS/configs/fpga.json -DFPGA_FORCE_ALL_PORTS
```

FPGA_CI_TEST_SHIELD needed macro
and specific test capabilities per target
are defined in:
https://github.com/ARMmbed/mbed-os/blob/master/TESTS/configs/fpga.json

## MBED-OS

Tested from factor is defined by MBED_CONF_TARGET_DEFAULT_FORM_FACTOR
"default-form-factor" default value is null.

When "default-form-factor" is not set, ARDUINO form factor is used.

Default ff_arduino_pins is defined in:
https://github.com/ARMmbed/mbed-os/blob/master/hal/source/mbed_pinmap_default.cpp#L28-L32

Default ff_arduino_names is defined in:
https://github.com/ARMmbed/mbed-os/blob/master/hal/source/mbed_pinmap_default.cpp#L34-L38

Default empty_gpio_pinmap is defined in:
https://github.com/ARMmbed/mbed-os/blob/master/hal/source/mbed_gpio.c#L89-L114

Some pins are restricted:
https://github.com/ARMmbed/mbed-os/blob/master/hal/source/mbed_pinmap_default.cpp#L69-L73

Some peripherals are restricted:
https://github.com/ARMmbed/mbed-os/blob/master/hal/source/mbed_pinmap_default.cpp#L94-L100

## Known issues

## LINKS

https://github.com/ARMmbed/fpga-ci-test-shield

https://github.com/ARMmbed/fpga-ci-test-shield-updater

https://github.com/ARMmbed/fpga-ci-test-shield-terminal


text:
package com.github.jochenw.afw.core.function;

import java.util.Objects;
import java.util.function.Consumer;

/**
 * Represents an operation that accepts three input arguments and returns no
 * result.  This is the three-arity specialization of {@link Consumer}.
 * Unlike most other functional interfaces, {@code TriConsumer} is expected
 * to operate via side-effects.
 *
 *
This is a functional interface
 * whose functional method is {@link #accept(Object, Object, Object)}.
 *
 * @param <I1> the type of the first argument to the operation
 * @param <I2> the type of the second argument to the operation
 * @param <I3> the type of the third argument to the operation
 *
 * @see Consumer
 * @since 1.8
 */
@FunctionalInterface
public interface TriConsumer<I1,I2,I3> {
    /**
     * Performs this operation on the given arguments.
     *
     * @param pI1 the first input argument
     * @param pI2 the second input argument
     * @param pI3 the third input argument
     */
    void accept(I1 pI1, I2 pI2, I3 pI3);

    /**
     * Returns a composed {@code TriConsumer} that performs, in sequence, this
     * operation followed by the {@code pAfter} operation. If performing either
     * operation throws an exception, it is relayed to the caller of the
     * composed operation.  If performing this operation throws an exception,
     * the {@code pAfter} operation will not be performed.
     *
     * @param pAfter the operation to perform after this operation
     * @return a composed {@code TriConsumer} that performs in sequence this
     * operation followed by the {@code pAfter} operation
     * @throws NullPointerException if {@code pAfter} is null
     */
    default TriConsumer<I1,I2,I3> andThen(TriConsumer<? super I1, ? super I2, ? super I3> pAfter) {
        Objects.requireNonNull(pAfter);

        return (i1, i2, i3) -> {
            accept(i1, i2, i3);
            pAfter.accept(i1, i2, i3);
        };
    }
}


text:
FROM debian:jessie

RUN apt-get update && apt-get install -y \
	git \
	make \
	gcc \
	gdb \
	python3 \
	libjansson-dev \
	&& rm -rf /var/lib/apt/lists/*

WORKDIR /raft

ENV REBUILD 3

#RUN git clone --depth 1 https://github.com/kvap/raft.git /raft
ADD . /raft
RUN cd /raft && make all

EXPOSE 6000
EXPOSE 6000/udp
ENTRYPOINT ["/raft/tests/docker-entrypoint.sh"]
#CMD ["bash"]


text:
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <meta name="description" content="">
        <meta name="author" content="">
        <title>Infra CNR</title>

        <link href="<?php echo base_url(); ?>bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

        <link href="<?php echo base_url(); ?>bootstrap/css/navbar-fixed-top.css" rel="stylesheet">

        <link href="<?php echo base_url(); ?>bootstrap/css/sticky-footer.css" rel="stylesheet">
      <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />

                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                    Toggle navigation

                </button>
                InfraCNR

                    Grafik

<a href="<?php echo base_url(); ?>index.php/Transport/grafik_transport">Grafik Transport

<a href="<?php echo base_url(); ?>index.php/ip/grafik_ip">Grafik IP

                    Maps

<a href="<?php echo base_url(); ?>index.php/Maps/live_transport">Maps Live Transport

<a href="<?php echo base_url(); ?>index.php/Maps">Maps Transport

                          <?php
                        if(($this->session->userdata('type') == "admin")||($this->session->userdata('type') == "user")){
                    ?>

<a href="<?php echo base_url(); ?>index.php/Transport">Transport

<a href="<?php echo base_url(); ?>index.php/Ip">IP

                    <?php } ?>

                    <?php
                            if($this->session->userdata('type') == "admin"){
                    ?>

<a href="<?php echo base_url(); ?>index.php/Divre">Regional

<a href="<?php echo base_url(); ?>index.php/Witel">Witel

<a href="<?php echo base_url(); ?>index.php/admin/home">Panel Admin

                    <?php } ?>

                <?php
                    if(($this->session->userdata('type') == "admin")||($this->session->userdata('type') == "user")){
                ?>

<a href="<?php echo base_url(); ?>index.php/Admin/logout">Logout

                <?php }else{  ?>

<a href="<?php echo base_url(); ?>index.php/user">Login

                <?php }?>

            <?php
            $now = new DateTime();
            $yesterday = new DateTime("-1 months");
            $now->setTimezone(new DateTimezone('Asia/Jakarta'));
            $yesterday->setTimezone(new DateTimezone('Asia/Jakarta'));
            $jam_sekarang = $now->format('H');
            $menit_sekarang = $now->format('i');
            $detik_sekarang = $now->format('s');
            $tanggal_sekarang = $now->format('Y-m-d');
            $tanggal_kemarin = $yesterday->format('Y-m-d');
            if(isset($awal)){
                $tanggal_kemarin = $awal;
                $tanggal_sekarang = $akhir;
            }
                echo "
";
                echo form_open('index.php/transport/grafik_transport');
                echo "

";
                echo "
";
                    echo "
";
                        echo "
";
                            echo "
Filter
";
                        echo "
";
                        echo "
";
                            echo "
";
                            echo "
";
                                echo ""; echo form_label('Mulai Dari : &nbsp'); echo "	";
                                echo "";echo form_input(array('id'=>'waktu_open','name'=>'waktu_open', 'class'=>'form-control'), $tanggal_kemarin);echo "	";
                            echo "
";
                            echo "
";
                                echo "
 	";
                            echo "
";
                            echo "
";
                                echo ""; echo form_label('Sampai : &nbsp'); echo "	";
                                echo "";echo form_input(array('id'=>'waktu_close','name'=>'waktu_close', 'class'=>'form-control'), $tanggal_sekarang);echo "	";
                            echo "
";
                            echo "
";
                                echo "
 	";
                            echo "
";
                            echo "
";
                                echo ""; echo form_label('Divre : &nbsp'); echo "	";
                                echo "";
                                ?>
                                    <select class="form-control id_divre" name="id_divre">
                                        <option value="">Regional</option>
                                    </select>
                                <?php
                                echo "	";
                            echo "
";
                            echo "
";
                                echo "
 	";
                            echo "
";
                            echo "
";
                                echo ""; echo form_label('Witel : &nbsp'); echo "	";
                                echo "";
                                ?>
                                <select class="form-control id_witel" name="id_witel">
                                    <option value="">Witel</option>
                                </select>
                            <?php
                                echo "
";
                            echo "
";
                                echo "
 	";
                            echo "
";
                            echo "
";
                                echo "";echo form_submit(array('id'=>'submit','name'=>'show_table','value'=>'Show', 'class'=>'btn  btn-primary'));echo "	";
                            echo "
";
                            echo "
";
                        echo "
";
                    echo "
";
                echo "
";
            echo form_close();
            echo "
";
        ?>

            <?php
                if(isset($witel)){
                    foreach ($witel as $key) {
                        echo "".$key->nama_witel."	";
                    }
                }else if(isset($divre)){
                    foreach ($divre as $key) {
                        echo "".$key->nama_divre."	";
                    }
                }else{
                    echo "Gangguan	";
                }
            ?>

            <?php
                $i=0;
                if(isset($witel)){
                    foreach($data as $key){
                        echo "
(".$tgl[$i].")	";
                        foreach ($witel as $val) {
                            $stats=0;
                            foreach ($key as $skey) {
                                if($skey->dot == $val->id_witel){
                                    if($stats==0){
                                        echo "".$skey->hasil."	";
                                        $stats=1;
                                    }
                                }
                            }
                            if($stats==0){
                                echo "0	";
                            }
                        }
                        echo "
";
                        $i++;
                    }
                }else if(isset($divre)){
                    foreach($data as $key){
                        echo "
(".$tgl[$i].")	";
                        foreach ($divre as $val) {
                            $stats=0;
                            foreach ($key as $skey) {
                                if($skey->dot == $val->id_divre){
                                    if($stats==0){
                                        echo "".$skey->hasil."	";
                                        $stats=1;
                                    }
                                }
                            }
                            if($stats==0){
                                echo "0	";
                            }
                        }
                        echo "
";
                        $i++;
                    }
                }else{
                    foreach($data as $key){
                        echo "
(".$tgl[$i].")	".$key->hasil."
";
                        $i++;
                    }
                }
            ?>

                Copyright © 2017 Network of Broadband. All Rights Reserved.

                Di Render Dalam <?php echo $this->benchmark->elapsed_time(); ?> detik Dengan Penggunaan Memory <?php echo $this->benchmark->memory_usage(); ?>


text:
package com.intellij.execution.configurations;

import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.TargetDebuggerConnection;
import com.intellij.execution.TargetDebuggerConnectionUtil;
import com.intellij.execution.process.OSProcessHandler;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.target.*;
import com.intellij.execution.target.java.JavaLanguageRuntimeConfiguration;
import com.intellij.execution.target.local.LocalTargetEnvironment;
import com.intellij.execution.target.local.LocalTargetEnvironmentRequest;
import com.intellij.execution.wsl.WslPath;
import com.intellij.execution.wsl.target.WslTargetEnvironmentConfiguration;
import com.intellij.execution.wsl.target.WslTargetEnvironmentRequest;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.Experiments;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Objects;

public abstract class JavaCommandLineState extends CommandLineState implements JavaCommandLine, TargetEnvironmentAwareRunProfileState, RemoteConnectionCreator {
  private static final Logger LOG = Logger.getInstance(JavaCommandLineState.class);
  private JavaParameters myParams;
  private TargetEnvironmentRequest myTargetEnvironmentRequest;
  private TargetedCommandLineBuilder myCommandLine;
  @Nullable private volatile TargetDebuggerConnection myTargetDebuggerConnection;

  protected JavaCommandLineState(@NotNull ExecutionEnvironment environment) {
    super(environment);
  }

  @Override
  public JavaParameters getJavaParameters() throws ExecutionException {
    if (myParams == null) {
      myParams = isReadActionRequired() ? ReadAction.compute(this::createJavaParameters) : createJavaParameters();
    }
    return myParams;
  }

  protected boolean isReadActionRequired() {
    return true;
  }

  public void clear() {
    myParams = null;
  }

  @Override
  @NotNull
  protected OSProcessHandler startProcess() throws ExecutionException {
    return JavaCommandLineStateUtil.startProcess(createCommandLine(), ansiColoringEnabled());
  }

  protected boolean ansiColoringEnabled() {
    return true;
  }

  protected abstract JavaParameters createJavaParameters() throws ExecutionException;

  @Override
  public TargetEnvironmentRequest createCustomTargetEnvironmentRequest() {
    try {
      JavaParameters parameters = getJavaParameters();
      WslTargetEnvironmentConfiguration config = checkCreateWslConfiguration(parameters.getJdk());
      return config == null ? null : new WslTargetEnvironmentRequest(config);
    }
    catch (ExecutionException e) {
      // ignore
    }
    return null;
  }

  public static WslTargetEnvironmentConfiguration checkCreateWslConfiguration(@Nullable Sdk jdk) {
    if (jdk == null) {
      return null;
    }
    VirtualFile virtualFile = jdk.getHomeDirectory();
    if (virtualFile == null) {
      return null;
    }
    WslPath wslPath = WslPath.parseWindowsUncPath(virtualFile.getPath());
    if (wslPath != null) {
      WslTargetEnvironmentConfiguration config = new WslTargetEnvironmentConfiguration(wslPath.getDistribution());
      JavaLanguageRuntimeConfiguration javaConfig = new JavaLanguageRuntimeConfiguration();
      javaConfig.setHomePath(wslPath.getLinuxPath());
      String jdkVersionString = jdk.getVersionString();
      if (jdkVersionString != null) {
        javaConfig.setJavaVersionString(jdkVersionString);
      }
      config.addLanguageRuntime(javaConfig);
      return config;
    }
    return null;
  }

  protected boolean shouldPrepareDebuggerConnection() {
    return true;
  }

  @Override
  public void prepareTargetEnvironmentRequest(
    @NotNull TargetEnvironmentRequest request,
    @NotNull TargetProgressIndicator targetProgressIndicator) throws ExecutionException {
    targetProgressIndicator.addSystemLine(ExecutionBundle.message("progress.text.prepare.target.requirements"));

    myTargetEnvironmentRequest = request;

    TargetDebuggerConnection targetDebuggerConnection =
      shouldPrepareDebuggerConnection() ? TargetDebuggerConnectionUtil.prepareDebuggerConnection(this, request) : null;
    myTargetDebuggerConnection = targetDebuggerConnection;

    Ref<TargetedCommandLineBuilder> commandLineRef = new Ref<>();
    Ref<ExecutionException> exceptionRef = new Ref<>();
    ApplicationManager.getApplication().invokeAndWait(() -> {
      try {
        commandLineRef.set(createTargetedCommandLine(myTargetEnvironmentRequest));
      }
      catch (ExecutionException e) {
        exceptionRef.set(e);
      }
    });
    if(!exceptionRef.isNull()){
      throw exceptionRef.get();
    }
    myCommandLine = commandLineRef.get();

    if (targetDebuggerConnection != null) {
      Objects.requireNonNull(request).getTargetPortBindings().add(targetDebuggerConnection.getDebuggerPortRequest());
    }
  }

  @Override
  public void handleCreatedTargetEnvironment(@NotNull TargetEnvironment environment,
                                             @NotNull TargetProgressIndicator targetProgressIndicator) {
    TargetDebuggerConnection targetDebuggerConnection = myTargetDebuggerConnection;
    if (targetDebuggerConnection != null) {
      targetDebuggerConnection.resolveRemoteConnection(environment);
    }
  }

  @Nullable
  @Override
  public RemoteConnection createRemoteConnection(ExecutionEnvironment environment) {
    TargetDebuggerConnection targetDebuggerConnection = myTargetDebuggerConnection;
    if (targetDebuggerConnection != null) {
      return targetDebuggerConnection.getResolvedRemoteConnection();
    }
    else {
      return null;
    }
  }

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

  public synchronized @Nullable TargetEnvironmentRequest getTargetEnvironmentRequest() {
    return myTargetEnvironmentRequest;
  }

  @NotNull
  protected synchronized TargetedCommandLineBuilder getTargetedCommandLine() {
    if (myCommandLine != null) {
      // In a correct implementation that uses the new API this condition is always true.
      return myCommandLine;
    }

    if (RunTargetsEnabled.get() &&
        !(getEnvironment().getTargetEnvironmentRequest() instanceof LocalTargetEnvironmentRequest)) {
      LOG.error("Command line hasn't been built yet. " +
                "Probably you need to run environment#getPreparedTargetEnvironment first, " +
                "or it return the environment from the previous run session");
    }
    try {
      // force re-prepareTargetEnvironment in order to drop previous environment
      getEnvironment().prepareTargetEnvironment(this, TargetProgressIndicator.EMPTY);
      return myCommandLine;
    }
    catch (ExecutionException e) {
      LOG.error(e);
      throw new RuntimeException(e);
    }
  }

  @NotNull
  protected TargetedCommandLineBuilder createTargetedCommandLine(@NotNull TargetEnvironmentRequest request)
    throws ExecutionException {
    SimpleJavaParameters javaParameters = getJavaParameters();
    if (!javaParameters.isDynamicClasspath()) {
      javaParameters.setUseDynamicClasspath(getEnvironment().getProject());
    }
    return javaParameters.toCommandLine(request);
  }

  protected GeneralCommandLine createCommandLine() throws ExecutionException {
    boolean redirectErrorStream = Registry.is("run.processes.with.redirectedErrorStream", false);
    LocalTargetEnvironmentRequest request = new LocalTargetEnvironmentRequest();
    TargetedCommandLineBuilder targetedCommandLineBuilder = createTargetedCommandLine(request);
    LocalTargetEnvironment environment = request.prepareEnvironment(TargetProgressIndicator.EMPTY);
    return environment
      .createGeneralCommandLine(targetedCommandLineBuilder.build())
      .withRedirectErrorStream(redirectErrorStream);
  }

  public boolean shouldAddJavaProgramRunnerActions() {
    return true;
  }
}


text:
namespace net {
namespace tools {
namespace test {

class HttpConstants {
 public:
  enum Version {
    HTTP_UNKNOWN = 0,
    HTTP_0_9,
    HTTP_1_0,
    HTTP_1_1
  };

  enum Method {
    UNKNOWN_METHOD = 0,
    OPTIONS,
    GET,
    HEAD,
    POST,
    PUT,
    DELETE,
    TRACE,
    CONNECT,

    MKCOL,
    UNLOCK,
  };
};

// Stripped down wrapper class which basically contains headers and a body.
class HTTPMessage {
 public:
  typedef HttpConstants::Version Version;
  typedef HttpConstants::Method Method;

  // Convenient functions to map strings into enums. The string passed in is
  // not assumed to be NULL-terminated.
  static Version StringToVersion(base::StringPiece str);
  static Method StringToMethod(base::StringPiece str);

  static const char* MethodToString(Method method);
  static const char* VersionToString(Version version);

  // Default constructor makes an empty HTTP/1.1 GET request. This is typically
  // used to construct a message that will be Initialize()-ed.
  HTTPMessage();

  // Build a request message
  HTTPMessage(Version version, Method request, const std::string& path);

  virtual ~HTTPMessage();

  const std::string& body() const { return body_; }

  // Adds a header line to the message.
  void AddHeader(const std::string& header, const std::string& value);

  // Removes a header line from the message.
  void RemoveHeader(const std::string& header);

  // A utility function which calls RemoveHeader followed by AddHeader.
  void ReplaceHeader(const std::string& header, const std::string& value);

  // Adds a body and the optional content-length header field (omitted to test
  // read until close test case). To generate a message that has a header field
  // of 0 content-length, call AddBody("", true).
  // Multiple calls to AddBody()/AddChunkedBody() has the effect of overwriting
  // the previous entry without warning.
  void AddBody(const std::string& body, bool add_content_length);

  bool has_complete_message() const { return has_complete_message_; }
  void set_has_complete_message(bool value) { has_complete_message_ = value; }

  // Do some basic http message consistency checks like:
  // - Valid transfer-encoding header
  // - Valid content-length header
  // - Messages we expect to be complete are complete.
  // This check can be disabled by setting skip_message_validation.
  void ValidateMessage() const;

  bool skip_message_validation() const { return skip_message_validation_; }
  void set_skip_message_validation(bool value) {
    skip_message_validation_ = value;
  }

  // Allow direct access to the body string.  This should be used with caution:
  // it will not update the request headers like AddBody and AddChunkedBody do.
  void set_body(const std::string& body) { body_ = body; }

  const BalsaHeaders* headers() const { return &headers_; }
  BalsaHeaders* headers() { return &headers_; }

 protected:
  BalsaHeaders headers_;

  std::string body_;  // the body with chunked framing/gzip compression

  bool is_request_;

  // True if the message should be considered complete during serialization.
  // Used by SPDY and Streamed RPC clients to decide wherever or not
  // to include fin flags and during message validation (if enabled).
  bool has_complete_message_;

  // Allows disabling message validation when creating test messages
  // that are intentionally invalid.
  bool skip_message_validation_;

 private:
  void InitializeFields();

  DISALLOW_COPY_AND_ASSIGN(HTTPMessage);
};

}  // namespace test
}  // namespace tools
}  // namespace net

#endif  // NET_TOOLS_QUIC_TEST_TOOLS_TEST_TOOLS_HTTP_MESSAGE_H_


text:
#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gtk/gtk.h>

#include "interface.h"
#include "support.h"
#include "callbacks.h"

#include <set_data.h>
#include <keytouch-editor.h>
#include <evdev.h>

/* This is our data identification string to store
 * data in list items
 */
const gchar *list_item_data_key = "list_item_data";

static void init_evdev_treeview (GtkTreeView *treeview);
static void tree_view_add_new_text_column (	GtkTreeView	*tree_view,
						char		*column_title,
						int		column_pos  );
static void list_append_item (GtkList *list, char *item_string);
static void list_store_append_string (	GtkListStore	*list_store,
					gchar		*string );
static void treeview_create_list (GtkTreeView *treeview);

void
clear_key_settings_frame (GtkWidget *this_widget)
/*
Input:
	this_widget	- A widget in the same tree as the widgets in the frame
Description:
	This function clears the contents of the following widgets:
	- key_name_entry
	- scancode_entry
	- keycode_combobox
	- program_entry
	- plugin_comboentry
	- plugin_function_comboentry
*/
{
	gtk_entry_set_text (GTK_ENTRY( lookup_widget(this_widget, "key_name_entry") ), "");
	gtk_entry_set_text (GTK_ENTRY( lookup_widget(this_widget, "scancode_entry") ), "");
	gtk_combo_box_set_active (GTK_COMBO_BOX( lookup_widget(this_widget, "keycode_combobox") ), -1);
	gtk_entry_set_text (GTK_ENTRY( lookup_widget(this_widget, "program_entry") ), "");
	gtk_entry_set_text (GTK_ENTRY( lookup_widget(this_widget, "plugin_comboentry") ), "");
	gtk_entry_set_text (GTK_ENTRY( lookup_widget(this_widget, "plugin_function_comboentry") ), "");
}

void
msg_box (	gchar		*message,
		GtkMessageType	msg_type       )
/*
Input:
	message		- The message to display
	msg_type	- The type of the message
Output:
	-
Returns:
	-
Description:
	msg_box() shows a message dialog containing text and an ok-button. The text of
	the dialog will be message. The type of the message is indicated by msg_type.
*/
{
	GtkWidget *msg_dialog;

	msg_dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, msg_type, GTK_BUTTONS_OK, message);
	/*
	 * Block the interaction with the other windows, so that
	 * the user can only use this window
	 */
	gtk_grab_add (GTK_WIDGET(msg_dialog));
	gtk_dialog_run (GTK_DIALOG (msg_dialog));
	gtk_widget_destroy (msg_dialog);
	/* Wait until the window has disappeared */
	while (g_main_context_iteration(NULL, FALSE))
		; /* NULL Statement */
}

void
gui_error_handler (const char *msg)
/*
Input:
	msg		- The message to display
Output:
	-
Returns:
	-
Description:
	This function calls msg_box(msg, GTK_MESSAGE_ERROR)
*/
{
	msg_box ((gchar *)msg, GTK_MESSAGE_ERROR);
}

void
list_append_item (	GtkList	*list,
			char	*item_string   )
/*
input:
	list		- The list to append the item to
	item_string	- The string of the new list item
output:
	-
returns:
	-
description:
	This function appends a list item to list. The string of the item is item_string.
*/
{
	GtkWidget *list_item;
	GtkWidget *label;

	label = gtk_label_new( item_string );
	gtk_misc_set_alignment (GTK_MISC (label), GTK_ALIGN_LEFT, GTK_ALIGN_CENTER);
	list_item = gtk_list_item_new();
	gtk_container_add (GTK_CONTAINER(list_item), label);
	gtk_widget_show (label);
	gtk_container_add (GTK_CONTAINER(list), list_item);
	gtk_widget_show (list_item);
	gtk_object_set_data (GTK_OBJECT(list_item), list_item_data_key, item_string);
}

void
reload_plugin_function_list (	GtkWidget	*this_widget,
				KTPlugin	*plugin       )
/*
Input:
	this_widget	- A widget in the same tree as the widget named
			  "plugin_combo"
	plugin		- The address of the currently selected plugin
Description:
	This function deletes all list items of a list widget and appends all
	functions names, of plugin, to the list. The list is a widget of a combo
	named "plugin_function_combo", which is in the same tree as this_widget.
	The list will only be cleared if plugin points to NULL.
*/
{
	GtkCombo	*plugin_function_combo;
	GtkWidget	*plugin_function_combo_entry;
	GtkList		*plugin_function_list_widget;
	int		count;

	plugin_function_combo_entry = lookup_widget(this_widget, "plugin_function_comboentry");
	/* Block the signal handler of plugin_entry */
	g_signal_handlers_block_by_func (GTK_OBJECT(plugin_function_combo_entry),
	                                  on_plugin_function_comboentry_changed, NULL);

	plugin_function_combo = GTK_COMBO(lookup_widget(this_widget, "plugin_function_combo"));

	plugin_function_list_widget = GTK_LIST(plugin_function_combo->list);
	/* Clear the plugin function list */
	gtk_list_clear_items (plugin_function_list_widget, 0, -1); /* Clear the whole list */

	if (plugin)
	{
		/* Add all function names to the list */
		for (count = 0; count < plugin->num_functions; count++)
		{
			list_append_item (plugin_function_list_widget, plugin->function[count]);
		}
	}

	/* Unblock the signal handler of plugin_entry */
	g_signal_handlers_unblock_by_func (GTK_OBJECT(plugin_function_combo_entry),
	                                    on_plugin_function_comboentry_changed, NULL);
}

void
reload_plugin_list (	GtkWidget	*this_widget,
			const KTPlugin	plugin_list[],
			int		num_plugins  )
/*
input:
	this_widget	- A widget in the same tree as the widget named
			  "plugin_combo"
	plugin_list	- This is array of all available plugins
	num_plugins	- Size of 'plugin_list' array
output:
	-
returns:
	-
description:
	This function deletes all list items of a list widget and appends all plugin names,
	which it will read from plugin_list, to the list. The list is a widget of a combo
	named "plugin_combo", which is in the same tree as this_widget.
*/
{
	GtkCombo		*plugin_combo;
	GtkWidget		*plugin_combo_entry;
	GtkList			*plugin_list_widget;
	int i;

	plugin_combo_entry = lookup_widget(this_widget, "plugin_comboentry");
	/* Block the signal handler of plugin_entry */
	g_signal_handlers_block_by_func (GTK_OBJECT(plugin_combo_entry), on_plugin_comboentry_changed, NULL);

	plugin_combo = GTK_COMBO(lookup_widget(this_widget, "plugin_combo"));

	plugin_list_widget = GTK_LIST(plugin_combo->list);
	/* Clear the plugin action list */
	gtk_list_clear_items (plugin_list_widget, 0, -1); /* Clear the whole list */
	/* Add all plugin names to the list */
	for (i = 0; i < num_plugins; i++)
	{
		list_append_item (plugin_list_widget, KTPlugin_get_name(plugin_list[i]));
	}

	/* Unblock the signal handler of plugin_entry */
	g_signal_handlers_unblock_by_func (GTK_OBJECT(plugin_combo_entry), on_plugin_comboentry_changed, NULL);
}

void
list_store_append_string (	GtkListStore	*list_store,
				gchar		*string )
/*
input:
	string		- The string to append to list_store
output:
	list_store	- The GtkListStore where the string was appended to
returns:
	-
description:
	This function appends string as a new row to list_store.
*/
{
	GtkTreeIter iter;

	gtk_list_store_append (list_store, &iter);
	gtk_list_store_set (list_store, &iter, FIRST_COLUMN, string, -1);
}

void
treeview_create_list (GtkTreeView *treeview)
/*
Output:
	treeview	- The GtkTreeView to make a list of
Description:
	This function makes a list of treeview. That means treeview will have one
	treeview column which contains text.
*/
{
	GtkListStore		*list_store;
	GtkTreeViewColumn	*column;
	GtkCellRenderer		*renderer;

	column = gtk_tree_view_column_new();
	/* pack tree view column into tree view */
	gtk_tree_view_append_column (treeview, column);
	renderer = gtk_cell_renderer_text_new();
	/* pack cell renderer into tree view column */
	gtk_tree_view_column_pack_start (column, renderer, TRUE);
	/* connect 'text' property of the cell renderer to
	 * model column that contains the text
	 */
	gtk_tree_view_column_add_attribute (column, renderer, "text", FIRST_COLUMN);

	list_store = gtk_list_store_new(ONE_COLUMN, G_TYPE_STRING);
	gtk_tree_view_set_model (treeview, GTK_TREE_MODEL(list_store));
	g_object_unref (list_store);
}

void
reload_key_treeview (	KTKeyList	*list,
			GtkWidget	*this_widget )
{
	KTKey		*key;
	GtkTreeView	*tree_view;
	GtkListStore	*list_store;

	tree_view = GTK_TREE_VIEW( lookup_widget(this_widget, "key_treeview") );
	list_store = GTK_LIST_STORE( gtk_tree_view_get_model(tree_view) );

	gtk_list_store_clear (list_store);/* Clear the whole treeview */
	/* Fill the treeview */
	for (key = KTKeyList_head(list); key; key = key->next)
	{
		/* Add a new row to the model */
		list_store_append_string (list_store, KTKey_get_name(key));
	}
}

void
tree_view_add_new_text_column (	GtkTreeView	*tree_view,
				char		*column_title,
				int		column_pos  )
/*
Input:
	column_title	- The title of the new column
	column_pos	- The position of the new column
Output:
	tree_view	- The tree view to add the new text column to
Returns:
	-
Description:
	This function adds a new text column to tree_view at the position column_pos.
*/
{
	GtkTreeViewColumn	*column;
	GtkCellRenderer		*renderer;

	column = gtk_tree_view_column_new();
	gtk_tree_view_column_set_title (column, column_title);
	/* pack tree view column into tree view */
	gtk_tree_view_append_column (tree_view, column);
	renderer = gtk_cell_renderer_text_new();
	/* pack cell renderer into tree view column */
	gtk_tree_view_column_pack_start (column, renderer, TRUE);
	/* connect 'text' property of the cell renderer to
	 * model column that contains the text */
	gtk_tree_view_column_add_attribute (column, renderer, "text", column_pos);
}

void
init_evdev_treeview (GtkTreeView *treeview)
/*
Output:
	treeview	- Will have a "Device", "Device name" and a "Bus" column
Description:
	This function makes a list of treeview with three columns: "Device", "Device
	name" and a "Bus". Only one row in this list can be selected.
*/
{
	GtkTreeSelection	*selection;
	GtkListStore		*list_store;

	selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(treeview) );
	gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);

	/************ Create the model ************/
	/* The last column with be 'invisible' and is a pointer to the
	   corresponding EVDEV_DEVICE structure. */
	list_store = gtk_list_store_new(NUM_COLS_EVDEV_TREEVIEW, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
	gtk_tree_view_set_model (treeview, GTK_TREE_MODEL(list_store));
	g_object_unref (list_store);

	/************ Create the view ************/
	tree_view_add_new_text_column (treeview, _("Device"), COL_EVDEV_FILE_NAME);
	tree_view_add_new_text_column (treeview, _("Device name"), COL_EVDEV_DEVICE_NAME);
	tree_view_add_new_text_column (treeview, _("Bus"), COL_EVDEV_BUS);
}

GtkWidget
*show_selectkb_window (EVDEV_LIST *evdev_list,
                       Boolean    acpi_usable )
/*
Input:
	evdev_list	- List containing information about all event devices
	acpi_usable	- Indicates if an entry for the ACPI device should be add to
			  the keyboard_treeview
Returns:
	The address of the created window
Description:
	This function creates and initializes the keyboard_treeview in the
	selectkb_window and fills it with the following information about the event
	devices in evdev_list: device (file name), device name and bus. If
	'acpi_usable' is TRUE then an entry for the ACPI device will be added to the
	end of the keyboard_treeview.
*/
{
	EVDEV_LIST_ENTRY	*entry;
	GtkTreeView		*treeview;
	GtkListStore		*list_store;
	GtkTreeIter		iter;
	GtkWidget		*window;

	window = create_selectkb_window();

	treeview = GTK_TREE_VIEW(lookup_widget(window, "keyboard_treeview"));
	init_evdev_treeview (treeview);

	list_store = GTK_LIST_STORE( gtk_tree_view_get_model(treeview) );

	gtk_list_store_clear (list_store); /* Clear the whole treeview */
	/* Fill the treeview */
	for (entry = evdev_list->head; entry; entry = entry->next)
	{
		/* Add a new row to the model */
		gtk_list_store_append (list_store, &iter);
		gtk_list_store_set (	list_store, &iter,
					COL_EVDEV_FILE_NAME, evdev_file_name(entry->evdev),
					COL_EVDEV_DEVICE_NAME, evdev_device_name(entry->evdev),
					COL_EVDEV_BUS, evdev_bus_string(entry->evdev),
					COL_EVDEV_STRUCT, entry->evdev,
					-1 );
	}
	if (acpi_usable)
	{
		gtk_list_store_append (list_store, &iter);
		gtk_list_store_set (	list_store, &iter,
					COL_EVDEV_FILE_NAME, ACPI_EVDEV_FILE_NAME,
					COL_EVDEV_DEVICE_NAME, ACPI_DEVICE_NAME,
					COL_EVDEV_BUS, ACPI_BUS_NAME,
					COL_EVDEV_STRUCT, NULL,
					-1 );
	}
	gtk_widget_show (window);

	return window;
}

GtkWidget
*show_main_window (MainWindowGUI_type *main_window_gui)
/*
Output:
	main_window_gui - Will be intialised with pointers to the
	                  created widgets
Returns:
	The address of the main window.
Description:
	This function creates the main window and shows it.
*/
{
	GtkWidget *window;
	int index;

	main_window_gui->main_window = create_main_window();
	window = main_window_gui->main_window;

	/* main_window_gui->keycode_combobox = GTK_COMBO_BOX(lookup_widget(window, "keycode_combobox")); */
#define _gui_init_widget(widget_name, type) (main_window_gui->widget_name = type(lookup_widget(window, #widget_name)))
	_gui_init_widget (keycode_combobox, GTK_COMBO_BOX);
	_gui_init_widget (scancode_event_descr_label, GTK_LABEL);
	_gui_init_widget (manufacturer_entry, GTK_ENTRY);
	_gui_init_widget (model_entry, GTK_ENTRY);
	_gui_init_widget (key_name_entry, GTK_ENTRY);
	_gui_init_widget (scancode_entry, GTK_ENTRY);
	_gui_init_widget (usbcode_entry, GTK_ENTRY);
	_gui_init_widget (program_entry, GTK_ENTRY);
	_gui_init_widget (plugin_function_comboentry, GTK_ENTRY);
	_gui_init_widget (plugin_comboentry, GTK_ENTRY);
	_gui_init_widget (program_radiobutton, GTK_RADIO_BUTTON);
	_gui_init_widget (special_action_radiobutton, GTK_RADIO_BUTTON);
	_gui_init_widget (key_treeview, GTK_TREE_VIEW);
	_gui_init_widget (keycode_combobox, GTK_COMBO_BOX);
	_gui_init_widget (usbcode_change_button, GTK_BUTTON);
	_gui_init_widget (scancode_change_button, GTK_BUTTON);

	for (index = 0; visible_keycodes[index]; index++)
	{
		gtk_combo_box_append_text (main_window_gui->keycode_combobox,
		                           keycode2string(visible_keycodes[index]));
	}

	reload_plugin_list (window, plugin_list, NUM_PLUGINS);

	/* main_window_gui->key_treeview = GTK_TREE_VIEW(lookup_widget(window, "key_treeview")); */
	treeview_create_list (main_window_gui->key_treeview);
	/* Set the signal handler */
	gtk_tree_selection_set_select_function (gtk_tree_view_get_selection(main_window_gui->key_treeview),
	                                        on_key_treeview_selection, NULL, NULL);

	gtk_widget_show (window);

	return window;
}


text:
import re
import socket

from IPy import IP
from aiohttp.resolver import DefaultResolver

ADDRESS_PATTERN = re.compile("^(.+?)(?::([0-9]+))?$")

class InvalidAddress(Exception):
    pass

class NameResolver(DefaultResolver):
    def filter_hosts(self, host):
        ip = IP(host['host'])
        if ip.iptype() == "PUBLIC":
            return True
        else:
            return False

    async def resolve(self, host, port=0, family=socket.AF_INET):
        hosts = await super().resolve(host, port, family)
        hosts = list(filter(self.filter_hosts, hosts))
        if not len(hosts):
            raise socket.gaierror("no public ip returned")
        return hosts

    async def resolve_ip(self, host, port=0, family=socket.AF_INET):
        hosts = await self.resolve(host, port, family)
        return hosts[0]['host']

class AddressResolver:
    def __init__(self, name_resolver=None, port_validator=lambda p: True):
        self.name_resolver = name_resolver or NameResolver()
        self.port_validator = port_validator

    async def resolve(self, s, default_port):
        m = ADDRESS_PATTERN.match(s)
        if m:
            try:
                host = await self.name_resolver.resolve_ip(m.group(1))
            except OSError as e:
                raise InvalidAddress("Failed to resolve address.")
            port = int(m.group(2)) if m.group(2) else default_port
            if port < 1 or port > 65535:
                raise InvalidAddress("Invalid port number.")
            if not self.port_validator(port):
                raise InvalidAddress("Port number is not within the valid range.")
            return host, port
        raise InvalidAddress("The address is unrecognized.")


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

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>FlowEntryToken xref</title>
<link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" />

View Javadoc

1
16  package org.yaml.snakeyaml.tokens;
17
18  import org.yaml.snakeyaml.error.Mark;
19
20  public final class FlowEntryToken extends Token {
21
22      public FlowEntryToken(Mark startMark, Mark endMark) {
23          super(startMark, endMark);
24      }
25
26      @Override
27      public Token.ID getTokenId() {
28          return ID.FlowEntry;
29      }
30  }

This page was automatically generated by Maven


text:
export MY_SERVER_NAME='openvpn'
export CLIENTS='client1 client2 client3 client4'
export CA_DIRECTORY='~/openvpn-ca'
#Key Setting
export KEY_COUNTRY='CN'
export KEY_PROVINCE='GD'
export KEY_CITY='GuangZhou'
export KEY_ORG='MediaClick'
export KEY_EMAIL='admin@gzmediaclick.com'
export KEY_OU='TechDep'
export KEY_NAME='server'
#Public interface name
export PUB_ETH=`ip route | grep default | awk '{print $5}'`
#Vpn serverconfig-file
export VPN_SERVER_ADDRESS='****'
export VPN_SERVER_TYPE='tcp'
export VPN_SERVER_PORT='443'
#Make_config function vars
export KEY_DIR='~/openvpn-ca/keys'
export OUTPUT_DIR='~/client-configs/files'
export BASE_CONFIG='~/client-configs/base.conf'
CURRENT_DIR=`pwd`
#########################
###Function Definition###
#########################
make_config() {
	cat ${BASE_CONFIG}
    <(echo -e '<ca>') \
    ${KEY_DIR}/ca.crt \
    <(echo -e '</ca>\n<cert>') \
    ${KEY_DIR}/${1}.crt \
    <(echo -e '</cert>\n<key>') \
    ${KEY_DIR}/${1}.key \
    <(echo -e '</key>\n<tls-auth>') \
    ${KEY_DIR}/ta.key \
    <(echo -e '</tls-auth>') \
    > ${OUTPUT_DIR}/${1}.ovpn
}
########################################################################################
#Install OpenVPN

apt-get update
apt-get install openvpn easy-rsa -y

#Set Up the CA Directory

make-cadir ~/openvpn-ca

#Configure the CA Variables

cd ~/openvpn-ca

####edit the vars

sed -i s/"KEY_COUNTRY.*\"$"/KEY_COUNTRY=\"${KEY_COUNTRY}\"/g vars
sed -i s/"KEY_PROVINCE.*\"$"/KEY_PROVINCE=\"${KEY_PROVINCE}\"/g vars
sed -i s/"KEY_CITY.*\"$"/KEY_CITY=\"${KEY_CITY}\"/g vars
sed -i s/"KEY_ORG.*\"$"/KEY_ORG=\"${KEY_ORG}\"/g vars
sed -i s/"KEY_EMAIL.*\"$"/KEY_EMAIL=\"${KEY_EMAIL}\"/g vars
sed -i s/"KEY_OU.*\"$"/KEY_OU=\"${KEY_OU}\"/g vars
sed -i s/"KEY_NAME.*\"$"/KEY_NAME=\"${KEY_NAME}\"/g vars

#Build the Certificate Authority
#修改build-ca,build-key-server,build-key去掉--interact,变为自动化模式,修改前备份文件
#
cp /usr/share/easy-rsa/build-ca /usr/share/easy-rsa/build-ca.default
sed -i s/--interact//g build-ca
cp /usr/share/easy-rsa/build-key-server /usr/share/easy-rsa/build-key-server.default
sed -i s/--interact//g build-key-server
cp /usr/share/easy-rsa/build-key /usr/share/easy-rsa/build-key.default
sed -i s/--interact//g build-key

#
source vars
./clean-all
./build-ca
#Create the Server Certificate, Key, and Encryption Files

./build-key-server ${MY_SERVER_NAME}
./build-dh
openvpn --genkey --secret keys/ta.key

#Configure the OpenVPN Service

cd ~/openvpn-ca/keys
cp ca.crt ca.key ${MY_SERVER_NAME}.crt ${MY_SERVER_NAME}.key ta.key dh2048.pem /etc/openvpn
gunzip -c /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz > /etc/openvpn/server.conf

##Modify OpenVPN Config File
cp /etc/openvpn/server.conf /etc/openvpn/server.conf.default
sed -i s/^\;tls/tls/g /etc/openvpn/server.conf
echo '#New Config' >> /etc/openvpn/server.conf
echo 'key-direction 0' >> /etc/openvpn/server.conf
sed -i s/^\;cipher[[:space:]]AES/cipher\ AES/g /etc/openvpn/server.conf
echo "auth SHA256" >> /etc/openvpn/server.conf
sed -i s/^\;user/user/g /etc/openvpn/server.conf
sed -i s/^\;group/group/g /etc/openvpn/server.conf
sed -i s/^\;push\ \"redirect-gateway/push\ \"redirect-gateway/g /etc/openvpn/server.conf
sed -i s/^\;push\ \"dhcp-option/push\ \"dhcp-option/g /etc/openvpn/server.conf
sed -i s/^port.*/port\ 443/g /etc/openvpn/server.conf
sed -i s/^proto.*/proto\ tcp/g /etc/openvpn/server.conf
sed -i s/^cert.*/cert\ ${MY_SERVER_NAME}.crt/g /etc/openvpn/server.conf
sed -i s/^key[[:space:]].*/key\ ${MY_SERVER_NAME}.key/g /etc/openvpn/server.conf
cp /etc/openvpn/server.conf /etc/openvpn/${MY_SERVER_NAME}.conf
##Modify sysctl.conf
sed -i s/^#net.ipv4.ip_forward.*/net.ipv4.ip_forward=1/g /etc/sysctl.conf
##Apply sysctl.conf
sysctl -p

##Firewall rules

sed -i s/^DEFAULT_FORWARD_POLICY.*/DEFAULT_FORWARD_POLICY=\"ACCEPT\"/g /etc/default/ufw

sed -i '11i# END OPENVPN RULES' /etc/ufw/before.rules
sed -i '11iCOMMIT' /etc/ufw/before.rules
sed -i 11i-A\ POSTROUTING\ -s\ 10.8.0.0/8\ -o\ ${PUB_ETH}\ -j\ MASQUERADE /etc/ufw/before.rules
sed -i '11i# Allow traffic from OpenVPN client to server' /etc/ufw/before.rules
sed -i '11i:POSTROUTING ACCEPT [0:0]' /etc/ufw/before.rules
sed -i '11i*nat' /etc/ufw/before.rules
sed -i '11i# NAT table rules' /etc/ufw/before.rules
sed -i '11i# START OPENVPN RULES' /etc/ufw/before.rules

##Apply firewall rules

ufw allow 443/tcp
ufw allow OpenSSH
ufw disable
yes | ufw enable

#Start and Enable the OpenVPN Service
systemctl start openvpn@${MY_SERVER_NAME}
systemctl status openvpn@${MY_SERVER_NAME} | grep Active
if [[ $? -eq 0 ]]; then
	echo "Openvpn active (running)"
fi
systemctl enable openvpn@${MY_SERVER_NAME}

##Create Client Configuration Infrastructure

mkdir -p ~/client-configs/files
chmod 700 ~/client-configs/files
cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf ~/client-configs/base.conf

####edit ~/client-configs/base.conf
sed -i s/^remote[[:space:]].*/remote\ ${VPN_SERVER_ADDRESS}\ 443/g ~/client-configs/base.conf
sed -i s/^proto.*/proto\ tcp/g ~/client-configs/base.conf
sed -i s/^\;user/user/g ~/client-configs/base.conf
sed -i s/^\;group/group/g ~/client-configs/base.conf
sed -i s/^ca[[:space:]]/#ca\ /g ~/client-configs/base.conf
sed -i s/^cert[[:space:]]/#cert\ /g ~/client-configs/base.conf
sed -i s/^key[[:space:]]/#key\ /g ~/client-configs/base.conf
echo 'cipher AES-128-CBC' >> ~/client-configs/base.conf
echo 'auth SHA256' >> ~/client-configs/base.conf
echo 'key-direction 1' >> ~/client-configs/base.conf

#Generate a Client Certificate and Key Pair
for i in ${CLIENTS}; do
	cd ~/openvpn-ca
	source vars
	./build-key ${i}
done

#Generate Client Configurations
cd ../..
for i in ${CLIENTS}; do
	cd ~/
	./make_config.sh $i
done

echo "Client Configurations is in ~/client-configs/files"


text:
outline: deep
---

# Socket.io Client

## socketio-client

<Badges>

[![npm version](https://img.shields.io/npm/v/@feathersjs/client.svg?style=flat-square)](https://www.npmjs.com/package/@feathersjs/socketio-client)
[![Changelog](https://img.shields.io/badge/changelog-.md-blue.svg?style=flat-square)](https://github.com/feathersjs/feathers/blob/dove/packages/socketio-client/CHANGELOG.md)

</Badges>

```
npm install @feathersjs/socketio-client --save
```

The `@feathersjs/socketio-client` module allows to connect to services exposed through the [Socket.io transport](../socketio.md) via a Socket.io socket. We recommend using Feathers and the `@feathersjs/socketio-client` module on the client if possible since it can also handle reconnection and reauthentication. If however, you want to use a direct Socket.io connection without using Feathers on the client, see the [Direct connection](#direct-connection) section.

Socket.io is also used to _call_ service methods. Using sockets for both calling methods and receiving real-time events is generally faster than using [REST](./rest.md). There is therefore no need to use both REST and Socket.io in the same client application.

### socketio(socket)

Initialize the Socket.io client using a given socket and the default options.

```ts
import { feathers } from '@feathersjs/feathers'
import socketio from '@feathersjs/socketio-client'
import io from 'socket.io-client'

const socket = io('http://api.feathersjs.com')
const app = feathers()

// Set up Socket.io client with the socket
app.configure(socketio(socket))

// Receive real-time events through Socket.io
app.service('messages').on('created', (message) => console.log('New message created', message))

// Call the `messages` service
app.service('messages').create({
  text: 'A message from a REST client'
})
```

### `app.io`

`app.io` contains a reference to the `socket` object passed to `socketio(socket [, options])`

```ts
app.io.on('disconnect', (reason: any) => {
  // Show offline message
})
```

### Custom Methods

On the client, [custom service methods](../services.md#custom-methods) are also registered using the `methods` option when registering the service via `socketClient.service()`:

```ts
import { feathers } from '@feathersjs/feathers'
import type { Params } from '@feathersjs/feathers'
import socketio from '@feathersjs/socketio-client'
import type { SocketService } from '@feathersjs/socketio-client'
import io from 'socket.io-client'

// `data` and return type of custom method
type CustomMethodData = { name: string }
type CustomMethodResponse = { acknowledged: boolean }

type ServiceTypes = {
  // The type is a Socket service extended with custom methods
  myservice: SocketService & {
    myCustomMethod(data: CustomMethodData, params: Params): Promise<CustomMethodResponse>
  }
}

const socket = io('http://api.feathersjs.com')
const client = feathers<ServiceTypes>()
const socketClient = socketio(socket)

// Set up Socket.io client with the socket
client.configure(socketClient)

// Register a socket client service with all methods listed
client.use('myservice', socketClient.service('myservice'), {
  methods: ['find', 'get', 'create', 'update', 'patch', 'remove', 'myCustomMethod']
})

// Then it can be used like other service methods
client.service('myservice').myCustomMethod(data, params)
```

Just like on the server _all_ methods you want to use have to be listed in the `methods` option.

## Direct connection

Feathers sets up a normal Socket.io server that you can connect to with any Socket.io compatible client, usually the [Socket.io client](http://socket.io/docs/client-api/) either by loading the `socket.io-client` module or `/socket.io/socket.io.js` from the server. Query parameter types do not have to be converted from strings as they do for REST requests.

The socket connection URL has to point to the server root which is where Feathers will set up Socket.io.

```html
<!-- Connecting to the same URL -->
<script src="/socket.io/socket.io.js"></script>
<script>
  var socket = io()
</script>

<!-- Connecting to a different server -->
<script src="http://localhost:3030/socket.io/socket.io.js"></script>
<script>
  var socket = io('http://localhost:3030/')
</script>
```

Service methods can be called by emitting a `<methodname>` event followed by the service path and method parameters. The service path is the name the service has been registered with (in `app.use`), without leading or trailing slashes. An optional callback following the `function(error, data)` Node convention will be called with the result of the method call or any errors that might have occurred.

`params` will be set as `params.query` in the service method call. Other service parameters can be set through a [Socket.io middleware](../socketio.md).

If the service path or method does not exist, an appropriate Feathers error will be returned.

### Authentication

There are two ways to establish an authenticated Socket.io connection. Either by calling the authentication service or by sending authentication headers.

#### Via authentication service

Sockets will be authenticated automatically by calling [.create](#create) on the [authentication service](../authentication/service.md):

```ts
import io from 'socket.io-client'

const socket = io('http://localhost:3030')

socket.emit(
  'create',
  'authentication',
  {
    strategy: 'local',
    email: 'hello@feathersjs.com',
    password: 'supersecret'
  },
  function (error, authResult) {
    console.log(authResult)
    // authResult will be {"accessToken": "your token", "user": user }
    // You can now send authenticated messages to the server
  }
)
```

When a socket disconnects and then reconnects, it has to be authenticated again before making any other request that requires authentication. This is usually done with the [jwt strategy](../authentication/jwt.md) using the `accessToken` from the `authResult`. The [authentication client](../authentication/client.md) handles this already automatically.

```js
socket.on('connect', () => {
  socket.emit(
    'create',
    'authentication',
    {
      strategy: 'jwt',
      accessToken: authResult.accessToken
    },
    function (error, newAuthResult) {
      console.log(newAuthResult)
    }
  )
})
```

#### Via handshake headers

If the authentication strategy (e.g. JWT or API key) supports parsing headers, an authenticated websocket connection can be established by adding the information in the [extraHeaders option](https://socket.io/docs/client-api/#With-extraHeaders):

```ts
import io from 'socket.io-client'

const socket = io('http://localhost:3030', {
  extraHeaders: {
    Authorization: `Bearer <accessToken here>`
  }
})
```

The authentication strategy needs to be included in the [`authStrategies` configuration](../authentication/service.md#configuration).

### find

Retrieves a list of all matching resources from the service

```js
socket.emit('find', 'messages', { status: 'read', user: 10 }, (error, data) => {
  console.log('Found all messages', data)
})
```

Will call `app.service('messages').find({ query: { status: 'read', user: 10 } })` on the server.

### get

Retrieve a single resource from the service.

```js
socket.emit('get', 'messages', 1, (error, message) => {
  console.log('Found message', message)
})
```

Will call `app.service('messages').get(1, {})` on the server.

```js
socket.emit('get', 'messages', 1, { status: 'read' }, (error, message) => {
  console.log('Found message', message)
})
```

Will call `app.service('messages').get(1, { query: { status: 'read' } })` on the server.

### create

Create a new resource with `data` which may also be an array.

```js
socket.emit(
  'create',
  'messages',
  {
    text: 'I really have to iron'
  },
  (error, message) => {
    console.log('Todo created', message)
  }
)
```

Will call `app.service('messages').create({ text: 'I really have to iron' }, {})` on the server.

```js
socket.emit('create', 'messages', [{ text: 'I really have to iron' }, { text: 'Do laundry' }])
```

Will call `app.service('messages').create` with the array.

### update

Completely replace a single or multiple resources.

```js
socket.emit(
  'update',
  'messages',
  2,
  {
    text: 'I really have to do laundry'
  },
  (error, message) => {
    console.log('Todo updated', message)
  }
)
```

Will call `app.service('messages').update(2, { text: 'I really have to do laundry' }, {})` on the server. The `id` can also be `null` to update multiple resources:

```js
socket.emit(
  'update',
  'messages',
  null,
  {
    status: 'unread'
  },
  { status: 'read' }
)
```

Will call `app.service('messages').update(null, { status: 'read' }, { query: { satus: 'unread' } })` on the server.

### patch

Merge the existing data of a single or multiple resources with the new `data`.

```js
socket.emit(
  'patch',
  'messages',
  2,
  {
    read: true
  },
  (error, message) => {
    console.log('Patched message', message)
  }
)
```

Will call `app.service('messages').patch(2, { read: true }, {})` on the server. The `id` can also be `null` to update multiple resources:

```js
socket.emit(
  'patch',
  'messages',
  null,
  {
    status: 'read'
  },
  {
    status: 'unread'
  },
  (error, message) => {
    console.log('Patched message', message)
  }
)
```

Will call `app.service('messages').patch(null, { status: 'read' }, { query: { status: 'unread' } })` on the server, to change the status for all read app.service('messages').

### remove

Remove a single or multiple resources:

```js
socket.emit('remove', 'messages', 2, {}, (error, message) => {
  console.log('Removed a message', message)
})
```

Will call `app.service('messages').remove(2, {})` on the server. The `id` can also be `null` to remove multiple resources:

```js
socket.emit('remove', 'messages', null, { status: 'archived' })
```

Will call `app.service('messages').remove(null, { query: { status: 'archived' } })` on the server to delete all messages with status `archived`.

### Custom methods

[Custom service methods](../services.md#custom-methods) can be called directly via Socket.io by sending a `socket.emit(methodName, serviceName, data, query)` message:

```js
socket.emit('myCustomMethod', 'myservice', { message: 'Hello world' }, {}, (error, data) => {
  console.log('Called myCustomMethod', data)
})
```

### Listening to events

Listening to service events allows real-time behaviour in an application. [Service events](../events.md) are sent to the socket in the form of `servicepath eventname`.

#### created

The `created` event will be published with the callback data, when a service `create` returns successfully.

```ts
const socket = io('http://localhost:3030/')

socket.on('messages created', (message: Message) => {
  console.log('Got a new Todo!', message)
})
```

#### updated, patched

The `updated` and `patched` events will be published with the callback data, when a service `update` or `patch` method calls back successfully.

```ts
const socket = io('http://localhost:3030/')

socket.on('my/messages updated', (message: Message) => {
  console.log('Got an updated Todo!', message)
})

socket.emit(
  'update',
  'my/messages',
  1,
  {
    text: 'Updated text'
  },
  {},
  (error, callback) => {
    // Do something here
  }
)
```

#### removed

The `removed` event will be published with the callback data, when a service `remove` calls back successfully.

```js
const socket = io('http://localhost:3030/')

socket.on('messages removed', (message: Message) => {
  // Remove element showing the Todo from the page
  $('#message-' + message.id).remove()
})
```

#### Custom events

[Custom events](../events.md#custom-events) can be listened to accordingly:

```ts
const socket = io('http://localhost:3030/')

socket.on('messages myevent', function (data: any) {
  console.log('Got myevent event', data)
})
```


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

<recipeml version="0.5">
  <recipe>
    <head>
      <title>Baker's Coconut Crust</title>
      <categories>
        <cat>Pie</cat></categories>
      <yield>1</yield></head>
    <ingredients>
      <ing>
        <amt>
          <qty>2</qty>
          <unit>tablespoons</unit></amt>
        <item>Soft butter</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>package</unit></amt>
        <item>(1 1/2 cups) Baker's Coconut</item></ing></ingredients>
    <directions>
      <step>  Spread butter evenly in an 8- or 9-inch pie pan. Sprinkle Baker's Coconut
  into the pan and pat evenly into the butter. Bake in modorate oven (350øF.)
  until crisp and golden brown (10 to 12 minutes). Cool.

  To serve--fill crust with your favorite flavor of Jell-O Pudding and Pie
  Filling, made according to package directins, and chill until firm. Or fill
  with ice cream and serve immediately.

  Date: Thu, 6 Jun 1996 00:09:37 -0400

  From: BobbieB1@aol.com

  MM-Recipes Digest V3 #157

  From the MealMaster recipe list.  Downloaded from Glen's MM Recipe Archive,
  http://www.erols.com/hosey.

</step></directions></recipe></recipeml>


text:
module Locomotive
  class ContentAssetPolicy < ApplicationPolicy

    def index?
      site_staff?
    end

    def create?
      site_staff?
    end

    def update?
      site_staff?
    end

    def destroy?
      site_staff?
    end

  end
end


text:
package flatbuf

import (
	flatbuffers "github.com/google/flatbuffers/go"
)

type Binary struct {
	_tab flatbuffers.Table
}

func GetRootAsBinary(buf []byte, offset flatbuffers.UOffsetT) *Binary {
	n := flatbuffers.GetUOffsetT(buf[offset:])
	x := &Binary{}
	x.Init(buf, n+offset)
	return x
}

func (rcv *Binary) Init(buf []byte, i flatbuffers.UOffsetT) {
	rcv._tab.Bytes = buf
	rcv._tab.Pos = i
}

func (rcv *Binary) Table() flatbuffers.Table {
	return rcv._tab
}

func BinaryStart(builder *flatbuffers.Builder) {
	builder.StartObject(0)
}
func BinaryEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}


text:
using System;

namespace Excel.Exceptions
{
	public class BiffRecordException : Exception
	{
		public BiffRecordException()
		{
		}

		public BiffRecordException(string message)
			: base(message)
		{
		}

		public BiffRecordException(string message, Exception innerException)
			: base(message, innerException)
		{
		}
	}
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mapping>
  <map key="VPR" value="present" />
  <map key="VER:pres" value="present" />
  <map key="VPP" value="past" />
  <map key="VER:subi" value="imperfect" />
  <map key="VER:subp" value="present" />
</mapping>


text:
Article 1213
----
L'obligation contractée solidairement envers le créancier se divise de plein
droit entre les débiteurs, qui n'en sont tenus entre eux que chacun pour sa part
et portion.


text:
package com.excella.cucumber.hov;

import org.apache.commons.lang3.builder.ToStringBuilder;

public class Vehicle {

	private String type;
	private Integer numberOfOccupants;

	public boolean isHOV3Eligible() {
		return type.equals("hybrid") ||
				type.equals("motorcycle") ||
				numberOfOccupants >= 3;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

}


text:
package org.apache.tinkerpop.gremlin.process.traversal.step.branch;

import org.apache.tinkerpop.gremlin.LoadGraphWith;
import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.MapHelper;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
import org.junit.runner.RunWith;

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

import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.hasLabel;
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.identity;
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.in;
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.out;
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.valueMap;
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.values;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 * @author Joshua Shinavier (http://fortytwo.net)
 */
@RunWith(GremlinProcessRunner.class)
public abstract class ChooseTest extends AbstractGremlinProcessTest {

    public abstract Traversal<Vertex, Object> get_g_V_chooseXout_countX_optionX2L__nameX_optionX3L__valueMapX();

    public abstract Traversal<Vertex, String> get_g_V_chooseXlabel_eqXpersonX__outXknowsX__inXcreatedXX_name();

    public abstract Traversal<Vertex, String> get_g_V_chooseXhasLabelXpersonX_and_outXcreatedX__outXknowsX__identityX_name();

    @Test
    @LoadGraphWith(MODERN)
    public void g_V_chooseXout_countX_optionX2L__nameX_optionX3L__valueMapX() {
        final Traversal<Vertex, Object> traversal = get_g_V_chooseXout_countX_optionX2L__nameX_optionX3L__valueMapX();
        printTraversalForm(traversal);
        final Map<String, Long> counts = new HashMap<>();
        int counter = 0;
        while (traversal.hasNext()) {
            MapHelper.incr(counts, traversal.next().toString(), 1l);
            counter++;
        }
        assertFalse(traversal.hasNext());
        assertEquals(2, counter);
        assertEquals(2, counts.size());
        assertEquals(Long.valueOf(1), counts.get("{name=[marko], age=[29]}"));
        assertEquals(Long.valueOf(1), counts.get("josh"));
    }

    @Test
    @LoadGraphWith(MODERN)
    public void g_V_chooseXlabel_eqXpersonX__outXknowsX__inXcreatedXX_name() {
        final Traversal<Vertex, String> traversal = get_g_V_chooseXlabel_eqXpersonX__outXknowsX__inXcreatedXX_name();
        printTraversalForm(traversal);
        checkResults(Arrays.asList("josh", "vadas", "josh", "josh", "marko", "peter"), traversal);
    }

    @Test
    @LoadGraphWith(MODERN)
    public void g_V_chooseXhasLabelXpersonX_and_outXcreatedX__outXknowsX__identityX_name() {
        final Traversal<Vertex, String> traversal = get_g_V_chooseXhasLabelXpersonX_and_outXcreatedX__outXknowsX__identityX_name();
        printTraversalForm(traversal);
        checkResults(Arrays.asList("lop", "ripple", "josh", "vadas", "vadas"), traversal);
    }

    public static class Traversals extends ChooseTest {

        @Override
        public Traversal<Vertex, Object> get_g_V_chooseXout_countX_optionX2L__nameX_optionX3L__valueMapX() {
            return g.V().choose(out().count())
                    .option(2L, values("name"))
                    .option(3L, valueMap());
        }

        @Override
        public Traversal<Vertex, String> get_g_V_chooseXlabel_eqXpersonX__outXknowsX__inXcreatedXX_name() {
            return g.V().choose(v -> v.label().equals("person"), out("knows"), in("created")).values("name");
        }

        @Override
        public Traversal<Vertex, String> get_g_V_chooseXhasLabelXpersonX_and_outXcreatedX__outXknowsX__identityX_name() {
            return g.V().choose(hasLabel("person").and().out("created"), out("knows"), identity()).values("name");
        }
    }
}


text:
export default {
  REINDEX_URL: 'https://catalytic-magnesium-355.myreindex.com',
};


text:
package cz.nethar.owncloudbookmarks;

import cz.nethar.owncloudbookmarks.R;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class SettingsActivity extends AppCompatActivity {

	private String url, user, pass;
	private boolean trust;
	public static int sort;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_settings);

        SharedPreferences sp = getSharedPreferences(TagList.PREF_KEY, MODE_PRIVATE);
		url = sp.getString(TagList.OWNCLOUD_ADDRESS, "");
		trust = sp.getBoolean(TagList.OWNCLOUD_ACCEPTWRONGCERT, false);
		user = sp.getString(TagList.OWNCLOUD_USERNAME, "");
		pass = sp.getString(TagList.OWNCLOUD_PASSWORD, "");

		if (url.length() == 0 && user.length() == 0) {
	        AccountManager accountManager = AccountManager.get(getApplicationContext());
	        Account[] accounts = accountManager.getAccountsByType("owncloud");

	        if (accounts.length > 0) {
	        	Account a = accounts[0];
	        	String[] all = a.name.split("@");
	        	if (all.length == 2) {
	        		user = all[0];
	        		url = all[1];
	        		if (!url.contains("http")) {
	        			url = "http://" + url;
	        		}
	        	}
	        }
		}

        EditText et = (EditText)this.findViewById(R.id.editTextUrl);
        et.setText(url);

        CheckBox trustCH = (CheckBox)this.findViewById(R.id.trustCheckBox);
        trustCH.setChecked(trust);

        et = (EditText)this.findViewById(R.id.editTextUser);
        et.setText(user);

        et = (EditText)this.findViewById(R.id.editTextPass);
        et.setText(pass);

        Spinner spinner = (Spinner)this.findViewById(R.id.SpinnerSort);
        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.sorting_array, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);

        sort = sp.getInt(TagList.OWNCLOUD_SORTING, TagList.ALPHA_ASC);
        spinner.setSelection(sort);
	}

	// two for spinner
    public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
    }
    public void onNothingSelected(AdapterView<?> parent) {
    }

	public void saveClick(View view) {
        SharedPreferences sp = getSharedPreferences(TagList.PREF_KEY, MODE_PRIVATE);
        Editor editor = sp.edit();

        EditText et = (EditText)this.findViewById(R.id.editTextUrl);
        String newUrl = et.getText().toString();
		if (!newUrl.endsWith("/")) {
			newUrl += "/";
		}

		int i1 = newUrl.lastIndexOf(':');
		int i2 = newUrl.indexOf('/', i1);
		int httpsPort = 443;

		try {
			if (i1 != -1) {
				String port = newUrl.substring(i1 + 1, i2);
				httpsPort = Integer.parseInt(port);
				newUrl = newUrl.substring(0, i1) + newUrl.substring(i2);
				Toast.makeText(this, "HTTPS port retrieved: " + port, Toast.LENGTH_SHORT).show();
			}
		} catch (Exception e) {
			// nothing to do, bad format, use 443
		}

		editor.putString(TagList.OWNCLOUD_ADDRESS, newUrl);
		editor.putInt(TagList.OWNCLOUD_HTTPSPORT, httpsPort);

		CheckBox ch = (CheckBox)this.findViewById(R.id.trustCheckBox);
		boolean newTrust = ch.isChecked();
		editor.putBoolean(TagList.OWNCLOUD_ACCEPTWRONGCERT, newTrust);

        et = (EditText)this.findViewById(R.id.editTextUser);
        String newUser = et.getText().toString();
        editor.putString(TagList.OWNCLOUD_USERNAME, newUser);

        et = (EditText)this.findViewById(R.id.editTextPass);
        String newPass = et.getText().toString();
        editor.putString(TagList.OWNCLOUD_PASSWORD, newPass);

        Spinner spinner = (Spinner)this.findViewById(R.id.SpinnerSort);
        int newSort = spinner.getSelectedItemPosition();
        editor.putInt(TagList.OWNCLOUD_SORTING, newSort);
        sort = newSort;

        editor.commit();

        if (!url.equals(newUrl) || trust != newTrust || !user.equals(newUser) || !pass.equals(newPass) || sort != newSort) {
        	TagList.forceRefresh = true;
        }

		finish();
	}

}