text:
package org.apache.hadoop.hbase.thrift;

import static org.apache.hadoop.hbase.thrift.TestThriftServerCmdLine.createBoundServer;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.function.Supplier;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.thrift.generated.Hbase;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManagerTestHelper;
import org.apache.hadoop.hbase.util.IncrementingEnvironmentEdge;
import org.apache.hadoop.hbase.util.TableDescriptorChecker;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.THttpClient;
import org.apache.thrift.transport.TTransportException;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.ExpectedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Start the HBase Thrift HTTP server on a random port through the command-line interface and talk
 * to it from client side.
 */
@Category({ ClientTests.class, LargeTests.class })
public class TestThriftHttpServer {
  @ClassRule
  public static final HBaseClassTestRule CLASS_RULE =
    HBaseClassTestRule.forClass(TestThriftHttpServer.class);

  private static final Logger LOG = LoggerFactory.getLogger(TestThriftHttpServer.class);

  protected static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();

  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    TEST_UTIL.getConfiguration().setBoolean(Constants.USE_HTTP_CONF_KEY, true);
    TEST_UTIL.getConfiguration().setBoolean(TableDescriptorChecker.TABLE_SANITY_CHECKS, false);
    TEST_UTIL.startMiniCluster();
    // ensure that server time increments every time we do an operation, otherwise
    // successive puts having the same timestamp will override each other
    EnvironmentEdgeManagerTestHelper.injectEdge(new IncrementingEnvironmentEdge());
  }

  @AfterClass
  public static void tearDownAfterClass() throws Exception {
    TEST_UTIL.shutdownMiniCluster();
    EnvironmentEdgeManager.reset();
  }

  @Test
  public void testExceptionThrownWhenMisConfigured() throws IOException {
    Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
    conf.set("hbase.thrift.security.qop", "privacy");
    conf.setBoolean("hbase.thrift.ssl.enabled", false);
    ExpectedException thrown = ExpectedException.none();
    ThriftServerRunner tsr = null;
    try {
      thrown.expect(IllegalArgumentException.class);
      thrown.expectMessage(
        "Thrift HTTP Server's QoP is privacy, " + "but hbase.thrift.ssl.enabled is false");
      tsr = TestThriftServerCmdLine.createBoundServer(() -> new ThriftServer(conf));
      fail("Thrift HTTP Server starts up even with wrong security configurations.");
    } catch (Exception e) {
      LOG.info("Expected!", e);
    } finally {
      if (tsr != null) {
        tsr.close();
      }
    }
  }

  @Rule
  public ExpectedException exception = ExpectedException.none();

  @Test
  public void testRunThriftServerWithHeaderBufferLength() throws Exception {
    // Test thrift server with HTTP header length less than 64k
    try {
      runThriftServer(1024 * 63);
    } catch (TTransportException tex) {
      assertFalse(tex.getMessage().equals("HTTP Response code: 431"));
    }

    // Test thrift server with HTTP header length more than 64k, expect an exception
    exception.expect(TTransportException.class);
    exception.expectMessage("HTTP Response code: 431");
    runThriftServer(1024 * 64);
  }

  protected Supplier<ThriftServer> getThriftServerSupplier() {
    return () -> new ThriftServer(TEST_UTIL.getConfiguration());
  }

  @Test
  public void testRunThriftServer() throws Exception {
    runThriftServer(0);
  }

  void runThriftServer(int customHeaderSize) throws Exception {
    // Add retries in case we see stuff like connection reset
    Exception clientSideException = null;
    for (int i = 0; i < 10; i++) {
      clientSideException = null;
      ThriftServerRunner tsr = createBoundServer(getThriftServerSupplier());
      String url = "http://" + HConstants.LOCALHOST + ":" + tsr.getThriftServer().listenPort;
      try {
        checkHttpMethods(url);
        talkToThriftServer(url, customHeaderSize);
        break;
      } catch (Exception ex) {
        clientSideException = ex;
        LOG.info("Client-side Exception", ex);
      } finally {
        tsr.close();
        tsr.join();
        if (tsr.getRunException() != null) {
          LOG.error("Invocation of HBase Thrift server threw exception", tsr.getRunException());
          throw tsr.getRunException();
        }
      }
    }

    if (clientSideException != null) {
      LOG.error("Thrift Client", clientSideException);
      throw clientSideException;
    }
  }

  private void checkHttpMethods(String url) throws Exception {
    // HTTP TRACE method should be disabled for security
    // See https://www.owasp.org/index.php/Cross_Site_Tracing
    HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
    conn.setRequestMethod("TRACE");
    conn.connect();
    Assert.assertEquals(conn.getResponseMessage(), HttpURLConnection.HTTP_FORBIDDEN,
      conn.getResponseCode());
  }

  protected static volatile boolean tableCreated = false;

  protected void talkToThriftServer(String url, int customHeaderSize) throws Exception {
    THttpClient httpClient = new THttpClient(url);
    httpClient.open();

    if (customHeaderSize > 0) {
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < customHeaderSize; i++) {
        sb.append("a");
      }
      httpClient.setCustomHeader("User-Agent", sb.toString());
    }

    try {
      TProtocol prot;
      prot = new TBinaryProtocol(httpClient);
      Hbase.Client client = new Hbase.Client(prot);
      if (!tableCreated) {
        TestThriftServer.createTestTables(client);
        tableCreated = true;
      }
      TestThriftServer.checkTableList(client);
    } finally {
      httpClient.close();
    }
  }
}


text:
"use strict";

function _interopDefault(ex) {
  return ex && "object" == typeof ex && "default" in ex ? ex.default : ex;
}

Object.defineProperty(exports, "__esModule", {
  value: !0
}), require("@babel/runtime/helpers/extends"), require("@babel/runtime/helpers/defineProperty");

var _classCallCheck = _interopDefault(require("@babel/runtime/helpers/classCallCheck")), _createClass = _interopDefault(require("@babel/runtime/helpers/createClass")), _inherits = _interopDefault(require("@babel/runtime/helpers/inherits")), _possibleConstructorReturn = _interopDefault(require("@babel/runtime/helpers/possibleConstructorReturn")), _getPrototypeOf = _interopDefault(require("@babel/runtime/helpers/getPrototypeOf"));

require("@babel/runtime/helpers/toConsumableArray");

var React = require("react"), React__default = _interopDefault(React), react = require("@emotion/react");

require("react-dom"), require("@babel/runtime/helpers/typeof");

var index$1 = require("./index-7d81dbd5.cjs.prod.js"), reactSelect = require("./Select-fc214dcf.cjs.prod.js");

require("@babel/runtime/helpers/objectWithoutProperties"), require("@babel/runtime/helpers/taggedTemplateLiteral"),
require("react-input-autosize");

var stateManager = require("./stateManager-cde87a80.cjs.prod.js"), createCache = _interopDefault(require("@emotion/cache")), memoizeOne = _interopDefault(require("memoize-one"));

function _createSuper(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
  return function() {
    var result, Super = _getPrototypeOf(Derived);
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else result = Super.apply(this, arguments);
    return _possibleConstructorReturn(this, result);
  };
}

function _isNativeReflectConstruct() {
  if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
  if (Reflect.construct.sham) return !1;
  if ("function" == typeof Proxy) return !0;
  try {
    return Date.prototype.toString.call(Reflect.construct(Date, [], (function() {}))),
    !0;
  } catch (e) {
    return !1;
  }
}

var NonceProvider = function(_Component) {
  _inherits(NonceProvider, _Component);
  var _super = _createSuper(NonceProvider);
  function NonceProvider(props) {
    var _this;
    return _classCallCheck(this, NonceProvider), (_this = _super.call(this, props)).createEmotionCache = function(nonce, key) {
      return createCache({
        nonce: nonce,
        key: key
      });
    }, _this.createEmotionCache = memoizeOne(_this.createEmotionCache), _this;
  }
  return _createClass(NonceProvider, [ {
    key: "render",
    value: function() {
      var emotionCache = this.createEmotionCache(this.props.nonce, this.props.cacheKey);
      return React__default.createElement(react.CacheProvider, {
        value: emotionCache
      }, this.props.children);
    }
  } ]), NonceProvider;
}(React.Component), index = stateManager.manageState(reactSelect.Select);

exports.components = index$1.components, exports.createFilter = reactSelect.createFilter,
exports.defaultTheme = reactSelect.defaultTheme, exports.mergeStyles = reactSelect.mergeStyles,
exports.NonceProvider = NonceProvider, exports.default = index;

redpajama_set_name: RedPajamaGithub


text:
---
layout: default
title: Quick tour
nav_order: 2
---
{% include support.md %}

# Quick tour

* [Transport](#transport)
* [Consumption](#consumption)
* [Remote Procedure Call (RPC)](#remote-procedure-call-rpc)
* [Client](#client)
* [Cli commands](#cli-commands)
* [Monitoring](#monitoring)
* [Symfony bundle](#symfony)

## Transport

The transport layer or PSR (Enqueue message service) is a Message Oriented Middleware for sending messages between two or more clients.
It is a messaging component that allows applications to create, send, receive, and read messages.
It allows the communication between different components of a distributed application to be loosely coupled, reliable, and asynchronous.

PSR is inspired by JMS (Java Message Service). We tried to stay as close as possible to the [JSR 914](https://docs.oracle.com/javaee/7/api/javax/jms/package-summary.html) specification.
For now it supports [AMQP](https://www.rabbitmq.com/tutorials/amqp-concepts.html) and [STOMP](https://stomp.github.io/) message queue protocols.
You can connect to many modern brokers such as [RabbitMQ](https://www.rabbitmq.com/), [ActiveMQ](http://activemq.apache.org/) and others.

Produce a message:

```php
<?php
use Interop\Queue\ConnectionFactory;

/** @var ConnectionFactory $connectionFactory **/
$context = $connectionFactory->createContext();

$destination = $context->createQueue('foo');
//$destination = $context->createTopic('foo');

$message = $context->createMessage('Hello world!');

$context->createProducer()->send($destination, $message);
```

Consume a message:

```php
<?php
use Interop\Queue\ConnectionFactory;

/** @var ConnectionFactory $connectionFactory **/
$context = $connectionFactory->createContext();

$destination = $context->createQueue('foo');
//$destination = $context->createTopic('foo');

$consumer = $context->createConsumer($destination);

$message = $consumer->receive();

// process a message

$consumer->acknowledge($message);
// $consumer->reject($message);
```

## Consumption

Consumption is a layer built on top of a transport functionality.
The goal of the component is to simply consume messages.
The `QueueConsumer` is main piece of the component it allows binding of message processors (or callbacks) to queues.
The `consume` method starts the consumption process which last as long as it is not interrupted.

```php
<?php
use Interop\Queue\Message;
use Interop\Queue\Processor;
use Interop\Queue\Context;
use Enqueue\Consumption\QueueConsumer;

/** @var Context $context */

$queueConsumer = new QueueConsumer($context);

$queueConsumer->bindCallback('foo_queue', function(Message $message) {
    // process message

    return Processor::ACK;
});
$queueConsumer->bindCallback('bar_queue', function(Message $message) {
    // process message

    return Processor::ACK;
});

$queueConsumer->consume();
```

There are bunch of [extensions](consumption/extensions.md) available.
This is an example of how you can add them.
The `SignalExtension` provides support of process signals, whenever you send SIGTERM for example it will correctly managed.
The `LimitConsumptionTimeExtension` interrupts the consumption after given time.

```php
<?php
use Enqueue\Consumption\ChainExtension;
use Enqueue\Consumption\QueueConsumer;
use Enqueue\Consumption\Extension\SignalExtension;
use Enqueue\Consumption\Extension\LimitConsumptionTimeExtension;

/** @var \Interop\Queue\Context $context */

$queueConsumer = new QueueConsumer($context, new ChainExtension([
    new SignalExtension(),
    new LimitConsumptionTimeExtension(new \DateTime('now + 60 sec')),
]));
```

## Remote Procedure Call (RPC)

There is RPC component that allows you send RPC requests over MQ easily.
You can do several calls asynchronously. This is how you can send a RPC message and wait for a reply message.

```php
<?php
use Enqueue\Rpc\RpcClient;

/** @var \Interop\Queue\Context $context */

$queue = $context->createQueue('foo');
$message = $context->createMessage('Hi there!');

$rpcClient = new RpcClient($context);

$promise = $rpcClient->callAsync($queue, $message, 1);
$replyMessage = $promise->receive();
```

There is also extensions for the consumption component.
It simplifies a server side of RPC.

```php
<?php
use Interop\Queue\Message;
use Interop\Queue\Context;
use Enqueue\Consumption\ChainExtension;
use Enqueue\Consumption\QueueConsumer;
use Enqueue\Consumption\Extension\ReplyExtension;
use Enqueue\Consumption\Result;

/** @var \Interop\Queue\Context $context */

$queueConsumer = new QueueConsumer($context, new ChainExtension([
    new ReplyExtension()
]));

$queueConsumer->bindCallback('foo', function(Message $message, Context $context) {
    $replyMessage = $context->createMessage('Hello');

    return Result::reply($replyMessage);
});

$queueConsumer->consume();
```

## Client

It provides an easy to use high level abstraction.
The goal of the component is to hide as much as possible low level details so you can concentrate on things that really matter.
For example, it configures a broker for you by creating queues, exchanges and bind them.
It provides easy to use services for producing and processing messages.
It supports unified format for setting message expiration, delay, timestamp, correlation id.
It supports [message bus](http://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageBus.html) so different applications can talk to each other.

Here's an example of how you can send and consume **event messages**.

```php
<?php
use Enqueue\SimpleClient\SimpleClient;
use Interop\Queue\Message;

// composer require enqueue/amqp-ext
$client = new SimpleClient('amqp:');

// composer require enqueue/fs
$client = new SimpleClient('file://foo/bar');
$client->bindTopic('a_foo_topic', function(Message $message) {
    echo $message->getBody().PHP_EOL;

    // your event processor logic here
});

$client->setupBroker();

$client->sendEvent('a_foo_topic', 'message');

// this is a blocking call, it'll consume message until it is interrupted
$client->consume();
```

and **command messages**:

```php
<?php
use Enqueue\SimpleClient\SimpleClient;
use Interop\Queue\Message;
use Interop\Queue\Context;
use Enqueue\Client\Config;
use Enqueue\Consumption\Extension\ReplyExtension;
use Enqueue\Consumption\Result;

// composer require enqueue/amqp-ext # or enqueue/amqp-bunny or enqueue/amqp-lib
$client = new SimpleClient('amqp:');

// composer require enqueue/fs
//$client = new SimpleClient('file://foo/bar');

$client->bindCommand('bar_command', function(Message $message) {
    // your bar command processor logic here
});

$client->bindCommand('baz_reply_command', function(Message $message, Context $context) {
    // your baz reply command processor logic here

    return Result::reply($context->createMessage('theReplyBody'));
});

$client->setupBroker();

// It is sent to one consumer.
$client->sendCommand('bar_command', 'aMessageData');

// It is possible to get reply
$promise = $client->sendCommand('bar_command', 'aMessageData', true);

// you can send several commands and only after start getting replies.

$replyMessage = $promise->receive(2000); // 2 sec

// this is a blocking call, it'll consume message until it is interrupted
$client->consume([new ReplyExtension()]);
```

Read more about events and commands [here](client/quick_tour.md#produce-message).

## Cli commands

The library provides handy commands out of the box.
They all build on top of [Symfony Console component](http://symfony.com/doc/current/components/console.html).
The most useful is a consume command. There are two of them one from consumption component and the other from client one.

Let's see how you can use consumption one:

```php
#!/usr/bin/env php
<?php
// app.php

use Symfony\Component\Console\Application;
use Interop\Queue\Message;
use Enqueue\Consumption\QueueConsumer;
use Enqueue\Symfony\Consumption\SimpleConsumeCommand;

/** @var QueueConsumer $queueConsumer */

$queueConsumer->bindCallback('a_queue', function(Message $message) {
    // process message
});

$consumeCommand = new SimpleConsumeCommand($queueConsumer);
$consumeCommand->setName('consume');

$app = new Application();
$app->add($consumeCommand);
$app->run();
```

and starts the consumption from the console:

```bash
$ app.php consume
```

## Monitoring

There is a tool that can track sent\consumed messages as well as consumer performance. Read more [here](monitoring.md)

[back to index](index.md)

## Symfony

Read more [here](bundle/quick_tour.md) about using Enqueue as a Symfony Bundle.


text:
class LargeSum

  def initialize long_numbers
    @long_numbers = long_numbers.map(&:to_i)
  end

  def euler
    truncate(sum, 10)
  end

  def sum
    long_numbers.reduce(:+)
  end

  def truncate(number, length)
    number.to_s()[0...length].to_i
  end

  private
  attr_accessor :long_numbers

end


text:
package com.amazonaws.services.elasticmapreduce.model.transform;

import java.util.Map;
import java.util.List;

import com.amazonaws.AmazonClientException;
import com.amazonaws.services.elasticmapreduce.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.BinaryUtils;
import com.amazonaws.util.StringUtils;
import com.amazonaws.util.IdempotentUtils;
import com.amazonaws.util.StringInputStream;
import com.amazonaws.protocol.json.*;

/**
 * HadoopJarStepConfigMarshaller
 */
public class HadoopJarStepConfigJsonMarshaller {

    /**
     * Marshall the given parameter object, and output to a SdkJsonGenerator
     */
    public void marshall(HadoopJarStepConfig hadoopJarStepConfig,
            StructuredJsonGenerator jsonGenerator) {

        if (hadoopJarStepConfig == null) {
            throw new AmazonClientException(
                    "Invalid argument passed to marshall(...)");
        }

        try {
            jsonGenerator.writeStartObject();

            com.amazonaws.internal.SdkInternalList<KeyValue> propertiesList = (com.amazonaws.internal.SdkInternalList<KeyValue>) hadoopJarStepConfig
                    .getProperties();
            if (!propertiesList.isEmpty() || !propertiesList.isAutoConstruct()) {
                jsonGenerator.writeFieldName("Properties");
                jsonGenerator.writeStartArray();
                for (KeyValue propertiesListValue : propertiesList) {
                    if (propertiesListValue != null) {

                        KeyValueJsonMarshaller.getInstance().marshall(
                                propertiesListValue, jsonGenerator);
                    }
                }
                jsonGenerator.writeEndArray();
            }
            if (hadoopJarStepConfig.getJar() != null) {
                jsonGenerator.writeFieldName("Jar").writeValue(
                        hadoopJarStepConfig.getJar());
            }
            if (hadoopJarStepConfig.getMainClass() != null) {
                jsonGenerator.writeFieldName("MainClass").writeValue(
                        hadoopJarStepConfig.getMainClass());
            }

            com.amazonaws.internal.SdkInternalList<String> argsList = (com.amazonaws.internal.SdkInternalList<String>) hadoopJarStepConfig
                    .getArgs();
            if (!argsList.isEmpty() || !argsList.isAutoConstruct()) {
                jsonGenerator.writeFieldName("Args");
                jsonGenerator.writeStartArray();
                for (String argsListValue : argsList) {
                    if (argsListValue != null) {
                        jsonGenerator.writeValue(argsListValue);
                    }
                }
                jsonGenerator.writeEndArray();
            }

            jsonGenerator.writeEndObject();
        } catch (Throwable t) {
            throw new AmazonClientException(
                    "Unable to marshall request to JSON: " + t.getMessage(), t);
        }
    }

    private static HadoopJarStepConfigJsonMarshaller instance;

    public static HadoopJarStepConfigJsonMarshaller getInstance() {
        if (instance == null)
            instance = new HadoopJarStepConfigJsonMarshaller();
        return instance;
    }

}


text:
namespace gsfts = GSF::TimeSeries;

// Adds a measurement key to the cache.
void gsfts::Transport::SignalIndexCache::AddMeasurementKey(
	uint16_t signalIndex,
	gsfts::Guid signalID,
	std::string source,
	uint32_t id)
{
	std::size_t vectorIndex = m_signalIDList.size();

	m_reference[signalIndex] = vectorIndex;
	m_signalIDList.push_back(signalID);
	m_sourceList.push_back(source);
	m_idList.push_back(id);

	m_signalIDCache[signalID] = signalIndex;
}

// Empties the cache.
void gsfts::Transport::SignalIndexCache::Clear()
{
	m_reference.clear();
	m_signalIDList.clear();
	m_sourceList.clear();
	m_idList.clear();

	m_signalIDCache.clear();
}

// Determines whether an element with the given runtime ID exists in the signal index cache.
bool gsfts::Transport::SignalIndexCache::Contains(uint16_t signalIndex) const
{
	return m_reference.find(signalIndex) != m_reference.end();
}

// Gets the globally unique signal ID associated with the given 16-bit runtime ID.
gsfts::Guid gsfts::Transport::SignalIndexCache::GetSignalID(uint16_t signalIndex) const
{
	std::size_t vectorIndex = m_reference.find(signalIndex)->second;
	return m_signalIDList[vectorIndex];
}

// Gets the first half of the human-readable measurement
// key associated with the given 16-bit runtime ID.
std::string gsfts::Transport::SignalIndexCache::GetSource(uint16_t signalIndex) const
{
	std::size_t vectorIndex = m_reference.find(signalIndex)->second;
	return m_sourceList[vectorIndex];
}

// Gets the second half of the human-readable measurement
// key associated with the given 16-bit runtime ID.
uint32_t gsfts::Transport::SignalIndexCache::GetID(uint16_t signalIndex) const
{
	std::size_t vectorIndex = m_reference.find(signalIndex)->second;
	return m_idList[vectorIndex];
}

// Gets the globally unique signal ID as well as the human-readable
// measurement key associated with the given 16-bit runtime ID.
void gsfts::Transport::SignalIndexCache::GetMeasurementKey(
	uint16_t signalIndex,
	gsfts::Guid& signalID,
	std::string& source,
	uint32_t& id) const
{
	std::size_t vectorIndex = m_reference.find(signalIndex)->second;

	signalID = m_signalIDList[vectorIndex];
	source = m_sourceList[vectorIndex];
	id = m_idList[vectorIndex];
}

// Gets the 16-bit runtime ID associated with the given globally unique signal ID.
unsigned short gsfts::Transport::SignalIndexCache::GetSignalIndex(gsfts::Guid signalID) const
{
	std::map<gsfts::Guid, uint16_t>::const_iterator it;
	uint16_t signalIndex = 0xFFFF;

	it = m_signalIDCache.find(signalID);

	if(it != m_signalIDCache.end())
		signalIndex = it->second;

	return signalIndex;
}


text:
---
topic: "Rational: ex14"
desc: "Java Lambdas"
indent: true
code_repo: https://github.com/UCSB-CS56-pconrad/cs56-rational-ex14
---

{% include rational_example_header.html %}

# Lambdas: An admittedly contrived example

My purpose here is to introduce lambdas in order to prepare us for
* using Lambdas with the [SparkJava Web Framework]()
* using Lambdas with the [Finite State Automaton Lexical Analizer](https://github.com/ucsb-cs56-pconrad/ucsb-cs56-parsing-arithmetic-expressions/blob/master/src/edu/ucsb/cs56/pconrad/parsing/tokenizer/Tokenizer.java#L33) that is part of the [Parsing Tutorial](https://ucsb-cs56-pconrad.github.io/tutorials/parsing/)
* job interview questions about [Java Lambdas](https://ucsb-cs56-pconrad.github.io/topics/java_lambda_expressions/) and Functional Programming in Java, in general, for example [Streams](https://ucsb-cs56-pconrad.github.io/topics/java_streams/)

Having said that, the example shown here is admittedly a bit contrived.

# Imaginary Dialog with the Ideal Student about this Contrived Example

* Q: "But Professor, why would we do it that way?"
* A: "Yeah, you're right, this might be a bad idea in practice. Or not.  That's not the point."
* Q: "What is the point?"
* A: "To have a small, simple example of using Lambdas that is rooted in the Rational Tutorial.  Go with me on this."
* Q: "Ok, but I'm skeptical".
* A: "Good.  That's right where I want you to be.  Open, but with just the right amount of skepticism. Not so much that you reject everything I say, and not so little that you just accept it blindly."

# Our contrived purpose

What we want is:
* A Java interface for a generic function that takes a Rational as it's argument, and produces a string.
* We could have lots of different implementations of that:
   * The most obviously one produces just the number in the form "3/4"
   *  If that sounds like `toString`, you are almost right.   What we are talking about is more of a "generic" toString function, but NOT as a member function
   of Rational.  As something more like a "plugin".
   * An alternative implementation might produce the numerator and demoninator as a prime factorization of the number, e.g. `"(3)/(2 * 2)"` or
      even `"(3)/(2^2)"`.   The fraction "9/50" might be rendered as `"(3^2)/(2 * 5^2)"`.
   * Another might be to render it as a decimal approximation, e.g. "0.75" instead of "3/4" or "0.333" instead of "1/3", or "0.667" instead of "2/3"
   * Finally, we might render it in a way that it could be typeset with a Math typesetting system LaTeX.
      For example if we want $$ \frac{3}{4} $$, we might produce the string `"\frac{3}{4}"`

# What would we use that for?

Suppose we wanted to make tables of rational numbers like this one.  Here, the column headings are the
numerators, and the row headings are the denominators.

| |1|2|3|4|
|-|-|-|-|-|
|1|1|2|3|4|
|2|1/2|1|3/2|2|
|3|1/3|2/3|1|4/3|

So we might add a method to the `Rational` class with this signature to produce such a table:

```java
  public static String tableOfRationalsMarkdown(int rows, int cols)
```

You can imagine that this method might have a couple of nested for loops, and go through
and for each of the entries, do something like this.  (This is just a portion of the code;
the part that generates everything except the first two lines.)

```java
  for (int denom=1; denom<=rows; denom++) {
    result += "|" + denom;
    for (int num=1; num<=cols; num++) {
      Rational r = new Rational(num,denom);
      result += "|" + r.toString();
    }
    result += "|" + System.lineSeparator();
  }
  return result;
```

But, what if we also wanted a table of decimal approximations to these Rational numbers, like this?

| |1|2|3|4|
|-|-|-|-|-|
|1|1.000|2.000|3.000|4.000|
|2|0.500|1.000|1.500|2.000|
|3|0.333|0.667|1.000|1.333|

Or HTML notation to give fractions, which when formatted, produces this:

| |1|2|3|4|5|
|-|-|-|-|-|-|
|1|1|2|3|4|5|
|2|1⁄2|1|3⁄2|2|5⁄2|
|3|1⁄3|2⁄3|1|4⁄3|5⁄3|
|4|1⁄4|1⁄2|3⁄4|1|5⁄4|

And in raw Markdown plus HTML looks like this:

```html
| |1|2|3|4|5|
|-|-|-|-|-|-|
|1|1|2|3|4|5|
|2|<sup>1</sup>⁄<sub>2</sub>|1|<sup>3</sup>⁄<sub>2</sub>|2|<sup>5</sup>⁄<sub>2</sub>|
|3|<sup>1</sup>⁄<sub>3</sub>|<sup>2</sup>⁄<sub>3</sub>|1|<sup>4</sup>⁄<sub>3</sub>|<sup>5</sup>⁄<sub>3</sub>|
|4|<sup>1</sup>⁄<sub>4</sub>|<sup>1</sup>⁄<sub>2</sub>|<sup>3</sup>⁄<sub>4</sub>|1|<sup>5</sup>⁄<sub>4</sub>|
```

Or LaTeX notation that, when formatted, produces this:

![latex notation](latex_25.png)

![latex notation](rational_ex14/latex_25.png)

In raw UTF-8 (ASCII) LaTeX code (text), that looks like this:

```
| |1|2|3|4|
|-|-|-|-|-|
|1|1|2|3|4|
|2|$$\frac{1}{2}$$|1|$$\frac{3}{2}$$|2|
|3|$$\frac{1}{3}$$|$$\frac{2}{3}$$|1|$$\frac{4}{3}$$|
```

Each time we want a different format,  we *could* go back into the Rational class each time,
and copy/paste all of that for loop code, just to change the *one line* that produces the formatted
string.

But that would be unpleasant,
and wasteful.   What we want instead, is a way to "plug in" a custom way of printing the Rational.

So, imagine that in addition the method we defined before, we also define this one:

* `public static String tableOfRationalsMarkdown(int rows, int cols)`
* `public static String tableOfRationalsMarkdown(int rows, int cols, Rational2String r2s)`

The second version of the method takes an additional parameter of type `Rational2String`.  This is
an object that implements the Rational2String interface, and allows us to "customize" the way
that the Rational object is printed.  And it allows us to do that *without having to change the
code for the Rational class!*

# Then, what if we could define that new class inline?

There are at least four ways of defining a new class for that plugin:

1. Separate class in a separate file
2. Separate inner class (with a name) that we explicitly instantiate
3. Inline anonymous inner class
4. Lambda expression

Let's show what each of those looks like.

# Separate class in a separate file

We could define a class that implements the `Rational2String`
interface in separate file.  For example, see the file
`BasicRational2String.java`.

Here's what that file looks like:

```java
package edu.ucsb.cs56.pconrad.rational;
public class BasicRational2String implements Rational2String {
    /**
        Return a string representation of a Rational number
     */
    @Override
    public String r2s(Rational r) {
        return r.toString();
    }
}
```

Here is an example of using that:

```java
        BasicRational2String br2s = new BasicRational2String();
        String actual = Rational.markdownTable(3,4,br2s);
```

# Separate named inner class that we explicitly instantiate

The named inner class might look like this.  This code would appear INSIDE another class where
`MyPlugin` is being used.

```java
  public class MyPlugin implements Rational2String {
        public String r2s(Rational r) { return r.toString(); }
    }
```

to use it, you'd write:

```java
        String actual = Rational.markdownTable(3,4,new MyPlugin());
```

Note that in the above line of code, the instance of the class `MyPlugin` is anonymous, but the class itself has a name.

# Inline anonymous inner class

```java
   Rational2String r2s = new Rational2String() {
                public String r2s(Rational r) { return r.toString(); }
            };
   String actual = Rational.markdownTable(3,4,r2s);
```

We could also write it like this:

```java
  String actual =
            Rational.markdownTable(3, 4 ,new Rational2String() {
                    public String r2s(Rational r) { return r.toString(); }
                });
 ```

# Lambda expression

We compress the entire anonymous instance of the anonymous inner class down to its essentials:

`(r)` is the parameter to the `r2s` method (function).
`->` says: we are mapping that `Rational r` to its return value
`r.toString()` is the return value for the `r2s` method (function).

```java
 String actual = Rational.markdownTable(3, 4 , (r)->r.toString() );
```


text:
package mil.army.usace.ehlschlaeger.rgik.unsorted;

import java.io.IOException;

import mil.army.usace.ehlschlaeger.rgik.core.GISClass;

public class SetNoData  {
	public SetNoData() {
	}

	public static void main( String argv[]) throws IOException {
		if( argv.length < 3) {
            System.out.println( "SetNoData: unset all cells with given value.");
            System.out.println( "Usage:");
			System.out.println( "  java SetNoData inputMap outputMap cellValue");
			System.exit( -1);
		}
		String iMap = argv[ 0];
		String oMap = argv[ 1];
		int c = (new Integer( argv[2].trim())).intValue();
		GISClass in_map = GISClass.loadEsriAscii( iMap);
		in_map.setCellValueToNoData( c);
		in_map.writeAsciiEsri( oMap);
	}
}


text:
class CreateUserStocks < ActiveRecord::Migration
  def change
    create_table :user_stocks do |t|
      t.references :user
      t.references :stock

      t.timestamps null: false
    end
  end
end


text:
package com.yunxian.immerse.utils;

import android.view.Window;
import android.view.WindowManager;

import androidx.annotation.NonNull;

/**
 * Window相关工具类
 *
 * @author AShuai
 * @email ls1110924@gmail.com
 * @date 17/1/23 上午10:07
 */
public final class WindowUtils {

    private WindowUtils() {
        throw new IllegalStateException("shouldn't init instance!");
    }

    /**
     * 为Window对象设置或取消一些标志位集合
     *
     * @param window Window对象
     * @param on     true为设置,false为取消
     * @param flags  {@link android.view.WindowManager.LayoutParams}中的标志位集合
     */
    private static void setWindowFlags(@NonNull Window window, boolean on, int flags) {
        WindowManager.LayoutParams params = window.getAttributes();
        if (on) {
            if ((params.flags & flags) == 0) {
                params.flags |= flags;
                window.setAttributes(params);
            }
        } else {
            if ((params.flags & flags) != 0) {
                params.flags &= ~flags;
                window.setAttributes(params);
            }
        }
    }

    /**
     * 为Window对象增加标志位
     *
     * @param window Window对象
     * @param flags  {@link android.view.WindowManager.LayoutParams}中的标志位集合
     */
    public static void addWindowFlags(@NonNull Window window, int flags) {
        setWindowFlags(window, true, flags);
    }

    /**
     * 为Window对象取消标志位
     *
     * @param window Window对象
     * @param flags  {@link android.view.WindowManager.LayoutParams}中的标志位集合
     */
    public static void clearWindowFlags(@NonNull Window window, int flags) {
        setWindowFlags(window, false, flags);
    }

}


text:
/// <reference path='fourslash.ts' />

//// var x: /*a*/{ a?: number, b?: string }/*b*/ = { };

goTo.select("a", "b");
edit.applyRefactor({
    refactorName: "Extract type",
    actionName: "Extract to type alias",
    actionDescription: "Extract to type alias",
    newContent: `type /*RENAME*/NewType = {
    a?: number;
    b?: string;
};

var x: NewType = { };`,
});


text:
//
//  UIImage+WHImage.h
//  WHKit
//  https://github.com/remember17/WHKit
//  Created by 吴浩 on 2017/6/7.
//  Copyright © 2017年 remember17. All rights reserved.
//  http://www.jianshu.com/p/c935314b078e

#import <UIKit/UIKit.h>

typedef void (^UIImageSizeRequestCompleted) (NSURL* imgURL, CGSize size);

@interface UIImage (WHImage)

//截屏
+(instancetype)wh_snapshotCurrentScreen;

//图片模糊效果
- (UIImage *)blur;

//高效添加圆角图片
- (UIImage*)wh_imageAddCornerWithRadius:(CGFloat)radius andSize:(CGSize)size;

//圆形图片
+ (UIImage *)wh_GetRoundImagewithImage:(UIImage *)image;

//在图片上加居中的文字
- (UIImage *)wh_imageWithTitle:(NSString *)title fontSize:(CGFloat)fontSize titleColor:(UIColor *)titleColor;

/**
 取图片某一像素点的颜色

 @param point 图片上的某一点
 @return 图片上这一点的颜色
 */
- (UIColor *)wh_colorAtPixel:(CGPoint)point;

/**
 生成一个纯色的图片

 @param color 图片颜色
 @return 返回的纯色图片
 */
- (UIImage *)wh_imageWithColor:(UIColor *)color;

/** 获得灰度图 */
- (UIImage *)wh_convertToGrayImage;

+ (UIImage *)animatedImageWithAnimatedGIFData:(NSData *)theData;
+ (UIImage *)animatedImageWithAnimatedGIFURL:(NSURL *)theURL;

/** 合并两个图片为一个图片 */
+ (UIImage*)mergeImage:(UIImage*)firstImage withImage:(UIImage*)secondImage;

/** 压缩图片 最大字节大小为maxLength */
- (NSData *)compressWithMaxLength:(NSInteger)maxLength;

/** 纠正图片的方向 */
- (UIImage *)fixOrientation;

/** 按给定的方向旋转图片 */
- (UIImage*)rotate:(UIImageOrientation)orient;

/** 垂直翻转 */
- (UIImage *)flipVertical;

/** 水平翻转 */
- (UIImage *)flipHorizontal;

/** 将图片旋转degrees角度 */
- (UIImage *)imageRotatedByDegrees:(CGFloat)degrees;

/** 将图片旋转radians弧度 */
- (UIImage *)imageRotatedByRadians:(CGFloat)radians;

/** 截取当前image对象rect区域内的图像 */
- (UIImage *)subImageWithRect:(CGRect)rect;

/** 压缩图片至指定尺寸 */
- (UIImage *)rescaleImageToSize:(CGSize)size;

/** 压缩图片至指定像素 */
- (UIImage *)rescaleImageToPX:(CGFloat )toPX;

/** 在指定的size里面生成一个平铺的图片 */
- (UIImage *)getTiledImageWithSize:(CGSize)size;

/** UIView转化为UIImage */
+ (UIImage *)imageFromView:(UIView *)view;

- (UIImage *)imageCroppedToRect:(CGRect)rect;
- (UIImage *)imageScaledToSize:(CGSize)size;
- (UIImage *)imageScaledToFitSize:(CGSize)size;
- (UIImage *)imageScaledToFillSize:(CGSize)size;
- (UIImage *)imageCroppedAndScaledToSize:(CGSize)size
                             contentMode:(UIViewContentMode)contentMode
                                padToFit:(BOOL)padToFit;

- (UIImage *)reflectedImageWithScale:(CGFloat)scale;
- (UIImage *)imageWithReflectionWithScale:(CGFloat)scale gap:(CGFloat)gap alpha:(CGFloat)alpha;

//带有阴影效果的图片
- (UIImage *)imageWithShadowColor:(UIColor *)color offset:(CGSize)offset blur:(CGFloat)blur;
- (UIImage *)imageWithCornerRadius:(CGFloat)radius;
- (UIImage *)imageWithAlpha:(CGFloat)alpha;
- (UIImage *)imageWithMask:(UIImage *)maskImage;

- (UIImage *)maskImageFromImageAlpha;

@end


text:
layout:     post
title:      "Design Workflow UI/UX"
subtitle:   "Set Up Domains"
date:       2015-02-21 14:00:44
author:     "Lucas Gatsas"
header-img: "img/lucas-gatsas-ux-ui.jpg"
---

Design UI/UX Interface

Update Post Soon. Stay in Space.

	"I Closely Follow Everthing about User Interface Or Human-Computer Interface:
	Technology That Makes Computers Closer to the Way Human Being Actually Functions" - Francois -Henri Pinault Lifehack Quotes


text:
package com.composum.sling.core.usermanagement.service.impl;

import com.composum.sling.core.usermanagement.service.Authorizables;
import com.composum.sling.core.usermanagement.service.ServiceUser;
import org.apache.commons.lang3.StringUtils;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Query;
import org.apache.jackrabbit.api.security.user.QueryBuilder;
import org.apache.jackrabbit.api.security.user.UserManager;
import org.apache.sling.serviceusermapping.Mapping;
import org.apache.sling.serviceusermapping.ServiceUserMapper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.jcr.RepositoryException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.regex.Pattern;

@Component
public class AuthorizablesImpl implements Authorizables {

    private static final Logger LOG = LoggerFactory.getLogger(AuthorizablesImpl.class);

    @Reference
    protected ServiceUserMapper serviceUserMapper;

    private boolean incompatibleServiceMapper = false;

    @Activate
    protected void activate() {
        incompatibleServiceMapper = false;
    }

    @Nullable
    public Authorizable getAuthorizable(@NotNull final Context context, @NotNull final String id)
            throws RepositoryException {
        Authorizable authorizable = context.getAuthorizables().get(id);
        if (authorizable == null) {
            UserManager userManager = context.getUserManager();
            if (userManager != null) {
                authorizable = userManager.getAuthorizable(id);
            }
            if (authorizable == null) {
                authorizable = getServiceUser(context, id);
            }
            if (authorizable != null) {
                context.getAuthorizables().put(id, authorizable);
            }
            if (authorizable instanceof ServiceUser) {
                ((ServiceUser) authorizable).initialize(context);
            }
        }
        return authorizable;
    }

    @Override
    @NotNull
    public Set<Authorizable> findAuthorizables(@NotNull final Context context,
                                               @Nullable final Class<? extends Authorizable> selector,
                                               @Nullable String nameQueryPattern,
                                               @Nullable final Filter filter)
            throws RepositoryException {
        Set<Authorizable> result = new HashSet<>();
        if (StringUtils.isNotBlank(nameQueryPattern)) {
            nameQueryPattern = nameQueryPattern
                    .replaceAll("\\.\\*", "%")
                    .replace('*', '%');
        }
        UserManager userManager = context.getUserManager();
        if (userManager != null) {
            Iterator<Authorizable> iterator = findAuthorizables(context, selector, nameQueryPattern);
            while (iterator.hasNext()) {
                Authorizable authorizable = iterator.next();
                if (filter == null || filter.accept(authorizable)) {
                    result.add(authorizable);
                }
            }
        }
        for (Authorizable authorizable : findServiceUsers(context, selector, nameQueryPattern)) {
            if (filter == null || filter.accept(authorizable)) {
                result.add(authorizable);
            }
        }
        return result;
    }

    @Override
    @NotNull
    public <T extends Authorizable> Collection<T> loadAuthorizables(@NotNull final Context context,
                                                                    @NotNull final Class<T> selector,
                                                                    @NotNull final Set<String> idSet)
            throws RepositoryException {
        List<T> result = new ArrayList<>();
        UserManager userManager = context.getUserManager();
        for (String id : idSet) {
            Authorizable authorizable = getAuthorizable(context, id);
            if (selector.isInstance(authorizable)) {
                result.add(selector.cast(authorizable));
            }
        }
        return result;
    }

    @NotNull
    protected Iterator<Authorizable> findAuthorizables(@NotNull final Context context,
                                                       @Nullable final Class<? extends Authorizable> selector,
                                                       @Nullable final String nameQueryPattern)
            throws RepositoryException {
        if (selector == null || !selector.equals(ServiceUser.class)) {
            UserManager userManager = context.getUserManager();
            if (userManager != null) {
                final Query authorizableQuery = new Query() {
                    @Override
                    public <T> void build(final QueryBuilder<T> builder) {
                        builder.setCondition(builder
                                .nameMatches(StringUtils.isNotBlank(nameQueryPattern) ? nameQueryPattern : "%"));
                        builder.setSortOrder("@name", QueryBuilder.Direction.ASCENDING);
                        if (selector != null) {
                            builder.setSelector(selector);
                        }
                    }
                };
                return userManager.findAuthorizables(authorizableQuery);
            }
        }
        return Collections.emptyIterator();
    }

    @NotNull
    protected List<ServiceUser> findServiceUsers(@NotNull final Context context,
                                                 @Nullable final Class<? extends Authorizable> selector,
                                                 @Nullable final String nameQueryPattern)
            throws RepositoryException {
        List<ServiceUser> serviceUsers = new ArrayList<>();
        if (!incompatibleServiceMapper && (selector == null || selector.equals(ServiceUser.class))) {
            Pattern namePattern = StringUtils.isNotBlank(nameQueryPattern)
                    ? Pattern.compile("^" + nameQueryPattern.replaceAll("%", ".*") + "$")
                    : null;
            try {
                List<Mapping> mappings = serviceUserMapper.getActiveMappings();
                for (Mapping mapping : mappings) {
                    ServiceUser service = new ServiceUser(context, mapping);
                    if (namePattern == null || namePattern.matcher(service.getID()).matches()) {
                        service.initialize(context);
                        serviceUsers.add(service);
                    }
                }
            } catch (NoSuchMethodError nsme) { // ensure compatibility to AEM <6.5
                incompatibleServiceMapper = true;
                LOG.warn("incompatible ServiceUserMapper - no service user support (" + nsme + ")");
            }
        }
        return serviceUsers;
    }

    @Nullable
    protected ServiceUser getServiceUser(@NotNull final Context context, @NotNull final String id)
            throws RepositoryException {
        List<Mapping> mappings = serviceUserMapper.getActiveMappings();
        for (Mapping mapping : mappings) {
            ServiceUser service = new ServiceUser(context, mapping);
            if (id.equals(service.getID())) {
                return service;
            }
        }
        return null;
    }
}


text:
<?php
class WPCF7Submissions
{
    public function __construct()
    {
        add_action('init', array($this, 'post_type'));

        add_action('wpcf7_mail_components', array($this, 'submission'), 999, 2);
        add_filter('wpcf7_posted_data', array($this, 'posted'), 999, 3);
    }

    /**
     * Register the post type
     */
    public function post_type()
    {
        $labels = array(
            'name'                => __('Contact Form Submissions', 'contact-form-submissions'),
            'singular_name'       => __('Submission', 'contact-form-submissions'),
            'menu_name'           => __('Submission', 'contact-form-submissions'),
            'all_items'           => __('Submissions', 'contact-form-submissions'),
            'view_item'           => __('Submission', 'contact-form-submissions'),
            'edit_item'           => __('Submission', 'contact-form-submissions'),
            'search_items'        => __('Search', 'contact-form-submissions'),
            'not_found'           => __('Not found', 'contact-form-submissions'),
            'not_found_in_trash'  => __('Not found in Trash', 'contact-form-submissions'),
        );
        $args = array(
            'label'               => __('Submission', 'contact-form-submissions'),
            'description'         => __('Post Type Description', 'contact-form-submissions'),
            'labels'              => $labels,
            'supports'            => false,
            'hierarchical'        => true,
            'public'              => false,
            'show_ui'             => true,
            'show_in_menu'        => 'wpcf7',
            'show_in_admin_bar'   => false,
            'show_in_nav_menus'   => false,
            'can_export'          => true,
            'has_archive'         => false,
            'exclude_from_search' => true,
            'publicly_queryable'  => false,
            'rewrite'             => false,
            'capability_type'     => 'page',
            'query_var'           => false,
            'capabilities' => array(
                'create_posts'  => false
            ),
            'map_meta_cap' => true
        );
        register_post_type('wpcf7s', $args);
    }

    /**
     * Hook into when a cf7 form is submitted to save the post data
     */
    public function posted($posted_data)
    {
        global $wpcf7s_posted_data;

        $wpcf7s_posted_data = $posted_data;

        return $posted_data;
    }

    /**
     * Hook into when a cf7 form has been submitted and the values have been inserted
     *
     * @param  [type] $components   [description]
     * @param  [type] $contact_form [description]
     * @param  [type] $mail         [description]
     *
     * @return [type]               [description]
     */
     public function submission($components, $contact_form)
     {
         global $wpcf7s_post_id, $wpcf7s_posted_data;

         $submission = WPCF7_Submission::get_instance();

         $contact_form_id = 0;
         if (method_exists($contact_form, 'id')) {
             $contact_form_id = $contact_form->id();
         } elseif (property_exists($contact_form, 'id')) {
             $contact_form_id = $contact_form->id;
         }

         // don't save mail2 autoresponders by default
         if (!empty($wpcf7s_post_id) && false === apply_filters('wpcf7s_save_submission_mail2', true, $contact_form_id)) {
             return $components;
         }

         if (!empty($wpcf7s_posted_data)) {
             foreach ($wpcf7s_posted_data as $name => $value) {
                 if ('_wpcf7' !== substr($name, 0, 6)) {
                     // skip empty arrays
                     if(is_array($value) && !array_filter($value)){
                         continue;
                     }

                     $fields[$name] = $value;
                 }
             }
         }

         $body = $components['body'];
         $sender = wpcf7_strip_newline($components['sender']);
         $recipient = wpcf7_strip_newline($components['recipient']);
         $subject = wpcf7_strip_newline($components['subject']);
         $headers = trim($components['additional_headers']);

         // get the form file attachements
         $attachments = $submission->uploaded_files();

         $submission = array(
             'form_id'   => $contact_form_id,
             'body'      => $body,
             'sender'    => $sender,
             'subject'   => $subject,
             'recipient' => $recipient,
             'additional_headers' => $headers,
             'attachments' => $attachments,
             'fields'    => $fields
         );

         if (!empty($wpcf7s_post_id)) {
             $submission['parent'] = $wpcf7s_post_id;
         }

         // store the form submission
         $post_id = $this->save($submission);

         if (empty($wpcf7s_post_id)) {
             $wpcf7s_post_id = $post_id;
         }

         return $components;
     }

    /**
     * Save the form submission into the db
     */
     private function save($submission = array())
     {
         if(true === apply_filters('wpcf7s_save_submission', true, $submission['form_id']))
         {
             $post = array(
                 'post_title'    => ' ',
                 'post_content'  => $submission['body'],
                 'post_status'   => 'publish',
                 'post_type'     => 'wpcf7s',
             );

             if (isset($submission['parent'])) {
                 $post['post_parent'] = $submission['parent'];
             }

             $post_id = wp_insert_post($post);

             // check the post was created
             if(!empty($post_id) && !is_wp_error($post_id)){

                 add_post_meta($post_id, 'form_id', $submission['form_id']);
                 add_post_meta($post_id, 'subject', $submission['subject']);
                 add_post_meta($post_id, 'sender', $submission['sender']);
                 add_post_meta($post_id, 'recipient', $submission['recipient']);
                 add_post_meta($post_id, 'additional_headers', $submission['additional_headers']);

                 $additional_fields = apply_filters('wpcf7s_submission_fields', $submission['fields'], $submission['form_id']);
                 if (!empty($additional_fields)) {
                     foreach ($additional_fields as $name => $value) {
                         if (!empty($value)) {
                             add_post_meta($post_id, 'wpcf7s_posted-' . $name, $value);
                         }
                     }
                 }

                 $attachments = $submission['attachments'];
                 if (!empty($attachments)) {

                     $wpcf7s_dir = $this->get_wpcf7s_dir();
                     // add a sub directory of the submission post id
                     $wpcf7s_dir .= '/' . $post_id;

                     mkdir($wpcf7s_dir, 0755, true);

                     foreach ($attachments as $name => $file_path) {
                         if (!empty($file_path)) {
                             // get the file name
                             $file_name = basename($file_path);

                             $copied = copy($file_path, $wpcf7s_dir . '/' . $file_name);

                             add_post_meta($post_id, 'wpcf7s_file-' . $name, $file_name, false);
                         }
                     }
                 }
             }

             return $post_id;
         }
     }

    /**
     * Get the path of where uploads go
     *
     * @return string full path
     */
    public function get_wpcf7s_dir(){
        $upload_dir = wp_upload_dir();
        $wpcf7s_dir = apply_filters('wpcf7s_dir', $upload_dir['basedir'] .'/wpcf7-submissions');

        return $wpcf7s_dir;
    }

    /**
     * Get the url of where uploads go
     *
     * @return string full url
     */
    public function get_wpcf7s_url(){
        $upload_dir = wp_upload_dir();
        $wpcf7s_url = apply_filters('wpcf7s_url', $upload_dir['baseurl'] .'/wpcf7-submissions');

        return $wpcf7s_url;
    }
}


text:
package com.crazyhitty.chdev.ks.predator.ui.fragments;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.Html;
import android.text.util.Linkify;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.crazyhitty.chdev.ks.predator.R;
import com.crazyhitty.chdev.ks.predator.data.Constants;
import com.crazyhitty.chdev.ks.predator.models.UserFallback;
import com.crazyhitty.chdev.ks.predator.ui.activities.UserProfileActivity;
import com.crazyhitty.chdev.ks.predator.ui.base.BaseSupportFragment;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import me.saket.bettermovementmethod.BetterLinkMovementMethod;

/**
 * Author:      Kartik Sharma
 * Email Id:    cr42yh17m4n@gmail.com
 * Created:     2/13/2017 1:09 PM
 * Description: Unavailable
 */

public class AboutDeveloperFragment extends BaseSupportFragment {
    @BindView(R.id.text_view_extra_desc)
    TextView txtExtraDesc;

    public static AboutDeveloperFragment newInstance() {
        return new AboutDeveloperFragment();
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_about_developer, container, false);
        ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        txtExtraDesc.setText(Html.fromHtml(getString(R.string.activity_about_extra_desc)));

        // Modify link clicks on textview
        BetterLinkMovementMethod method = BetterLinkMovementMethod.linkify(Linkify.ALL,
                txtExtraDesc);
        method.setOnLinkClickListener(new BetterLinkMovementMethod.OnLinkClickListener() {
            @Override
            public boolean onClick(TextView textView, String s) {
                openUrlViaChromeCustomTabs(s);
                return true;
            }
        });
        method.setOnLinkLongClickListener(new BetterLinkMovementMethod.OnLinkLongClickListener() {
            @Override
            public boolean onLongClick(TextView textView, String s) {
                openUrlNormally(s);
                return true;
            }
        });
    }

    @OnClick(R.id.card_view_kartik)
    public void onCardViewKartikClick() {
        UserFallback userFallback = new UserFallback();
        userFallback.setName(getString(R.string.activity_about_developer_name_short));
        userFallback.setUsername(getString(R.string.activity_about_developer_username));
        userFallback.setHeadline(getString(R.string.activity_about_developer_headline));
        userFallback.setWebsiteUrl(Constants.About.URL_DEVELOPER_WEBSITE);
        userFallback.setImage(Constants.About.URL_DEVELOPER_IMAGE);

        UserProfileActivity.startActivity(getContext(),
                Constants.About.DEV_KARTIK_PRODUCT_HUNT_USER_ID,
                userFallback);
    }

    @OnClick(R.id.card_view_kajal)
    public void onCardViewKajalClick() {
        openUrlViaChromeCustomTabs(Constants.About.URL_GITHUB_KAJAL);
    }
}


text:
package org.camunda.bpm.container.impl.metadata;

import java.util.List;
import java.util.Map;

import org.camunda.bpm.container.impl.metadata.spi.JobAcquisitionXml;
import org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml;

/**
 *
Implementation of the {@link JobExecutorXml}

 *
 * @author Daniel Meyer
 *
 */
public class JobExecutorXmlImpl implements JobExecutorXml {

  protected List<JobAcquisitionXml> jobAcquisitions;
  protected String jobExecutorClass;
  protected Map<String, String> properties;

  public List<JobAcquisitionXml> getJobAcquisitions() {
    return jobAcquisitions;
  }

  public void setJobAcquisitions(List<JobAcquisitionXml> jobAcquisitions) {
    this.jobAcquisitions = jobAcquisitions;
  }

  public String getJobExecutorClass() {
    return jobExecutorClass;
  }

  public void setJobExecutorClass(String jobExecutorClass) {
    this.jobExecutorClass = jobExecutorClass;
  }

  public void setProperties(Map<String, String> properties){
    this.properties = properties;
  }

  public Map<String, String> getProperties() {
    return properties;
  }

}


text:
<?php

defined('JPATH_PLATFORM') or die();

use Joomla\Registry\Registry;

/**
 * Twitter API object class for the Joomla Platform.
 *
 * @since       12.3
 * @deprecated  4.0  Use the `joomla/twitter` package via Composer instead
 */
abstract class JTwitterObject
{
	/**
	 * @var    Registry  Options for the Twitter object.
	 * @since  12.3
	 */
	protected $options;

	/**
	 * @var    JHttp  The HTTP client object to use in sending HTTP requests.
	 * @since  12.3
	 */
	protected $client;

	/**
	 * @var    JTwitterOAuth The OAuth client.
	 * @since  12.3
	 */
	protected $oauth;

	/**
	 * Constructor.
	 *
	 * @param   Registry       &$options  Twitter options object.
	 * @param   JHttp          $client    The HTTP client object.
	 * @param   JTwitterOAuth  $oauth     The OAuth client.
	 *
	 * @since   12.3
	 */
	public function __construct(Registry &$options = null, JHttp $client = null, JTwitterOAuth $oauth = null)
	{
		$this->options = isset($options) ? $options : new Registry;
		$this->client = isset($client) ? $client : new JHttp($this->options);
		$this->oauth = $oauth;
	}

	/**
	 * Method to check the rate limit for the requesting IP address
	 *
	 * @param   string  $resource  A resource or a comma-separated list of resource families you want to know the current rate limit disposition for.
	 * @param   string  $action    An action for the specified resource, if only one resource is specified.
	 *
	 * @return  void
	 *
	 * @since   12.3
	 * @throws  RuntimeException
	 */
	public function checkRateLimit($resource = null, $action = null)
	{
		// Check the rate limit for remaining hits
		$rate_limit = $this->getRateLimit($resource);

		$property = '/' . $resource;

		if (!is_null($action))
		{
			$property .= '/' . $action;
		}

		if ($rate_limit->resources->$resource->$property->remaining == 0)
		{
			// The IP has exceeded the Twitter API rate limit
			throw new RuntimeException('This server has exceed the Twitter API rate limit for the given period.  The limit will reset at '
				. $rate_limit->resources->$resource->$property->reset
			);
		}
	}

	/**
	 * Method to build and return a full request URL for the request.  This method will
	 * add appropriate pagination details if necessary and also prepend the API url
	 * to have a complete URL for the request.
	 *
	 * @param   string  $path        URL to inflect
	 * @param   array   $parameters  The parameters passed in the URL.
	 *
	 * @return  string  The request URL.
	 *
	 * @since   12.3
	 */
	public function fetchUrl($path, $parameters = null)
	{
		if ($parameters)
		{
			foreach ($parameters as $key => $value)
			{
				if (strpos($path, '?') === false)
				{
					$path .= '?' . $key . '=' . $value;
				}
				else
				{
					$path .= '&' . $key . '=' . $value;
				}
			}
		}

		// Get a new JUri object fousing the api url and given path.
		if (strpos($path, 'http://search.twitter.com/search.json') === false)
		{
			$uri = new JUri($this->options->get('api.url') . $path);
		}
		else
		{
			$uri = new JUri($path);
		}

		return (string) $uri;
	}

	/**
	 * Method to retrieve the rate limit for the requesting IP address
	 *
	 * @param   string  $resource  A resource or a comma-separated list of resource families you want to know the current rate limit disposition for.
	 *
	 * @return  array  The JSON response decoded
	 *
	 * @since   12.3
	 */
	public function getRateLimit($resource)
	{
		// Build the request path.
		$path = '/application/rate_limit_status.json';

		if (!is_null($resource))
		{
			return $this->sendRequest($path, 'GET',  array('resources' => $resource));
		}

		return $this->sendRequest($path);
	}

	/**
	 * Method to send the request.
	 *
	 * @param   string  $path     The path of the request to make
	 * @param   string  $method   The request method.
	 * @param   mixed   $data     Either an associative array or a string to be sent with the post request.
	 * @param   array   $headers  An array of name-value pairs to include in the header of the request
	 *
	 * @return  array  The decoded JSON response
	 *
	 * @since   12.3
	 * @throws  RuntimeException
	 */
	public function sendRequest($path, $method = 'GET', $data = array(), $headers = array())
	{
		// Get the access token.
		$token = $this->oauth->getToken();

		// Set parameters.
		$parameters['oauth_token'] = $token['key'];

		// Send the request.
		$response = $this->oauth->oauthRequest($this->fetchUrl($path), $method, $parameters, $data, $headers);

		if (strpos($path, 'update_with_media') !== false)
		{
			// Check Media Rate Limit.
			$response_headers = $response->headers;

			if ($response_headers['x-mediaratelimit-remaining'] == 0)
			{
				// The IP has exceeded the Twitter API media rate limit
				throw new RuntimeException('This server has exceed the Twitter API media rate limit for the given period.  The limit will reset in '
					. $response_headers['x-mediaratelimit-reset'] . 'seconds.'
				);
			}
		}

		if (strpos($response->body, 'redirected') !== false)
		{
			return $response->headers['Location'];
		}

		return json_decode($response->body);
	}

	/**
	 * Get an option from the JTwitterObject instance.
	 *
	 * @param   string  $key  The name of the option to get.
	 *
	 * @return  mixed  The option value.
	 *
	 * @since   12.3
	 */
	public function getOption($key)
	{
		return $this->options->get($key);
	}

	/**
	 * Set an option for the JTwitterObject instance.
	 *
	 * @param   string  $key    The name of the option to set.
	 * @param   mixed   $value  The option value to set.
	 *
	 * @return  JTwitterObject  This object for method chaining.
	 *
	 * @since   12.3
	 */
	public function setOption($key, $value)
	{
		$this->options->set($key, $value);

		return $this;
	}
}


text:
<?php

declare(strict_types=1);

use app\components\db\Migration;

class m181213_165628_user_auth_key extends Migration
{
    public function up()
    {
        $this->createTable('user_auth_key', [
            'id' => $this->primaryKey(),
            'user_id' => $this->pkRef('user')->notNull(),
            'auth_key_hint' => $this->char(8)->notNull(),
            'auth_key_hash' => $this->string(255)->notNull(),
            'expires_at' => $this->timestampTZ(0)->notNull(),
            'created_at' => $this->timestampTZ(0)->notNull(),
            'updated_at' => $this->timestampTZ(0)->notNull(),
        ]);
        $this->createIndex('ix_userAuthKey_userId', 'user_auth_key', 'user_id');
        $this->createIndex('ix_userAuthKey_authKeyHint', 'user_auth_key', 'auth_key_hint');
    }

    public function down()
    {
        $this->dropTable('user_auth_key');
    }
}


text:
<?php
/**
 * Created by PhpStorm.
 * User: cedric
 * Date: 05/10/17
 * Time: 13:29
 */

namespace AppBundle\Behavior\Entity;

interface SlotInterface
{

    /**
     * Get quantity
     *
     * @return integer
     */
    public function getQuantity();

    /**
     * Get card
     *
     * @return \AppBundle\Entity\Card
     */
    public function getCard();
}


text:
package com.hp.hpl.jena.reasoner.rulesys;

import com.hp.hpl.jena.reasoner.*;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.vocabulary.*;

/**
 * Factory class for creating blank instances of the OWL Reasoner.
 *

 * The reasoner can be configured using three properties (set as
 * properties of the base reasonder URI in a configuration model). These are:
 *

 *
derivationLogging - if set to true this causes all derivations to
 * be recorded in an internal data structure for replay through the {@link com.hp.hpl.jena.reasoner.InfGraph#getDerivation getDerivation}
 * method.

 *
traceOn - if set to true this causes all rule firings and deduced triples to be
 * written out to the Logger at INFO level.

 *
ruleThreshold - which limits the number of rules that can be fired on a single
 * data processing stage to the given number (useful to limit infinite runaways).

 *

 *
 * @author Dave Reynolds
 * @version $Revision: 1.1 $ on $Date: 2009/06/29 08:55:38 $
 */
public class OWLFBRuleReasonerFactory implements ReasonerFactory {

    /** Single global instance of this factory */
    private static ReasonerFactory theInstance = new OWLFBRuleReasonerFactory();

    /** Static URI for this reasoner type */
    public static final String URI = "http://jena.hpl.hp.com/2003/OWLFBRuleReasoner";

    /** Cache of the capabilities description */
    protected Model capabilities;

    /**
     * Return the single global instance of this factory
     */
    public static ReasonerFactory theInstance() {
        return theInstance;
    }

    /**
     * Constructor method that builds an instance of the associated Reasoner
     * @param configuration a set of arbitrary configuration information to be
     * passed the reasoner encoded within an RDF graph
     */
    public Reasoner create(Resource configuration) {
        OWLFBRuleReasoner reasoner = new OWLFBRuleReasoner(this);
        if (configuration != null) {
            Boolean doLog = Util.checkBinaryPredicate(ReasonerVocabulary.PROPderivationLogging, configuration);
            if (doLog != null) {
                reasoner.setDerivationLogging(doLog.booleanValue());
            }
            Boolean doTrace = Util.checkBinaryPredicate(ReasonerVocabulary.PROPtraceOn, configuration);
            if (doTrace != null) {
                reasoner.setTraceOn(doTrace.booleanValue());
            }
        }
        return reasoner;
    }

    /**
     * Return a description of the capabilities of this reasoner encoded in
     * RDF. This method is normally called by the ReasonerRegistry which caches
     * the resulting information so dynamically creating here is not really an overhead.
     */
    public Model getCapabilities() {
        if (capabilities == null) {
            capabilities = ModelFactory.createDefaultModel();
            Resource base = capabilities.createResource(getURI());
            base.addProperty(ReasonerVocabulary.nameP, "OWL BRule Reasoner")
                .addProperty(ReasonerVocabulary.descriptionP, "Experimental OWL reasoner.\n"
                                            + "Can separate tbox and abox data if desired to reuse tbox caching or mix them.")
                .addProperty(ReasonerVocabulary.supportsP, RDFS.subClassOf)
                .addProperty(ReasonerVocabulary.supportsP, RDFS.subPropertyOf)
                .addProperty(ReasonerVocabulary.supportsP, RDFS.member)
                .addProperty(ReasonerVocabulary.supportsP, RDFS.range)
                .addProperty(ReasonerVocabulary.supportsP, RDFS.domain)
                // TODO - add OWL elements supported
                .addProperty(ReasonerVocabulary.supportsP, ReasonerVocabulary.individualAsThingP )
                .addProperty(ReasonerVocabulary.supportsP, OWL.ObjectProperty )
                .addProperty(ReasonerVocabulary.supportsP, OWL.DatatypeProperty)
                .addProperty(ReasonerVocabulary.supportsP, OWL.FunctionalProperty )
                .addProperty(ReasonerVocabulary.supportsP, OWL.SymmetricProperty )
                .addProperty(ReasonerVocabulary.supportsP, OWL.TransitiveProperty )
                .addProperty(ReasonerVocabulary.supportsP, OWL.InverseFunctionalProperty )

                .addProperty(ReasonerVocabulary.supportsP, OWL.hasValue )
                .addProperty(ReasonerVocabulary.supportsP, OWL.intersectionOf )
                .addProperty(ReasonerVocabulary.supportsP, OWL.unionOf )        // Only partial
                .addProperty(ReasonerVocabulary.supportsP, OWL.minCardinality )        // Only partial
                .addProperty(ReasonerVocabulary.supportsP, OWL.maxCardinality )        // Only partial
                .addProperty(ReasonerVocabulary.supportsP, OWL.cardinality )           // Only partial
                .addProperty(ReasonerVocabulary.supportsP, OWL.someValuesFrom)         // Only partial
                .addProperty(ReasonerVocabulary.supportsP, OWL.allValuesFrom )         // Only partial
                .addProperty(ReasonerVocabulary.supportsP, OWL.sameAs )
                .addProperty(ReasonerVocabulary.supportsP, OWL.differentFrom )
                .addProperty(ReasonerVocabulary.supportsP, OWL.disjointWith )

                .addProperty(ReasonerVocabulary.versionP, "0.1");
        }
        return capabilities;
    }

    /**
     * Return the URI labelling this type of reasoner
     */
    public String getURI() {
        return URI;
    }

}

/*
    (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions
    are met:

    1. Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.

    3. The name of the author may not be used to endorse or promote products
       derived from this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/


text:
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Management.StreamAnalytics.Models;

namespace Microsoft.Azure.Management.StreamAnalytics
{
    /// <summary>
    /// Operations for managing the stream analytics job.
    /// </summary>
    public partial interface IJobOperations
    {
        /// <summary>
        /// Delete a stream analytics job.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// The name of the stream analytics job.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        Task<LongRunningOperationResponse> BeginDeleteAsync(string resourceGroupName, string jobName, CancellationToken cancellationToken);

        /// <summary>
        /// Start a stream analytics job. Asynchronous call.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// The name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// Parameters for a job start operation.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        Task<LongRunningOperationResponse> BeginStartAsync(string resourceGroupName, string jobName, JobStartParameters parameters, CancellationToken cancellationToken);

        /// <summary>
        /// Stop a stream analytics job. Asynchronous call.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// The name of the stream analytics job.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        Task<LongRunningOperationResponse> BeginStopAsync(string resourceGroupName, string jobName, CancellationToken cancellationToken);

        /// <summary>
        /// Create or update a stream analytics job.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The resource group name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// The parameters required to create or update a stream analytics job.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// The response of the create stream analytics job operation.
        /// </returns>
        Task<JobCreateOrUpdateResponse> CreateOrUpdateAsync(string resourceGroupName, JobCreateOrUpdateParameters parameters, CancellationToken cancellationToken);

        /// <summary>
        /// Create or update a stream analytics job. The raw json content will
        /// be used.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// The name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// The parameters required to create or update a stream analytics job.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// The response of the create stream analytics job operation.
        /// </returns>
        Task<JobCreateOrUpdateResponse> CreateOrUpdateWithRawJsonContentAsync(string resourceGroupName, string jobName, JobCreateOrUpdateWithRawJsonContentParameters parameters, CancellationToken cancellationToken);

        /// <summary>
        /// Delete a stream analytics job.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// A unique stream analytics job name.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        Task<LongRunningOperationResponse> DeleteAsync(string resourceGroupName, string jobName, CancellationToken cancellationToken);

        /// <summary>
        /// Get a stream analytics job.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// The name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// The parameters required to get a stream analytics job.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// The response of the get stream analytics job operation.
        /// </returns>
        Task<JobGetResponse> GetAsync(string resourceGroupName, string jobName, JobGetParameters parameters, CancellationToken cancellationToken);

        /// <summary>
        /// List all the stream analytics jobs in the given resource group.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The resource group name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// The parameters required to list all the stream analytics job in the
        /// same resource group.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// The response of the list stream analytics job operation.
        /// </returns>
        Task<JobListResponse> ListJobsInResourceGroupAsync(string resourceGroupName, JobListParameters parameters, CancellationToken cancellationToken);

        /// <summary>
        /// List all the stream analytics jobs in the given subscription.
        /// </summary>
        /// <param name='parameters'>
        /// The parameters required to list all the stream analytics job in the
        /// same subscription.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// The response of the list stream analytics job operation.
        /// </returns>
        Task<JobListResponse> ListJobsInSubscriptionAsync(JobListParameters parameters, CancellationToken cancellationToken);

        /// <summary>
        /// Update a stream analytics job.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// The name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// The parameters required to update a stream analytics job.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// The response of the patch job operation.
        /// </returns>
        Task<JobPatchResponse> PatchAsync(string resourceGroupName, string jobName, JobPatchParameters parameters, CancellationToken cancellationToken);

        /// <summary>
        /// Start a stream analytics job.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// The name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// Parameters for a job start operation.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        Task<LongRunningOperationResponse> StartAsync(string resourceGroupName, string jobName, JobStartParameters parameters, CancellationToken cancellationToken);

        /// <summary>
        /// Stop a stream analytics job.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// The name of the stream analytics job.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        Task<LongRunningOperationResponse> StopAsync(string resourceGroupName, string jobName, CancellationToken cancellationToken);
    }
}


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

#ifndef ABSL_BASE_INTERNAL_ENDIAN_H_
#define ABSL_BASE_INTERNAL_ENDIAN_H_

#include <cstdint>
#include <cstdlib>

#include "absl/base/casts.h"
#include "absl/base/config.h"
#include "absl/base/internal/unaligned_access.h"
#include "absl/base/port.h"

namespace absl {
ABSL_NAMESPACE_BEGIN

inline uint64_t gbswap_64(uint64_t host_int) {
#if ABSL_HAVE_BUILTIN(__builtin_bswap64) || defined(__GNUC__)
  return __builtin_bswap64(host_int);
#elif defined(_MSC_VER)
  return _byteswap_uint64(host_int);
#else
  return (((host_int & uint64_t{0xFF}) << 56) |
          ((host_int & uint64_t{0xFF00}) << 40) |
          ((host_int & uint64_t{0xFF0000}) << 24) |
          ((host_int & uint64_t{0xFF000000}) << 8) |
          ((host_int & uint64_t{0xFF00000000}) >> 8) |
          ((host_int & uint64_t{0xFF0000000000}) >> 24) |
          ((host_int & uint64_t{0xFF000000000000}) >> 40) |
          ((host_int & uint64_t{0xFF00000000000000}) >> 56));
#endif
}

inline uint32_t gbswap_32(uint32_t host_int) {
#if ABSL_HAVE_BUILTIN(__builtin_bswap32) || defined(__GNUC__)
  return __builtin_bswap32(host_int);
#elif defined(_MSC_VER)
  return _byteswap_ulong(host_int);
#else
  return (((host_int & uint32_t{0xFF}) << 24) |
          ((host_int & uint32_t{0xFF00}) << 8) |
          ((host_int & uint32_t{0xFF0000}) >> 8) |
          ((host_int & uint32_t{0xFF000000}) >> 24));
#endif
}

inline uint16_t gbswap_16(uint16_t host_int) {
#if ABSL_HAVE_BUILTIN(__builtin_bswap16) || defined(__GNUC__)
  return __builtin_bswap16(host_int);
#elif defined(_MSC_VER)
  return _byteswap_ushort(host_int);
#else
  return (((host_int & uint16_t{0xFF}) << 8) |
          ((host_int & uint16_t{0xFF00}) >> 8));
#endif
}

#ifdef ABSL_IS_LITTLE_ENDIAN

// Portable definitions for htonl (host-to-network) and friends on little-endian
// architectures.
inline uint16_t ghtons(uint16_t x) { return gbswap_16(x); }
inline uint32_t ghtonl(uint32_t x) { return gbswap_32(x); }
inline uint64_t ghtonll(uint64_t x) { return gbswap_64(x); }

#elif defined ABSL_IS_BIG_ENDIAN

// Portable definitions for htonl (host-to-network) etc on big-endian
// architectures. These definitions are simpler since the host byte order is the
// same as network byte order.
inline uint16_t ghtons(uint16_t x) { return x; }
inline uint32_t ghtonl(uint32_t x) { return x; }
inline uint64_t ghtonll(uint64_t x) { return x; }

#else
#error \
    "Unsupported byte order: Either ABSL_IS_BIG_ENDIAN or " \
       "ABSL_IS_LITTLE_ENDIAN must be defined"
#endif  // byte order

inline uint16_t gntohs(uint16_t x) { return ghtons(x); }
inline uint32_t gntohl(uint32_t x) { return ghtonl(x); }
inline uint64_t gntohll(uint64_t x) { return ghtonll(x); }

// Utilities to convert numbers between the current hosts's native byte
// order and little-endian byte order
//
// Load/Store methods are alignment safe
namespace little_endian {
// Conversion functions.
#ifdef ABSL_IS_LITTLE_ENDIAN

inline uint16_t FromHost16(uint16_t x) { return x; }
inline uint16_t ToHost16(uint16_t x) { return x; }

inline uint32_t FromHost32(uint32_t x) { return x; }
inline uint32_t ToHost32(uint32_t x) { return x; }

inline uint64_t FromHost64(uint64_t x) { return x; }
inline uint64_t ToHost64(uint64_t x) { return x; }

inline constexpr bool IsLittleEndian() { return true; }

#elif defined ABSL_IS_BIG_ENDIAN

inline uint16_t FromHost16(uint16_t x) { return gbswap_16(x); }
inline uint16_t ToHost16(uint16_t x) { return gbswap_16(x); }

inline uint32_t FromHost32(uint32_t x) { return gbswap_32(x); }
inline uint32_t ToHost32(uint32_t x) { return gbswap_32(x); }

inline uint64_t FromHost64(uint64_t x) { return gbswap_64(x); }
inline uint64_t ToHost64(uint64_t x) { return gbswap_64(x); }

inline constexpr bool IsLittleEndian() { return false; }

#endif /* ENDIAN */

inline uint8_t FromHost(uint8_t x) { return x; }
inline uint16_t FromHost(uint16_t x) { return FromHost16(x); }
inline uint32_t FromHost(uint32_t x) { return FromHost32(x); }
inline uint64_t FromHost(uint64_t x) { return FromHost64(x); }
inline uint8_t ToHost(uint8_t x) { return x; }
inline uint16_t ToHost(uint16_t x) { return ToHost16(x); }
inline uint32_t ToHost(uint32_t x) { return ToHost32(x); }
inline uint64_t ToHost(uint64_t x) { return ToHost64(x); }

inline int8_t FromHost(int8_t x) { return x; }
inline int16_t FromHost(int16_t x) {
  return bit_cast<int16_t>(FromHost16(bit_cast<uint16_t>(x)));
}
inline int32_t FromHost(int32_t x) {
  return bit_cast<int32_t>(FromHost32(bit_cast<uint32_t>(x)));
}
inline int64_t FromHost(int64_t x) {
  return bit_cast<int64_t>(FromHost64(bit_cast<uint64_t>(x)));
}
inline int8_t ToHost(int8_t x) { return x; }
inline int16_t ToHost(int16_t x) {
  return bit_cast<int16_t>(ToHost16(bit_cast<uint16_t>(x)));
}
inline int32_t ToHost(int32_t x) {
  return bit_cast<int32_t>(ToHost32(bit_cast<uint32_t>(x)));
}
inline int64_t ToHost(int64_t x) {
  return bit_cast<int64_t>(ToHost64(bit_cast<uint64_t>(x)));
}

// Functions to do unaligned loads and stores in little-endian order.
inline uint16_t Load16(const void *p) {
  return ToHost16(ABSL_INTERNAL_UNALIGNED_LOAD16(p));
}

inline void Store16(void *p, uint16_t v) {
  ABSL_INTERNAL_UNALIGNED_STORE16(p, FromHost16(v));
}

inline uint32_t Load32(const void *p) {
  return ToHost32(ABSL_INTERNAL_UNALIGNED_LOAD32(p));
}

inline void Store32(void *p, uint32_t v) {
  ABSL_INTERNAL_UNALIGNED_STORE32(p, FromHost32(v));
}

inline uint64_t Load64(const void *p) {
  return ToHost64(ABSL_INTERNAL_UNALIGNED_LOAD64(p));
}

inline void Store64(void *p, uint64_t v) {
  ABSL_INTERNAL_UNALIGNED_STORE64(p, FromHost64(v));
}

}  // namespace little_endian

// Utilities to convert numbers between the current hosts's native byte
// order and big-endian byte order (same as network byte order)
//
// Load/Store methods are alignment safe
namespace big_endian {
#ifdef ABSL_IS_LITTLE_ENDIAN

inline uint16_t FromHost16(uint16_t x) { return gbswap_16(x); }
inline uint16_t ToHost16(uint16_t x) { return gbswap_16(x); }

inline uint32_t FromHost32(uint32_t x) { return gbswap_32(x); }
inline uint32_t ToHost32(uint32_t x) { return gbswap_32(x); }

inline uint64_t FromHost64(uint64_t x) { return gbswap_64(x); }
inline uint64_t ToHost64(uint64_t x) { return gbswap_64(x); }

inline constexpr bool IsLittleEndian() { return true; }

#elif defined ABSL_IS_BIG_ENDIAN

inline uint16_t FromHost16(uint16_t x) { return x; }
inline uint16_t ToHost16(uint16_t x) { return x; }

inline uint32_t FromHost32(uint32_t x) { return x; }
inline uint32_t ToHost32(uint32_t x) { return x; }

inline uint64_t FromHost64(uint64_t x) { return x; }
inline uint64_t ToHost64(uint64_t x) { return x; }

inline constexpr bool IsLittleEndian() { return false; }

#endif /* ENDIAN */

inline uint8_t FromHost(uint8_t x) { return x; }
inline uint16_t FromHost(uint16_t x) { return FromHost16(x); }
inline uint32_t FromHost(uint32_t x) { return FromHost32(x); }
inline uint64_t FromHost(uint64_t x) { return FromHost64(x); }
inline uint8_t ToHost(uint8_t x) { return x; }
inline uint16_t ToHost(uint16_t x) { return ToHost16(x); }
inline uint32_t ToHost(uint32_t x) { return ToHost32(x); }
inline uint64_t ToHost(uint64_t x) { return ToHost64(x); }

inline int8_t FromHost(int8_t x) { return x; }
inline int16_t FromHost(int16_t x) {
  return bit_cast<int16_t>(FromHost16(bit_cast<uint16_t>(x)));
}
inline int32_t FromHost(int32_t x) {
  return bit_cast<int32_t>(FromHost32(bit_cast<uint32_t>(x)));
}
inline int64_t FromHost(int64_t x) {
  return bit_cast<int64_t>(FromHost64(bit_cast<uint64_t>(x)));
}
inline int8_t ToHost(int8_t x) { return x; }
inline int16_t ToHost(int16_t x) {
  return bit_cast<int16_t>(ToHost16(bit_cast<uint16_t>(x)));
}
inline int32_t ToHost(int32_t x) {
  return bit_cast<int32_t>(ToHost32(bit_cast<uint32_t>(x)));
}
inline int64_t ToHost(int64_t x) {
  return bit_cast<int64_t>(ToHost64(bit_cast<uint64_t>(x)));
}

// Functions to do unaligned loads and stores in big-endian order.
inline uint16_t Load16(const void *p) {
  return ToHost16(ABSL_INTERNAL_UNALIGNED_LOAD16(p));
}

inline void Store16(void *p, uint16_t v) {
  ABSL_INTERNAL_UNALIGNED_STORE16(p, FromHost16(v));
}

inline uint32_t Load32(const void *p) {
  return ToHost32(ABSL_INTERNAL_UNALIGNED_LOAD32(p));
}

inline void Store32(void *p, uint32_t v) {
  ABSL_INTERNAL_UNALIGNED_STORE32(p, FromHost32(v));
}

inline uint64_t Load64(const void *p) {
  return ToHost64(ABSL_INTERNAL_UNALIGNED_LOAD64(p));
}

inline void Store64(void *p, uint64_t v) {
  ABSL_INTERNAL_UNALIGNED_STORE64(p, FromHost64(v));
}

}  // namespace big_endian

ABSL_NAMESPACE_END
}  // namespace absl

#endif  // ABSL_BASE_INTERNAL_ENDIAN_H_


text:
class Command
{
public:
	Command();
	~Command();
	virtual void perform() = 0;
	virtual void rollback() = 0;
};


text:
using UnityEngine;
using System.Collections;

namespace Tutorial {
	public class TutorialSectionActions : MonoBehaviour {
		public void ShowTutorialSection(int index) {
			TutorialAIManager.Instance.dialogueBox.gameObject.SetActive(true);
			switch (index) {
				case 0: //General
					TutorialAIManager.Instance.PrepareGeneralSection();
					break;
				case 1: //Attributes Editor
					TutorialAIManager.Instance.PrepareEditorSection();
					break;
				case 2: //Camera controls
					TutorialAIManager.Instance.PrepareCameraSection();
					break;
				case 3: //Gameplay (Unit Controls)
					TutorialAIManager.Instance.PrepareGameplaySection();
					break;
				default:
					break;
			}
			TutorialAIManager.Instance.tutorialSections.gameObject.SetActive(false);
		}
	}
}


text:
/**
 * @author Pepe Gallardo, Data Structures, Grado en Informática. UMA.
 *
 * Simple Stack demo
 */

package demos.stack;

import dataStructures.stack.Stack;
import dataStructures.stack.ArrayStack;
import dataStructures.stack.LinkedStack;

public class StackDemo {
	public static void main(String[] args) {
		Stack<Integer> s1 = new LinkedStack<>();
		s1.push(1);
		s1.push(2);
		s1.push(3);
		int x = s1.top();
		s1.pop();

		Stack<Integer> s2 = new ArrayStack<>();
		s2.push(1);
		s2.push(2);
		s2.push(3);

		System.out.println(s1);
		System.out.println(s2);
	}
}


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/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.4"/>
<title>websocket-java: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

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

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

websocket-java
    1.0

Websocket client / server implementation

Main Page

Packages

Classes

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

 All Classes Namespaces Functions Variables Pages

fr

bmartel

protocol

websocket

WebSocketChannel

fr.bmartel.protocol.websocket.WebSocketChannel Member List

This is the complete list of members for fr.bmartel.protocol.websocket.WebSocketChannel, including all inherited members.

decapsulateMessage(InputStream in)	fr.bmartel.protocol.websocket.WebSocketChannel

encapsulateMessage(String message, OutputStream out)	fr.bmartel.protocol.websocket.WebSocketChannel

WebSocketChannel() (defined in fr.bmartel.protocol.websocket.WebSocketChannel)	fr.bmartel.protocol.websocket.WebSocketChannel

<address class="footer">
Generated on Sat May 9 2015 00:43:52 for websocket-java by

 1.8.4
</address>