text:
---
layout: page
title: Hello Samza High Level API - Code Walkthrough
---
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->

This tutorial introduces the high level API by showing you how to build wikipedia application from the [hello-samza high level API Yarn tutorial] (hello-samza-high-level-yarn.html). Upon completion of this tutorial, you'll know how to implement and configure a [StreamApplication](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/application/StreamApplication.html). Along the way, you'll see how to use some of the basic operators as well as how to leverage key-value stores and metrics in an app.

The same [hello-samza](https://github.com/apache/samza-hello-samza) project is used for this tutorial as for many of the others. You will clone that project and by the end of the tutorial, you will have implemented a duplicate of the `WikipediaApplication`.

Let's get started.

### Get the Code

Check out the hello-samza project:

{% highlight bash %}
git clone https://gitbox.apache.org/repos/asf/samza-hello-samza.git hello-samza
cd hello-samza
git checkout latest
{% endhighlight %}

This project already contains implementations of the wikipedia application using both the Low Level Task API and the High Level Streams API. The Low Level Task API implementations are in the `samza.examples.wikipedia.task` package. The High Level Streams API implementation is in the `samza.examples.wikipedia.application` package.

This tutorial will provide step by step instructions to recreate the existing wikipedia application.

### Introduction to Wikipedia Consumer
In order to consume events from Wikipedia, the hello-samza project includes a `WikipediaSystemFactory` implementation of the Samza [SystemFactory](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/system/SystemFactory.html) that provides a `WikipediaConsumer`.

The WikipediaConsumer is an implementation of [SystemConsumer](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/system/SystemConsumer.html) that can consume events from Wikipedia. It is also a listener for events from the `WikipediaFeed`. It's important to note that the events received in `onEvent` are of the type `WikipediaFeedEvent`, so we will expect that type for messages on our input streams. For other systems, the messages may come in the form of `byte[]`. In that case you may want to configure a samza [serde](/learn/documentation/{{site.version}}/container/serialization.html) and the application should expect the output type of that serde.

Now that we understand the Wikipedia system and the types of inputs we'll be processing, we can proceed with creating our application.

### Create the Initial Config
In the hello-samza project, configs are kept in the _src/main/config/_ path. This is where we will add the config for our application.
Create a new file named _my-wikipedia-application.properties_ in this location.

#### Core Configuration
Let's start by adding some of the core properties to the file:

{% highlight bash %}
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

app.class=samza.examples.wikipedia.application.MyWikipediaApplication
app.runner.class=org.apache.samza.runtime.RemoteApplicationRunner

job.factory.class=org.apache.samza.job.yarn.YarnJobFactory
job.name=my-wikipedia-application
job.default.system=kafka

yarn.package.path=file://${basedir}/target/${project.artifactId}-${pom.version}-dist.tar.gz
{% endhighlight %}

Be sure to include the Apache header. The project will not compile without it.

Here's a brief summary of what we configured so far.

* **app.class**: the class that defines the application logic. We will create this class later.
* **app.runner.class**: the runner implementation which will launch our application. Since we are using YARN, we use `RemoteApplicationRunner` which is required for any cluster-based deployment.
* **job.factory.class**: the [factory](/learn/documentation/{{site.version}}/jobs/job-runner.html) that will create the runtime instances of our jobs. Since we are using YARN, we want each job to be created as a [YARN job](/learn/documentation/{{site.version}}/jobs/yarn-jobs.html), so we use `YarnJobFactory`
* **job.name**: the primary identifier for the job.
* **job.default.system**: the default system to use for input, output, and internal metadata streams. This can be overridden on a per-stream basis. The _kafka_ system will be defined in the next section.
* **yarn.package.path**: tells YARN where to find the [job package](/learn/documentation/{{site.version}}/jobs/packaging.html) so the Node Managers can download it.

These basic configurations are enough to launch the application on YARN but we haven't defined any streaming systems for Samza to use, so the application would not process anything.

Next, let's define the streaming systems with which the application will interact.

#### Define Systems
This Wikipedia application will consume events from Wikipedia and produce stats to a Kafka topic. We need to define those systems in config before Samza can use them. Add the following lines to the config:

{% highlight bash %}
systems.wikipedia.samza.factory=samza.examples.wikipedia.system.WikipediaSystemFactory
systems.wikipedia.host=irc.wikimedia.org
systems.wikipedia.port=6667

systems.kafka.samza.factory=org.apache.samza.system.kafka.KafkaSystemFactory
systems.kafka.consumer.zookeeper.connect=localhost:2181/
systems.kafka.producer.bootstrap.servers=localhost:9092
systems.kafka.default.stream.replication.factor=1
{% endhighlight %}

The above configuration defines 2 systems; one called _wikipedia_ and one called _kafka_.

A factory is required for each system, so the _systems.system-name.samza.system.factory_ property is required for both systems. The other properties are system and use-case specific.

For the _kafka_ system, we set the default replication factor to 1 for all streams because this application is intended for a demo deployment which utilizes a Kafka cluster with only 1 broker, so a replication factor larger than 1 is invalid.

#### Configure Streams
Samza identifies streams using a unique stream ID. In most cases, the stream ID is the same as the actual stream name. However, if a stream has a name that doesn't match the pattern `[A-Za-z0-9_-]+`, we need to configure a separate _physical.name_ to associate the actual stream name with a legal stream ID. The Wikipedia channels we will consume have a '#' character in the names. So for each of them we must pick a legal stream ID and then configure the physical name to match the channel.

Samza uses the _job.default.system_ for any streams that do not explicitly specify a system. In the previous sections, we defined 2 systems, _wikipedia_ and _kafka_, and we configured _kafka_ as the default. To understand why, let's look at the streams and how Samza will use them.

For this app, Samza will:

1. Consume from input streams
2. Produce to an output stream and a metrics stream
3. Both produce and consume from job-coordination, checkpoint, and changelog streams

While the _wikipedia_ system is necessary for case 1, it does not support producers (we can't write Samza output to Wikipedia), which are needed for cases 2-3. So it is more convenient to use _kafka_ as the default system. We can then explicitly configure the input streams to use the _wikipedia_ system.

{% highlight bash %}
streams.en-wikipedia.samza.system=wikipedia
streams.en-wikipedia.samza.physical.name=#en.wikipedia

streams.en-wiktionary.samza.system=wikipedia
streams.en-wiktionary.samza.physical.name=#en.wiktionary

streams.en-wikinews.samza.system=wikipedia
streams.en-wikinews.samza.physical.name=#en.wikinews
{% endhighlight %}

The above configurations declare 3 streams with IDs, _en-wikipedia_, _en-wiktionary_, and _en-wikinews_. It associates each stream with the _wikipedia_ system we defined earlier and set the physical name to the corresponding Wikipedia channel.

Since all the Kafka streams for cases 2-3 are on the default system and do not include special characters in their names, we do not need to configure them explicitly.

### Create a StreamApplication

With the core configuration settled, we turn our attention to code.

### Define Application Logic
Let's create the application class we configured above. The next 8 sections walk you through writing the code for the Wikipedia application.

Create a new class named `MyWikipediaApplication` in the `samza.examples.wikipedia.application` package. The class must implement [StreamApplication](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/application/StreamApplication.html) and should look like this:

{% highlight java %}

package samza.examples.wikipedia.application;

import org.apache.samza.application.StreamApplication;
import org.apache.samza.config.Config;
import org.apache.samza.operators.StreamGraph;

public class MyWikipediaApplication implements StreamApplication{
  @Override
  public void init(StreamGraph streamGraph, Config config) {

  }
}
{% endhighlight %}

Be sure to include the Apache header. The project will not compile without it.

The [init](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/application/StreamApplication.html#init-org.apache.samza.operators.StreamGraph-org.apache.samza.config.Config-) method is where the application logic is defined. The [Config](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/config/Config.html) argument is the runtime configuration loaded from the properties file we defined earlier. The [StreamGraph](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/StreamGraph.html) argument provides methods to declare input streams. You can then invoke a number of flexible operations on those streams. The result of each operation is another stream, so you can keep chaining more operations or direct the result to an output stream.

Next, we will declare the input streams for the Wikipedia application.

#### Inputs
The Wikipedia application consumes events from three channels. Let's declare each of those channels as an input streams via the [StreamGraph](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/StreamGraph.html) in the [init](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/application/StreamApplication.html#init-org.apache.samza.operators.StreamGraph-org.apache.samza.config.Config-) method.
{% highlight java %}
MessageStream<WikipediaFeedEvent> wikipediaEvents = streamGraph.getInputStream("en-wikipedia", new NoOpSerde<>());
MessageStream<WikipediaFeedEvent> wiktionaryEvents = streamGraph.getInputStream("en-wiktionary", new NoOpSerde<>());
MessageStream<WikipediaFeedEvent> wikiNewsEvents = streamGraph.getInputStream("en-wikinews", new NoOpSerde<>());
{% endhighlight %}

The first argument to the [getInputStream](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/StreamGraph.html#getInputStream-java.lang.String-org.apache.samza.serializers.Serde-) method is the stream ID. Each ID must match the corresponding stream IDs we configured earlier.
The second argument is the `Serde` used to deserialize the message. We've set this to a `NoOpSerde` since our `wikipedia` system already returns `WikipediaFeedEvent`s and there is no need for further deserialization.

Note the streams are all MessageStreams of type WikipediaFeedEvent. [MessageStream](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/MessageStream.html) is the in-memory representation of a stream in Samza. It uses generics to ensure type safety across the streams and operations.

#### Merge
We'd like to use the same processing logic for all three input streams, so we will use the [mergeAll](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/MessageStream.html#mergeAll-java.util.Collection-) operator to merge them together. Note: this is not the same as a [join](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/MessageStream.html#join-org.apache.samza.operators.MessageStream-org.apache.samza.operators.functions.JoinFunction-java.time.Duration-) because we are not associating events by key. We are simply combining three streams into one, like a union.

Add the following snippet to the [init](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/application/StreamApplication.html#init-org.apache.samza.operators.StreamGraph-org.apache.samza.config.Config-) method. It merges all the input streams into a new one called _allWikipediaEvents_
{% highlight java %}
MessageStream<WikipediaFeed.WikipediaFeedEvent> allWikipediaEvents = MessageStream.mergeAll(ImmutableList.of(wikipediaEvents, wiktionaryEvents, wikiNewsEvents));
{% endhighlight %}

Note there is a [merge](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/MessageStream.html#merge-java.util.Collection-) operator instance method on MessageStream, but the static [mergeAll](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/MessageStream.html#mergeAll-java.util.Collection-) method is a more convenient alternative if you need to merge many streams.

#### Parse
The next step is to parse the events and extract some information. We will use the pre-existing `WikipediaParser.parseEvent()' method to do this. The parser extracts some flags we want to monitor as well as some metadata about the event. Inspect the method signature. The input is a WikipediaFeedEvents and the output is a Map<String, Object>. These types will be reflected in the types of the streams before and after the operation.

In the [init](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/application/StreamApplication.html#init-org.apache.samza.operators.StreamGraph-org.apache.samza.config.Config-) method, invoke the [map](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/MessageStream.html#map-org.apache.samza.operators.functions.MapFunction-) operation on `allWikipediaEvents`, passing the `WikipediaParser::parseEvent` method reference as follows:

{% highlight java %}
allWikipediaEvents.map(WikipediaParser::parseEvent);
{% endhighlight %}

#### Window
Now that we have the relevant information extracted, let's perform some aggregations over a 10-second [window](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/windows/Window.html).

First, we need a container class for statistics we want to track. Add the following static class after the [init](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/application/StreamApplication.html#init-org.apache.samza.operators.StreamGraph-org.apache.samza.config.Config-) method.
{% highlight java %}
private static class WikipediaStats {
  int edits = 0;
  int byteDiff = 0;
  Set<String> titles = new HashSet<String>();
  Map<String, Integer> counts = new HashMap<String, Integer>();
}
{% endhighlight %}

Now we need to define the logic to aggregate the stats over the duration of the window. To do this, we implement [FoldLeftFunction](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/functions/FoldLeftFunction.html) by adding the following class after the `WikipediaStats` class:
{% highlight java %}
private class WikipediaStatsAggregator implements FoldLeftFunction<Map<String, Object>, WikipediaStats> {

  @Override
  public WikipediaStats apply(Map<String, Object> edit, WikipediaStats stats) {
    // Update window stats
    stats.edits++;
    stats.byteDiff += (Integer) edit.get("diff-bytes");
    stats.titles.add((String) edit.get("title"));

    Map<String, Boolean> flags = (Map<String, Boolean>) edit.get("flags");
    for (Map.Entry<String, Boolean> flag : flags.entrySet()) {
      if (Boolean.TRUE.equals(flag.getValue())) {
        stats.counts.compute(flag.getKey(), (k, v) -> v == null ? 0 : v + 1);
      }
    }

    return stats;
  }
}
{% endhighlight %}

Note: the type parameters for [FoldLeftFunction](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/functions/FoldLeftFunction.html) reflect the upstream data type and the window value type, respectively. In our case, the upstream type is the output of the parser and the window value is our `WikipediaStats` class.

Finally, we can define our [window](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/windows/Window.html) back in the [init](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/application/StreamApplication.html#init-org.apache.samza.operators.StreamGraph-org.apache.samza.config.Config-) method by chaining the result of the parser:
{% highlight java %}
allWikipediaEvents.map(WikipediaParser::parseEvent)
        .window(Windows.tumblingWindow(Duration.ofSeconds(10), WikipediaStats::new, new WikipediaStatsAggregator(), new JsonSerdeV2<>(WikipediaStats.class)));
{% endhighlight %}

This defines an unkeyed [tumbling window](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/windows/Windows.html) that spans 10s, which instantiates a new `WikipediaStats` object at the beginning of each window and aggregates the stats using `WikipediaStatsAggregator`.

The output of the window is a [WindowPane](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/windows/WindowPane.html) with a key and value. Since we used an unkeyed tumbling window, the key is `Void`. The value is our `WikipediaStats` object.

#### Output
We will do a [map](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/MessageStream.html#map-org.apache.samza.operators.functions.MapFunction-) at the end to format our window output. Let's begin by defining a simple container class for our formatted output.

{% highlight java %}
  static class WikipediaStatsOutput {
    public int edits;
    public int bytesAdded;
    public int uniqueTitles;
    public Map<String, Integer> counts;

    public WikipediaStatsOutput(int edits, int bytesAdded, int uniqueTitles,
        Map<String, Integer> counts) {
      this.edits = edits;
      this.bytesAdded = bytesAdded;
      this.uniqueTitles = uniqueTitles;
      this.counts = counts;
    }
  }
{% endhighlight %}

Paste the following after the aggregator class:
{% highlight java %}
  private WikipediaStatsOutput formatOutput(WindowPane<Void, WikipediaStats> statsWindowPane) {
    WikipediaStats stats = statsWindowPane.getMessage();
    return new WikipediaStatsOutput(
        stats.edits, stats.byteDiff, stats.titles.size(), stats.counts);
  }
{% endhighlight %}

Now, we can invoke the method by adding another [map](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/MessageStream.html#map-org.apache.samza.operators.functions.MapFunction-) operation to the chain in [init](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/application/StreamApplication.html#init-org.apache.samza.operators.StreamGraph-org.apache.samza.config.Config-). The operator chain should now look like this:
{% highlight java %}
allWikipediaEvents.map(WikipediaParser::parseEvent)
        .window(Windows.tumblingWindow(Duration.ofSeconds(10), WikipediaStats::new, new WikipediaStatsAggregator()))
        .map(this::formatOutput);
{% endhighlight %}

Next we need to get the output stream to which we will send the stats. Insert the following line below the creation of the 3 input streams:
{% highlight java %}
  OutputStream<WikipediaStatsOutput> wikipediaStats =
     graph.getOutputStream("wikipedia-stats", new JsonSerdeV2<>(WikipediaStatsOutput.class));
{% endhighlight %}

The [OutputStream](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/OutputStream.html) is parameterized by the type of the output.

The first parameter of [getOutputStream](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/StreamGraph.html#getOutputStream-java.lang.String-org.apache.samza.serializers.Serde-) is the output stream ID. We will use _wikipedia-stats_ and since it contains no special characters, we won't bother configuring a physical name so Samza will use the stream ID as the topic name.
The second parameter is the [Serde](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/serializers/Serde.html) to serialize the outgoing message. We will set it to [JsonSerdeV2](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/serializers/JsonSerdeV2.html) to serialize our `WikipediaStatsOutput` as a JSON string.

Finally, we can send our output to the output stream using the [sendTo](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/MessageStream.html#sendTo-org.apache.samza.operators.OutputStream-) operator:
{% highlight java %}
allWikipediaEvents.map(WikipediaParser::parseEvent)
        .window(Windows.tumblingWindow(Duration.ofSeconds(10), WikipediaStats::new, new WikipediaStatsAggregator()))
        .map(this::formatOutput)
        .sendTo(wikipediaStats);
{% endhighlight %}

Tip: Because the MessageStream type information is preserved in the operator chain, it is often easier to define the OutputStream inline with the [sendTo](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/MessageStream.html#sendTo-org.apache.samza.operators.OutputStream-) operator and then refactor it for readability. That way you don't have to hunt down the types.

#### KVStore
We now have an operational Wikipedia application which provides stats aggregated over a 10 second interval. One of those stats is a count of the number of edits within the 10s window. But what if we want to keep an additional durable counter of the total edits?

We will do this by keeping a separate count outside the window and persisting it in a [KeyValueStore](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/storage/kv/KeyValueStore.html).

We start by defining the store in the config file:
{% highlight bash %}
serializers.registry.string.class=org.apache.samza.serializers.StringSerdeFactory
serializers.registry.integer.class=org.apache.samza.serializers.IntegerSerdeFactory

stores.wikipedia-stats.factory=org.apache.samza.storage.kv.RocksDbKeyValueStorageEngineFactory
stores.wikipedia-stats.changelog=kafka.wikipedia-stats-changelog
stores.wikipedia-stats.key.serde=string
stores.wikipedia-stats.msg.serde=integer
{% endhighlight %}

These properties declare a [RocksDB](http://rocksdb.org/) key-value store named "wikipedia-stats". The store is replicated to a changelog stream called "wikipedia-stats-changelog" on the _kafka_ system for durability. It uses the _string_ and _integer_ serdes for keys and values respectively.

Next, we add a total count member variable to the `WikipediaStats` class, and to the `WikipediaStatsOutput` class:
{% highlight java %}
int totalEdits = 0;
{% endhighlight %}

To use the store in the application, we need to get it from the [TaskContext](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/task/TaskContext.html). Also, since we want to emit the total edit count along with the window edit count, it's easiest to update both of them in our aggregator. Declare the store as a member variable of the `WikipediaStatsAggregator` class:
{% highlight java %}
private KeyValueStore<String, Integer> store;
{% endhighlight %}

Then override the [init](/learn/documentation/{{site.version}}/api/javadocs/org/apache/samza/operators/functions/InitableFunction.html#init-org.apache.samza.context.Context-) method in `WikipediaStatsAggregator` to initialize the store.
{% highlight java %}
@Override
public void init(Config config, TaskContext context) {
  store = (KeyValueStore<String, Integer>) context.getStore("wikipedia-stats");
}
{% endhighlight %}

Update and persist the counter in the `apply` method.
{% highlight java %}
Integer editsAllTime = store.get("count-edits-all-time");
if (editsAllTime == null) editsAllTime = 0;
editsAllTime++;
store.put("count-edits-all-time", editsAllTime);
stats.totalEdits = editsAllTime;
{% endhighlight %}

Finally, update the `MyWikipediaApplication#formatOutput` method to include the total counter in its `WikipediaStatsOutput`.

#### Metrics
Lastly, let's add a metric to the application which counts the number of repeat edits each topic within the window interval.

As with the key-value store, we must first define the metrics reporters in the config file.
{% highlight bash %}
metrics.reporters=snapshot,jmx
metrics.reporter.snapshot.class=org.apache.samza.metrics.reporter.MetricsSnapshotReporterFactory
metrics.reporter.snapshot.stream=kafka.metrics
metrics.reporter.jmx.class=org.apache.samza.metrics.reporter.JmxReporterFactory
{% endhighlight %}

The above properties define 2 metrics reporters. The first emits metrics to a _metrics_ topic on the _kafka_ system. The second reporter emits metrics to JMX.

In the WikipediaStatsAggregator, declare a counter member variable.
{% highlight java %}
private Counter repeatEdits;
{% endhighlight %}

Then add the following to the `WikipediaStatsAggregator#init` method to initialize the counter.
{% highlight java %}
repeatEdits = context.getMetricsRegistry().newCounter("edit-counters", "repeat-edits");
{% endhighlight %}

Update and persist the counter from the `apply` method.
{% highlight java %}
boolean newTitle = stats.titles.add((String) edit.get("title"));

if (!newTitle) {
  repeatEdits.inc();
  log.info("Frequent edits for title: {}", edit.get("title"));
}
{% endhighlight %}

#### Run and View Plan
You can set up the grid and run the application using the same instructions from the [hello samza high level API Yarn tutorial] (hello-samza-high-level-yarn.html). The only difference is to replace the `wikipedia-application.properties` config file in the _config-path_ command line parameter with `my-wikipedia-application.properties`

### Summary
Congratulations! You have built and executed a Wikipedia stream application on Samza using the high level API. The final application should be directly comparable to the pre-existing `WikipediaApplication` in the project.

You can provide feedback on this tutorial in the [dev mailing list](mailto:dev@samza.apache.org).


text:
package org.kuali.rice.krms.impl.provider.repository;

import org.kuali.rice.krms.api.engine.ExecutionEnvironment;
import org.kuali.rice.krms.api.repository.rule.RuleDefinition;
import org.kuali.rice.krms.framework.engine.Rule;
import org.kuali.rice.krms.framework.type.RuleTypeService;
import org.kuali.rice.krms.impl.type.KrmsTypeResolver;

/**
 * A rule which doesn't load it's members until evaluation.
 *
 * @author Kuali Rice Team (rice.collab@kuali.org)
 *
 */
final class LazyRule implements Rule {

	private final RuleDefinition ruleDefinition;
	private final KrmsTypeResolver typeResolver;

	private final Object mutex = new Object();

	// volatile for double-checked locking idiom
	private volatile Rule rule;

    /**
     *
     * @param ruleDefinition
     * @param typeResolver
     */
	LazyRule(RuleDefinition ruleDefinition, KrmsTypeResolver typeResolver) {
		this.ruleDefinition = ruleDefinition;
		this.typeResolver = typeResolver;
		this.rule = null;
	}

	@Override
	public boolean evaluate(ExecutionEnvironment environment) {
		return getRule().evaluate(environment);
	}

	/**
	 * Gets the rule using a lazy double-checked locking mechanism as documented in Effective Java Item 71.
	 */
	private Rule getRule() {
		Rule localRule = rule;
		if (localRule == null) {
			synchronized (mutex) {
				localRule = rule;
				if (localRule == null) {
					rule = localRule = constructRule();
				}
			}
		}
		return localRule;
	}

    /**
     * builder method
     * @return Rule
     */
	private Rule constructRule() {
		RuleTypeService ruleTypeService = typeResolver.getRuleTypeService(ruleDefinition);
		Rule rule = ruleTypeService.loadRule(ruleDefinition);
		if (rule == null) {
			rule = new Rule() {
				@Override
				public boolean evaluate(ExecutionEnvironment environment) {
                    return false;
				}
			};
		}
		return rule;
	}

}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <title>Qt 4.8: QSslCertificate Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />

  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />

      Home

    Qt Reference Documentation

Qt HOME

DEV

          DOC

BLOG

Qt 4.8

ALL VERSIONS

API Lookup

Class index

Function index

Modules

Namespaces

Global Declarations

QML elements

Qt Topics

Programming with Qt

Device UIs & Qt Quick

UI Design with Qt

Supported Platforms

Qt and Key Technologies

How-To's and Best Practices

Examples

Examples

Tutorials

Demos

QML Examples

          Search index:

          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />

 Close

All | API | Articles | Examples

 results:

            </fieldset>
          </form>

            API Lookup

Class index

Function index

Modules

Namespaces

Global Declarations

QML elements

            Qt Topics

Programming with Qt

Device UIs & Qt Quick

UI Design with Qt

Supported Platforms

Qt and Key Technologies

How-To's and Best Practices

            Examples

Examples

Tutorials

Demos

QML Examples

Home

Modules

QtNetwork

QSslCertificate

A

A

A

                Print

Contents

Public Types

Public Functions

Static Public Members

Detailed Description

QSslCertificate Class Reference

The QSslCertificate class provides a convenient API for an X509 certificate. More...

 #include <QSslCertificate>

Note: All functions in this class are reentrant.

This class was introduced in Qt 4.3.

List of all members, including inherited members

Public Types

 enum 	SubjectInfo { Organization, CommonName, LocalityName, OrganizationalUnitName, CountryName, StateOrProvinceName }

Public Functions

 	QSslCertificate ( QIODevice * device, QSsl::EncodingFormat format = QSsl::Pem )

 	QSslCertificate ( const QByteArray & data = QByteArray(), QSsl::EncodingFormat format = QSsl::Pem )

 	QSslCertificate ( const QSslCertificate & other )

 	~QSslCertificate ()

 QMultiMap<QSsl::AlternateNameEntryType, QString> 	alternateSubjectNames () const

 void 	clear ()

 QByteArray 	digest ( QCryptographicHash::Algorithm algorithm = QCryptographicHash::Md5 ) const

 QDateTime 	effectiveDate () const

 QDateTime 	expiryDate () const

 Qt::HANDLE 	handle () const

 bool 	isNull () const

 bool 	isValid () const

 QString 	issuerInfo ( SubjectInfo subject ) const

 QString 	issuerInfo ( const QByteArray & tag ) const

 QSslKey 	publicKey () const

 QByteArray 	serialNumber () const

 QString 	subjectInfo ( SubjectInfo subject ) const

 QString 	subjectInfo ( const QByteArray & tag ) const

 QByteArray 	toDer () const

 QByteArray 	toPem () const

 QByteArray 	version () const

 bool 	operator!= ( const QSslCertificate & other ) const

 QSslCertificate & 	operator= ( const QSslCertificate & other )

 bool 	operator== ( const QSslCertificate & other ) const

Static Public Members

 QList<QSslCertificate> 	fromData ( const QByteArray & data, QSsl::EncodingFormat format = QSsl::Pem )

 QList<QSslCertificate> 	fromDevice ( QIODevice * device, QSsl::EncodingFormat format = QSsl::Pem )

 QList<QSslCertificate> 	fromPath ( const QString & path, QSsl::EncodingFormat format = QSsl::Pem, QRegExp::PatternSyntax syntax = QRegExp::FixedString )

Detailed Description

The QSslCertificate class provides a convenient API for an X509 certificate.

QSslCertificate stores an X509 certificate, and is commonly used to verify the identity and store information about the local host, a remotely connected peer, or a trusted third party Certificate Authority.

There are many ways to construct a QSslCertificate. The most common way is to call QSslSocket::peerCertificate(), which returns a QSslCertificate object, or QSslSocket::peerCertificateChain(), which returns a list of them. You can also load certificates from a DER (binary) or PEM (Base64) encoded bundle, typically stored as one or more local files, or in a Qt Resource.

You can call isNull() to check if your certificate is null. By default, QSslCertificate constructs a null certificate. To check if the certificate is valid, call isValid(). A null certificate is invalid, but an invalid certificate is not necessarily null. If you want to reset all contents in a certificate, call clear().

After loading a certificate, you can find information about the certificate, its subject, and its issuer, by calling one of the many accessor functions, including version(), serialNumber(), issuerInfo() and subjectInfo(). You can call effectiveDate() and expiryDate() to check when the certificate starts being effective and when it expires. The publicKey() function returns the certificate subject's public key as a QSslKey. You can call issuerInfo() or subjectInfo() to get detailed information about the certificate issuer and its subject.

Internally, QSslCertificate is stored as an X509 structure. You can access this handle by calling handle(), but the results are likely to not be portable.

See also QSslSocket, QSslKey, QSslCipher, and QSslError.

Member Type Documentation

enum QSslCertificate::SubjectInfo

Describes keys that you can pass to QSslCertificate::issuerInfo() or QSslCertificate::subjectInfo() to get information about the certificate issuer or subject.

Constant	Value	Description

<tt>QSslCertificate::Organization</tt>	<tt>0</tt>	"O" The name of the organization.

<tt>QSslCertificate::CommonName</tt>	<tt>1</tt>	"CN" The common name; most often this is used to store the host name.

<tt>QSslCertificate::LocalityName</tt>	<tt>2</tt>	"L" The locality.

<tt>QSslCertificate::OrganizationalUnitName</tt>	<tt>3</tt>	"OU" The organizational unit name.

<tt>QSslCertificate::CountryName</tt>	<tt>4</tt>	"C" The country.

<tt>QSslCertificate::StateOrProvinceName</tt>	<tt>5</tt>	"ST" The state or province.

Member Function Documentation

QSslCertificate::QSslCertificate ( QIODevice * device, QSsl::EncodingFormat format = QSsl::Pem )

Constructs a QSslCertificate by reading format encoded data from device and using the first certificate found. You can later call isNull() to see if device contained a certificate, and if this certificate was loaded successfully.

QSslCertificate::QSslCertificate ( const QByteArray & data = QByteArray(), QSsl::EncodingFormat format = QSsl::Pem )

Constructs a QSslCertificate by parsing the format encoded data and using the first available certificate found. You can later call isNull() to see if data contained a certificate, and if this certificate was loaded successfully.

QSslCertificate::QSslCertificate ( const QSslCertificate & other )

Constructs an identical copy of other.

QSslCertificate::~QSslCertificate ()

Destroys the QSslCertificate.

QMultiMap<QSsl::AlternateNameEntryType, QString> QSslCertificate::alternateSubjectNames () const

Returns the list of alternative subject names for this certificate. The alternate subject names typically contain host names, optionally with wildcards, that are valid for this certificate.

These names are tested against the connected peer's host name, if either the subject information for CommonName doesn't define a valid host name, or the subject info name doesn't match the peer's host name.

See also subjectInfo().

void QSslCertificate::clear ()

Clears the contents of this certificate, making it a null certificate.

See also isNull().

QByteArray QSslCertificate::digest ( QCryptographicHash::Algorithm algorithm = QCryptographicHash::Md5 ) const

Returns a cryptographic digest of this certificate. By default, an MD5 digest will be generated, but you can also specify a custom algorithm.

QDateTime QSslCertificate::effectiveDate () const

Returns the date-time that the certificate becomes valid, or an empty QDateTime if this is a null certificate.

See also expiryDate().

QDateTime QSslCertificate::expiryDate () const

Returns the date-time that the certificate expires, or an empty QDateTime if this is a null certificate.

See also effectiveDate().

QList<QSslCertificate> QSslCertificate::fromData ( const QByteArray & data, QSsl::EncodingFormat format = QSsl::Pem )<tt> [static]</tt>

Searches for and parses all certificates in data that are encoded in the specified format and returns them in a list of certificates.

See also fromDevice().

QList<QSslCertificate> QSslCertificate::fromDevice ( QIODevice * device, QSsl::EncodingFormat format = QSsl::Pem )<tt> [static]</tt>

Searches for and parses all certificates in device that are encoded in the specified format and returns them in a list of certificates.

See also fromData().

QList<QSslCertificate> QSslCertificate::fromPath ( const QString & path, QSsl::EncodingFormat format = QSsl::Pem, QRegExp::PatternSyntax syntax = QRegExp::FixedString )<tt> [static]</tt>

Searches all files in the path for certificates encoded in the specified format and returns them in a list. must be a file or a pattern matching one or more files, as specified by syntax.

Example:

 foreach (const QSslCertificate &cert, QSslCertificate::fromPath("C:/ssl/certificate.*.pem", QSsl::Pem,
                                                          QRegExp::Wildcard)) {
     qDebug() << cert.issuerInfo(QSslCertificate::Organization);
 }

See also fromData().

Qt::HANDLE QSslCertificate::handle () const

Returns a pointer to the native certificate handle, if there is one, or a null pointer otherwise.

You can use this handle, together with the native API, to access extended information about the certificate.

Warning: Use of this function has a high probability of being non-portable, and its return value may vary from platform to platform or change from minor release to minor release.

bool QSslCertificate::isNull () const

Returns true if this is a null certificate (i.e., a certificate with no contents); otherwise returns false.

By default, QSslCertificate constructs a null certificate.

See also isValid() and clear().

bool QSslCertificate::isValid () const

Returns true if this certificate is valid; otherwise returns false.

Note: Currently, this function checks that the current data-time is within the date-time range during which the certificate is considered valid, and checks that the certificate is not in a blacklist of fraudulent certificates.

See also isNull().

QString QSslCertificate::issuerInfo ( SubjectInfo subject ) const

Returns the issuer information for the subject from the certificate, or an empty string if there is no information for subject in the certificate.

See also subjectInfo().

QString QSslCertificate::issuerInfo ( const QByteArray & tag ) const

Returns the issuer information for tag from the certificate, or an empty string if there is no information for tag in the certificate.

See also subjectInfo().

QSslKey QSslCertificate::publicKey () const

Returns the certificate subject's public key.

QByteArray QSslCertificate::serialNumber () const

Returns the certificate's serial number string in decimal format. In case the serial number cannot be converted to decimal format (i.e. if it is bigger than 4294967295, which means it does not fit into 4 bytes), its hexadecimal version is returned.

QString QSslCertificate::subjectInfo ( SubjectInfo subject ) const

Returns the information for the subject, or an empty string if there is no information for subject in the certificate.

See also issuerInfo().

QString QSslCertificate::subjectInfo ( const QByteArray & tag ) const

Returns the subject information for tag, or an empty string if there is no information for tag in the certificate.

See also issuerInfo().

QByteArray QSslCertificate::toDer () const

Returns this certificate converted to a DER (binary) encoded representation.

QByteArray QSslCertificate::toPem () const

Returns this certificate converted to a PEM (Base64) encoded representation.

QByteArray QSslCertificate::version () const

Returns the certificate's version string.

bool QSslCertificate::operator!= ( const QSslCertificate & other ) const

Returns true if this certificate is not the same as other; otherwise returns false.

QSslCertificate & QSslCertificate::operator= ( const QSslCertificate & other )

Copies the contents of other into this certificate, making the two certificates identical.

bool QSslCertificate::operator== ( const QSslCertificate & other ) const

Returns true if this certificate is the same as other; otherwise returns false.

      <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.

      The documentation provided herein is licensed under the terms of the
      GNU Free Documentation
      License version 1.3 as published by the Free Software Foundation.

      Documentation sources may be obtained from
      www.qt-project.org.

      Digia, Qt and their respective logos are trademarks of Digia Plc
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. Privacy Policy


text:
using System;
using Aspose.BarCode.Generation;
using Aspose.BarCode.BarCodeRecognition;

namespace Aspose.BarCode.Examples.CSharp.KnowledgeBase
{
    internal class SwissPostDomesticMail : SwissPostParcelBase
    {
		public static void Run()
        {
            string path = GetWriteFolder();
            Console.WriteLine("SwissPostDomesticMail:");
            BarcodeGenerator gen;

            //generate Swiss Post Domestic Mail barcode as it looks
            gen = new BarcodeGenerator(EncodeTypes.SwissPostParcel, "98.34.123456.12345678");
            gen.Parameters.Barcode.XDimension.Pixels = 2;
            gen.Parameters.Barcode.BarHeight.Pixels = 40;
            gen.Save($"{path}SwissPostDomesticMailAsIs.png", BarCodeImageFormat.Png);
            //read the current barcode value
            foreach(BarCodeResult result in new BarCodeReader(gen.GenerateBarCodeImage(), DecodeType.SwissPostParcel).ReadBarCodes())
                Console.WriteLine($"Barcode type:{result.CodeTypeName}, Barcode Data:{result.CodeText}");

            //generate Swiss Post Domestic Mail barcode as raw digits
            gen = new BarcodeGenerator(EncodeTypes.SwissPostParcel, "983412345612345678");
            gen.Parameters.Barcode.XDimension.Pixels = 2;
            gen.Parameters.Barcode.BarHeight.Pixels = 40;
            gen.Save($"{path}SwissPostDomesticMailAsDigits.png", BarCodeImageFormat.Png);
            //read the current barcode value
            foreach (BarCodeResult result in new BarCodeReader(gen.GenerateBarCodeImage(), DecodeType.SwissPostParcel).ReadBarCodes())
                Console.WriteLine($"Barcode type:{result.CodeTypeName}, Barcode Data:{result.CodeText}");
        }
	}
}


text:
package ipmi

// Client provides common high level functionality around the underlying transport
type Client struct {
	*Connection
	transport
}

// NewClient creates a new Client with the given Connection properties
func NewClient(c *Connection) (*Client, error) {
	t, err := newTransport(c)
	if err != nil {
		return nil, err
	}
	return &Client{
		Connection: c,
		transport:  t,
	}, nil
}

// Open a new IPMI session
func (c *Client) Open() error {
	// TODO: auto-select transport based on BMC capabilities
	return c.open()
}

// Close the IPMI session
func (c *Client) Close() error {
	return c.close()
}

// Send a Request and unmarshal to given Response type
func (c *Client) Send(req *Request, res Response) error {
	// TODO: handle retry, timeouts, etc.
	return c.send(req, res)
}

// DeviceID get the Device ID of the BMC
func (c *Client) DeviceID() (*DeviceIDResponse, error) {
	req := &Request{
		NetworkFunctionApp,
		CommandGetDeviceID,
		&DeviceIDRequest{},
	}
	res := &DeviceIDResponse{}
	return res, c.Send(req, res)
}

func (c *Client) setBootParam(param uint8, data ...uint8) error {
	r := &Request{
		NetworkFunctionChassis,
		CommandSetSystemBootOptions,
		&SetSystemBootOptionsRequest{
			Param: param,
			Data:  data,
		},
	}
	return c.Send(r, &SetSystemBootOptionsResponse{})
}

// SetBootDevice is a wrapper around SetSystemBootOptionsRequest to configure the BootDevice
// per section 28.12 - table 28
func (c *Client) SetBootDevice(dev BootDevice) error {
	useProgress := true
	// set set-in-progress flag
	err := c.setBootParam(BootParamSetInProgress, 0x01)
	if err != nil {
		useProgress = false
	}

	err = c.setBootParam(BootParamInfoAck, 0x01, 0x01)
	if err != nil {
		if useProgress {
			// set-in-progress = set-complete
			_ = c.setBootParam(BootParamSetInProgress, 0x00)
		}
		return err
	}

	err = c.setBootParam(BootParamBootFlags, 0x80, uint8(dev), 0x00, 0x00, 0x00)
	if err == nil {
		if useProgress {
			// set-in-progress = commit-write
			_ = c.setBootParam(BootParamSetInProgress, 0x02)
		}
	}

	if useProgress {
		// set-in-progress = set-complete
		_ = c.setBootParam(BootParamSetInProgress, 0x00)
	}

	return err
}

// Control sends a chassis power control command
func (c *Client) Control(ctl ChassisControl) error {
	r := &Request{
		NetworkFunctionChassis,
		CommandChassisControl,
		&ChassisControlRequest{ctl},
	}
	return c.Send(r, &ChassisControlResponse{})
}


text:
<?php

namespace Platformsh\Cli\SiteAlias;

use Platformsh\Client\Model\Project;

class DrushPhp extends DrushAlias
{
    /**
     * {@inheritdoc}
     */
    protected function getFilename($groupName)
    {
        return $this->drush->getSiteAliasDir() . '/' . $groupName . '.aliases.drushrc.php';
    }

    /**
     * {@inheritdoc}
     */
    protected function formatAliases(array $aliases)
    {
        $formatted = [];
        foreach ($aliases as $aliasName => $newAlias) {
            $formatted[] = sprintf(
                "\$aliases['%s'] = %s;\n",
                str_replace("'", "\\'", $aliasName),
                var_export($newAlias, true)
            );
        }

        return implode("\n", $formatted);
    }

    /**
     * {@inheritdoc}
     */
    protected function normalize(array $aliases)
    {
        return $this->swapKeys($aliases, [
            'host' => 'remote-host',
            'user' => 'remote-user',
        ]);
    }

    /**
     * {@inheritdoc}
     */
    protected function getHeader(Project $project)
    {
        return <<<EOT
<?php
/**
 * Drush aliases for the {$this->config->get('service.name')} project "{$project->title}".
 *
 * This file is auto-generated by the {$this->config->get('application.name')}.
 *
 * WARNING
 * This file may be regenerated at any time.
 * - User-defined aliases will be preserved.
 * - Aliases for active environments (including any custom additions) will be preserved.
 * - Aliases for deleted or inactive environments will be deleted.
 * - All other information will be deleted.
 */
EOT;
    }
}


text:
namespace RevolutionaryStuff.Core.Caching;

public interface ICacheEntryRetentionPolicy
{
    TimeSpan? CacheEntryTimeout { get; }
}


text:
<?php

namespace Fc\AdminBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;

use Knp\Menu\ItemInterface as MenuItemInterface;

use Fc\FantaBundle\Entity\Championship;

/**
 * Description of SeasonAdmin
 *
 * @author cris
 */
class ChampionshipAdmin extends Admin
{
    /**
     * @param \Sonata\AdminBundle\Show\ShowMapper $showMapper
     *
     * @return void
     */
    protected function configureShowField(ShowMapper $showMapper)
    {
        $showMapper
                ->add('enabled')
                ->add('name')
                ->add('season', 'sonata_type_model')
                ->add('days', 'sonata_type_model')
        ;
    }

    /**
     * @param \Sonata\AdminBundle\Form\FormMapper $formMapper
     *
     * @return void
     */
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->with('General')
                ->add('enabled', 'fc_type_boolean', array('expanded' => false))
                ->add('is_calendar_frozen', 'fc_type_boolean', array('expanded' => false))
                ->add('name')
                ->add('season', 'sonata_type_model', array('expanded' => true, 'compound' => true))
            ->end()
            ->with('Clubs')
                //->add('clubs', 'sonata_type_model')
            ->end()
        ;
    }

    /**
     * @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper
     *
     * @return void
     */
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('name')
            ->add('season', 'sonata_type_model')
            ->add('enabled')
            ->add('_action', 'actions', array(
                'actions' => array(
                    'import_players' => array('template' => 'FcAdminBundle:ChampionshipAdmin:list__action_import_players.html.twig'),
                    'import_marks' => array('template' => 'FcAdminBundle:ChampionshipAdmin:list__action_import_marks.html.twig'),
                    'init_calendar' => array('template' => 'FcAdminBundle:ChampionshipAdmin:list__action_init_calendar.html.twig'),
                    'view' => array(),
                    'edit' => array(),
                    'delete' => array(),
                )
            ))

        ;
    }

    /**
     * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
     *
     * @return void
     */
    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('name')
            ->add('season')
            ->add('enabled')
        ;
    }

    protected function configureRoutes(RouteCollection $collection)
    {
        $collection->add('init_calendar', 'init-calendar');
        $collection->add('import_players', 'import-players');
        $collection->add('import_marks', 'import-marks');
    }

    /**
     * {@inheritdoc}
    protected function configureSideMenu(MenuItemInterface $menu, $action, Admin $childAdmin = null)
    {
        $admin = $this->isChild() ? $this->getParent() : $this;

        if ($action=="list")
        {
            $menu->addChild(
                $this->trans('Importa giocatori'),
                array('uri' => $admin->generateUrl('import'))
            );
        }
    }

    public function getListTemplate()
    {
        return 'FcAdminBundle:ChampionshipAdmin:list.html.twig';
    }
     */

}

?>


text:
///<reference path="APIRequest.ts"/>
///<reference path="APIResponse.ts"/>
///<reference path="BaseSocialBridge.ts"/>
///<reference path="CommonUtil.ts"/>
///<reference path="IAdaptiveRPGroup.ts"/>
///<reference path="IBaseSocial.ts"/>
///<reference path="ITwitter.ts"/>
module Adaptive {

     /**
        @class Adaptive.TwitterBridge
        @extends Adaptive.BaseSocialBridge
        Interface for Managing the Twitter operations

        @author Carlos Lozano Diez
        @since v2.0
     */
     export class TwitterBridge extends BaseSocialBridge implements ITwitter {

          /**
             @method constructor
             Default constructor.
          */
          constructor() {
               super();
          }
     }
}
/**
------------------------------------| Engineered with ♥ in Barcelona, Catalonia |--------------------------------------
*/


text:
namespace cloudscribe.Web.Navigation.Caching
{
    public class TreeCacheOptions
    {
        public int CacheDurationInSeconds { get; set; } = 1800; //30 minutes
    }
}


text:
// This file is automatically generated.

package adila.db;

/*
 * NGM You Color P551
 *
 * DEVICE: NGM_P551
 * MODEL: P551
 */
final class ngm5fp551_p551 {
    public static final String DATA = "NGM|You Color P551|You Color";
}


text:
<?php if(!defined('KIRBY')) exit ?>

title: Projects
pages:
  template: project
files: false
  sortable: true
fields:
  title:
    label: Title
    type:  text
  video_background:
    label: Video Background (youtube or vimeo)
    type:  text
  image_background:
    label: Image Background (can be used as a preview image for video or separately)
    type:  textarea


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/accessapproval/v1/accessapproval.proto

package com.google.cloud.accessapproval.v1;

public interface AccessApprovalSettingsOrBuilder
    extends
    // @@protoc_insertion_point(interface_extends:google.cloud.accessapproval.v1.AccessApprovalSettings)
    com.google.protobuf.MessageOrBuilder {

  /**
   *
   *
   *

   * The resource name of the settings. Format is one of:
   *   * "projects/{project}/accessApprovalSettings"
   *   * "folders/{folder}/accessApprovalSettings"
   *   * "organizations/{organization}/accessApprovalSettings"
   *

   *
   * string name = 1 [(.google.api.resource_reference) = { ... }
   *
   * @return The name.
   */
  java.lang.String getName();
  /**
   *
   *
   *

   * The resource name of the settings. Format is one of:
   *   * "projects/{project}/accessApprovalSettings"
   *   * "folders/{folder}/accessApprovalSettings"
   *   * "organizations/{organization}/accessApprovalSettings"
   *

   *
   * string name = 1 [(.google.api.resource_reference) = { ... }
   *
   * @return The bytes for name.
   */
  com.google.protobuf.ByteString getNameBytes();

  /**
   *
   *
   *

   * A list of email addresses to which notifications relating to approval
   * requests should be sent. Notifications relating to a resource will be sent
   * to all emails in the settings of ancestor resources of that resource. A
   * maximum of 50 email addresses are allowed.
   *

   *
   * repeated string notification_emails = 2;
   *
   * @return A list containing the notificationEmails.
   */
  java.util.List<java.lang.String> getNotificationEmailsList();
  /**
   *
   *
   *

   * A list of email addresses to which notifications relating to approval
   * requests should be sent. Notifications relating to a resource will be sent
   * to all emails in the settings of ancestor resources of that resource. A
   * maximum of 50 email addresses are allowed.
   *

   *
   * repeated string notification_emails = 2;
   *
   * @return The count of notificationEmails.
   */
  int getNotificationEmailsCount();
  /**
   *
   *
   *

   * A list of email addresses to which notifications relating to approval
   * requests should be sent. Notifications relating to a resource will be sent
   * to all emails in the settings of ancestor resources of that resource. A
   * maximum of 50 email addresses are allowed.
   *

   *
   * repeated string notification_emails = 2;
   *
   * @param index The index of the element to return.
   * @return The notificationEmails at the given index.
   */
  java.lang.String getNotificationEmails(int index);
  /**
   *
   *
   *

   * A list of email addresses to which notifications relating to approval
   * requests should be sent. Notifications relating to a resource will be sent
   * to all emails in the settings of ancestor resources of that resource. A
   * maximum of 50 email addresses are allowed.
   *

   *
   * repeated string notification_emails = 2;
   *
   * @param index The index of the value to return.
   * @return The bytes of the notificationEmails at the given index.
   */
  com.google.protobuf.ByteString getNotificationEmailsBytes(int index);

  /**
   *
   *
   *

   * A list of Google Cloud Services for which the given resource has Access
   * Approval enrolled. Access requests for the resource given by name against
   * any of these services contained here will be required to have explicit
   * approval. If name refers to an organization, enrollment can be done for
   * individual services. If name refers to a folder or project, enrollment can
   * only be done on an all or nothing basis.
   * If a cloud_product is repeated in this list, the first entry will be
   * honored and all following entries will be discarded. A maximum of 10
   * enrolled services will be enforced, to be expanded as the set of supported
   * services is expanded.
   *

   *
   * repeated .google.cloud.accessapproval.v1.EnrolledService enrolled_services = 3;
   */
  java.util.List<com.google.cloud.accessapproval.v1.EnrolledService> getEnrolledServicesList();
  /**
   *
   *
   *

   * A list of Google Cloud Services for which the given resource has Access
   * Approval enrolled. Access requests for the resource given by name against
   * any of these services contained here will be required to have explicit
   * approval. If name refers to an organization, enrollment can be done for
   * individual services. If name refers to a folder or project, enrollment can
   * only be done on an all or nothing basis.
   * If a cloud_product is repeated in this list, the first entry will be
   * honored and all following entries will be discarded. A maximum of 10
   * enrolled services will be enforced, to be expanded as the set of supported
   * services is expanded.
   *

   *
   * repeated .google.cloud.accessapproval.v1.EnrolledService enrolled_services = 3;
   */
  com.google.cloud.accessapproval.v1.EnrolledService getEnrolledServices(int index);
  /**
   *
   *
   *

   * A list of Google Cloud Services for which the given resource has Access
   * Approval enrolled. Access requests for the resource given by name against
   * any of these services contained here will be required to have explicit
   * approval. If name refers to an organization, enrollment can be done for
   * individual services. If name refers to a folder or project, enrollment can
   * only be done on an all or nothing basis.
   * If a cloud_product is repeated in this list, the first entry will be
   * honored and all following entries will be discarded. A maximum of 10
   * enrolled services will be enforced, to be expanded as the set of supported
   * services is expanded.
   *

   *
   * repeated .google.cloud.accessapproval.v1.EnrolledService enrolled_services = 3;
   */
  int getEnrolledServicesCount();
  /**
   *
   *
   *

   * A list of Google Cloud Services for which the given resource has Access
   * Approval enrolled. Access requests for the resource given by name against
   * any of these services contained here will be required to have explicit
   * approval. If name refers to an organization, enrollment can be done for
   * individual services. If name refers to a folder or project, enrollment can
   * only be done on an all or nothing basis.
   * If a cloud_product is repeated in this list, the first entry will be
   * honored and all following entries will be discarded. A maximum of 10
   * enrolled services will be enforced, to be expanded as the set of supported
   * services is expanded.
   *

   *
   * repeated .google.cloud.accessapproval.v1.EnrolledService enrolled_services = 3;
   */
  java.util.List<? extends com.google.cloud.accessapproval.v1.EnrolledServiceOrBuilder>
      getEnrolledServicesOrBuilderList();
  /**
   *
   *
   *

   * A list of Google Cloud Services for which the given resource has Access
   * Approval enrolled. Access requests for the resource given by name against
   * any of these services contained here will be required to have explicit
   * approval. If name refers to an organization, enrollment can be done for
   * individual services. If name refers to a folder or project, enrollment can
   * only be done on an all or nothing basis.
   * If a cloud_product is repeated in this list, the first entry will be
   * honored and all following entries will be discarded. A maximum of 10
   * enrolled services will be enforced, to be expanded as the set of supported
   * services is expanded.
   *

   *
   * repeated .google.cloud.accessapproval.v1.EnrolledService enrolled_services = 3;
   */
  com.google.cloud.accessapproval.v1.EnrolledServiceOrBuilder getEnrolledServicesOrBuilder(
      int index);

  /**
   *
   *
   *

   * Output only. This field is read only (not settable via
   * UpdateAccessApprovalSettings method). If the field is true, that
   * indicates that at least one service is enrolled for Access Approval in one
   * or more ancestors of the Project or Folder (this field will always be
   * unset for the organization since organizations do not have ancestors).
   *

   *
   * bool enrolled_ancestor = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   * @return The enrolledAncestor.
   */
  boolean getEnrolledAncestor();

  /**
   *
   *
   *

   * The asymmetric crypto key version to use for signing approval requests.
   * Empty active_key_version indicates that a Google-managed key should be used
   * for signing. This property will be ignored if set by an ancestor of this
   * resource, and new non-empty values may not be set.
   *

   *
   * string active_key_version = 6;
   *
   * @return The activeKeyVersion.
   */
  java.lang.String getActiveKeyVersion();
  /**
   *
   *
   *

   * The asymmetric crypto key version to use for signing approval requests.
   * Empty active_key_version indicates that a Google-managed key should be used
   * for signing. This property will be ignored if set by an ancestor of this
   * resource, and new non-empty values may not be set.
   *

   *
   * string active_key_version = 6;
   *
   * @return The bytes for activeKeyVersion.
   */
  com.google.protobuf.ByteString getActiveKeyVersionBytes();

  /**
   *
   *
   *

   * Output only. This field is read only (not settable via UpdateAccessApprovalSettings
   * method). If the field is true, that indicates that an ancestor of this
   * Project or Folder has set active_key_version (this field will always be
   * unset for the organization since organizations do not have ancestors).
   *

   *
   * bool ancestor_has_active_key_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   *
   * @return The ancestorHasActiveKeyVersion.
   */
  boolean getAncestorHasActiveKeyVersion();

  /**
   *
   *
   *

   * Output only. This field is read only (not settable via UpdateAccessApprovalSettings
   * method). If the field is true, that indicates that there is some
   * configuration issue with the active_key_version configured at this level in
   * the resource hierarchy (e.g. it doesn't exist or the Access Approval
   * service account doesn't have the correct permissions on it, etc.) This key
   * version is not necessarily the effective key version at this level, as key
   * versions are inherited top-down.
   *

   *
   * bool invalid_key_version = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   * @return The invalidKeyVersion.
   */
  boolean getInvalidKeyVersion();
}


text:
Party.create(party_name: "Buch")
Party.create(party_name: "Goodman")
Party.create(party_name: "Speck")

Guest.create(first_name: "Lisa", last_name: "Buch", email: "lisakbuch@gmail.com", party_id:1, meal_id:1)
Guest.create(first_name:"hey", last_name:"Yo", email: "yo@yo.com", party_id:1,meal_id:1)
Guest.create(first_name: "David", last_name: "Moroney", email: "dave@dave.com", party_id:3)
Guest.create(first_name: "Kylie", last_name:"Minogue", email: "keylie@key.com", party_id:3)

Meal.create(desc: "ice cream")
Meal.create(desc: "fish pie")
Meal.create(desc: "bubblegum")


text:
/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
          indent:4, unused:vars, latedef:nofunc,
          sub:true
*/

var fs = require('fs'),
    path = require('path'),
    shell = require('shelljs'),
    events = require('../../events'),
    util = require('../util'),
    Q = require('q'),
    ConfigParser = require('../../configparser/ConfigParser');

module.exports = function firefoxos_parser(project) {
    this.path = project;
};

// Returns a promise.
module.exports.check_requirements = function(project_root, lib_path) {
    return Q(); // Requirements always met.
};

module.exports.prototype = {
    // Returns a promise.
    update_from_config: function() {
        var config = new ConfigParser(this.config_xml());
        var manifestPath = path.join(this.www_dir(), 'manifest.webapp');
        var manifest = {};

        // Load existing manifest
        if (fs.existsSync(manifestPath)) {
            manifest = JSON.parse(fs.readFileSync(manifestPath));
        }

        // overwrite properties existing in config.xml
        var contentNode = config.doc.find('content');
        var contentSrc = contentNode.attrib['src'];
        manifest.launch_path = path.join('/', contentSrc) || '/index.html';

        manifest.installs_allowed_from = manifest.installs_allowed_from || ['*'];
        manifest.version = config.version();
        manifest.name = config.name();
        manifest.description = config.description();
        manifest.developer = {
            name: config.author()
        };

        var authorNode = config.doc.find('author');
        var authorUrl = authorNode.attrib['href'];

        if (authorUrl) {
            manifest.developer.url = authorUrl;
        }

        var fullScreen = config.getPreference('fullscreen');

        if (fullScreen) {
            manifest.fullscreen = fullScreen;
        }

        var orientations = [];
        var preferenceNodes = config.doc.findall('preference');
        preferenceNodes.forEach(function (preference) {
            if (preference.attrib.name.toLowerCase() === 'orientation') {
                orientations.push(preference.attrib.value);
            }
        });

        if (orientations && orientations.length) {
            manifest.orientation = orientations;
        }

        var permissionNodes = config.doc.findall('permission');
        var privileged = false;

        if (permissionNodes.length) {
            manifest.permissions = {};

            permissionNodes.forEach(function(node) {
                var permissionName = node.attrib['name'];

                manifest.permissions[permissionName] = {
                    description: node.attrib['description']
                };

                if (node.attrib['access']) {
                    manifest.permissions[permissionName].access = node.attrib['access'];
                }

                if (node.attrib['privileged'] === 'true') {
                    privileged = true;
                }
            });
        }

        if (privileged) {
            manifest.type = 'privileged';
        } else {
            delete manifest.type;
        }

        var icons = config.getIcons('firefoxos');
        // if there are icon elements in config.xml
        if (icons) {
            manifest.icons = {};
            for (var i = 0; i < icons.length; i++) {
                var icon = icons[i];
                var size = icon.width;
                var sizeInt = parseInt(size);

                events.emit('verbose', 'icon[' + i + ']:' + JSON.stringify(icon));

                if (size && !isNaN(sizeInt)) {
                    if (icon.src) {
                        var destfilepath = path.join(this.www_dir(), 'icon', 'icon-' + size + '.png');

                        manifest.icons[sizeInt] = '/icon/icon-' + size + '.png';

                        if (!fs.existsSync(icon.src)) {
                            events.emit('verbose', 'ignoring icon[' + i + '] icon. File ' + icon.src + ' not found.');
                        } else {
                            events.emit('verbose', 'Copying icon from ' + icon.src + ' to ' + destfilepath);
                            shell.cp('-f', icon.src, destfilepath);
                        }
                    } else {
                        events.emit('warn', 'ignoring icon[' + i + '] no src attribute:' + JSON.stringify(icon));
                    }
                }
            }
        }

        fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 4));

        return Q();
    },

    www_dir: function() {
        return path.join(this.path, 'www');
    },

    // Used for creating platform_www in projects created by older versions.
    cordovajs_path:function(libDir) {
        var jsPath = path.join(libDir, 'cordova-lib', 'cordova.js');
        return path.resolve(jsPath);
    },

    // Replace the www dir with contents of platform_www and app www.
    update_www:function() {
        var projectRoot = util.isCordova(this.path);
        var app_www = util.projectWww(projectRoot);
        var platform_www = path.join(this.path, 'platform_www');

        // Clear the www dir
        shell.rm('-rf', this.www_dir());
        shell.mkdir(this.www_dir());
        // Copy over all app www assets
        shell.cp('-rf', path.join(app_www, '*'), this.www_dir());
        // Copy over stock platform www assets (cordova.js)
        shell.cp('-rf', path.join(platform_www, '*'), this.www_dir());
    },

    update_overrides: function() {
        var projectRoot = util.isCordova(this.path);
        var mergesPath = path.join(util.appDir(projectRoot), 'merges', 'firefoxos');
        if(fs.existsSync(mergesPath)) {
            var overrides = path.join(mergesPath, '*');
            shell.cp('-rf', overrides, this.www_dir());
        }
    },

    config_xml:function(){
        return path.join(this.path, 'config.xml');
    },

    // Returns a promise.
    update_project: function(cfg) {
        return this.update_from_config()
            .then(function(){
                this.update_overrides();
                util.deleteSvnFolders(this.www_dir());
            }.bind(this));
    }
};


text:
package com.compomics.pride_asa_pipeline.core.repository;

import com.compomics.pride_asa_pipeline.model.AnalyzerData;
import com.compomics.pride_asa_pipeline.model.Identification;
import com.compomics.pride_asa_pipeline.model.Modification;
import com.compomics.pride_asa_pipeline.model.Peak;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import uk.ac.ebi.pride.tools.jmzreader.JMzReaderException;
import uk.ac.ebi.pride.tools.mzxml_parser.MzXMLParsingException;

/**
 *
 * @author Niels Hulstaert
 */

/**
 *
 * @author Kenneth Verheggen
 */
public interface FileParser {

    /**
     * Inits the parser with the given Pride XML file
     *
     * @param prideXmlFile the Pride XML file
     * @throws java.lang.ClassNotFoundException
     * @throws uk.ac.ebi.pride.tools.mzxml_parser.MzXMLParsingException
     * @throws uk.ac.ebi.pride.tools.jmzreader.JMzReaderException
     */
    void init(File prideXmlFile)throws ClassNotFoundException, MzXMLParsingException, JMzReaderException;

    /**
     * Clears the parser resources
     *
     */
    void clear();

    /**
     * Gets the experiment identifications
     *
     * @return the list of experiment identifications
     */
    List<Identification> getExperimentIdentifications();

    /**
     * Gets the number of spectra
     *
     * @return the number of spectra
     */
    long getNumberOfSpectra();

    /**
     * Gets the number of peptides
     *
     * @return the number of peptides
     */
    long getNumberOfPeptides();

    /**
     * Gets the number of unique peptides
     *
     * @return the number of unique peptides
     */
    long getNumberUniquePeptides();

    /**
     * Gets the spectrum metadat for a given experiment; experiment ID,
     * precursor mz value and charge state
     *
     * @return the spectra metadata
     */
    List<Map<String, Object>> getSpectraMetadata();

    /**
     * Gets the spectrum IDs
     *
     * @return the spectrum IDs
     */
    List<String> getSpectrumIds();

    /**
     * Gets the modifications found in the file.
     *
     * @return the list of found modifications
     */
    List<Modification> getModifications();

    /**
     * Gets the analyzer sources as a map (key: cv accession, value: cv value)
     *
     * @return the analyzer source map
     */
    Map<String, String> getAnalyzerSources();

    /**
     * Gets the experiment analyzer data
     *
     * @return the experiment analyzer data list
     */
    List<AnalyzerData> getAnalyzerData();

    /**
     * Gets protein accessions for a given experiment
     *
     * @return the protein accession list
     */
    List<String> getProteinAccessions();

    /**
     * Gets the spectrum peak list by spectrum ID.
     *
     * @param spectrumId the spectrum ID
     * @return the spectrum peaks
     */
    List<Peak> getSpectrumPeaksBySpectrumId(String spectrumId);

    /**
     * Gets the spectrum peak map (key: mz value, value: intensity value) by
     * spectrum ID.
     *
     * @param spectrumId the spectrum ID
     * @return the spectrum peaks
     */
    HashMap<Double, Double> getSpectrumPeakMapBySpectrumId(String spectrumId);

}


text:
/**
 * DO NOT EDIT THIS FILE.
 *
 * This source code was autogenerated from source code within the `app/src/gms` directory
 * and is not intended for modifications. If any edits should be made, please do so in the
 * corresponding file under the `app/src/gms` directory.
 */
/*
 * Copyright 2018 Google LLC
 *
 * 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.
 */

package com.example.placesdemo;

import com.google.android.libraries.maps.model.LatLng;
import com.google.android.libraries.maps.model.LatLngBounds;
import com.google.android.libraries.places.api.model.AutocompletePrediction;
import com.google.android.libraries.places.api.model.Place;
import com.google.android.libraries.places.api.model.PlaceLikelihood;
import com.google.android.libraries.places.api.net.FetchPlaceResponse;
import com.google.android.libraries.places.api.net.FindAutocompletePredictionsResponse;
import com.google.android.libraries.places.api.net.FindCurrentPlaceResponse;

import android.graphics.Bitmap;
import android.text.TextUtils;
import android.widget.TextView;

import androidx.annotation.Nullable;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Utility class for converting objects to viewable strings and back.
 */
public final class StringUtil {

  private static final String FIELD_SEPARATOR = "\n\t";
  private static final String RESULT_SEPARATOR = "\n---\n\t";

  static void prepend(TextView textView, String prefix) {
    textView.setText(prefix + "\n\n" + textView.getText());
  }

  @Nullable
  static LatLngBounds convertToLatLngBounds(
      @Nullable String southWest, @Nullable String northEast) {
    LatLng soundWestLatLng = convertToLatLng(southWest);
    LatLng northEastLatLng = convertToLatLng(northEast);
    if (soundWestLatLng == null || northEast == null) {
      return null;
    }

    return new LatLngBounds(soundWestLatLng, northEastLatLng);
  }

  @Nullable
  static LatLng convertToLatLng(@Nullable String value) {
    if (TextUtils.isEmpty(value)) {
      return null;
    }

    String[] split = value.split(",", -1);
    if (split.length != 2) {
      return null;
    }

    try {
      return new LatLng(Double.parseDouble(split[0]), Double.parseDouble(split[1]));
    } catch (NullPointerException | NumberFormatException e) {
      return null;
    }
  }

  static List<String> countriesStringToArrayList(String countriesString) {
    // Allow these delimiters: , ; | / \
    List<String> countries = Arrays.asList(countriesString
            .replaceAll("\\s", "|")
            .split("[,;|/\\\\]",-1));

    return countries;
  }

  static String stringify(FindAutocompletePredictionsResponse response, boolean raw) {
    StringBuilder builder = new StringBuilder();

    builder
        .append(response.getAutocompletePredictions().size())
        .append(" Autocomplete Predictions Results:");

    if (raw) {
      builder.append(RESULT_SEPARATOR);
      appendListToStringBuilder(builder, response.getAutocompletePredictions());
    } else {
      for (AutocompletePrediction autocompletePrediction : response.getAutocompletePredictions()) {
        builder
            .append(RESULT_SEPARATOR)
            .append(autocompletePrediction.getFullText(/* matchStyle */ null));
      }
    }

    return builder.toString();
  }

  static String stringify(FetchPlaceResponse response, boolean raw) {
    StringBuilder builder = new StringBuilder();

    builder.append("Fetch Place Result:").append(RESULT_SEPARATOR);
    if (raw) {
      builder.append(response.getPlace());
    } else {
      builder.append(stringify(response.getPlace()));
    }

    return builder.toString();
  }

  static String stringify(FindCurrentPlaceResponse response, boolean raw) {
    StringBuilder builder = new StringBuilder();

    builder.append(response.getPlaceLikelihoods().size()).append(" Current Place Results:");

    if (raw) {
      builder.append(RESULT_SEPARATOR);
      appendListToStringBuilder(builder, response.getPlaceLikelihoods());
    } else {
      for (PlaceLikelihood placeLikelihood : response.getPlaceLikelihoods()) {
        builder
            .append(RESULT_SEPARATOR)
            .append("Likelihood: ")
            .append(placeLikelihood.getLikelihood())
            .append(FIELD_SEPARATOR)
            .append("Place: ")
            .append(stringify(placeLikelihood.getPlace()));
      }
    }

    return builder.toString();
  }

  static String stringify(Place place) {
    return place.getName()
            + " ("
            + place.getAddress()
            + ")"
            + " is open now? "
            + place.isOpen(System.currentTimeMillis());
  }

  static String stringify(Bitmap bitmap) {
    StringBuilder builder = new StringBuilder();

    builder
        .append("Photo size (width x height)")
        .append(RESULT_SEPARATOR)
        .append(bitmap.getWidth())
        .append(", ")
        .append(bitmap.getHeight());

    return builder.toString();
  }

  public static String stringifyAutocompleteWidget(Place place, boolean raw) {
    StringBuilder builder = new StringBuilder();

    builder.append("Autocomplete Widget Result:").append(RESULT_SEPARATOR);

    if (raw) {
      builder.append(place);
    } else {
      builder.append(stringify(place));
    }

    return builder.toString();
  }

  private static <T> void appendListToStringBuilder(StringBuilder builder, List<T> items) {
    if (items.isEmpty()) {
      return;
    }

    builder.append(items.get(0));
    for (int i = 1; i < items.size(); i++) {
      builder.append(RESULT_SEPARATOR);
      builder.append(items.get(i));
    }
  }
}


text:
package ach

import (
	"strings"
	"testing"

	"github.com/moov-io/base"
)

func mockAddenda05() *Addenda05 {
	addenda05 := NewAddenda05()
	addenda05.SequenceNumber = 1
	addenda05.PaymentRelatedInformation = "This is an Addenda05"
	addenda05.EntryDetailSequenceNumber = 0000001
	return addenda05
}

func TestMockAddenda05(t *testing.T) {
	addenda05 := mockAddenda05()
	if err := addenda05.Validate(); err != nil {
		t.Error("mockAddenda05 does not validate and will break other tests")
	}
	if addenda05.EntryDetailSequenceNumber != 0000001 {
		t.Error("EntryDetailSequenceNumber dependent default value has changed")
	}
}

// testParseAddenda05 parses an Addenda05 record for a PPD detail entry
func testParseAddenda05(t testing.TB) {
	addendaPPD := NewAddenda05()
	var line = "705PPD                                        DIEGO MAY                            00010000001"
	addendaPPD.Parse(line)

	r := NewReader(strings.NewReader(line))

	//Add a new BatchPPD
	r.addCurrentBatch(NewBatchPPD(mockBatchPPDHeader()))

	//Add a PPDEntryDetail
	entryDetail := mockPPDEntryDetail()

	//Add an addenda to the PPD EntryDetail
	entryDetail.AddAddenda05(addendaPPD)

	// add the PPD entry detail to the batch
	r.currentBatch.AddEntry(entryDetail)

	record := r.currentBatch.GetEntries()[0].Addenda05[0]

	if record.recordType != "7" {
		t.Errorf("RecordType Expected '7' got: %v", record.recordType)
	}
	if record.TypeCode != "05" {
		t.Errorf("TypeCode Expected 05 got: %v", record.TypeCode)
	}
	if record.PaymentRelatedInformationField() != "PPD                                        DIEGO MAY                            " {
		t.Errorf("PaymentRelatedInformation Expected 'PPD                                        DIEGO MAY                            ' got: %v", record.PaymentRelatedInformationField())
	}
	if record.SequenceNumberField() != "0001" {
		t.Errorf("SequenceNumber Expected '0001' got: %v", record.SequenceNumberField())
	}
	if record.EntryDetailSequenceNumberField() != "0000001" {
		t.Errorf("EntryDetailSequenceNumber Expected '0000001' got: %v", record.EntryDetailSequenceNumberField())
	}
}

// TestParseAddenda05 tests parsing an Addenda05 record for a PPD detail entry
func TestParseAddenda05(t *testing.T) {
	testParseAddenda05(t)
}

// BenchmarkParseAddenda05 benchmarks parsing an Addenda05 record for a PPD detail entry
func BenchmarkParseAddenda05(b *testing.B) {
	b.ReportAllocs()
	for i := 0; i < b.N; i++ {
		testParseAddenda05(b)
	}
}

// testAddenda05String validates that a known parsed file can be return to a string of the same value
func testAddenda05String(t testing.TB) {
	addenda05 := NewAddenda05()
	var line = "705WEB                                        DIEGO MAY                            00010000001"
	addenda05.Parse(line)

	if addenda05.String() != line {
		t.Errorf("Strings do not match")
	}
}

// TestAddenda05 String tests validating that a known parsed file can be return to a string of the same value
func TestAddenda05String(t *testing.T) {
	testAddenda05String(t)
}

// BenchmarkAddenda05 String benchmarks validating that a known parsed file can be return to a string of the same value
func BenchmarkAddenda05String(b *testing.B) {
	b.ReportAllocs()
	for i := 0; i < b.N; i++ {
		testAddenda05String(b)
	}
}

func TestValidateAddenda05RecordType(t *testing.T) {
	addenda05 := mockAddenda05()
	addenda05.recordType = "63"
	err := addenda05.Validate()
	if !base.Match(err, NewErrRecordType(7)) {
		t.Errorf("%T: %s", err, err)
	}
}

func TestValidateAddenda05TypeCode(t *testing.T) {
	addenda05 := mockAddenda05()
	addenda05.TypeCode = "23"
	err := addenda05.Validate()
	if !base.Match(err, ErrAddendaTypeCode) {
		t.Errorf("%T: %s", err, err)
	}
}

func TestAddenda05FieldInclusion(t *testing.T) {
	addenda05 := mockAddenda05()
	addenda05.EntryDetailSequenceNumber = 0
	err := addenda05.Validate()
	if !base.Match(err, ErrConstructor) {
		t.Errorf("%T: %s", err, err)
	}
}

func TestAddenda05FieldInclusionSequenceNumber(t *testing.T) {
	addenda05 := mockAddenda05()
	addenda05.SequenceNumber = 0
	err := addenda05.Validate()
	if !base.Match(err, ErrConstructor) {
		t.Errorf("%T: %s", err, err)
	}
}

func TestAddenda05FieldInclusionRecordType(t *testing.T) {
	addenda05 := mockAddenda05()
	addenda05.recordType = ""
	err := addenda05.Validate()
	if !base.Match(err, ErrConstructor) {
		t.Errorf("%T: %s", err, err)
	}
}

func TestAddenda05PaymentRelatedInformationAlphaNumeric(t *testing.T) {
	addenda05 := mockAddenda05()
	addenda05.PaymentRelatedInformation = "®©"
	err := addenda05.Validate()
	if !base.Match(err, ErrNonAlphanumeric) {
		t.Errorf("%T: %s", err, err)
	}
}

func testAddenda05TypeCodeNil(t testing.TB) {
	addenda05 := mockAddenda05()
	addenda05.TypeCode = ""
	err := addenda05.Validate()
	if !base.Match(err, ErrConstructor) {
		t.Errorf("%T: %s", err, err)
	}
}

func TestAddenda05TypeCodeNil(t *testing.T) {
	testAddenda05TypeCodeNil(t)
}

func BenchmarkAddenda05TypeCodeNil(b *testing.B) {
	b.ReportAllocs()
	for i := 0; i < b.N; i++ {
		testAddenda05TypeCodeNil(b)
	}
}

// testAddenda05TypeCode05 TypeCode is 05
func testAddenda05TypeCode05(t testing.TB) {
	addenda05 := mockAddenda05()
	addenda05.TypeCode = "99"
	err := addenda05.Validate()
	if !base.Match(err, ErrAddendaTypeCode) {
		t.Errorf("%T: %s", err, err)
	}
}

// TestAddenda05TypeCode05 tests TypeCode is 05
func TestAddenda05TypeCode05(t *testing.T) {
	testAddenda05TypeCode05(t)
}

// BenchmarkAddenda05TypeCode05 benchmarks TypeCode is 05
func BenchmarkAddenda05TypeCode05(b *testing.B) {
	b.ReportAllocs()
	for i := 0; i < b.N; i++ {
		testAddenda05TypeCode05(b)
	}
}

// TestAddenda05RuneCountInString validates RuneCountInString
func TestAddenda05RuneCountInString(t *testing.T) {
	addenda05 := NewAddenda05()
	var line = "705WEB                                        DIEGO MAY                            "
	addenda05.Parse(line)

	if addenda05.PaymentRelatedInformation != "" {
		t.Error("Parsed with an invalid RuneCountInString not equal to 94")
	}
}


text:
declare global {
  interface SymbolConstructor {
    readonly observable: symbol;
  }
}
export interface Observable<T = any> {
  subscribe(
    onNext?: ((value: T) => void) | null,
    onError?: ((error: any) => void) | null,
    onComplete?: (() => void) | null
  ): Subscription;
  subscribe(observer?: Observer<T> | null): Subscription;
  [Symbol.observable]: () => Observable<T>;
}

export interface Subscription {
  unsubscribe(): void;
  readonly closed: boolean;
}

export interface Observer<T = any> {
  start?: (subscription: Subscription) => void;
  next?: (value: T) => void;
  error?: (error: any) => void;
  complete?: () => void;
}


text:
@implementation RSDFCustomDatePickerCollectionView

- (UIColor *)selfBackgroundColor
{
    return [UIColor clearColor];
}

@end


text:
/* Dummy unistd.h for win32 */

#include <io.h>
#include <fcntl.h>
#include <stdio.h>

#define write(fd, buf, len) _write((fd), (buf), (unsigned int)(len))
#define read(fd, buf, len)  _read((fd), (buf), (len))
#define close(fd)           _close((fd))
#define mktemp(template)    _mktemp((template))
#define mkstemp(template)   _open(_mktemp(template), _O_RDWR|_O_CREAT, 0600)
#define unlink(name)        _unlink((name))
#define stat _stat

#define O_RDONLY        _O_RDONLY
#define O_WRONLY        _O_WRONLY
#define O_RDWR          _O_RDWR
#define O_APPEND        _O_APPEND
#define O_CREAT         _O_CREAT
#define O_TRUNC         _O_TRUNC
#define O_EXCL          _O_EXCL

#include <process.h>

#define getpid() _getpid()


text:
I recommend to use **https://github.com/raneio/core-sass**

## Startpoint for every web projects

Pure Sass, no Javascript. Startpoint will get you a simple and beautiful starting point for your website. It contains a variable file where you can determine colors, font properties, spaces and other styles. In addition to this Startpoint offers the most important helper attributes that speed up the development of your site.

![issues](https://img.shields.io/github/issues/raneio/startpoint-sass.svg)
![forks](https://img.shields.io/github/forks/raneio/startpoint-sass.svg)
![stars](https://img.shields.io/github/stars/raneio/startpoint-sass.svg)
![license](https://img.shields.io/badge/license-MIT-blue.svg)

[![NPM](https://nodei.co/npm/startpoint-sass.png?compact=true)](https://nodei.co/npm/startpoint-sass/)

***!!! I can't promise backwards compatible before version 1.0.0 !!!***

## Docs
**https://www.rane.io/startpoint**

## Links

Demo https://startpoint-demo.rane.io

Github https://github.com/raneio/startpoint-sass

NPM https://www.npmjs.com/package/startpoint-sass

Yarn https://yarn.pm/startpoint-sass

Twitter https://twitter.com/raneio

## Dependencies
No dependencies, but I recommend to use [Normalize](https://necolas.github.io/normalize.css/)

## Creator
**Rane Ahonen**

- https://www.rane.io
- https://twitter.com/raneio
- https://github.com/raneio

## Copyright and license

Code and documentation copyright 2017 Rane Ahonen, [Rane.io](https://www.rane.io). Code released under the [MIT License](https://github.com/raneio/startpoint-sass/blob/master/LICENSE). Docs released under [Creative Commons](https://creativecommons.org/licenses/by/3.0/).

---

#### How to test with demo site

1. Check "Get Started" from documents: https://www.rane.io/startpoint
1. `npm install --save-dev node-sass`
1. Copy variables from `./default.sass` to `./demo/sass/variables.sass`
1. Make some changes to `./demo/sass/variables.sass`
1. `npm run demo`
1. Open `./demo/index.html` with your browser

#### Thanks

<img src="https://file-cjlgurihla.now.sh/" width="150">


text:
3.0.0 / 2017-02-19
==================

  * Breaking fix - `merge.smart` should not merge a child missing `include`/`exclude` to a parent that has either. This is safer and more predictable behavior than the old one. #69

2.6.1 / 2017-01-29
==================

  * Bug fix - `merge.smart` should not merge rules that have differing `enforce` fields. #65

2.6.0 / 2017-01-27
==================

  * Bug fix - Support `replace` mode for `merge.smartStrategy`. #63

2.5.0 / 2017-01-26
==================

  * Bug fix - Make sure `merge.smartStrategy` works with higher level nesting like `'module.rules.use': 'prepend'`. #64

2.4.0 / 2017-01-12
==================

  * Feature - Add `merge.unique` helper that plugs into `customizeArray`. This allows you to force only one plugin of a type to the end result. #58

2.3.1 / 2017-01-06
==================

  * Bug fix - Clear up `CopyWebpackPlugin` handling. #56

2.3.0 / 2017-01-06
==================

  * Refactor - Depend only on `lodash` instead of individual packages as latter has been discontinued. #52

2.2.0 / 2017-01-05
==================

  * Bug fix - Drop `merge.smartStrategy(rules, plugins)` as that caused other issues (prototype copying for complex cases). That needs a better approach. #55

2.1.1 / 2017-01-05
==================

  * Bug fix - Avoid recursion at `merge.smart`. #53

2.1.0 / 2017-01-05
==================

  * Feature - Allow `merge.smartStrategy` to merge plugin contents. API: `merge.smartStrategy(rules, plugins)`. #44. Example:

```javascript
const output = merge.smartStrategy(
  {
    entry: 'prepend', // or 'replace'
    'module.loaders': 'prepend'
  },
  ['LoaderOptionsPlugin']
)(object1, object2, object3, ...);
```

2.0.0 / 2016-12-22
==================

  * Breaking - Disallow overriding configuration with empty arrays/objects (#48). If you want to override, use `merge.strategy`. Example:

```javascript
const a = {
  entry: ['foo']
};
const b = {
  entry: []
};

merge(a, b); // Yields a result, not b like before.
```

1.1.2 / 2016-12-18
==================

  * Bug fix - `merge({ entry: {} })` should return the same result as input instead of a function.

1.1.1 / 2016-12-11
==================

  * Bug fix - Support previously undocumented, yet used, `merge([<object>])` format. This works with all available functions. #46

1.1.0 / 2016-12-09
==================

  * Feature - Allow `merge` behavior to be customized with overrides. Example:

```javascript
var output = merge({
  customizeArray(a, b, key) { return [...a, ...b]; },
  customizeObject(a, b, key) { return mergeWith(a, b); }
})(object1, object2, object3, ...);
```

This allows you to guarantee array uniqueness and so on.

1.0.2 / 2016-11-29
==================

  * Bug fix - `merge` should not mutate inputs with mismatched keys.

1.0.0 / 2016-11-28
==================

  * Feature: Support merging Webpack 2 Rule.use. #38
  * Bug fix - Don't concat loaders if the first matching entry's include/exclude doesn't match. #39

0.20.0 / 2016-11-27
===================

  * Feature: Add support for merging functions. This feature has been designed `postcss` in mind. It executes the functions, picks their results, and packs them again.

0.19.0 / 2016-11-26
===================

  * Feature: Add support for 'replace' option at `merge.strategy`. It literally replaces the old field value with the newer one. #40

0.18.0 / 2016-11-24
===================

  * Feature: Add support for recursive definitions at `merge.strategy`. Example:

```javascript
var output = merge.strategy({
  entry: 'prepend',
  'module.loaders': 'prepend'
})(object1, object2, object3, ...);
```

  * Feature: Add `merge.smartStrategy`. This combines the ideas of `merge.smart` and `merge.strategy` into one. Example:

```javascript
var output = merge.smartStrategy({
  entry: 'prepend',
  'module.loaders': 'prepend'
})(object1, object2, object3, ...);
```

0.17.0 / 2016-11-16
===================

  * Feature: Add support for `merge.strategy`. Now you can customize merging behavior per root level configuration field. Example: `merge.strategy({ entry: 'prepend' })(object1, object2, object3, ...);`. #17

0.16.0 / 2016-11-14
===================

  * Feature: Add support for webpack 2 at `merge.smart`. It should pick up `module.rules` as you might expect now. #35

0.15.0 / 2016-10-18
===================

  * Breaking: Rework `merge.smart` so that it **appends** loaders instead of **prepending** them. This is the logical thing to do as it allows you to specify behavior better as you `merge`. #32

0.14.1 / 2016-07-25
===================

  * Docs: Improve package description. #23.
  * Bug fix - Let `merge.smart` merge loaders based on their full name instead of first letter. Thanks to @choffmeister. #26.

0.14.0 / 2016-06-05
===================

  * Feature: Allow `merge.smart` to merge `loaders` if `exclude` is the same. Thanks to @mshwery. #21.

0.13.0 / 2016-05-24
===================

  * Bug fix: Allow `merge.smart` to merge configuration if `include` is defined. Thanks to @blackrabbit99. #20.

0.12.0 / 2016-04-19
===================

  * Feature: Support `include/exclude` at `merge.smart` for `loader` definition too. Thanks to @Whoaa512. #16.

0.11.0 / 2016-04-18
===================

  * Feature: Support `include/exclude` at `merge.smart` when its set only in a parent. #15.

0.10.0 / 2016-04-10
===================

  * Feature: Support `include/exclude` at `merge.smart`. Thanks to @siready. #14.

0.9.0 / 2016-04-08
==================

  * Feature: Allow existing objects/arrays to be emptied with an empty object/array later in merge. This overriding behavior is useful for example emptying your `entry` configuration.

0.8.4 / 2016-03-17
==================

  * Bug fix: *webpack-merge* should not mutate inputs. #12

0.8.3 / 2016-03-02
==================

  * Bug fix: Drop `files` field from *package.json* as it wasn't including the dist correctly.

0.8.0 / 2016-03-02
==================

  * Breaking: Change merging behavior so that only loaders get prepended. The rest follow appending logic. This makes `entry` array merging behavior logical. Prepend makes sense only for loaders after all. #10

0.7.3 / 2016-01-11
==================

  * Bug fix: Do not error when there are no matching loaders. Thanks @GreenGremlin!

0.7.2 / 2016-01-08
==================

  * Regenerate tarball. The problem was that there were some old dependencies included. Closes #7.

0.7.1 / 2016-01-03
==================

  * Improve performance by defaulting to `concat` and by dropping a redundant check. Thanks @davegomez!

0.7.0 / 2015-12-31
==================

  * Bug fix: Arrays get merged within nested structures correctly now. Array items are prepended (reverse order compared to earlier). This is related to the change made in *0.6.0*. Incidentally this change affects normal merge as well.
  * Smart merge: If a loader contains either `include` or `exclude`, it will generate separate entries instead of merging. Without this the configuration might change in an unpredictable manner.

0.6.0 / 2015-12-30
==================

  * Support `preLoaders` and `postLoaders`. Previously only `loaders` were supported.
  * Breaking: Change smart merging behavior for `loaders` field so that it prepends loaders instead of appending them. The benefit of this is that now it's possible to specialize loader setup in a predictable manner. For example you can have a linter set up at the root and expect it to become evaluated first always.

0.5.1 / 2015-12-26
==================

  * Fix `merge` object/array case (missing `bind`). The behavior should be correct now.

0.5.0 / 2015-12-26
==================

  * Breaking: Push smart merging behind `merge.smart`. Now `merge` behaves exactly as in *0.3.0* series.

0.4.0 / 2015-12-23
==================

  * Dropped changelog generator. It's better to write these by hand.
  * Breaking: Added smart merging (@GreenGremlin)

0.3.2 / 2015-11-23
==================

  * Tweaked changelog generator process.

0.3.1 / 2015-11-23
==================

  * Added changelog generator.

0.3.0 / 2015-11-13
==================

  * Improved formatting
  * Allowed an arbitrary amount of objects to be merged

0.2.0 / 2015-08-30
==================

  * Only require lodash modules used by the package (@montogeek)
  * Removed lodash.isarray dependency, use Array.isArray standard object

0.1.3 / 2015-08-10
==================

  * Improved README example

0.1.2 / 2015-07-01
==================

  * Simplified example

0.1.1 / 2015-06-26
==================

  * Fixed travis link

0.1.0 / 2015-06-26
==================

  * Initial implementation