text:
package org.springframework.boot.actuate.metrics.repository;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.junit.Test;

import org.springframework.boot.actuate.metrics.Metric;
import org.springframework.boot.actuate.metrics.writer.Delta;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Tests for {@link InMemoryMultiMetricRepository}.
 *
 * @author Dave Syer
 */
public class InMemoryMultiMetricRepositoryTests {

	private final InMemoryMultiMetricRepository repository = new InMemoryMultiMetricRepository();

	@Test
	public void registeredPrefixCounted() {
		this.repository.increment("foo", new Delta<Number>("bar", 1));
		this.repository.increment("foo", new Delta<Number>("bar", 1));
		this.repository.increment("foo", new Delta<Number>("spam", 1));
		Set<String> names = new HashSet<>();
		for (Metric<?> metric : this.repository.findAll("foo")) {
			names.add(metric.getName());
		}
		assertThat(names).hasSize(2);
		assertThat(names.contains("foo.bar")).isTrue();
	}

	@Test
	public void prefixWithWildcard() {
		this.repository.increment("foo", new Delta<Number>("bar", 1));
		Set<String> names = new HashSet<>();
		for (Metric<?> metric : this.repository.findAll("foo.*")) {
			names.add(metric.getName());
		}
		assertThat(names).hasSize(1);
		assertThat(names.contains("foo.bar")).isTrue();
	}

	@Test
	public void prefixWithPeriod() {
		this.repository.increment("foo", new Delta<Number>("bar", 1));
		Set<String> names = new HashSet<>();
		for (Metric<?> metric : this.repository.findAll("foo.")) {
			names.add(metric.getName());
		}
		assertThat(names).hasSize(1);
		assertThat(names.contains("foo.bar")).isTrue();
	}

	@Test
	public void onlyRegisteredPrefixCounted() {
		this.repository.increment("foo", new Delta<Number>("bar", 1));
		this.repository.increment("foobar", new Delta<Number>("spam", 1));
		Set<String> names = new HashSet<>();
		for (Metric<?> metric : this.repository.findAll("foo")) {
			names.add(metric.getName());
		}
		assertThat(names).hasSize(1);
		assertThat(names.contains("foo.bar")).isTrue();
	}

	@Test
	public void incrementGroup() {
		this.repository.increment("foo", new Delta<Number>("foo.bar", 1));
		this.repository.increment("foo", new Delta<Number>("foo.bar", 2));
		this.repository.increment("foo", new Delta<Number>("foo.spam", 1));
		Map<String, Metric<?>> metrics = new HashMap<>();
		for (Metric<?> metric : this.repository.findAll("foo")) {
			metrics.put(metric.getName(), metric);
		}
		assertThat(metrics).hasSize(2);
		assertThat(metrics).containsKeys("foo.bar", "foo.spam");
		assertThat(metrics.get("foo.bar").getValue()).isEqualTo(3L);
	}

}


text:
package com.joelzhu.bindview.annotations;

import androidx.annotation.IdRes;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface OnItemClick {
    @IdRes int resId() default -1;

    String resName() default "";
}

redpajama_set_name: RedPajamaGithub


text:
"""Script to extract the program cache."""

import argparse
import logging
import sys

from dfvfs.helpers import volume_scanner as dfvfs_volume_scanner

from winregrc import output_writers
from winregrc import programscache
from winregrc import volume_scanner

def Main():
  """The main program function.

  Returns:
    bool: True if successful or False if not.
  """
  argument_parser = argparse.ArgumentParser(description=(
      'Extracts the program cache from a NTUSER.DAT Registry file.'))

  argument_parser.add_argument(
      '-d', '--debug', dest='debug', action='store_true', default=False,
      help='enable debug output.')

  argument_parser.add_argument(
      'source', nargs='?', action='store', metavar='PATH', default=None,
      help=(
          'path of the volume containing C:\\Windows, the filename of '
          'a storage media image containing the C:\\Windows directory, '
          'or the path of a NTUSER.DAT Registry file.'))

  options = argument_parser.parse_args()

  if not options.source:
    print('Source value is missing.')
    print('')
    argument_parser.print_help()
    print('')
    return False

  logging.basicConfig(
      level=logging.INFO, format='[%(levelname)s] %(message)s')

  # TODO: add support to select user.
  mediator = volume_scanner.WindowsRegistryVolumeScannerMediator()
  scanner = volume_scanner.WindowsRegistryVolumeScanner(mediator=mediator)

  volume_scanner_options = dfvfs_volume_scanner.VolumeScannerOptions()
  volume_scanner_options.partitions = ['all']
  volume_scanner_options.snapshots = ['none']
  volume_scanner_options.volumes = ['none']

  if not scanner.ScanForWindowsVolume(
      options.source, options=volume_scanner_options):
    print((f'Unable to retrieve the volume with the Windows directory from: '
           f'{options.source:s}.'))
    print('')
    return False

  output_writer = output_writers.StdoutOutputWriter()

  if not output_writer.Open():
    print('Unable to open output writer.')
    print('')
    return False

  try:
    collector_object = programscache.ProgramsCacheCollector(
        debug=options.debug, output_writer=output_writer)

    # TODO: change collector to generate ProgramCacheEntry
    has_results = collector_object.Collect(scanner.registry)

  finally:
    output_writer.Close()

  if not has_results:
    print('No program cache entries found.')

  return True

if __name__ == '__main__':
  if not Main():
    sys.exit(1)
  else:
    sys.exit(0)


text:
' Copyright (c) 2015 ZZZ Projects. All rights reserved
' Licensed under MIT License (MIT) (https://github.com/zzzprojects/Z.ExtensionMethods)
' Website: http://www.zzzprojects.com/
' Feedback / Feature Requests / Issues : http://zzzprojects.uservoice.com/forums/283927
' All ZZZ Projects products: Entity Framework Extensions / Bulk Operations / Extension Methods /Icon Library

Imports System.Net

Public Module Extensions_264

	''' <summary>
	'''     Converts a short value from network byte order to host byte order.
	''' </summary>
	''' <param name="network">The number to convert, expressed in network byte order.</param>
	''' <returns>A short value, expressed in host byte order.</returns>
	<System.Runtime.CompilerServices.Extension> _
	Public Function NetworkToHostOrder(network As Int16) As Int16
		Return IPAddress.NetworkToHostOrder(network)
	End Function
End Module


text:
package org.seasar.doma.internal.apt.validator;

import java.util.Iterator;
import java.util.List;
import org.seasar.doma.Dao;
import org.seasar.doma.internal.apt.processor.dao.MyConfig;

@SuppressWarnings("deprecation")
@Dao(config = MyConfig.class)
public interface SqlValidationDao {

  void testBindVariable(String name);

  void testBindVariable_list(List<String> names);

  void testBindVariable_array(String[] names);

  void testEmbeddedVariable(String orderBy);

  void testEmbeddedVariable_unsupportedType(Integer orderBy);

  void testFor(List<String> names);

  void testFor_array(String[] names);

  void testFor_notIterable(Iterator<String> names);

  void testFor_noTypeArgument(@SuppressWarnings("rawtypes") List names);

  void testExpand(String name);

  void testPopulate(String name);

  void testTypeParameterResolution(CriteriaHolder criteriaHolder);
}


text:
The WeekProject is both a site that you can use at [WeekProject.com](https://weekproject.com/)
and an open source project which you can find at [WeekProject.org](https://weekproject.org/).

Funnily enough, the original WeekProject website was intended as a WeekProject, however I did three days and stopped
due to other commitments. The second time I started the WeekProject, I started afresh and finished v1.0 within the
week.

The Week Project is on Twitter at [@weekproject](https://twitter.com/weekproject).

## Inspiration ##

The whole inspiration of the WeekProject is you give you impetus to learn something new, over the course of a
week. There is no direction from us or anyone else, but your own internal desire to do something.

If this is not quite enough, the you can create a project at the WeekProject with some details, then keep a running log
of it through the week. Once you've done that, the best thing to do is post updates about your WeekProject to your
social networks so that others around you can keep you honest and to task. :)

## Author ##

By [Andrew Chilton](https://chilts.org/), [@andychilton](https://twitter.com/andychilton).

For [AppsAttic](https://appsattic.com/),  [@AppsAttic](https://twitter.com/AppsAttic).

## License ##

[MIT](https://opensource.org/licenses/MIT).

(Ends)


text:
<?php

namespace modules\site\models\query;

/**
 * This is the ActiveQuery class for [[\modules\site\models\ArticeLang]].
 *
 * @see \modules\site\models\ArticeLang
 */
class ArticeLangQuery extends \yii\db\ActiveQuery
{
    /*public function active()
    {
        $this->andWhere('[[status]]=1');
        return $this;
    }*/

    /**
     * @inheritdoc
     * @return \modules\site\models\ArticeLang[]|array
     */
    public function all($db = null)
    {
        return parent::all($db);
    }

    /**
     * @inheritdoc
     * @return \modules\site\models\ArticeLang|array|null
     */
    public function one($db = null)
    {
        return parent::one($db);
    }
}


text:
package com.fruit.utils;

import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class FileBean {

	private String name ;
	private Long size;
	private Date date;
	private Boolean isDirectory;

	public FileBean(File file){
		this.name=file.getName();
		this.size = file.getTotalSpace();
		this.date = new Date(file.lastModified());
		this.isDirectory= file.isDirectory();
	}

	public static List<FileBean> getFileList (File folder){

		File[] files = folder.listFiles();
		List<FileBean> fileList = new ArrayList<FileBean>(files.length);
		for(File f:files){
			fileList.add(new FileBean(f));
		}
		return fileList;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getSize() {
		return size;
	}

	public void setSize(Long size) {
		this.size = size;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Boolean getIsDirectory() {
		return isDirectory;
	}

	public void setIsDirectory(Boolean isDirectory) {
		this.isDirectory = isDirectory;
	}

}


text:
module Onionjs
  module Helper

    # Usage:
    #
    #   <%= onionjs_app(:calendar) %>
    #
    # Attach to an existing element:
    #
    #   <%= onionjs_app(:calendar, attach_to: '#some-element') %>
    #
    # Append to an existing element:
    #
    #   <%= onionjs_app(:calendar, append_to: '#some-element') %>
    #
    # Make pre-loaded JSON data available in the app as a "preloadedData" model
    #
    #   <%= onionjs_app(:calendar, preloaded_data: {user: current_user}) %>
    #
    # Other options:
    #
    #   <%= onionjs_app(:calendar,
    #         require_path: 'calendar/calendar_controller',
    #         pre_require: ['augment.min.js', 'supplement.min.js'],
    #         controller_name: 'CalendarController',
    #       ) %>
    #
    def onionjs_app(app_name, opts={})
      # Preloaded data
      preloaded_data = opts[:preloaded_data] || {}

      # Requires
      app_path = opts[:require_path] || "#{app_name}/#{app_name}_controller"
      pre_require = opts[:pre_require]
      requires = [app_path] + Array.wrap(pre_require)

      # Controller Name
      controller_name = opts[:controller_name] || "#{app_name}_controller".camelize

      # Return the script tag
      %(
        <script type="text/javascript">
          require(#{requires.to_json}, function(#{controller_name}){
            window.app = new #{controller_name}({ preloadedData: #{preloaded_data.to_json} })
            #{onionjs_app_insert_code(opts)}
            app.run()
          })
        </script>
      ).html_safe
    end

    private

    def onionjs_app_insert_code(opts)
      if opts[:append_to]
        "app.appendTo('#{opts[:append_to]}')"
      elsif opts[:attach_to]
        "app.attachTo('#{opts[:attach_to]}')"
      else
        "app.appendTo('body')"
      end
    end

  end
end


text:
/**
 *
 */
Crossword.View.StatusBar = Crossword.View.extend({

	events		: {
		'mouseover .icon'	: 'showHint'
	},

	/**
	 *
	 */
	initialize	: function( options ) {
		this.options.timeout = options.timeout || 3000;
	},

	/**
	 *
	 */
	showMessage	: function( text, forceShowHint ) {
		return this._showMessage( text, 'info', forceShowHint );
	},

	/**
	 *
	 */
	showError	: function( text, forceShowHint ) {
		return this._showMessage( text, 'error', forceShowHint );
	},

	/**
	 *
	 */
	showLoading	: function() {

	},

	/**
	 *
	 */
	clear		: function() {
		clearTimeout( this._timer );
	},

	/**
	 *
	 */
	showHint	: function() {

		var hintElement = this.$( this.options.hintElement );

		hintElement.show();

		clearInterval( this._timer );

		this._timer = setInterval( function(){
			hintElement.fadeOut();
		}, this.options.timeout )
	},

	/**
	 *
	 */
	_showMessage	: function( text, type, forceShowHint ) {
		var forceShowHint = forceShowHint || false;

		this.clear();

		this.render({text: text, status: type});

		if ( forceShowHint ) {
			this.showHint();
		}
	},

	_timer		: 0
});


text:
<?php

namespace Embark\CMS\Fields\System;

use Embark\CMS\Entries\EntryInterface;
use Embark\CMS\Fields\FieldInterface;
use Embark\CMS\Fields\FieldQueryInterface;
use Embark\CMS\Schemas\SchemaInterface;
use Embark\CMS\Schemas\SchemaSelectQuery;
use Embark\CMS\Metadata\MetadataTrait;
use Embark\CMS\Metadata\Filters\SortingDirection;

class CreationDateSortQuery implements FieldQueryInterface
{
    use MetadataTrait;

    public function __construct()
    {
        $this->setSchema([
            'direction' => [
                'filter' =>        new SortingDirection()
            ]
        ]);
    }

    public function appendQuery(SchemaSelectQuery $query, SchemaInterface $schema, FieldInterface $field = null)
    {
        $query->sortByMetadata('creation_date', $this['direction']);
    }
}


text:
When working with arrays, you sometimes want to execute code for each value in the array.
This is called iterating or looping over the array.

Here we will look at the case where you do not want to modify the array in the process.
For transforming arrays, see [Concept Array Transformations][concept-array-transformations] instead.

## The `for` Loop

The most basic and usually very performant way to iterate over an array is to use a `for` loop, see [Concept For Loops][concept-for-loops].

```javascript
const numbers = [6.0221515, 10, 23];

for (let i = 0; i < numbers.length; i++) {
  console.log(numbers[i]);
}
// => 6.0221515
// => 10
// => 23
```

## The `for...of` Loop

When you want to work with the value directly in each iteration and do not require the index at all, you can use a `for .. of` loop.

`for...of` works like the basic `for` loop shown above, but instead of having to deal with the _index_ as a variable in the loop, you are provided with the _value_ directly.

```javascript
const numbers = [6.0221515, 10, 23];

// Because re-assigning number inside the loop will be very
// confusing, disallowing that via const is preferable.
for (const number of numbers) {
  console.log(number);
}
// => 6.0221515
// => 10
// => 23
```

Just like in regular `for` loops, you can use `continue` to stop the current iteration and `break` to stop the execution of the loop entirely.

JavaScript also has a `for...in` loop to iterate over keys in an object.
It is important to note that `for...of` and `for...in` are not interchangeable, see [MDN documentation][mdn-for-in-for-of] for details on this.

## The `forEach` Method

Every array includes a `forEach` method that can also be used to loop over the elements in the array.

`forEach` accepts a [callback][concept-callbacks] as a parameter.
The callback function is called once for each element in the array.

```javascript
const numbers = [6.0221515, 10, 23];

numbers.forEach((number) => console.log(number));
// => 6.0221515
// => 10
// => 23
```

In the example above the callback only uses the current element as a parameter.
If needed, the callback can make use of up to three parameters.

- the _value_ of the current iteration
- the _index_ of the current iteration
- the entire _array_

```javascript
const numbers = [6.0221515, 10, 23];

function callback(number, index, fullArray) {
  console.log(number, index, fullArray);
}

numbers.forEach(callback);
// => 6.0221515 0 [ 6.0221515, 10, 23 ]
// => 10 1 [ 6.0221515, 10, 23 ]
// => 23 2 [ 6.0221515, 10, 23 ]
```

Besides the callback, `forEach` accepts the `this` context to use for the iteration as an optional second parameter.
You can see an example in the ["Using thisArg" section on MDN][mdn-foreach-thisarg].

There are a couple of things you should keep in mind when working with `forEach`.

- There is no way to stop the iteration once the `forEach` loop has started.
  The statements `break` and `continue` do not exist in this context.
- `forEach` behaves weirdly if you modify the array after starting the loop.
  Elements you add to the end will be ignored, removing elements can lead to others being skipped, etc.
  To avoid these kinds of issues, never modify the underlying array in the callback.
- The return value of the `forEach` method itself is `undefined`.
  Because of that, you cannot chain any other array methods at the end.
- If you need to optimize your code for performance, you should consider using `for` or `for...of` instead as both are around three times faster.

[concept-array-transformations]: /tracks/javascript/concepts/array-transformations
[concept-for-loops]: /tracks/javascript/concepts/for-loops
[concept-callbacks]: /tracks/javascript/concepts/callbacks
[mdn-foreach-thisarg]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#using_thisarg
[mdn-for-in-for-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of#difference_between_for...of_and_for...in


text:
package org.apache.camel.impl;

import java.util.concurrent.TimeUnit;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.Endpoint;
import org.apache.camel.PollingConsumer;
import org.apache.camel.support.cache.DefaultConsumerCache;
import org.apache.camel.support.service.ServiceSupport;
import org.junit.jupiter.api.Test;

import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class ConsumerCacheOneCapacityTest extends ContextTestSupport {

    @Test
    public void testConsumerCacheOneCapacity() throws Exception {
        DefaultConsumerCache cache = new DefaultConsumerCache(this, context, 1);
        cache.start();

        assertEquals(0, cache.size(), "Size should be 0");

        Endpoint endpoint = context.getEndpoint(fileUri("?fileName=foo.txt&initialDelay=0&delay=10"));
        PollingConsumer consumer = cache.acquirePollingConsumer(endpoint);
        assertNotNull(consumer);
        assertEquals("Started", ((ServiceSupport) consumer).getStatus().name());

        // let it run a poll
        consumer.receive(50);

        boolean found
                = Thread.getAllStackTraces().keySet().stream().anyMatch(t -> t.getName().contains(testDirectory().toString()));
        assertFalse(found, "Should not find file consumer thread");

        cache.releasePollingConsumer(endpoint, consumer);

        // takes a little to stop
        assertTrue(((ServiceSupport) consumer).isStarted(), "Should still be started");

        cache.stop();

        // takes a little to stop
        await().atMost(2, TimeUnit.SECONDS)
                .untilAsserted(() -> assertEquals("Stopped", ((ServiceSupport) consumer).getStatus().name()));

        // should not be a file consumer thread
        found = Thread.getAllStackTraces().keySet().stream().anyMatch(t -> t.getName().contains(testDirectory().toString()));
        assertFalse(found, "Should not find file consumer thread");
    }

}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

/** Package containing the data models for DynatraceObservability. null. */
package com.azure.resourcemanager.dynatrace.models;


text:
#include <iostream>
#include <sstream>

#include <sbml/SBMLTypes.h>
#include "util.h"

using namespace std;
LIBSBML_CPP_NAMESPACE_USE

bool validateSBML(const string& filename, bool enableUnitCheck=true);

const string usage = "Usage: validateSBML [-u] filename [...]\n"
                     " -u : disable unit consistency check";

int
main (int argc, char* argv[])
{
  bool enableUnitCheck = true;

  if (argc < 2)
  {
    cout << usage << endl;
    return 1;
  }
  else if (argc == 2)
  {
    if ( string("-u") == string(argv[1]) )
    {
      cout << usage << endl;
      return 1;
    }
  }

  int  argIndex = 1;

  if ( string("-u") == string(argv[1]) )
  {
    enableUnitCheck = false;
    ++argIndex;
  }

  int numInvalidFiles = 0;

  for (int i=argIndex; i < argc; i++)
  {
    if (!validateSBML(argv[i], enableUnitCheck))
      ++numInvalidFiles;

    cout << "---------------------------------------------------------------------------\n";
  }

  int numFiles = (enableUnitCheck) ? argc - 1 : argc - 2;

  cout << "Validated " << numFiles << " files, " << (numFiles - numInvalidFiles) << " valid files, "
       << numInvalidFiles << " invalid files" << endl;
  if (!enableUnitCheck)
    cout << "(Unit consistency checks skipped)" << endl;

  return numInvalidFiles;
}

bool validateSBML(const string& filename, bool enableUnitCheck)
{
  SBMLDocument* document;
  SBMLReader reader;
  unsigned long long start, stop;

  start    = getCurrentMillis();
  document = reader.readSBML(filename);
  stop     = getCurrentMillis();

  double     timeRead = (double)(stop - start);
  unsigned int errors = document->getNumErrors();
  bool  seriousErrors = false;

  unsigned int numReadErrors   = 0;
  unsigned int numReadWarnings = 0;
  string       errMsgRead      = "";

  if (errors > 0)
  {
    for (unsigned int i = 0; i < errors; i++)
    {
      if (document->getError(i)->isFatal() || document->getError(i)->isError())
      {
        seriousErrors = true;
	++numReadErrors;
        break;
      }
      else
        ++numReadWarnings;
    }

    ostringstream oss;
    document->printErrors(oss);
    errMsgRead = oss.str();
  }

  // If serious errors are encountered while reading an SBML document, it
  // does not make sense to go on and do full consistency checking because
  // the model may be nonsense in the first place.

  unsigned int numCCErrors   = 0;
  unsigned int numCCWarnings = 0;
  string       errMsgCC      = "";
  bool   skipCC = false;
  double timeCC = 0.0;
  bool  isValid = true;

  if (seriousErrors)
  {
    skipCC = true;
    isValid = false;
    errMsgRead += "Further consistency checking and validation aborted.";
  }
  else
  {
    unsigned int failures = 0;

    document->setConsistencyChecks(LIBSBML_CAT_UNITS_CONSISTENCY, enableUnitCheck);

    start    = getCurrentMillis();
    failures = document->checkConsistency();
    stop     = getCurrentMillis();
    timeCC   = (double)(stop - start);

    if (failures > 0)
    {

      for (unsigned int i = 0; i < failures; i++)
      {
        if (document->getError(i)->isFatal() || document->getError(i)->isError())
        {
          ++numCCErrors;
	  isValid = false;
        }
        else
          ++numCCWarnings;
      }

      ostringstream oss;
      document->printErrors(oss);
      errMsgCC = oss.str();

    }
  }

  //
  // Print Results
  //
  cout << "                 filename : " << filename << endl;
  cout << "         file size (byte) : " << getFileSize(filename.c_str()) << endl;
  cout << "           read time (ms) : " << timeRead << endl;

  if (!skipCC)
  {
    cout << "        c-check time (ms) : " << timeCC << endl;
  }
  else
  {
    cout << "        c-check time (ms) : skipped" << endl;
  }

  cout << "      validation error(s) : " << numReadErrors  + numCCErrors << endl;
  if (!skipCC)
    cout << "    (consistency error(s)): " << numCCErrors << endl;
  else
    cout << "    (consistency error(s)): skipped" << endl;

  cout << "    validation warning(s) : " << numReadWarnings + numCCWarnings << endl;
  if (!skipCC)
    cout << "  (consistency warning(s)): " << numCCWarnings << endl;
  else
    cout << "  (consistency warning(s)): skipped" << endl;

  if ( !errMsgRead.empty() || !errMsgCC.empty() )
  {
    cout << "\n===== validation error/warning messages =====\n";
    if (!errMsgRead.empty())
      cout << errMsgRead << endl;

    if (!errMsgCC.empty())
    {
      cout << "\n*** consistency check ***\n";
      cout << errMsgCC << endl;
    }
  }

  delete document;

  return (isValid) ? true: false;
}


text:
package org.jrdf.query;

/**
 * A query to a graph.
 *
 * @author Tom Adams
 * @version $Revision: 1.1 $
 */
public interface Query {
}


text:
package com.cute.meido;

import android.app.AlertDialog;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.PopupWindow;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;

import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationClientOption.AMapLocationMode;
import com.amap.api.location.AMapLocationListener;
import com.amap.api.maps2d.AMap;
import com.amap.api.maps2d.CameraUpdateFactory;
import com.amap.api.maps2d.LocationSource;
import com.amap.api.maps2d.MapView;
import com.amap.api.maps2d.model.BitmapDescriptorFactory;
import com.amap.api.maps2d.model.MyLocationStyle;
import com.cute.meido.adapter.RegularInfo;
import com.cute.meido.utils.RegularDBHelper;
import com.cute.meido.utils.ToolBox;

import java.util.ArrayList;

/*
修复条件为空是显示N/A
修复不启用地理位置检查时规则数据错误
时间安全检查整理为函数一直工具类

 */

public class NewRegularActivity  extends AppCompatActivity implements LocationSource,
        AMapLocationListener,View.OnClickListener{

    private AMap aMap;
    private MapView mapView;
    private OnLocationChangedListener mListener;
    private AMapLocationClient locationClient;
    private AMapLocationClientOption mLocationOption;

    private String time = "00:00";

    // 没有文本交互控件
    private String premise = "打开蓝牙";
    private String premiseInfo = " ";
    private String action = "关闭蓝牙";
    private String actionInfo = " ";

    private String address = " ";
    private String location = " ";

    private TextView date;
    private TextView sTime;
    private TextView eTime;
    private Switch locSwitch;
    private TextView uipremise;
    private TextView uiaction;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_new_regular);
        setTitle("新建规则");
        initView();
        mapView = (MapView) findViewById(R.id.map);
        mapView.onCreate(savedInstanceState);// 此方法必须重写
        init();
    }
    private void initView(){
        //需要和文本交互的控件
        date = (TextView)findViewById(R.id.nrdate);
        sTime = (TextView)findViewById(R.id.nrstartTime);
        eTime = (TextView)findViewById(R.id.nrendTime);
        locSwitch = (Switch)findViewById(R.id.locSwitch);
        uipremise = (TextView)findViewById(R.id.uipremise);
        uiaction = (TextView)findViewById(R.id.uiaction);

        //
        View viewList[]  = {
                // 文本交互
                findViewById(R.id.nrdate),
                findViewById(R.id.nrstartTime),
                findViewById(R.id.nrendTime),
                // 行为交互
                //findViewById(R.id.locSwitch),
                // 不需要文本交互1
                findViewById(R.id.cancel_button),
                findViewById(R.id.add_button),
                // na 系

                //new
                findViewById(R.id.uipremise),
                findViewById(R.id.uiaction)
        };
        for (View v : viewList){
            v.setOnClickListener(this);
        }
    }

    @Override
    public void onClick(View v) {
        View  itemView;
        AlertDialog.Builder dialog;
        TimePicker timePicker;
        switch (v.getId()){

            case R.id.uipremise:
                final AlertDialog.Builder builder = new AlertDialog.Builder(NewRegularActivity.this);
                builder.setTitle("触发条件");
                final String[] dateSource = new String[] {"打开蓝牙","插入耳机","未接来电","充电连接"};
                builder.setSingleChoiceItems(dateSource, 0, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                       premise= dateSource[which];
                    }
                });
                builder.setPositiveButton("确定",null);
                builder.show();
                break;

            case R.id.uiaction:
                AlertDialog.Builder builder2 = new AlertDialog.Builder(NewRegularActivity.this);
                builder2.setTitle("触发条件");
                final String[] dateSource2 = new String[] {"关闭蓝牙","打开蓝牙","打开Wi-Fi","关闭Wi-Fi","回复短信","静音模式","打开应用"};
                builder2.setSingleChoiceItems(dateSource2, 0, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        action = dateSource2[which];
                        if(action.equals("打开应用")){
                              Intent intent = new Intent(NewRegularActivity.this,PickAppActivity.class);
                                startActivityForResult(intent, ToolBox.PICK_START_APP);
                        }
                    }
                });
                builder2.setPositiveButton("确定",null);
                builder2.show();
                break;

            case R.id.nrstartTime:
                 time = "00:00";
                itemView = getLayoutInflater().inflate(R.layout.dialog_pick_time,null);
                dialog = new AlertDialog.Builder(NewRegularActivity.this);
                dialog.setView(itemView);
                timePicker = (TimePicker) itemView.findViewById(R.id.timePicker);
                timePicker.setIs24HourView(true);
                timePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
                    @Override
                    public void onTimeChanged(TimePicker timePicker, int i, int i1) {
                        time = i + ":" + i1;
                    }
                });
                dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        sTime.setText(time);
                    }
                });
                dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        sTime.setText("00:00");
                    }
                });
                dialog.show();
                break;
            case  R.id.nrendTime:
                time = "23:59";
                itemView = getLayoutInflater().inflate(R.layout.dialog_pick_time,null);
                dialog = new AlertDialog.Builder(NewRegularActivity.this);
                dialog.setView(itemView);
                timePicker = (TimePicker) itemView.findViewById(R.id.timePicker);
                timePicker.setIs24HourView(true);
                timePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
                    @Override
                    public void onTimeChanged(TimePicker timePicker, int i, int i1) {
                        time = i + ":" + i1;
                    }
                });
                dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        eTime.setText(time);
                    }
                });
                dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        eTime.setText("23:59");
                    }
                });
                dialog.show();
                break;
            case R.id.nrdate:
                final ArrayList<String> dateList = new ArrayList<>();
                final AlertDialog.Builder builder3 = new AlertDialog.Builder(NewRegularActivity.this);
                builder3.setTitle("选择执行日期");
                final String[] dateSource3 = new String[] {"星期一","星期二","星期三","星期四","星期五","星期六","星期日"};
                builder3.setMultiChoiceItems(dateSource3, new boolean[]{false,false,false,false,false,false,false}, new DialogInterface.OnMultiChoiceClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which, boolean isChecked) {
                        if(isChecked){
                            if(dateList.indexOf(dateSource3[which]) == -1)
                                dateList.add(dateSource3[which]);
                        }else{
                            if(dateList.indexOf(dateSource3[which]) != -1)
                                dateList.remove(dateSource3[which]);
                        }
                    }
                });
                builder3.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if(dateList.size() == 7){
                            date.setText("每天");
                        }else{
                            String tempDate = "";
                            for (String s : dateList) {
                                tempDate = tempDate + " " + s;
                            }
                            date.setText(tempDate);
                        }
                    }
                });
                builder3.show();
                break;
            case R.id.add_button:
                if(!locSwitch.isChecked()){
                    location = "未使用地理位置限制";
                    address = "未使用地理位置限制";
                }

                if(!ToolBox.checkTimeSe(sTime.getText().toString(),eTime.getText().toString())){
                    Toast.makeText(NewRegularActivity.this, "规则执行起止时间设置不合法", Toast.LENGTH_SHORT).show();
                    return ;
                }
                if(actionInfo.equals("Error:你没有选择要打开的应用")){
                    Toast.makeText(NewRegularActivity.this, "你没有选择要打开的应用", Toast.LENGTH_SHORT).show();
                    return;
                }
                if(!action.equals("打开应用")){
                    actionInfo = " ";
                }

                RegularDBHelper dbHelper = new RegularDBHelper(NewRegularActivity.this, "regular.db", null, 1);
                SQLiteDatabase db = dbHelper.getWritableDatabase();
                ContentValues values = new ContentValues();
                values.put("status", 1);
                values.put("date", date.getText().toString());
                values.put("time", sTime.getText().toString() + " " + eTime.getText().toString());
                values.put("location", location);
                values.put("address",address);
                values.put("premise", premise);
                values.put("premiseInfo", premiseInfo);
                values.put("action", action);
                values.put("actionInfo", actionInfo);
                db.insert("RegularInfo", null, values);
                values.clear();
                Cursor cursor = db.query("RegularInfo", null, null, null, null, null, null);
                MainActivity.regList.clear();
                if (cursor.moveToFirst()) {
                    do {
                        String id = cursor.getString(cursor.getColumnIndex("id"));
                        String status = cursor.getString(cursor.getColumnIndex("status"));
                        String date = cursor.getString(cursor.getColumnIndex("date"));
                        String time = cursor.getString(cursor.getColumnIndex("time"));
                        String location = cursor.getString(cursor.getColumnIndex("location"));
                        String address = cursor.getString(cursor.getColumnIndex("address"));
                        String premise = cursor.getString(cursor.getColumnIndex("premise"));
                        String premiseInfo = cursor.getString(cursor.getColumnIndex("premiseInfo"));
                        String action = cursor.getString(cursor.getColumnIndex("action"));
                        String actionInfo = cursor.getString(cursor.getColumnIndex("actionInfo"));
                        MainActivity.regList.add(new RegularInfo(id, status, date, time, location,address, premise,
                                premiseInfo, action, actionInfo));
                    } while (cursor.moveToNext());
                    cursor.close();
                }
                MainActivity.adapter.notifyDataSetChanged();
                NewRegularActivity.this.finish();
                break;
            case R.id.cancel_button:
                NewRegularActivity.this.finish();
                break;

        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch (requestCode){
            case ToolBox.PICK_START_APP:
                actionInfo = data.getStringExtra("Pkg");
                break;
        }
    }
    private void init() {
        if (aMap == null) {
            aMap = mapView.getMap();
            setUpMap();
        }
    }
    private void setUpMap() {
        // 自定义系统定位小蓝点
        MyLocationStyle myLocationStyle = new MyLocationStyle();
        myLocationStyle.myLocationIcon(BitmapDescriptorFactory
                .fromResource(R.drawable.location_marker));// 设置小蓝点的图标
        myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));// 设置圆形的边框颜色
        myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));// 设置圆形的填充颜色
        // myLocationStyle.anchor(int,int)//设置小蓝点的锚点
        myLocationStyle.strokeWidth(1.0f);// 设置圆形的边框粗细
        aMap.setMyLocationStyle(myLocationStyle);
        aMap.setLocationSource(this);// 设置定位监听
        aMap.getUiSettings().setMyLocationButtonEnabled(true);// 设置默认定位按钮是否显示
        aMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
        // aMap.setMyLocationType()
        aMap.getUiSettings().setScrollGesturesEnabled(false); //  设置 禁止 拖动
        aMap.getUiSettings().setZoomGesturesEnabled(false);
        aMap.getUiSettings().setZoomControlsEnabled(false);

}
    @Override
    protected void onResume() {
        super.onResume();
        mapView.onResume();
    }
    @Override
    protected void onPause() {
        super.onPause();
        mapView.onPause();
        deactivate();
    }
    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        mapView.onSaveInstanceState(outState);
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        mapView.onDestroy();
    }
    @Override
    public void onLocationChanged(AMapLocation amapLocation) {
        if (mListener != null && amapLocation != null) {
            if (amapLocation.getErrorCode() == 0) {
                mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
                aMap.animateCamera(CameraUpdateFactory.zoomTo(16));//动画移动缩放
                // 获取位置信息
                address = amapLocation.getAddress();
                location = amapLocation.getLatitude() + " " + amapLocation.getLongitude();
            } else {
                String errText = "定位失败," + amapLocation.getErrorCode()+ ": " + amapLocation.getErrorInfo();
                Log.e("AmapErr",errText);
            }
        }
    }
    @Override
    public void activate(OnLocationChangedListener listener) {
        mListener = listener;
        if (locationClient == null) {
            locationClient = new AMapLocationClient(this);
            mLocationOption = new AMapLocationClientOption();
            //设置定位监听
            locationClient.setLocationListener(this);
            //设置为高精度定位模式
            mLocationOption.setLocationMode(AMapLocationMode.Hight_Accuracy);
            //设置定位参数
            locationClient.setLocationOption(mLocationOption);
            // 此方法为每隔固定时间会发起一次定位请求,为了减少电量消耗或网络流量消耗,
            // 注意设置合适的定位时间的间隔(最小间隔支持为2000ms),并且在合适时间调用stopLocation()方法来取消定位请求
            // 在定位结束后,在合适的生命周期调用onDestroy()方法
            // 在单次定位情况下,定位无论成功与否,都无需调用stopLocation()方法移除请求,定位sdk内部会移除
            locationClient.startLocation();
        }
    }
    @Override
    public void deactivate() {
        mListener = null;
        if (locationClient != null) {
            locationClient.stopLocation();
            locationClient.onDestroy();
        }
        locationClient = null;
    }
}


text:
#import <Foundation/Foundation.h>
#import "DatabaseRecord.h"

extern NSInteger const kRecordState_InProgress;
extern NSInteger const kRecordState_Completed;
extern NSInteger const kRecordState_Submitted;

@class Control;
@class RecordXML;
@class Binding;

@interface Record : DatabaseRecord {

    RecordXML *xml;                 // xml <instance>

    NSArray *questions;              // An ordered list of Question dbids

    NSString *constraintMessage;    // Message to display if constraint evaluation fails
}

@property (nonatomic, readonly) RecordXML *xml;
@property (nonatomic, readonly) NSArray *questions;
@property (nonatomic, copy)     NSString *constraintMessage;

@property (nonatomic, readonly) NSInteger state;
@property (nonatomic, readonly) NSDate *createDate;
@property (nonatomic, readonly) NSDate *completeDate;
@property (nonatomic, readonly) NSDate *submitDate;

// Return a 'context sensitive' date.
//
//  State:                      Returns:
//  kRecordState_InProgress     createDate
//  kRecordState_Completed      completeDate
//  kRecordState_Submitted      submitDate
@property (nonatomic, readonly) NSDate *date;

// Get the progress (% complete) from 0.0 to 1.0
@property (nonatomic, readonly) float progress;

// A Questions 'relevant' (skip-logic) and 'required'
// flags are XPath expressions that depends on previous answers.
// iterate through every Question in 'questions' recalculate these flags.
- (void)recalculateGlobalQuestionState;

// Get the Control that corresponds to the Question (in 'questions')
// at the specified index. Will return nil if index is out-of-range or
// if binding 'relevant' is not satisfied
- (Control *)getControl:(NSInteger)index;

// Get just the 'label' of the Control at the specified index.
// Useful if we want to show a summary list of all Questions
// without incurring the cost of constructing a Control. Will
// return nil if index is out of range
- (NSString *)getLabel:(NSInteger)index;

- (BOOL)isAnswered:(NSInteger)index;

- (NSString *)getAnswer:(NSInteger)index;

- (BOOL)isRelevant:(NSInteger)index;

- (BOOL)isRequired:(NSInteger)index;

// Return YES if the current Question has a 'previous' Question
// or NO if the current Question is the first. Note: Bindings
// are not considered - just the raw list of Questions
- (BOOL)hasPrevious:(NSInteger)index;

// Return YES if the current Question has a 'next' Question
// or NO if the current Question is the last. Note: Bindings
// are not considered - just the raw list of Questions
- (BOOL)hasNext:(NSInteger)index;

// Reset a 'Complete' or 'Submitted' record to 'In-Progress'
- (void)inProgress;

// Set record state to 'Complete'
- (void)complete;

// Set record state to 'Submitted'
- (void)submitted;

// Update this Record with the results of the Control. Returns YES if
// the record was successfully updated, or NO otherwise. If NO,
// the property 'constraintMessage' will contain a message to display
- (BOOL)updateRecordWithControlResult:(Control *)control;

@end


text:
echo "

# QUERY TUNING

random_page_cost = 1.1
effective_cache_size = 12GB

# AUTOVACUUM PARAMETERS

autovacuum = on

# CLIENT CONNECTION DEFAULTS

datestyle = 'iso, mdy'
lc_messages = 'C'
lc_monetary = 'C'
lc_numeric = 'C'
lc_time = 'C'
default_text_search_config = 'pg_catalog.english'

" >> /var/lib/postgresql/data/postgresql.conf


text:
         ConsultApp

          List

          Create

				Sign Up

				Sign In

{{authentication.user.displayName}}

						Edit Profile

						Change Password

						Signout


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="@dimen/nav_header_height"
    android:background="?attr/colorPrimaryDark"
    android:gravity="bottom"
    android:orientation="vertical"
    android:padding="@dimen/activity_vertical_margin"
    android:theme="@style/ThemeOverlay.AppCompat.Dark">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/nav_header_vertical_spacing"
        android:text="eJotter"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1"
        android:textSize="40sp"/>

</LinearLayout>


text:
package automation

import (
	"fmt"

	pb "github.com/youtube/vitess/go/vt/proto/automation"
	"golang.org/x/net/context"
)

// SplitCloneTask runs SplitClone on a remote vtworker to split an existing shard.
type SplitCloneTask struct {
}

// Run is part of the Task interface.
func (t *SplitCloneTask) Run(parameters map[string]string) ([]*pb.TaskContainer, string, error) {
	keyspaceAndSourceShard := fmt.Sprintf("%v/%v", parameters["keyspace"], parameters["source_shard"])
	// TODO(mberlin): Add parameters for the following options?
	//                        '--source_reader_count', '1',
	//                        '--destination_pack_count', '1',
	//                        '--destination_writer_count', '1',
	//                        '--strategy=-populate_blp_checkpoint',
	args := []string{"SplitClone", "--strategy=-populate_blp_checkpoint"}
	if excludeTables, ok := parameters["exclude_tables"]; ok {
		args = append(args, "--exclude_tables="+excludeTables)
	}
	args = append(args, keyspaceAndSourceShard)
	output, err := ExecuteVtworker(context.TODO(), parameters["vtworker_endpoint"], args)

	// TODO(mberlin): Remove explicit reset when vtworker supports it implicility.
	if err == nil {
		// Ignore output and error of the Reset.
		ExecuteVtworker(context.TODO(), parameters["vtworker_endpoint"], []string{"Reset"})
	}
	return nil, output, err
}

// RequiredParameters is part of the Task interface.
func (t *SplitCloneTask) RequiredParameters() []string {
	return []string{"keyspace", "source_shard", "vtworker_endpoint"}
}

// OptionalParameters is part of the Task interface.
func (t *SplitCloneTask) OptionalParameters() []string {
	return []string{"exclude_tables"}
}


text:
package com.github.ricardobaumann.release_kraken;

import hudson.Extension;
import hudson.model.ItemGroup;
import hudson.model.TopLevelItem;
import hudson.model.BooleanParameterDefinition;
import hudson.model.ChoiceParameterDefinition;
import hudson.model.ParameterDefinition;
import hudson.model.ParametersDefinitionProperty;
import hudson.model.Project;
import hudson.model.StringParameterDefinition;
import hudson.util.RunList;

import java.util.Map;

import jenkins.model.Jenkins;

/**
 * Zenvia Flow software project.
 *
 * @author Ricardo Luis Baumann <https://github.com/ricardobaumann>
 */
@SuppressWarnings("unchecked")
public class ZenviaFlowProject extends Project<ZenviaFlowProject,ZenviaFreeStyleBuild> implements TopLevelItem {

	private ParameterDefinition[] buildParameters = new ParameterDefinition[]{
		new ChoiceParameterDefinition("build_type", new String[]{"build","release"}, "Build: Merge dos branches ativos e build. Release: Gera branch de release"),
		new ChoiceParameterDefinition("releaseType", new String[]{"RC","FINAL"}, "Tipo da Release"),
		new StringParameterDefinition("releaseVersion", "1.0.0-RC1","Proxima versão release"),
		new StringParameterDefinition("developmentVersion", "1.1.0-SNAPSHOT","Proxima versao snapshot"),
		new StringParameterDefinition("branches", "","Branches que serão utilizados no release. Deixe em branch para o default develop e issues/* não mergeados"),
		new BooleanParameterDefinition("just_verification", false, "Run the release without pushing to remote repository"),
		new BooleanParameterDefinition("overwrite", false, "Overwrite the release branch if it exists"),
		new ChoiceParameterDefinition("merge_mode", new String[]{"normal","auto"}, "Estratégia de merge a ser utilizada"),
		//new ChoiceParameterDefinition("list_last_releases", new String[]{"0","5","10"}, "Lista os últimos releases")
	};

    /**
     * @deprecated as of 1.390
     */
    public ZenviaFlowProject(Jenkins parent, String name) {
        super(parent, name);
        init();
    }

    private void init() {
		try {

			getBuildersList().add(new ZenviaFlowBuilder("git@bitbucket.org:zenvia-sms/"+name+".git","pom.xml",getBuildTool().toString(),null));

			addProperty(new ParametersDefinitionProperty(buildParameters));

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

    public Map<String, String> getLastReleaseBuildParams() {

    	RunList<ZenviaFreeStyleBuild> lastBuilds = getBuilds();
    	for (ZenviaFreeStyleBuild build : lastBuilds) {
    		Map<String, String> envVars = build.getEnvVars();
    		return envVars;
    	}
    	return null;
    }

	protected BuildTool getBuildTool() {
		return BuildTool.MAVEN;
	}

	@SuppressWarnings("rawtypes")
	public ZenviaFlowProject(ItemGroup parent, String name) {
        super(parent, name);
        init();
    }

    @Override
    protected Class<ZenviaFreeStyleBuild> getBuildClass() {
        return ZenviaFreeStyleBuild.class;
    }

    public AbstractProjectDescriptor getDescriptor() {
        return DESCRIPTOR;
    }

    @Extension(ordinal=2000)
    public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl();

    public static final class DescriptorImpl extends AbstractProjectDescriptor {
        public String getDisplayName() {
            return "Zenvia Flow Maven Project";
        }

        @SuppressWarnings("rawtypes")
		public ZenviaFlowProject newInstance(ItemGroup parent, String name) {
            return new ZenviaFlowProject(parent, name);
        }

    }
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using Orchard.UI.Resources;

namespace Liveo.Platform
{
	public class ResourceManifest : IResourceManifestProvider
	{
		public void BuildManifests(ResourceManifestBuilder builder)
		{
			var manifest = builder.Add();

			#region generated scripts

			var generatedScripts = new string[] {
													"viewModel_Affiliate",
													"viewModel_Album",
													"viewModel_AnswerSelection",
													"viewModel_ChartType",
													"viewModel_Exercise",
													"viewModel_ExerciseType",
													"viewModel_Feature",
													"viewModel_Goal",
													"viewModel_Goal_WIP",
													"viewModel_GoalType",
													"viewModel_Group",
													"viewModel_GroupMembership",
													"viewModel_Ingredient",
													"viewModel_Meal",
													"viewModel_Measurement",
													"viewModel_MeasurementType",
													"viewModel_MediaItem",
													"viewModel_Organization",
													"viewModel_Persona",
													"viewModel_Program",
													"viewModel_ProgramCycle",
													"viewModel_QuestionType",
													"viewModel_Reading",
													"viewModel_ReadingSource",
													"viewModel_ReadingSourceType",
													"viewModel_ReadingType",
													"viewModel_ReadingTypeUnitTypeX",
													"viewModel_Role",
													"viewModel_Survey",
													"viewModel_SurveyQuestion",
													"viewModel_SystemInstallation",
													"viewModel_UnitType",
													"viewModel_User",
													"viewModel_UserAffiliateX",
													"viewModel_UserAnswer",
													"viewModel_UserPersona",
													"viewModel_UserQuestion",
													"viewModel_UserSurvey"};

			#endregion

			manifest.DefineScript("jquerytools").SetUrl("Resources/jquery.tools.1.2.7-min.js", "Resources/jquery.tools.1.2.7-min.js").SetVersion("2012.2.913");
			manifest.DefineScript("jqueryuijs").SetUrl("Resources/jquery-ui-1.8.24-min.js", "Resources/jquery-ui-1.8.24-min.js").SetVersion("2012.2.913");
            manifest.DefineScript("jquerycookie").SetUrl("Resources/jquery.cookie.js", "Resources/jquery.cookie.js").SetVersion("1.3");
            manifest.DefineScript("jqueryfancybox").SetUrl("Resources/jquery.fancybox.js", "Resources/jquery.fancybox.js").SetVersion("2012.1.1");
            manifest.DefineScript("jqueryfancyboxpack").SetUrl("Resources/jquery.fancybox.pack.js", "Resources/jquery.fancybox.pack.js").SetVersion("2012.1.1");
            manifest.DefineScript("jquerymousewheelpack").SetUrl("Resources/jquery.mousewheel-3.0.6.pack.js", "Resources/jquery.mousewheel-3.0.6.pack.js").SetVersion("3.0.6");
            manifest.DefineScript("datejs").SetUrl("Resources/date.js", "Resources/date.js").SetVersion("1.0");

			manifest.DefineScript("livequery").SetUrl("Resources/jquery.livequery.js", "Resources/jquery.livequery.js").SetVersion("1.1.1");
			manifest.DefineScript("form").SetUrl("Resources/jquery.form.js", "Resources/jquery.form.min.js").SetVersion("3.18");
            manifest.DefineScript("ko").SetUrl("Resources/knockout-2.1.0.js", "Resources/knockout-2.1.0.debug.js").SetVersion("2.1.0");
			manifest.DefineScript("komulti").SetUrl("Resources/knockout.multimodels-0.1.min.js", "Resources/knockout.multimodels-0.1.min.js").SetVersion("0.1");

			manifest.DefineScript("common").SetUrl("fitness/common.js", "fitness/common.js").SetVersion("2012.2.913");

			//manifest.DefineScript("style").SetUrl("Resources/style.js", "Resources/style.js").SetVersion("1.0");
			//manifest.DefineScript("colorbox").SetUrl("Resources/jquery.colorbox.js", "Resources/jquery.colorbox.js").SetVersion("1.3.20.1");

			foreach (var alias in generatedScripts)
			{
				var filename = string.Format("generated/{0}.js", alias);
				manifest.DefineScript(alias).SetUrl(filename, filename).SetVersion("2012.2.913");
			}

            manifest.DefineScript("kovalidate").SetUrl("Resources/knockout.validation.min.js", "Resources/knockout.validation.js").SetVersion("0.1");
			// css required for jquery tools popup dialog that we are leveraging
			manifest.DefineStyle("modal").SetUrl("modal.css", "modal.css").SetVersion("2012.2.913");

			// jquery ui css, had to rename b/c orchard wouldn't recognize the regular name of this file (jquery.ui.2.blah.blah.min.js)
			manifest.DefineStyle("jqui").SetUrl("jqui.css", "jqui.css").SetVersion("2012.2.913");
            manifest.DefineStyle("fancybox").SetUrl("jquery.fancybox.css", "jquery.fancybox.css").SetVersion("2012.2.913");

			// standards styles setup by kyle (copied from Liveo.MVC4 project which has a copy from Standards repo
			manifest.DefineStyle("reset").SetUrl("Liveo/reset.css", "Liveo/reset.css").SetVersion("2012.2.913");
			manifest.DefineStyle("layout").SetUrl("Liveo/layout.css", "Liveo/layout.css").SetVersion("2012.2.913");
            manifest.DefineStyle("layout_ext").SetUrl("Liveo/layout_ext.css", "Liveo/layout_ext.css").SetVersion("2012.2.913");
			manifest.DefineStyle("font").SetUrl("Liveo/font.css", "Liveo/font.css").SetVersion("2012.2.913");
		}
	}
}
//


text:
package msci.mg.factories;

import msci.mg.Choice;
import org.apache.commons.collections15.Factory;

import java.util.List;

public abstract class IntelligentAgentFactory extends AgentFactory {
    private Factory<Integer> memoryCapacityFactory;
    private Factory<Integer> numberOfStrategiesFactory;
    private List<Choice> initialChoiceMemory;

    public IntelligentAgentFactory(
            Factory<Integer> memoryCapacityFactory,
            Factory<Integer> numberOfStrategiesFactory,
            List<Choice> initialChoiceMemory) {
        this.memoryCapacityFactory = memoryCapacityFactory;
        this.numberOfStrategiesFactory = numberOfStrategiesFactory;
        this.initialChoiceMemory = initialChoiceMemory;
    }

    public Factory<Integer> getMemoryCapacityFactory() {
        return this.memoryCapacityFactory;
    }

    public Factory<Integer> getNumberOfStrategiesFactory() {
        return this.numberOfStrategiesFactory;
    }

    public List<Choice> getInitialChoiceMemory() {
        return this.initialChoiceMemory;
    }

    public void setMemoryCapacityFactory(Factory<Integer> memoryCapacityFactory) {
        this.memoryCapacityFactory = memoryCapacityFactory;
    }

    public void setNumberOfStrategiesFactory(Factory<Integer> numberOfStrategiesFactory) {
        this.numberOfStrategiesFactory = numberOfStrategiesFactory;
    }

    public void setInitialChoiceMemory(List<Choice> initialChoiceMemory) {
        this.initialChoiceMemory = initialChoiceMemory;
    }

}


text:
/*	$NetBSD: dm9000var.h,v 1.2 2012/01/28 08:29:55 nisimura Exp $	*/

/*
 * Copyright (c) 2009 Paul Fleischer
 * All rights reserved.
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the company nor the name of the author may be used to
 *    endorse or promote products derived from this software without specific
 *    prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

/* Based on sys/dev/ic/cs89x0var.h */
/*
 * Copyright 1997
 * Digital Equipment Corporation. All rights reserved.
 *
 * This software is furnished under license and may be used and
 * copied only in accordance with the following terms and conditions.
 * Subject to these conditions, you may download, copy, install,
 * use, modify and distribute this software in source and/or binary
 * form. No title or ownership is transferred hereby.
 *
 * 1) Any source code used, modified or distributed must reproduce
 *    and retain this copyright notice and list of conditions as
 *    they appear in the source file.
 *
 * 2) No right is granted to use any trade name, trademark, or logo of
 *    Digital Equipment Corporation. Neither the "Digital Equipment
 *    Corporation" name nor any trademark or logo of Digital Equipment
 *    Corporation may be used to endorse or promote products derived
 *    from this software without the prior written permission of
 *    Digital Equipment Corporation.
 *
 * 3) This software is provided "AS-IS" and any express or implied
 *    warranties, including but not limited to, any implied warranties
 *    of merchantability, fitness for a particular purpose, or
 *    non-infringement are disclaimed. In no event shall DIGITAL be
 *    liable for any damages whatsoever, and in particular, DIGITAL
 *    shall not be liable for special, indirect, consequential, or
 *    incidental damages or damages for lost profits, loss of
 *    revenue or loss of use, whether such damages arise in contract,
 *    negligence, tort, under statute, in equity, at law or otherwise,
 *    even if advised of the possibility of such damage.
 */

#ifndef _DEV_IC_DM9000VAR_H_
#define _DEV_IC_DM9000VAR_H_

#include <sys/callout.h>

#define DM9000_MODE_8BIT 2
#define DM9000_MODE_16BIT 0
#define DM9000_MODE_32BIT 1

struct dme_softc {
	device_t	sc_dev;		/* Generic Base Device */

	struct ethercom sc_ethercom;	/* Ethernet common data */
	struct ifmedia	sc_media;	/* Media control structures */

	uint		sc_media_active;
	uint		sc_media_status;

	bus_space_tag_t		sc_iot;
	bus_space_handle_t	sc_ioh;
	void		*sc_ih;

	uint		dme_io;
	uint		dme_data;

	uint16_t	sc_vendor_id;
	uint16_t	sc_product_id;

	uint8_t		sc_data_width;

	uint8_t		sc_enaddr[ETHER_ADDR_LEN];

	int		txbusy;		/* A packet is being transmitted. */
	int		txready;	/* A packet has been sent to the DM9000
					   for transmission. */
	uint16_t	txready_length;

	int (*sc_pkt_write)(struct dme_softc*, struct mbuf *);
	int (*sc_pkt_read)(struct dme_softc*, struct ifnet *, struct mbuf **);

	callout_t	sc_link_callout;

	bool		sc_phy_initialized;

#ifdef DIAGNOSTIC
	bool		sc_inside_interrupt;
#endif
};

/* Function declarations */
int	dme_attach(struct dme_softc *, const uint8_t *);
int	dme_detach(struct dme_softc *);
int	dme_intr(void *);

/* Helper method used by sc_pkt_read */
struct mbuf* dme_alloc_receive_buffer(struct ifnet *, unsigned int);

/* Inline memory access methods */
static inline uint8_t
dme_read(struct dme_softc *sc, int reg)
{
	bus_space_write_1(sc->sc_iot, sc->sc_ioh, sc->dme_io, reg);
	return (bus_space_read_1(sc->sc_iot, sc->sc_ioh, sc->dme_data));
}

static inline void
dme_write(struct dme_softc *sc, int reg, uint8_t value)
{
	bus_space_write_1(sc->sc_iot, sc->sc_ioh, sc->dme_io, reg);
	bus_space_write_1(sc->sc_iot, sc->sc_ioh, sc->dme_data, value);
}

static inline void
dme_write2(struct dme_softc *sc, int reg, uint16_t value)
{
	bus_space_write_1(sc->sc_iot, sc->sc_ioh, sc->dme_io, reg);
	bus_space_write_2(sc->sc_iot, sc->sc_ioh, sc->dme_data, value);
}

static inline void
dme_write_c(struct dme_softc *sc, int reg, uint8_t value[], uint count)
{
	for(int i=0; i<count; i++) {
		dme_write(sc, reg+i, value[i]);
	}
}

static inline void
dme_read_c(struct dme_softc *sc, int reg, uint8_t *value, uint count)
{
	for(int i=0; i<count; i++) {
		value[i] = dme_read(sc, reg+i);
	}
}

#endif /* _DEV_IC_DM9000VAR_H_ */


text:
package grails.plugins.quartz.listeners;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.groovy.grails.support.PersistenceContextInterceptor;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.listeners.JobListenerSupport;

/**
 * JobListener implementation which wraps the execution of a Quartz Job in a
 * persistence context, via the persistenceInterceptor.
 *
 * @author Sergey Nebolsin (nebolsin@gmail.com)
 * @since 0.2
 */
public class SessionBinderJobListener extends JobListenerSupport {
    private static final transient Log LOG = LogFactory.getLog(SessionBinderJobListener.class);

    public static final String NAME = "sessionBinderListener";

    private PersistenceContextInterceptor persistenceInterceptor;

    public String getName() {
        return NAME;
    }

    public PersistenceContextInterceptor getPersistenceInterceptor() {
        return persistenceInterceptor;
    }

    public void setPersistenceInterceptor(PersistenceContextInterceptor persistenceInterceptor) {
        this.persistenceInterceptor = persistenceInterceptor;
    }

    /**
     * Before job executing. Init persistence context.
     */
    public void jobToBeExecuted(JobExecutionContext context) {
        if (persistenceInterceptor != null) {
            persistenceInterceptor.init();
        }
    }

    /**
     * After job executing. Flush and destroy persistence context.
     */
    public void jobWasExecuted(JobExecutionContext context, JobExecutionException exception) {
        if (persistenceInterceptor != null) {
            try {
                persistenceInterceptor.flush();
            } catch (Exception e) {
                LOG.error("Failed to flush session after job: " + context.getJobDetail().getDescription(), e);
            } finally {
                try {
                    persistenceInterceptor.destroy();
                } catch (Exception e) {
                    LOG.error("Failed to finalize session after job: " + context.getJobDetail().getDescription(), e);
                }
            }
        }
    }
}


text: <form class="login" class2="log in" id='home form' id2='home_form' x=c></form>


text:
import pycomicvine
import datetime
from pycomicvine.tests.utils import *

pycomicvine.api_key = "476302e62d7e8f8f140182e36aebff2fe935514b"

class TestVideoTypesList(ListResourceTestCase):
    def test_get_id_and_name(self):
        self.get_id_and_name_test(
                pycomicvine.VideoTypes,
                pycomicvine.VideoType
            )

class TestVideoTypeAttributes(SingularResourceTestCase):
    def setUp(self):
        self.get_random_instance(pycomicvine.VideoTypes)

    def test_get_all_attributes(self):
        video_type = self.get_sample(pycomicvine.VideoType)
        if video_type != None:
            self.assertIsInstance(
                    video_type.api_detail_url,
                    (type(None),basestring)
                )
            self.assertIsInstance(
                    video_type.deck,
                    (type(None),basestring)
                )
            self.assertIsInstance(
                    video_type.id,
                    int
                )
            self.assertIsInstance(
                    video_type.name,
                    (type(None),basestring)
                )
            self.assertIsInstance(
                    video_type.site_detail_url,
                    (type(None),basestring)
                )


text:
void downsample(rod::dimage<float> &dest, const rod::dimage<float> &orig)
{
    save("orig.png",orig);

    char cmd[128];

    sprintf(cmd,"convert orig.png -resize %dx%d dest.png",
            dest.width(),dest.height());
    if(system(cmd) == -1)
        throw std::runtime_error(strerror(errno));

    load(dest, "dest.png");

    unlink("orig.png");
    unlink("dest.png");
}

#elif METHOD == OPENCV

#include <opencv2/core/wimage.hpp>
#include <opencv2/imgproc/imgproc.hpp>

void downsample(rod::dimage<float> &dest, const rod::dimage<float> &orig)
{
    rod::dimage<unsigned char> imgaux(orig.width(), orig.height());
    convert(&imgaux, &orig, false);

    std::vector<unsigned char> cpu;
    imgaux.copy_to_host(cpu);

    cv::WImageViewC<unsigned char,1> temp(&cpu[0], orig.width(), orig.height());

    cv::Mat out;
    resize((cv::Mat)temp.Ipl(), out, cv::Size(dest.width(),dest.height()),
           0,0,cv::INTER_AREA);

    IplImage temp2 = out;
    cv::WImageView<unsigned char> img = &temp2;

    rod::dimage<uchar1> temp3;
    temp3.copy_from_host(img(0,0), img.Width(),
                        img.Height(), img.WidthStep());
    convert(&dest, &temp3, false);
}

#elif METHOD == NEHAB

#include <resample/scale.h>
#include "imgio.h"

void downsample(rod::dimage<float> &dest, const rod::dimage<float> &orig)
{
    using namespace nehab;

    image::rgba<float> orig_rgba;
    image::load(orig, &orig_rgba);

    kernel::base *pre = new kernel::generalized(
            new kernel::discrete::delta,
            new kernel::discrete::sampled(new kernel::generating::bspline3),
            new kernel::generating::bspline3);
    // no additional discrete processing
    kernel::discrete::base *delta = new kernel::discrete::delta;
    // use mirror extension
    extension::base *ext = new extension::mirror;

    scale(dest.height(), dest.width(), pre, delta, delta, ext, &orig_rgba, dest);

    return;
}

#else
#   error bad downsampling method
#endif


text:
CREATE TABLE MEMBERSHIP (
  ID        INTEGER              NOT NULL PRIMARY KEY AUTO_INCREMENT,
  BEGINDATE DATE                 NOT NULL,
  ENDDATE   DATE,
  MAINCLUB  BOOLEAN DEFAULT TRUE NOT NULL,
  USER_ID   INTEGER              NOT NULL,
  CLUB_ID   INTEGER              NOT NULL,
  CONSTRAINT MEMBERSHIP_USER_ID_FK FOREIGN KEY (USER_ID) REFERENCES USER (ID),
  CONSTRAINT MEMBERSHIP_CLUB_ID_FK FOREIGN KEY (CLUB_ID) REFERENCES CLUB (ID)
);


text:
<?php

class CM_PagingSource_AbstractTest extends CMTest_TestCase {

    public function setUp() {
        CM_Db_Db::exec('CREATE TABLE `test` (
						`id` INT(10) unsigned NOT NULL AUTO_INCREMENT,
						`num` INT(10) NOT NULL,
						PRIMARY KEY (`id`)
						)');
        for ($i = 0; $i < 100; $i++) {
            CM_Db_Db::insert('test', array('num' => $i));
        }
    }

    public function tearDown() {
        CM_Db_Db::exec('DROP TABLE `test`');
    }

    public function testCacheLocal() {
        $source = new CM_PagingSource_Sql('`num`', 'test');
        $source->enableCacheLocal();
        $this->assertEquals(100, $source->getCount());

        CM_Db_Db::delete('test', array('num' => 0));
        $this->assertEquals(100, $source->getCount());
        $source->clearCache();
        $this->assertEquals(99, $source->getCount());
        CM_Cache_Local::getInstance()->flush();
    }

    public function testCache() {
        $source = new CM_PagingSource_Sql('`num`', 'test');
        $source->enableCache();
        $this->assertSame(100, $source->getCount());

        $sourceNocache = new CM_PagingSource_Sql('`num`', 'test');
        $this->assertSame(100, $sourceNocache->getCount());

        CM_Db_Db::delete('test', array('num' => 0));
        $this->assertSame(100, $source->getCount());
        $this->assertSame(99, $sourceNocache->getCount());
        $source->clearCache();
        $this->assertSame(99, $source->getCount());
        $this->assertSame(99, $sourceNocache->getCount());
        CM_Cache_Shared::getInstance()->flush();
    }
}


text:
package com.android.internal.telephony.cat;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Container class for PlayTone commands parameters.
 *
 */
public class ToneSettings implements Parcelable {
    public Duration duration;
    public Tone tone;
    public boolean vibrate;

    public ToneSettings(Duration duration, Tone tone, boolean vibrate) {
        this.duration = duration;
        this.tone = tone;
        this.vibrate = vibrate;
    }

    private ToneSettings(Parcel in) {
        duration = in.readParcelable(null);
        tone = in.readParcelable(null);
        vibrate = in.readInt() == 1;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(duration, 0);
        dest.writeParcelable(tone, 0);
        dest.writeInt(vibrate ? 1 : 0);
    }

    public static final Parcelable.Creator<ToneSettings> CREATOR = new Parcelable.Creator<ToneSettings>() {
        @Override
        public ToneSettings createFromParcel(Parcel in) {
            return new ToneSettings(in);
        }

        @Override
        public ToneSettings[] newArray(int size) {
            return new ToneSettings[size];
        }
    };
}


text:
package com.intellij.openapi.editor.impl;

import com.intellij.openapi.editor.ex.util.EditorUIUtil;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.ui.UIUtil;
import gnu.trove.TIntHashSet;
import org.intellij.lang.annotations.JdkConstants;
import org.jetbrains.annotations.NotNull;

import java.awt.*;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.font.TextAttribute;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FilenameFilter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Locale;

/**
 * @author max
 */
public class FontInfo {
  private static final boolean USE_ALTERNATIVE_CAN_DISPLAY_PROCEDURE = SystemInfo.isAppleJvm && Registry.is("ide.mac.fix.font.fallback");
  private static final FontRenderContext DUMMY_CONTEXT = new FontRenderContext(null, false, false);
  private static final boolean ENABLE_OPTIONAL_LIGATURES = Registry.is("editor.enable.optional.ligatures");

  private final TIntHashSet mySymbolsToBreakDrawingIteration = new TIntHashSet();

  private final Font myFont;
  private final int mySize;
  @JdkConstants.FontStyle private final int myStyle;
  private final TIntHashSet mySafeCharacters = new TIntHashSet();
  private FontMetrics myFontMetrics = null;
  private final int[] charWidth = new int[128];
  private boolean myHasGlyphsToBreakDrawingIteration;
  private boolean myCheckedForProblemGlyphs;

  public FontInfo(final String familyName, final int size, @JdkConstants.FontStyle int style) {
    mySize = size;
    myStyle = style;
    Font font = new Font(familyName, style, size);
    myFont = ENABLE_OPTIONAL_LIGATURES ? getFontWithLigaturesEnabled(font) : font;
  }

  @NotNull
  private static Font getFontWithLigaturesEnabled(Font font) {
    if (SystemInfo.isMac) {
      // Ligatures don't work on Mac for fonts loaded natively, so we need to locate and load font manually
      File fontFile = findFileForFont(font, true);
      if (fontFile == null && font.getStyle() != Font.PLAIN) fontFile = findFileForFont(font.deriveFont(Font.PLAIN), true);
      if (fontFile == null) fontFile = findFileForFont(font, false);
      if (fontFile == null) return font;
      try {
        font = Font.createFont(Font.TRUETYPE_FONT, fontFile).deriveFont(font.getStyle(), font.getSize());
      }
      catch (Exception e) {
        return font;
      }
    }
    return font.deriveFont(Collections.singletonMap(TextAttribute.LIGATURES, TextAttribute.LIGATURES_ON));
  }

  private static File findFileForFont(Font font, final boolean matchStyle) {
    final String normalizedFamilyName = font.getFamily().toLowerCase(Locale.getDefault()).replace(" ", "");
    final int fontStyle = font.getStyle();
    File[] files = new File(System.getProperty("user.home"), "Library/Fonts").listFiles(new FilenameFilter() {
      @Override
      public boolean accept(File file, String name) {
        String normalizedName = name.toLowerCase(Locale.getDefault());
        return normalizedName.startsWith(normalizedFamilyName) &&
               (normalizedName.endsWith(".otf") || normalizedName.endsWith(".ttf")) &&
               (!matchStyle || fontStyle == ComplementaryFontsRegistry.getFontStyle(name));
      }
    });
    if (files == null || files.length == 0) return null;
    // to make sure results are predictable we return first file in alphabetical order
    return Collections.min(Arrays.asList(files), new Comparator<File>() {
      @Override
      public int compare(File file1, File file2) {
        return file1.getName().compareTo(file2.getName());
      }
    });
  }

  private void parseProblemGlyphs() {
    myCheckedForProblemGlyphs = true;
    BufferedImage buffer = UIUtil.createImage(20, 20, BufferedImage.TYPE_INT_RGB);
    final Graphics graphics = buffer.getGraphics();
    if (!(graphics instanceof Graphics2D)) {
      return;
    }
    final FontRenderContext context = ((Graphics2D)graphics).getFontRenderContext();
    char[] charBuffer = new char[1];
    for (char c = 0; c < 128; c++) {
      if (!myFont.canDisplay(c)) {
        continue;
      }
      charBuffer[0] = c;
      final GlyphVector vector = myFont.createGlyphVector(context, charBuffer);
      final float y = vector.getGlyphMetrics(0).getAdvanceY();
      if (Math.round(y) != 0) {
        mySymbolsToBreakDrawingIteration.add(c);
      }
    }
    myHasGlyphsToBreakDrawingIteration = !mySymbolsToBreakDrawingIteration.isEmpty();
  }

  /**
   * We've experienced a problem that particular symbols from particular font are represented really weird
   * by the IJ editor (IDEA-83645).
   *

   * Eventually it was found out that outline font glyphs can have a 'y advance', i.e. instruction on how the subsequent
   * glyphs location should be adjusted after painting the current glyph. In terms of java that means that such a problem
   * glyph should be the last symbol at the {@link Graphics#drawChars(char[], int, int, int, int) text drawing iteration}.
   *

   * Hopefully, such glyphs are exceptions from the normal processing, so, this method allows to answer whether a font
   * {@link #getFont() referenced} by the current object has such a glyph.
   *
   * @return    true if the {@link #getFont() target font} has problem glyphs; false otherwise
   */
  public boolean hasGlyphsToBreakDrawingIteration() {
    if (!myCheckedForProblemGlyphs) {
      parseProblemGlyphs();
    }
    return myHasGlyphsToBreakDrawingIteration;
  }

  /**
   * @return    unicode symbols which glyphs {@link #hasGlyphsToBreakDrawingIteration() have problems}
   * at the {@link #getFont() target font}.
   */
  @NotNull
  public TIntHashSet getSymbolsToBreakDrawingIteration() {
    if (!myCheckedForProblemGlyphs) {
      parseProblemGlyphs();
    }
    return mySymbolsToBreakDrawingIteration;
  }

  public boolean canDisplay(char c) {
    try {
      if (c < 128) return true;
      if (mySafeCharacters.contains(c)) return true;
      if (canDisplayImpl(c)) {
        mySafeCharacters.add(c);
        return true;
      }
      return false;
    }
    catch (Exception e) {
      // JRE has problems working with the font. Just skip.
      return false;
    }
  }

  private boolean canDisplayImpl(char c) {
    if (USE_ALTERNATIVE_CAN_DISPLAY_PROCEDURE) {
      return myFont.createGlyphVector(DUMMY_CONTEXT, new char[]{c}).getGlyphCode(0) > 0;
    }
    else {
      return myFont.canDisplay(c);
    }
  }

  public Font getFont() {
    return myFont;
  }

  public int charWidth(char c) {
    final FontMetrics metrics = fontMetrics();
    if (c < 128) return charWidth[c];
    return metrics.charWidth(c);
  }

  private FontMetrics fontMetrics() {
    if (myFontMetrics == null) {
      // We need to use antialising-aware font metrics because we've alrady encountered a situation when non-antialiased symbol
      // width is not equal to the antialiased one (IDEA-81539).
      final Graphics graphics = UIUtil.createImage(1, 1, BufferedImage.TYPE_INT_RGB).getGraphics();
      EditorUIUtil.setupAntialiasing(graphics);
      graphics.setFont(myFont);
      myFontMetrics = graphics.getFontMetrics();
      for (int i = 0; i < 128; i++) {
        charWidth[i] = myFontMetrics.charWidth(i);
      }
    }
    return myFontMetrics;
  }

  void reset() {
    myFontMetrics = null;
  }

  public int getSize() {
    return mySize;
  }

  @JdkConstants.FontStyle
  public int getStyle() {
    return myStyle;
  }
}


text:
// @link http://schemas.wbeme.com/json-schema/eme/users/request/search-users-response/1-0-0.json#
import GdbotsNcrSearchNodesResponseV1Mixin from '@gdbots/schemas/gdbots/ncr/mixin/search-nodes-response/SearchNodesResponseV1Mixin';
import GdbotsPbjxResponseV1Mixin from '@gdbots/schemas/gdbots/pbjx/mixin/response/ResponseV1Mixin';
import GdbotsPbjxResponseV1Trait from '@gdbots/schemas/gdbots/pbjx/mixin/response/ResponseV1Trait';
import Message from '@gdbots/pbj/Message';
import MessageResolver from '@gdbots/pbj/MessageResolver';
import Schema from '@gdbots/pbj/Schema';

export default class SearchUsersResponseV1 extends Message {
  /**
   * @private
   *
   * @returns {Schema}
   */
  static defineSchema() {
    return new Schema('pbj:eme:users:request:search-users-response:1-0-0', SearchUsersResponseV1,
      [],
      [
        GdbotsPbjxResponseV1Mixin.create(),
        GdbotsNcrSearchNodesResponseV1Mixin.create(),
      ],
    );
  }
}

GdbotsPbjxResponseV1Trait(SearchUsersResponseV1);
MessageResolver.register('eme:users:request:search-users-response', SearchUsersResponseV1);
Object.freeze(SearchUsersResponseV1);
Object.freeze(SearchUsersResponseV1.prototype);


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="Android API 19 Platform" project-jdk-type="Android SDK">
    <output url="file://$PROJECT_DIR$/output" />
  </component>
  <component name="SvnBranchConfigurationManager">
    <option name="mySupportsUserInfoFilter" value="true" />
  </component>
</project>


text:
export class LinkedList<T> {

    private first: LinkedListItem<T> = null;
    private last: LinkedListItem<T> = null;

    public add(item: T): void {
        let entry: LinkedListItem<T> = {
            item: item,
            next: null
        };
        if (this.last) {
            this.last.next = entry;
        } else {
            this.first = entry;
        }
        this.last = entry;
    }

    public remove(): T {
        let result = this.first;
        if (result) {
            this.first = result.next;
            if (!this.first) {
                this.last = null;
            }
        }
        return result.item;
    }

    public isEmpty(): boolean {
        return !this.first;
    }
}

class LinkedListItem<T> {
    item: T;
    next: LinkedListItem<T>;
}