text:
<?php

namespace Scene7\Commands;

use Scene7\Definitions\RenderIntents;

trait OutputColorProfile
{
    /**
     * @param string $object
     * @param string|null $renderIntent One of Definitions\OutputColorProfiles
     * @param bool|null $blackpointComp
     * @param bool|null $dither
     * @return $this
     */
    public function setOutputColorProfile($object, $renderIntent = null, $blackpointComp = null, $dither = null)
    {
        if (!in_array($renderIntent, $this->getAllowedRenderIntents())) {
            throw new \InvalidArgumentException('Invalid render intent');
        }

        $ocp = $object;

        if ($renderIntent !== null || $blackpointComp !== null || $dither !== null) {
            $ocp .= ',' . $renderIntent;
        }

        if ($blackpointComp !== null || $dither !== null) {
            $ocp .= ',' . (int) (bool) $blackpointComp;
        }

        if ($dither !== null) {
            $ocp .= ',' . (int) (bool) $dither;
        }

        $this->addCommand(['icc' => $ocp]);
        return $this;
    }

    public function getAllowedRenderIntents()
    {
        return [
            RenderIntents::ABSOLUTE,
            RenderIntents::PERCEPTUAL,
            RenderIntents::RELATIVE,
            RenderIntents::SATURATION,
        ];
    }
}


text:
var ReadPreference = require('./read_preference').ReadPreference
  , Base = require('./base').Base
  , inherits = require('util').inherits;

/**
 * Mongos constructor provides a connection to a mongos proxy including failover to additional servers
 *
 * Options
 *  - **socketOptions** {Object, default:null}, an object containing socket options to use (noDelay:(boolean), keepAlive:(number), connectTimeoutMS:(number), socketTimeoutMS:(number))
 *  - **ha** {Boolean, default:true}, turn on high availability, attempts to reconnect to down proxies
 *  - **haInterval** {Number, default:2000}, time between each replicaset status check.
 *
 * @class Represents a Mongos connection with failover to backup proxies
 * @param {Array} list of mongos server objects
 * @param {Object} [options] additional options for the mongos connection
 */
var Mongos = function Mongos(servers, options) {
  // Set up basic
  if(!(this instanceof Mongos))
    return new Mongos(servers, options);

  // Set up event emitter
  Base.call(this);

  // Throw error on wrong setup
  if(servers == null || !Array.isArray(servers) || servers.length == 0)
    throw new Error("At least one mongos proxy must be in the array");

  // Ensure we have at least an empty options object
  this.options = options == null ? {} : options;
  // Set default connection pool options
  this.socketOptions = this.options.socketOptions != null ? this.options.socketOptions : {};
  // Enabled ha
  this.haEnabled = this.options['ha'] == null ? true : this.options['ha'];
  // How often are we checking for new servers in the replicaset
  this.mongosStatusCheckInterval = this.options['haInterval'] == null ? 2000 : this.options['haInterval'];
  // Save all the server connections
  this.servers = servers;
  // Servers we need to attempt reconnect with
  this.downServers = [];
  // Just contains the current lowest ping time and server
  this.lowestPingTimeServer = null;
  this.lowestPingTime = 0;

  // Add options to servers
  for(var i = 0; i < this.servers.length; i++) {
    var server = this.servers[i];
    server._callBackStore = this._callBackStore;
    // Default empty socket options object
    var socketOptions = {host: server.host, port: server.port};
    // If a socket option object exists clone it
    if(this.socketOptions != null) {
      var keys = Object.keys(this.socketOptions);
      for(var k = 0; k < keys.length;k++) socketOptions[keys[i]] = this.socketOptions[keys[i]];
    }
    // Set socket options
    server.socketOptions = socketOptions;
  }
}

/**
 * @ignore
 */
inherits(Mongos, Base);

/**
 * @ignore
 */
Mongos.prototype.isMongos = function() {
  return true;
}

/**
 * @ignore
 */
Mongos.prototype.connect = function(db, options, callback) {
  if('function' === typeof options) callback = options, options = {};
  if(options == null) options = {};
  if(!('function' === typeof callback)) callback = null;
  var self = this;

  // Keep reference to parent
  this.db = db;
  // Set server state to connecting
  this._serverState = 'connecting';
  // Number of total servers that need to initialized (known servers)
  this._numberOfServersLeftToInitialize = this.servers.length;
  // Default to the first proxy server as the first one to use
  this._currentMongos = this.servers[0];

  // Connect handler
  var connectHandler = function(_server) {
    return function(err, result) {
      self._numberOfServersLeftToInitialize = self._numberOfServersLeftToInitialize - 1;

      if(self._numberOfServersLeftToInitialize == 0) {
        // Start ha function if it exists
        if(self.haEnabled) {
          // Setup the ha process
          self._replicasetTimeoutId = setTimeout(self.mongosCheckFunction, self.mongosStatusCheckInterval);
        }

        // Set the mongos to connected
        self._serverState = "connected";
        // Emit the open event
        self.db.emit("open", null, self.db);
        // Callback
        callback(null, self.db);
      }
    }
  };

  // Error handler
  var errorOrCloseHandler = function(_server) {
    return function(err, result) {
      // Create current mongos comparision
      var currentUrl = self._currentMongos.host + ":" + self._currentMongos.port;
      var serverUrl = this.host + ":" + this.port;
      // We need to check if the server that closed is the actual current proxy we are using, otherwise
      // just ignore
      if(currentUrl == serverUrl) {
        // Remove the server from the list
        if(self.servers.indexOf(_server) != -1) {
          self.servers.splice(self.servers.indexOf(_server), 1);
        }

        // Pick the next one on the list if there is one
        for(var i = 0; i < self.servers.length; i++) {
          // Grab the server out of the array (making sure there is no servers in the list if none available)
          var server = self.servers[i];
          // Generate url for comparision
          var serverUrl = server.host + ":" + server.port;
          // It's not the current one and connected set it as the current db
          if(currentUrl != serverUrl && server.isConnected()) {
            self._currentMongos = server;
            break;
          }
        }
      }

      // Ensure we don't store the _server twice
      if(self.downServers.indexOf(_server) == -1) {
        // Add the server instances
        self.downServers.push(_server);
      }
    }
  }

  // Mongo function
  this.mongosCheckFunction = function() {
    // If we have down servers let's attempt a reconnect
    if(self.downServers.length > 0) {
      var numberOfServersLeft = self.downServers.length;
      // Attempt to reconnect
      for(var i = 0; i < self.downServers.length; i++) {
        var downServer = self.downServers.pop();
        // Attemp to reconnect
        downServer.connect(self.db, {returnIsMasterResults: true}, function(_server) {
          // Return a function to check for the values
          return function(err, result) {
            // Adjust the number of servers left
            numberOfServersLeft = numberOfServersLeft - 1;

            if(err != null) {
              self.downServers.push(_server);
            } else {
              // Add server event handlers
              _server.on("close", errorOrCloseHandler(_server));
              _server.on("error", errorOrCloseHandler(_server));
              // Add to list of servers
              self.servers.push(_server);
            }

            if(numberOfServersLeft <= 0) {
              // Perfom another ha
              self._replicasetTimeoutId = setTimeout(self.mongosCheckFunction, self.mongosStatusCheckInterval);
            }
          }
        }(downServer));
      }
    } else if(self.servers.length > 0) {
      var numberOfServersLeft = self.servers.length;
      var _s = new Date().getTime()

      // Else let's perform a ping command
      for(var i = 0; i < self.servers.length; i++) {
        var executePing = function(_server) {
          // Get a read connection
          var _connection = _server.checkoutReader();
          // Execute ping command
          self.db.command({ping:1}, {connection:_connection}, function(err, result) {
            var pingTime = new Date().getTime() - _s;
            // If no server set set the first one, otherwise check
            // the lowest ping time and assign the server if it's got a lower ping time
            if(self.lowestPingTimeServer == null) {
              self.lowestPingTimeServer = _server;
              self.lowestPingTime = pingTime;
              self._currentMongos = _server;
            } else if(self.lowestPingTime > pingTime
                && (_server.host != self.lowestPingTimeServer.host || _server.port != self.lowestPingTimeServer.port)) {
              self.lowestPingTimeServer = _server;
              self.lowestPingTime = pingTime;
              self._currentMongos = _server;
            }

            // Number of servers left
            numberOfServersLeft = numberOfServersLeft - 1;
            // All active mongos's pinged
            if(numberOfServersLeft == 0) {
              // Perfom another ha
              self._replicasetTimeoutId = setTimeout(self.mongosCheckFunction, self.mongosStatusCheckInterval);
            }
          })
        }
        // Execute the function
        executePing(self.servers[i]);
      }
    } else {
      self._replicasetTimeoutId = setTimeout(self.mongosCheckFunction, self.mongosStatusCheckInterval);
    }
  }

  // Connect all the server instances
  for(var i = 0; i < this.servers.length; i++) {
    // Get the connection
    var server = this.servers[i];
    server.mongosInstance = this;
    // Add server event handlers
    server.on("close", errorOrCloseHandler(server));
    server.on("timeout", errorOrCloseHandler(server));
    server.on("error", errorOrCloseHandler(server));
    // Connect the instance
    server.connect(self.db, {returnIsMasterResults: true}, connectHandler(server));
  }
}

/**
 * @ignore
 * Just return the currently picked active connection
 */
Mongos.prototype.allServerInstances = function() {
  return this.servers;
}

/**
 * Always ourselves
 * @ignore
 */
Mongos.prototype.setReadPreference = function() {}

/**
 * @ignore
 */
Mongos.prototype.allRawConnections = function() {
  // Neeed to build a complete list of all raw connections, start with master server
  var allConnections = [];
  // Add all connections
  for(var i = 0; i < this.servers.length; i++) {
    allConnections = allConnections.concat(this.servers[i].allRawConnections());
  }

  // Return all the conections
  return allConnections;
}

/**
 * @ignore
 */
Mongos.prototype.isConnected = function() {
  return this._serverState == "connected";
}

/**
 * @ignore
 */
Mongos.prototype.checkoutWriter = function() {
  // No current mongo, just pick first server
  if(this._currentMongos == null && this.servers.length > 0) {
    return this.servers[0].checkoutWriter();
  }
  return this._currentMongos.checkoutWriter();
}

/**
 * @ignore
 */
Mongos.prototype.checkoutReader = function(read) {
  // If we have a read preference object unpack it
  if(typeof read == 'object' && read['_type'] == 'ReadPreference') {
    // Validate if the object is using a valid mode
    if(!read.isValid()) throw new Error("Illegal readPreference mode specified, " + read.mode);
  } else if(!ReadPreference.isValid(read)) {
    throw new Error("Illegal readPreference mode specified, " + read);
  }

  // No current mongo, just pick first server
  if(this._currentMongos == null && this.servers.length > 0) {
    return this.servers[0].checkoutReader();
  }
  return this._currentMongos.checkoutReader();
}

/**
 * @ignore
 */
Mongos.prototype.close = function(callback) {
  var self = this;
  // Set server status as disconnected
  this._serverState = 'disconnected';
  // Number of connections to close
  var numberOfConnectionsToClose = self.servers.length;
  // If we have a ha process running kill it
  if(self._replicasetTimeoutId != null) clearTimeout(self._replicasetTimeoutId);
  // Close all proxy connections
  for(var i = 0; i < self.servers.length; i++) {
    self.servers[i].close(function(err, result) {
      numberOfConnectionsToClose = numberOfConnectionsToClose - 1;
      // Callback if we have one defined
      if(numberOfConnectionsToClose == 0 && typeof callback == 'function') {
        callback(null);
      }
    });
  }
}

/**
 * @ignore
 * Return the used state
 */
Mongos.prototype._isUsed = function() {
  return this._used;
}

exports.Mongos = Mongos;

redpajama_set_name: RedPajamaGithub


text:
package nz.co.example.dev.integration.operation;

/**
 *
 */
public class DeleteWSipLayerTwoCircuit extends AbstractBaseOperationImpl {

    /**
     *
     */
    private static final long serialVersionUID = 790522421293410345L;

    public DeleteWSipLayerTwoCircuit(Object operand) {
        super(OperationType.DELETE, operand);
    }
}


text:
/* $Id$ */

package org.apache.fop.pdf;

// Java
import java.util.List;

/**
 * class representing an object which is a list of annotations.
 *
 * This PDF object is a list of references to /Annot objects. So far we
 * are dealing only with links.
 */
public class PDFAnnotList extends PDFObject {

    /**
     * the /Annot objects
     */
    private List links = new java.util.Vector();

    /**
     * add an /Annot object of /Subtype /Link.
     *
     * @param link the PDFLink to add.
     */
    public void addAnnot(PDFObject link) {
        this.links.add(link);
    }

    /**
     * get the count of /Annot objects
     *
     * @return the number of links
     */
    public int getCount() {
        return this.links.size();
    }

    /**
     * {@inheritDoc}
     */
    public String toPDFString() {
        StringBuffer p = new StringBuffer(128);
        p.append("[\n");
        for (int i = 0; i < getCount(); i++) {
            p.append(((PDFObject)links.get(i)).referencePDF());
            p.append("\n");
        }
        p.append("]");
        return p.toString();
    }

    /*
     * example
     * [
     * 19 0 R
     * ]
     */
}


text:
"""Cloud Datastore query splitter test."""

from __future__ import absolute_import

import unittest

import mock

# Protect against environments where datastore library is not available.
try:
  from apache_beam.io.gcp.datastore.v1new import helper
  from apache_beam.io.gcp.datastore.v1new import query_splitter
  from apache_beam.io.gcp.datastore.v1new import types
  from apache_beam.io.gcp.datastore.v1new.query_splitter import SplitNotPossibleError
  from google.cloud.datastore import key
  # Keep this import last so it doesn't import conflicting pb2 modules.
  from apache_beam.io.gcp.datastore.v1 import query_splitter_test  # pylint: disable=ungrouped-imports
  QuerySplitterTestBase = query_splitter_test.QuerySplitterTest

# TODO(BEAM-4543): Remove TypeError once googledatastore dependency is removed.
except (ImportError, TypeError):
  query_splitter = None
  SplitNotPossibleError = None
  QuerySplitterTestBase = unittest.TestCase

@unittest.skipIf(query_splitter is None, 'GCP dependencies are not installed')
class QuerySplitterTest(QuerySplitterTestBase):
  """v1new adaptation of QuerySplitterTest.

  NOTE: This test inherits test cases from QuerySplitterTestBase.
  Please prefer to add new test cases to v1/query_splitter_test if possible.
  """
  _PROJECT = 'project'
  _NAMESPACE = 'namespace'

  split_error = SplitNotPossibleError
  query_splitter = query_splitter

  def setUp(self):
    """Overrides base class version with skipIf() decorators."""

  def create_query(self, kinds=(), order=False, limit=None, offset=None,
                   inequality_filter=False):
    if len(kinds) > 1:
      self.skipTest('v1new queries do not support more than one kind.')
    if offset is not None:
      self.skipTest('v1new queries do not support offsets.')

    kind = None
    filters = []
    if kinds:
      kind = kinds[0]
    if order:
      order = ['prop1']
    if inequality_filter:
      filters = [('prop1', '>', 'value1')]

    return types.Query(kind=kind, filters=filters, order=order, limit=limit)

  def test_get_splits_query_with_num_splits_of_one(self):
    query = self.create_query()
    with self.assertRaisesRegexp(self.split_error, r'num_splits'):
      query_splitter.get_splits(None, query, 1)

  def test_create_scatter_query(self):
    query = types.Query(kind='shakespeare-demo')
    num_splits = 10
    scatter_query = query_splitter._create_scatter_query(query, num_splits)
    self.assertEqual(scatter_query.kind, query.kind)
    self.assertEqual(scatter_query.limit,
                     (num_splits -1) * query_splitter.KEYS_PER_SPLIT)
    self.assertEqual(scatter_query.order,
                     [query_splitter.SCATTER_PROPERTY_NAME])
    self.assertEqual(scatter_query.projection,
                     [query_splitter.KEY_PROPERTY_NAME])

  def check_get_splits(self, query, num_splits, num_entities,
                       unused_batch_size):
    """A helper method to test the query_splitter get_splits method.

    Args:
      query: the query to be split
      num_splits: number of splits
      num_entities: number of scatter entities returned to the splitter.
      unused_batch_size: ignored in v1new since query results are entirely
        handled by the Datastore client.
    """
    # Test for random long ids, string ids, and a mix of both.
    for id_or_name in [True, False, None]:
      if id_or_name is None:
        client_entities = helper.create_client_entities(num_entities, False)
        client_entities.extend(helper.create_client_entities(num_entities,
                                                             True))
        num_entities *= 2
      else:
        client_entities = helper.create_client_entities(num_entities,
                                                        id_or_name)

      mock_client = mock.MagicMock()
      mock_client_query = mock.MagicMock()
      mock_client_query.fetch.return_value = client_entities
      with mock.patch.object(
          types.Query, '_to_client_query', return_value=mock_client_query):
        split_queries = query_splitter.get_splits(
            mock_client, query, num_splits)

      mock_client_query.fetch.assert_called_once()
      # if request num_splits is greater than num_entities, the best it can
      # do is one entity per split.
      expected_num_splits = min(num_splits, num_entities + 1)
      self.assertEqual(len(split_queries), expected_num_splits)

      # Verify no gaps in key ranges. Filters should look like:
      # query1: (__key__ < key1)
      # query2: (__key__ >= key1), (__key__ < key2)
      # ...
      # queryN: (__key__ >=keyN-1)
      prev_client_key = None
      last_query_seen = False
      for split_query in split_queries:
        self.assertFalse(last_query_seen)
        lt_key = None
        gte_key = None
        for _filter in split_query.filters:
          self.assertEqual(query_splitter.KEY_PROPERTY_NAME, _filter[0])
          if _filter[1] == '<':
            lt_key = _filter[2]
          elif _filter[1] == '>=':
            gte_key = _filter[2]

        # Case where the scatter query has no results.
        if lt_key is None and gte_key is None:
          self.assertEqual(1, len(split_queries))
          break

        if prev_client_key is None:
          self.assertIsNone(gte_key)
          self.assertIsNotNone(lt_key)
          prev_client_key = lt_key
        else:
          self.assertEqual(prev_client_key, gte_key)
          prev_client_key = lt_key
          if lt_key is None:
            last_query_seen = True

  def test_id_or_name(self):
    id_ = query_splitter.IdOrName(1)
    self.assertEqual(1, id_.id)
    self.assertIsNone(id_.name)
    name = query_splitter.IdOrName('1')
    self.assertIsNone(name.id)
    self.assertEqual('1', name.name)
    self.assertEqual(query_splitter.IdOrName(1), query_splitter.IdOrName(1))
    self.assertEqual(query_splitter.IdOrName('1'), query_splitter.IdOrName('1'))
    self.assertLess(query_splitter.IdOrName(2), query_splitter.IdOrName('1'))
    self.assertLess(query_splitter.IdOrName(1), query_splitter.IdOrName(2))
    self.assertLess(query_splitter.IdOrName('1'), query_splitter.IdOrName('2'))

  def test_client_key_sort_key(self):
    k = key.Key('kind1', 1, project=self._PROJECT, namespace=self._NAMESPACE)
    k2 = key.Key('kind2', 'a', parent=k)
    k3 = key.Key('kind2', 'b', parent=k)
    k4 = key.Key('kind1', 'a', project=self._PROJECT, namespace=self._NAMESPACE)
    k5 = key.Key('kind1', 'a', project=self._PROJECT)
    keys = [k5, k, k4, k3, k2, k2, k]
    expected_sort = [k5, k, k, k2, k2, k3, k4]
    keys.sort(key=query_splitter.client_key_sort_key)
    self.assertEqual(expected_sort, keys)

  def test_client_key_sort_key_ids(self):
    k1 = key.Key('kind', 2, project=self._PROJECT)
    k2 = key.Key('kind', 1, project=self._PROJECT)
    keys = [k1, k2]
    expected_sort = [k2, k1]
    keys.sort(key=query_splitter.client_key_sort_key)
    self.assertEqual(expected_sort, keys)

  def test_client_key_sort_key_names(self):
    k1 = key.Key('kind', '2', project=self._PROJECT)
    k2 = key.Key('kind', '1', project=self._PROJECT)
    keys = [k1, k2]
    expected_sort = [k2, k1]
    keys.sort(key=query_splitter.client_key_sort_key)
    self.assertEqual(expected_sort, keys)

  def test_client_key_sort_key_ids_vs_names(self):
    # Keys with IDs always come before keys with names.
    k1 = key.Key('kind', '1', project=self._PROJECT)
    k2 = key.Key('kind', 2, project=self._PROJECT)
    keys = [k1, k2]
    expected_sort = [k2, k1]
    keys.sort(key=query_splitter.client_key_sort_key)
    self.assertEqual(expected_sort, keys)

# Hide base class from collection by nose.
del QuerySplitterTestBase

if __name__ == '__main__':
  unittest.main()


text:
package org.march.data.command;

import org.march.data.model.Command;
import org.march.data.model.Data;

public class Insert implements Command{

    private static final long serialVersionUID = -801997573780532462L;

    private int offset;
    private Data data;

    public Insert() {
		super();
	}

	public Insert(int offset, Data data) {
        super();
        this.offset = offset;
        this.data  = data;
    }

    public int getOffset() {
        return offset;
    }

    public void setOffset(int offset) {
        this.offset = offset;
    }

    public Data getData() {
        return data;
    }

    public void setData(Data data) {
        this.data = data;
    }

    public Command clone(){
        return new Insert(this.offset, this.data);
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((data == null) ? 0 : data.hashCode());
        result = prime * result + offset;
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Insert other = (Insert) obj;
        if (data == null) {
            if (other.data != null)
                return false;
        } else if (!data.equals(other.data))
            return false;
        if (offset != other.offset)
            return false;
        return true;
    }

    @Override
    public String toString() {
        return "Insert [offset=" + offset + ", data=" + data + "]";
    }

}


text:
FMNetworkImage
==============

An Async-Network-Image-Loader for iOS

After working with a few other alternatives, I ended up writing my own one.
Codes might be a little bit of ugly, but I aimed for performance in this. Especially in
table views, scrolling fast through images.

Features / News
===============

*14th October 2013:*

- Decoded Image Cache support added, Using [NSCache](https://developer.apple.com/library/ios/documentation/cocoa/reference/NSCache_Class/Reference/Reference.html)

**More About Decoded Image Cache**

```objc
// Note : You only need this in cases, where loaded images are bigger/smaller than the imageView, needs cropping/resizing.

// This will make FMNetworkImage crop & resize your image in background to fit your imageView
myImageview.netImage.fixImageCropResize = YES;

// This will make cropped/resized/decoded image to be cached (not to be confused with url cache, this is RAW Bitmap)
myImageview.netImage.cacheDecodedResults = YES;
```

The cache used here, will consume much more memory, but will be freed automatically when needed. All handled by [NSCache](https://developer.apple.com/library/ios/documentation/cocoa/reference/NSCache_Class/Reference/Reference.html) implementation of apple. Since the RAW Bitmap of resized image is cached, the UI Thread (Main Thread) will not deal with these and everything will work smoothly on UI.

When an image gets deleted from this cache, and you try to load that image again, it will be loaded from URL Cache, and will get decoded/resized/cropped/whatever again, which is still OK.

You should not use `fixImageCropResize` if you are going to resize that imageView randomly.

===

*13th October 2013:*

- Code converted to use a ImageView Category, `UIImageView+FMNetworkImage`, with Obj-C Associated Objects. *( Old code for separate view class is remaining, but is outdated now. )*
- Background resizing (respecting contentMode) for images with different size than imageView, eliminating glitches in UI when setting the image in the main thread.

===

*Originally:*

- Background Fetching
- Optional Delay before fetch
  *( So you use this to prevent loading an image for a cell that's gonna be displayed for 1.5 miliseconds ( not 1.5ms literally :/ ) )*
- Optional Cross-Fade after load
- Placeholder Image
- `(UIImage*)onLoad(UIImage* loadedImage)` hook using blocks
- Automatically changing between UIViewContent modes when showing loading image or placeholder image
- Making use of NSOperationQueue
- Background Decoding (ripoff from [SDWebImage](https://github.com/rs/SDWebImage), thanks for that)

Usage
=====

**Simply**
```objc
// on any UIImageView
myImageView.netImage.URL = [NSURL URLWithString:@"http://url.to/my/image"];
```

**Compatibility Shortcut**
```objc
myImageView.imageURL = [NSURL URLWithString:@"http://url.to/my/image"];
```

**Advanced Usage**
```objc
UIImageView* imageView = [UIImageView.alloc initWithFrame:CGRectInset(self.bounds, 10, 10)].autorelease;
imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth + UIViewAutoresizingFlexibleHeight;
imageView.backgroundColor = UIColor.darkGrayColor;
imageView.netImage.placeholderImage = [UIImage imageNamed:@"placeholder.png"];
imageView.netImage.placeholderContentMode = UIViewContentModeCenter;
imageView.netImage.loadedImageContentMode = UIViewContentModeScaleAspectFill;
imageView.netImage.crossfadeImages = YES;
imageView.netImage.delayBeforeLoading = 1.0 / 30.0;
imageView.netImage.fixImageCropResize = YES;
imageView.netImage.cacheDecodedResults = YES;
imageView.clipsToBounds = YES;

imageView.netImage.URL = @"http://url.to/my/image";
```

**UITableViewCell / UICollectionViewCell Notes**
```objc
- (void)prepareForReuse {
	imageView.netImage.URL = nil; // Sets image to placeholderImage or empty if no placeholder image is present.
}
```

Install
=======

Just Copy `UIImageView+FMNetworkImage.(m|h)` in your project. I don't like `bundle`,`composer`,`pip`,`pod`,`npm` at all.
I like `apt` though.

Notes
=====

 **DOESN'T** use ARC. If you're using ARC in your project, you'll need `-fno-objc-arc` for `UIImageView+FMNetworkImage.m` [need help?](http://stackoverflow.com/questions/6646052/how-can-i-disable-arc-for-a-single-file-in-a-project)

License
=======

 **INFORMATION DOES NOT BELONG TO ANY BODY**

 Just to prevent somebody claiming otherwise over this code, license for any other purpose
 than iOS Projects is [GPLv3](http://www.gnu.org/copyleft/gpl.html), but since you want
 to use this in your iOS project, *-only applies to iOS Projects-* [MIT License](http://opensource.org/licenses/MIT)
 rules apply. ( does it even work that way? ).

 I used and learned stuff from other libraries, [AsyncImageView](https://github.com/nicklockwood/AsyncImageView),
 [SDWebImage](https://github.com/rs/SDWebImage) as mentioned above, maybe a few more on this, I don't remember at all.


text:
namespace vast {

class port;

template <>
struct access::state<port> {
  template <typename T, typename F>
  static void call(T&& x, F f) {
    f(x.number_, x.type_);
  }
};

} // namespace vast

#endif


text:
package com.squarespace.less;

import static com.squarespace.less.model.Combinator.CHILD;
import static com.squarespace.less.model.Combinator.DESC;
import static com.squarespace.less.model.Combinator.SIB_ADJ;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotEquals;

import org.testng.annotations.Test;

import com.squarespace.less.core.LessHarness;
import com.squarespace.less.core.LessTestBase;
import com.squarespace.less.exec.ExecEnv;
import com.squarespace.less.model.Combinator;
import com.squarespace.less.model.Selector;
import com.squarespace.less.parse.LessSyntax;

public class SelectorTest extends LessTestBase {

  @Test
  public void testEquals() {
    assertEquals(selector(element(".x")), selector(element(".x")));
    assertEquals(selector(element(".x"), element(".y")), selector(element(".x"), element(".y")));

    assertNotEquals(selector(element(".x")), null);
    assertNotEquals(selector(element(".x")), prop("x"));
    assertNotEquals(selector(element(".x")), selector(element(".y")));
    assertNotEquals(selector(element(DESC, ".x")), selector(element(CHILD, ".x")));
    assertNotEquals(selector(element(null, ".x")), selector(element(CHILD, ".x")));
  }

  @Test
  public void testModelReprSafety() {
    selector(element(CHILD, ".foo"), element(".y")).toString();
  }

  @Test
  public void testRender() throws LessException {
    Selector sel = selector(element("li"), element(null, ".bar"), element(CHILD, "span"), element(null, ".foo"),
          element(DESC, "baz"));

    assertEquals(render(false, sel), "li.bar > span.foo baz");
    assertEquals(render(true, sel), "li.bar>span.foo baz");

    sel = selector(element("p"), element(null, ".para"), element(SIB_ADJ, "span"), element(null, ".word"),
        element(DESC, "b"));

    assertEquals(render(false, sel), "p.para + span.word b");
    assertEquals(render(true, sel), "p.para+span.word b");
  }

  @Test
  public void testParse() throws LessException {
    LessHarness h = new LessHarness(LessSyntax.SELECTOR);

    h.parseEquals("p", selector(element(DESC, "p")));
    h.parseEquals("> p", selector(element(Combinator.CHILD, "p")));
    h.parseEquals("+ p.class", selector(element(Combinator.SIB_ADJ, "p"), element(null, ".class")));

    Selector exp = selector(element("p"), attr(null, "class", "~=", quoted('"', false, "a")));
    h.parseEquals("p[class~=\"a\"]", exp);
  }

  @Test
  public void testWildcardNoAncestors() throws LessException {
    LessHarness h = new LessHarness(LessSyntax.STYLESHEET);
    LessOptions opts = new LessOptions(true);
    assertEquals(h.execute(".ruleset & & & { color: red; }"), ".ruleset {\n  color: red;\n}\n");
    assertEquals(h.execute(".ruleset & & & { color: red; }", opts), ".ruleset{color:red}");
  }

  private String render(boolean compress, Selector selector) throws LessException {
    LessContext ctx = new LessContext(new LessOptions(compress));
    ExecEnv env = ctx.newEnv();
    return env.context().render(selector);
  }

}


text:
package com.biggis.storm.bolt;

import backtype.storm.task.OutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseRichBolt;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Tuple;
import backtype.storm.tuple.Values;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * SplitterBolt
 */
public class SplitterBolt extends BaseRichBolt {

    private static final Logger LOG = LoggerFactory.getLogger(SplitterBolt.class);
    private OutputCollector collector;

    public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {

        this.collector = outputCollector;
    }

    public void execute(Tuple tuple) {

        // get tuples from KafkaSpout
        String [] words = tuple.getString(0).split("\\s+");

        for (int i = 0; i < words.length; i++) {
            // check fo non-word character and replace
            words[i] = words[i].replaceAll("[^\\w]", "");

            // emit words and acknowledge processed tuple
            collector.emit(tuple, new Values(words[i]));
            collector.ack(tuple);
        }
    }

    public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
        outputFieldsDeclarer.declare(new Fields("word"));
    }
}


text:
#ifndef RESOURCE_H
#define RESOURCE_H

#include <QDebug>
#include <QString>

#define PACKAGE "qbrew"
#define VERSION "0.4.1"

// some stuff to differentiate between platforms
#if defined(Q_WS_X11)
#define QDIR_HOME   QDir::homePath()
#elif defined(Q_WS_MACX)
#define QDIR_HOME   QDir::homePath()
#else
#define QDIR_HOME   QDir::currentPath()
#endif

namespace Resource {

///////////////////////////////////////////////////////////////////
// general application values

const QByteArray TITLE        = "QBrew";
const QByteArray DESCRIPTION  = QT_TRANSLATE_NOOP("description",
                                "A Homebrewer's Recipe Calculator");
const QByteArray COPYRIGHT    = QT_TRANSLATE_NOOP("copyright",
                                "Copyright 1999-2008");
const QByteArray AUTHOR       = "David Johnson";
const QByteArray AUTHOR_EMAIL = "david@usermode.org";
const QByteArray CONTRIBUTORS = "Lee Henderson, "
                                "Rob Hudson, "
                                "Abe Kabakoff, "
                                "Stephen Lowrie, "
                                "Michal Palczewski, "
                                "Kevin Pullin, "
                                "Tobias Quathamer";

const QByteArray READY        = QT_TRANSLATE_NOOP("message",
                                "Ready");

const QChar DEGREE            = QChar(0xB0);  // ISO 8859-1

///////////////////////////////////////////////////////////////////
// file locations and stuff

const QByteArray FILE_EXT        = PACKAGE;
const QByteArray FILE_FILTER     = QT_TRANSLATE_NOOP("file filter",
                                   "QBrew files (*.qbrew)");
const QByteArray TEXT_FILTER     = QT_TRANSLATE_NOOP("file filter",
                                   "Text files (*.txt)");
const QByteArray HTML_FILTER     = QT_TRANSLATE_NOOP("file filter",
                                   "HTML files (*.html *.htm)");
const QByteArray BEERXML_FILTER  = QT_TRANSLATE_NOOP("file filter",
                                   "BeerXML recipes (*.xml)");
const QByteArray PDF_FILTER      = QT_TRANSLATE_NOOP("file filter",
                                   "PDF files (*.pdf)");
const QByteArray ALL_FILTER      = QT_TRANSLATE_NOOP("file filter",
                                   "All files (*)");
const QByteArray OPEN_FILTER     = QT_TRANSLATE_NOOP("file filter",
                                   FILE_FILTER + ";;"
                                   + BEERXML_FILTER + ";;"
                                   + ALL_FILTER);
const QByteArray SAVE_FILTER     = QT_TRANSLATE_NOOP("file filter",
                                   FILE_FILTER + ";;"
                                   + ALL_FILTER);
const QByteArray EXPORT_FILTER   = QT_TRANSLATE_NOOP("file filter",
                                   HTML_FILTER + ";;"
                                   + BEERXML_FILTER + ";;"
                                   + PDF_FILTER + ";;"
                                   + TEXT_FILTER);

const QByteArray DATA_FILE       = "qbrewdata";
const QByteArray HELP_FILE       = "book/handbook-index.html";
const QByteArray PRIMER_FILE     = "primer/primer.html";
const QByteArray DEFAULT_FILE    = QT_TRANSLATE_NOOP("file name", "untitled");

// previous valid data formats
const QByteArray RECIPE_PREVIOUS = "0.1.7";
const QByteArray DATA_PREVIOUS   = "0.3.0";

///////////////////////////////////////////////////////////////////
// configuration strings

const QByteArray CONFGROUP_WINDOW      = "/window";
const QByteArray CONF_WIN_STATUSBAR    = "/statusbar";
const QByteArray CONF_WIN_MAINWINDOW   = "/mainwindow";
const QByteArray CONF_WIN_SIZE         = "/size";

const QByteArray CONFGROUP_GENERAL     = "/general";
const QByteArray CONF_GEN_LOOK_FEEL    = "/lookfeel";
const QByteArray CONF_GEN_SHOW_SPLASH  = "/showsplash";
const QByteArray CONF_GEN_AUTOSAVE     = "/autosave";
const QByteArray CONF_GEN_SAVEINTERVAL = "/saveinterval";
const QByteArray CONF_GEN_AUTOBACKUP   = "/autobackup";
const QByteArray CONF_GEN_LOADLAST     = "/loadlast";
const QByteArray CONF_GEN_RECENTFILES  = "/recentfiles";
const QByteArray CONF_GEN_RECENTNUM    = "/recentnum";

const QByteArray CONFGROUP_RECIPE       = "/recipedefaults";
const QByteArray CONF_RECIPE_BATCH      = "/batch";
const QByteArray CONF_RECIPE_STYLE      = "/style";
 const QByteArray CONF_RECIPE_HOPFORM    = "/hopform"; // TODO: deprecated 0.4.0
const QByteArray CONF_RECIPE_HOPTYPE    = "/hoptype";

const QByteArray CONFGROUP_CALC         = "/calc";
const QByteArray CONF_CALC_STEEPYIELD   = "/steepyield";
const QByteArray CONF_CALC_EFFICIENCY   = "/efficiency";
const QByteArray CONF_CALC_MOREY        = "/morey";
const QByteArray CONF_CALC_TINSETH      = "/tinseth";
const QByteArray CONF_CALC_UNITS        = "/units";

//////////////////////////////////////////////////////////////////////////////
// XML Format Strings (need to be QString)

const QString tagRecipe             = "recipe";
const QString attrApplication       = "application";
const QString attrGenerator         = "generator";
const QString tagTitle              = "title";
const QString tagBrewer             = "brewer";
const QString tagBatch              = "batch";
const QString tagNotes              = "notes";
const QString attrClass             = "class";
const QString classRecipe           = tagRecipe;
const QString classBatch            = tagBatch;

const QString tagDoc                = "qbrewdata";
const QString attrVersion           = "version";
const QString tagStyles             = "styles";
const QString tagStyle              = "style";
const QString attrOGLow             = "oglow";
const QString attrOGHigh            = "oghigh";
const QString attrFGLow             = "fglow";
const QString attrFGHigh            = "fghigh";
const QString attrIBULow            = "ibulow";
const QString attrIBUHigh           = "ibuhigh";
const QString attrSRMLow            = "srmlow";
const QString attrSRMHigh           = "srmhigh";
const QString tagGrains             = "grains";
const QString tagGrain              = "grain";
const QString attrQuantity          = "quantity";
const QString attrSize              = "size"; // TODO: deprecated
const QString attrExtract           = "extract";
const QString attrColor             = "color";
const QString attrType              = "type";
const QString attrUse               = "use";
const QString tagHops               = "hops";
const QString tagHop                = "hop";
const QString attrForm              = "form";
const QString attrAlpha             = "alpha";
const QString attrTime              = "time";
const QString tagMiscs              = "miscingredients"; // TODO: rename
const QString tagMisc               = "miscingredient";
const QString attrNotes             = "notes";
const QString tagUtilization        = "utilization";
const QString tagEntry              = "entry";
const QString attrUtil              = "util";

// BeerXML Format Strings

// TODO: see if I can use lowercase, converting on the fly during import/export
const QString beerXMLVersion        = "1";
const QString tagRECIPES            = "RECIPES";
const QString tagRECIPE             = "RECIPE";
const QString tagNAME               = "NAME";
const QString tagVERSION            = "VERSION";
const QString tagTYPE               = "TYPE";
const QString tagSTYLE              = "STYLE";
const QString tagBREWER             = "BREWER";
const QString tagBATCHSIZE          = "BATCH_SIZE";
const QString tagEFFICIENCY         = "EFFICIENCY";
const QString tagFERMENTABLES       = "FERMENTABLES";
const QString tagFERMENTABLE        = "FERMENTABLE";
const QString tagHOPS               = "HOPS";
const QString tagHOP                = "HOP";
const QString tagYEASTS             = "YEASTS";
const QString tagYEAST              = "YEAST";
const QString tagMISCS              = "MISCS";
const QString tagMISC               = "MISC";
const QString tagNOTES              = "NOTES";
const QString tagTASTENOTES         = "TASTE_NOTES";
const QString tagWATERS             = "WATERS";

const QString tagOGMIN              = "OG_MIN";
const QString tagOGMAX              = "OG_MAX";
const QString tagFGMIN              = "FG_MIN";
const QString tagFGMAX              = "FG_MAX";
const QString tagIBUMIN             = "IBU_MIN";
const QString tagIBUMAX             = "IBU_MAX";
const QString tagCOLORMIN           = "COLOR_MIN";
const QString tagCOLORMAX           = "COLOR_MAX";

const QString tagAMOUNT             = "AMOUNT";
const QString tagAMOUNTISWEIGHT     = "AMOUNT_IS_WEIGHT";
const QString tagYIELD              = "YIELD";
const QString tagCOLOR              = "COLOR";

const QString tagALPHA              = "ALPHA";
const QString tagUSE                = "USE";
const QString tagTIME               = "TIME";
const QString tagFORM               = "FORM";

///////////////////////////////////////////////////////////////////
// Misc

const QByteArray UNIT_METRIC        = QT_TRANSLATE_NOOP("units", "Metric");
const QByteArray UNIT_US            = QT_TRANSLATE_NOOP("units", "US");

}; // namespace Resource

#endif // RESOURCE_H


text:
MessagePack for C/C++
=====================
Binary-based efficient object serialization library.

## Installation

Download latest package from [releases of MessagePack](http://sourceforge.net/projects/msgpack/files/) and extract it.

On UNIX-like platform, run ./configure && make && sudo make install:

    $ ./configure
    $ make
    $ sudo make install

On Windows, open msgpack_vc8.vcproj or msgpack_vc2008 file and build it using batch build. DLLs are built on lib folder,
and the headers are built on include folder.

To use the library in your program, include msgpack.hpp header and link "msgpack" library.

## Example
```CPP
#include <msgpack.hpp>
#include <vector>

int main(void) {
    // This is target object.
    std::vector<std::string> target;
    target.push_back("Hello,");
    target.push_back("World!");

    // Serialize it.
    msgpack::sbuffer sbuf;  // simple buffer
    msgpack::pack(&sbuf, target);

    // Deserialize the serialized data.
    msgpack::unpacked msg;    // includes memory pool and deserialized object
    msgpack::unpack(&msg, sbuf.data(), sbuf.size());
    msgpack::object obj = msg.get();

    // Print the deserialized object to stdout.
    std::cout << obj << std::endl;    // ["Hello," "World!"]

    // Convert the deserialized object to staticaly typed object.
    std::vector<std::string> result;
    obj.convert(&result);

    // If the type is mismatched, it throws msgpack::type_error.
    obj.as<int>();  // type is mismatched, msgpack::type_error is thrown
}
```

See [QuickStart for C](QUICKSTART-C.md) and [QuickStart for C++](QUICKSTART-CPP.md) for other example codes.

## License

    Copyright (C) 2008-2010 FURUHASHI Sadayuki

       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

           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.

See also NOTICE file.


text:
@interface PodsDummy_Pods_SmartMall : NSObject
@end
@implementation PodsDummy_Pods_SmartMall
@end


text:
.IntroductionDemos {
    & .ComponentDemo.section {
        padding: 0 !important;
        border: none !important;
    }
    & .flex-container {
        border-top: 1px solid #d8d8d8;
        box-shadow: none !important;
    }
    & .demo-area {
        background: none !important;
        & > .ComponentDemo.padded { padding: 0 !important; }
    }
}


text:
/* 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
 *
 *      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.
 */
package org.flowable.cmmn.converter;

import javax.xml.stream.XMLStreamReader;

import org.apache.commons.lang3.StringUtils;
import org.flowable.cmmn.model.CmmnElement;
import org.flowable.cmmn.model.HumanTask;

/**
 * @author Tijs Rademakers
 */
public class HumanTaskXmlConverter extends TaskXmlConverter {

    @Override
    public String getXMLElementName() {
        return CmmnXmlConstants.ELEMENT_HUMAN_TASK;
    }

    @Override
    protected CmmnElement convert(XMLStreamReader xtr, ConversionHelper conversionHelper) {
        HumanTask task = new HumanTask();
        convertCommonTaskAttributes(xtr, task);

        task.setAssignee(xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE, CmmnXmlConstants.ATTRIBUTE_ASSIGNEE));
        task.setOwner(xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE, CmmnXmlConstants.ATTRIBUTE_OWNER));
        task.setPriority(xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE, CmmnXmlConstants.ATTRIBUTE_PRIORITY));
        task.setFormKey(xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE, CmmnXmlConstants.ATTRIBUTE_FORM_KEY));
        task.setDueDate(xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE, CmmnXmlConstants.ATTRIBUTE_DUE_DATE));
        task.setCategory(xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE, CmmnXmlConstants.ATTRIBUTE_CATEGORY));

        String candidateUsersString = xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE, CmmnXmlConstants.ATTRIBUTE_CANDIDATE_USERS);
        if (StringUtils.isNotEmpty(candidateUsersString)) {
            String[] candidateUsers = candidateUsersString.split(",");
            for (String candidateUser : candidateUsers) {
                task.getCandidateUsers().add(candidateUser);
            }
        }

        String candidateGroupsString = xtr.getAttributeValue(CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE, CmmnXmlConstants.ATTRIBUTE_CANDIDATE_GROUPS);
        if (StringUtils.isNotEmpty(candidateGroupsString)) {
            String[] candidateGroups = candidateGroupsString.split(",");
            for (String candidateGroup : candidateGroups) {
                task.getCandidateGroups().add(candidateGroup);
            }
        }

        return task;
    }

}


text:
package org.camunda.bpm.engine.impl.persistence.entity;

import java.util.List;

import org.camunda.bpm.engine.management.IncidentStatistics;
import org.camunda.bpm.engine.management.ProcessDefinitionStatistics;

public class ProcessDefinitionStatisticsEntity extends ProcessDefinitionEntity implements ProcessDefinitionStatistics {

  protected static final long serialVersionUID = 1L;
  protected int instances;
  protected int failedJobs;
  protected List<IncidentStatistics> incidentStatistics;

  public int getInstances() {
    return instances;
  }
  public void setInstances(int instances) {
    this.instances = instances;
  }
  public int getFailedJobs() {
    return failedJobs;
  }
  public void setFailedJobs(int failedJobs) {
    this.failedJobs = failedJobs;
  }
  public List<IncidentStatistics> getIncidentStatistics() {
    return incidentStatistics;
  }
  public void setIncidentStatistics(List<IncidentStatistics> incidentStatistics) {
    this.incidentStatistics = incidentStatistics;
  }

  @Override
  public String toString() {
    return this.getClass().getSimpleName()
           + "[instances=" + instances
           + ", failedJobs=" + failedJobs
           + ", id=" + id
           + ", deploymentId=" + deploymentId
           + ", description=" + description
           + ", historyLevel=" + historyLevel
           + ", category=" + category
           + ", hasStartFormKey=" + hasStartFormKey
           + ", diagramResourceName=" + diagramResourceName
           + ", key=" + key
           + ", name=" + name
           + ", resourceName=" + resourceName
           + ", revision=" + revision
           + ", version=" + version
           + ", suspensionState=" + suspensionState
           + "]";
  }
}


text:
package cn.hicc.suguan.dormitory.activity;

import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.design.widget.TabLayout;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.bigkoo.pickerview.OptionsPickerView;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

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

import cn.hicc.suguan.dormitory.R;
import cn.hicc.suguan.dormitory.adapter.MyFragmentPagerAdapter;
import cn.hicc.suguan.dormitory.fragment.LeaderAcademyFragment;
import cn.hicc.suguan.dormitory.fragment.LeaderBasisFragment;
import cn.hicc.suguan.dormitory.fragment.LeaderDivisionFragment;
import cn.hicc.suguan.dormitory.fragment.LeaderDorCheckStateFragment;
import cn.hicc.suguan.dormitory.fragment.LeaderDorFragment;
import cn.hicc.suguan.dormitory.model.Score;
import cn.hicc.suguan.dormitory.utils.Constant;
import cn.hicc.suguan.dormitory.utils.Logs;
import cn.hicc.suguan.dormitory.utils.SpUtil;
import cn.hicc.suguan.dormitory.utils.ToastUtil;
import cn.hicc.suguan.dormitory.utils.URL;
import cn.hicc.suguan.dormitory.utils.Utils;
import cn.hicc.suguan.dormitory.view.ScrollViewPager;
import okhttp3.Call;

/**
 * 领导界面
 */

public class LeaderActivity extends MainBaseActivity {

    private ProgressDialog mProgressDialog;
    private int weekCode;
    private String dateType = "week";
    private List<Score> mAcademyScoreList = new ArrayList<>();
    private List<Score> mGradeScoreList = new ArrayList<>();
    private List<Score> mSexScoreList = new ArrayList<>();
    private List<Score> mCheckTypeScoreList = new ArrayList<>();
    private List<Score> mDorScoreList = new ArrayList<>();
    private List<Score> mDivisionScoreList = new ArrayList<>();
    private ScrollViewPager viewpager;
    private MyFragmentPagerAdapter adapter;
    private ArrayList<Integer> weekNum;
    private ArrayList<Integer> monthNum;
    private int currentWeekCode;
    private int currentMonth;

    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            switch (msg.what) {
                // 解析数据成功
                case 0:
                    setUI();
                    closeDialog();
                    break;
                // 获取数据失败
                case 1:
                    ToastUtil.showShort("获取数据失败");
                    closeDialog();
                    break;
                // 解析异常
                case 2:
                    ToastUtil.showShort("解析数据失败");
                    closeDialog();
                    break;
                // 无数据
                case 3:
                    setUINoData();
                    closeDialog();
                    break;
            }
        }
    };

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

        Intent intent = getIntent();
        weekCode = intent.getIntExtra("weekCode", 0);
        currentWeekCode = weekCode;
        currentMonth = Utils.getMonth();

        initView();

        // 初始化选择器数据
        initPickerViewData();

        initData();
    }

    // 当获取到数据后,在设置viewpager适配器
    private void setUI() {
        LeaderBasisFragment b = (LeaderBasisFragment) adapter.getItem(0);
        b.setData(weekCode,mGradeScoreList,mSexScoreList,mCheckTypeScoreList,dateType);

        LeaderDivisionFragment d = (LeaderDivisionFragment) adapter.getItem(1);
        d.setData(weekCode,mDivisionScoreList,dateType);

        LeaderAcademyFragment a = (LeaderAcademyFragment) adapter.getItem(2);
        a.setData(weekCode,mAcademyScoreList,dateType);

        LeaderDorFragment dor = (LeaderDorFragment) adapter.getItem(3);
        dor.setData(weekCode,mDorScoreList,dateType);
    }

    // 当获取到数据后,调取fragment方法更新数据
    private void setUINoData() {
        LeaderBasisFragment b = (LeaderBasisFragment) adapter.getItem(0);
        b.clearData();

        LeaderDivisionFragment d = (LeaderDivisionFragment) adapter.getItem(1);
        d.clearData();

        LeaderAcademyFragment a = (LeaderAcademyFragment) adapter.getItem(2);
        a.clearData();

        LeaderDorFragment dor = (LeaderDorFragment) adapter.getItem(3);
        dor.clearData();
    }

    // 获取数据
    private void initData() {
        showDialog();
        mAcademyScoreList.clear();
        mGradeScoreList.clear();
        mSexScoreList.clear();
        mCheckTypeScoreList.clear();
        mDorScoreList.clear();
        mDivisionScoreList.clear();
        OkHttpUtils
                .get()
                .url(URL.LEADER_CHECK_SCORE)
                .addParams("weekCode",weekCode+"")
                .addParams("dateType",dateType)
                .build()
                .execute(new StringCallback() {
                    @Override
                    public void onError(Call call, Exception e, int id) {
                        ToastUtil.showShort("获取数据失败,请稍后重试");
                        Logs.e("获取数据失败:"+e.toString());
                        closeDialog();
                    }

                    @Override
                    public void onResponse(String response, int id) {
                        // 解析json
                        resolveJson(response);
                    }
                });
    }

    // 解析json
    private void resolveJson(final String response) {
        new Thread(){
            @Override
            public void run() {
                super.run();
                try {
                    JSONObject jsonObject = new JSONObject(response);
                    if (jsonObject.getBoolean("flag")) {
                        JSONArray data = jsonObject.getJSONArray("data");
                        for (int i=0; i<data.length(); i++) {
                            JSONObject info = data.getJSONObject(i);
                            String classCodes = info.getString("classCodes");
                            String avgs = info.getString("avgSocre");
                            double avgScore = 0;
                            if (!avgs.equals("")) {
                                avgScore = Double.parseDouble(avgs);
                            }
                            Score score = new Score(info.getString("className"), avgScore);
                            switch (classCodes) {
                                // 检查类型
                                case "Description":
                                    mCheckTypeScoreList.add(score);
                                    break;
                                // 宿舍楼平均成绩信息
                                case "DormitoryBuilding":
                                    mDorScoreList.add(score);
                                    break;
                                // 书院平均成绩信息
                                case "Academy":
                                    mAcademyScoreList.add(score);
                                    break;
                                // 年级平均成绩信息
                                case "TimesCode":
                                    mGradeScoreList.add(score);
                                    break;
                                // 性别平均成绩信息
                                case "Gender":
                                    mSexScoreList.add(score);
                                    break;
                                // 学部平均成绩信息
                                case "Division":
                                    mDivisionScoreList.add(score);
                                    break;
                            }
                        }
                        if (data.length() > 0) {
                            // 请求数据成功
                            mHandler.sendEmptyMessage(0);
                        } else {
                            // 无数据
                            mHandler.sendEmptyMessage(3);
                        }

                    } else {
                        // 请求数据失败
                        mHandler.sendEmptyMessage(1);
                        Logs.e("服务器请求失败");
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                    mHandler.sendEmptyMessage(2);
                    Logs.e("解析异常:"+e.toString());
                }
            }
        }.start();
    }

    private void initView() {
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle(SpUtil.getString(Constant.ASSISTANT_NAME));
        setSupportActionBar(toolbar);

        // 初始化viewpager
        viewpager = (ScrollViewPager) findViewById(R.id.viewpager);
        // 设置viewpager是否禁止滑动
        viewpager.setNoScroll(true);
        viewpager.setOffscreenPageLimit(5); // 设置预加载个数
        // 初始化viewpager
        adapter = new MyFragmentPagerAdapter(getSupportFragmentManager());
        adapter.addFrag(new LeaderBasisFragment(),"基础项目成绩对比");
        adapter.addFrag(new LeaderDivisionFragment(),"学部成绩对比");
        adapter.addFrag(new LeaderAcademyFragment(),"书院成绩对比");
        adapter.addFrag(new LeaderDorFragment(),"宿舍楼成绩对比");
        adapter.addFrag(new LeaderDorCheckStateFragment(),"本周查宿情况");
        viewpager.setAdapter(adapter);

        // 初始化tablayout
        TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
        tabLayout.setSelectedTabIndicatorColor(Color.parseColor("#9AB4E2"));
        tabLayout.setupWithViewPager(viewpager);
    }

    private void showDialog() {
        if (mProgressDialog == null) {
            mProgressDialog = new ProgressDialog(this);
        }
        mProgressDialog.setMessage("加载数据中...");
        mProgressDialog.setCanceledOnTouchOutside(false);
        mProgressDialog.show();
    }

    private void closeDialog() {
        if (mProgressDialog != null) {
            mProgressDialog.dismiss();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_leader, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        // 灵活查询
        /*if (id == R.id.action_flexible) {
            startActivity(new Intent(this, LeaderFlexibleActivity.class));
            return true;
        }*/
        if (id == R.id.action_exit) {
            SpUtil.remove(Constant.PASSWORD);
            SpUtil.remove(Constant.ASSISTANT_NAME);
            SpUtil.remove(Constant.IS_LOGIN);
            startActivity(new Intent(this, LoginActivity.class));
            finish();
            return true;
        }
        // 选择周数
        if (id == R.id.action_week) {
            showWeekPickerView();
            return true;
        }
        // 选择月份
        /*if (id == R.id.action_month) {
            showMonthPickerView();
            return true;
        }*/
        return super.onOptionsItemSelected(item);
    }

    // 设置选择器数据
    private void initPickerViewData() {
        weekNum = new ArrayList<>();
        for (int i=1; i<=17;i++) {
            weekNum.add(i);
        }

        monthNum = new ArrayList<>();
        for (int i=1; i<=12; i++) {
            monthNum.add(i);
        }
    }

    // 显示周数选择器
    private void showWeekPickerView() {
        //条件选择器
        OptionsPickerView pvOptions = new OptionsPickerView.Builder(this, new OptionsPickerView.OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int options1, int option2, int options3, View v) {
                //返回的分别是三个级别的选中位置
                weekCode = weekNum.get(options1);
                dateType = "week";

                // 重新获取分数
                initData();
            }
        }).setTitleText("选择周数(本周第"+currentWeekCode+"周)")
                .setTitleSize(14)
                .build();

        pvOptions.setSelectOptions(currentWeekCode-1);
        pvOptions.setPicker(weekNum);
        pvOptions.show();
    }

    // 显示月数选择器
    private void showMonthPickerView() {
        //条件选择器
        OptionsPickerView pvOptions = new OptionsPickerView.Builder(this, new OptionsPickerView.OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int options1, int option2, int options3, View v) {
                //返回的分别是三个级别的选中位置
                weekCode = monthNum.get(options1);
                dateType = "month";

                // 重新获取分数
                initData();
            }
        }).setTitleText("选择月份(本月"+currentMonth+"月)")
                .setTitleSize(14)
                .build();

        pvOptions.setSelectOptions(currentMonth-1);
        pvOptions.setPicker(monthNum);
        pvOptions.show();
    }
}


text:
set -e
# Check unset variables
set -u
# Print commands
set -x

if [ "${CI:-}" == "bootstrap" ]; then
    # Use the provided pull head sha, from prow.
    GIT_SHA="${PULL_PULL_SHA}"
    # Using fixed directory for bazel cache
    ISTIO_TMP_DIR="${GOPATH}/src/istio.io/istio"
    mkdir -p "${ISTIO_TMP_DIR}"
  else
    # Use the current commit.
    GIT_SHA="$(git rev-parse --verify HEAD)"
    ISTIO_TMP_DIR="$(mktemp -d istio-XXXXX)"
fi

echo "=== Clone istio/istio ==="
git clone --depth 1 https://github.com/istio/istio "${ISTIO_TMP_DIR}"
cd "${ISTIO_TMP_DIR}"

HUB="gcr.io/istio-testing"
BUCKET="istio-artifacts"
ARTIFACTS_DIR="${GOPATH}/src/github.com/istio/mixer/_artifacts"

echo "=== Smoke Test ==="
# Note: These tests use the default ~/.kube/config file. The prow container mounts the test cluster
# kubeconfig at this path. On the other hand, when running this script locally, the test framework
# uses your current kube context!
#
# In the future, this should be parameterized similarly to the integration tests, with the kubeconfig
# location specified explicitly.
./tests/e2e.sh \
    --mixer_hub="${HUB}" \
    --mixer_tag="${GIT_SHA}" \
    --test_logs_path="${ARTIFACTS_DIR}" \
    --log_provider='stackdriver' \
    --project_id='istio-testing'

rm -rf "${ISTIO_TMP_DIR}"


text:
// Copyright (C) 2013 The Android Open Source Project
//
// 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
//
// 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.

package com.google.gerrit.server.query.change;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gerrit.server.query.QueryParseException;

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

/**
 * This class is used to extract comma separated values in a predicate.
 *

 * If tags for the values are present (e.g. "branch=jb_2.3,vote=approved") then
 * the args are placed in a map that maps tag to value (e.g., "branch" to "jb_2.3").
 * If no tag is present (e.g. "jb_2.3,approved") then the args are placed into a
 * positional list.  Args may be mixed so some may appear in the map and others
 * in the positional list (e.g. "vote=approved,jb_2.3).
 */
public class PredicateArgs {
  public List<String> positional;
  public Map<String, String> keyValue;

  /**
   * Parses query arguments into {@link #keyValue} and/or {@link #positional}..
   *

   * Labels for these arguments should be kept in ChangeQueryBuilder
   * as {@code ARG_ID_{argument name}}.
   *
   * @param args arguments to be parsed
   * @throws QueryParseException
   */
  PredicateArgs(String args) throws QueryParseException {
    positional = Lists.newArrayList();
    keyValue = Maps.newHashMap();

    String[] splitArgs = args.split(",");

    for (String arg : splitArgs) {
      String[] splitKeyValue = arg.split("=");

      if (splitKeyValue.length == 1) {
        positional.add(splitKeyValue[0]);
      } else if (splitKeyValue.length == 2) {
        if (!keyValue.containsKey(splitKeyValue[0])) {
          keyValue.put(splitKeyValue[0], splitKeyValue[1]);
        } else {
          throw new QueryParseException("Duplicate key " + splitKeyValue[0]);
        }
      } else {
        throw new QueryParseException("invalid arg " + arg);
      }
    }
  }
}


text:
DEFINE_int32(answer, 42, "Human-readable flag description.");
DEFINE_string(question, "six by nine", "Another human-readable flag description.");

void example() {
  std::cout << FLAGS_question.length() << ' ' << FLAGS_answer * FLAGS_answer << std::endl;
}

int main(int argc, char** argv) {
  ParseDFlags(&argc, &argv);
  example();
}


text:
/**
 * create by 朱施健
 */
package com.flower.tables;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

/**
 * @author 朱施健
 * 配送地址
 */
@Entity
@DynamicUpdate
@DynamicInsert
public class DeliveryAddress {
	public int id;
	//收货人
	public String receiver;
	//地址
	public String address;
	//联系电话
	public String phone;

	public Customer customer;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
	@Column(nullable=false,updatable=false)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}

	@Column(nullable=false)
	public String getReceiver() {
		return receiver;
	}
	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}

	@Column(nullable=false)
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}

	@Column(nullable=false)
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}

	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER, optional = false)
	@JoinColumn(name="uid")
	public Customer getCustomer() {
		return customer;
	}
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
}


text:
<?php

namespace MVNerds\CoreBundle\Model;

use MVNerds\CoreBundle\Model\om\BaseGameMode;

/**
 * Skeleton subclass for representing a row from the 'game_mode' table.
 *
 *
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *
 * @package    propel.generator.src.MVNerds.CoreBundle.Model
 */
class GameMode extends BaseGameMode {

} // GameMode


text:
using System;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http;

namespace WebApi.Contrib.Results
{
    public abstract class LocationResult : IHttpActionResult
    {
        public HttpStatusCode StatusCode { get; }
        public string Location { get; }

        private readonly HttpRequestMessage _request;

        protected LocationResult(HttpStatusCode statusCode, string location, ApiController controller)
            : this(statusCode, location, controller.Request)
        {
        }

        protected LocationResult(HttpStatusCode statusCode, string location, HttpRequestMessage request)
        {
            // Not guarding against not defined enum value as some code are missing, for example 308 (Permanent Redirect)
            if (location == null) throw new ArgumentNullException(nameof(location));
            if (request == null) throw new ArgumentNullException(nameof(request));
            StatusCode = statusCode;
            Location = location;
            _request = request;
        }

        public Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
        {
            return Task.FromResult(Execute());
        }

        private HttpResponseMessage Execute()
        {
            var httpResponseMessage = new HttpResponseMessage(StatusCode);

            try
            {
                httpResponseMessage.Headers.Location = new Uri(Location);
                httpResponseMessage.RequestMessage = _request;
            }
            catch
            {
                httpResponseMessage.Dispose();
                throw;
            }

            return httpResponseMessage;
        }
    }
}


text:
package org.springframework.osgi.service;

import java.io.Serializable;
import java.util.Dictionary;
import java.util.Hashtable;

import junit.framework.TestCase;

import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.InvalidSyntaxException;
import org.springframework.osgi.mock.MockBundleContext;
import org.springframework.osgi.util.OsgiFilterUtils;

/**
 * @author Costin Leau
 *
 */
public class OsgiFilterUtilsTest extends TestCase {

	private String[] classes;

	private Dictionary dictionary;

	protected void setUp() throws Exception {
		classes = new String[] { Object.class.getName(), Cloneable.class.getName(), Serializable.class.getName() };
		dictionary = new Hashtable();
		dictionary.put(Constants.OBJECTCLASS, classes);
	}

	protected void tearDown() throws Exception {
		dictionary = null;
		classes = null;
	}

	public void testNoArgument() {
		try {
			OsgiFilterUtils.unifyFilter((String) null, null);
			fail("should have thrown exception");
		}
		catch (Exception ex) {
			// expected
		}
	}

	public void testClassArrayWithGarbage() {
		String[] garbage = new String[] { null, null };
		try {
			OsgiFilterUtils.unifyFilter(garbage, null);
			fail("should have thrown exception " + IllegalArgumentException.class.getName());
		}
		catch (IllegalArgumentException iae) {
			// expected
		}
	}

	public void testOnlyClassArgument() {
		String filter = OsgiFilterUtils.unifyFilter(classes[0], null);
		assertNotNull(filter);
		assertTrue(OsgiFilterUtils.isValidFilter(filter));
	}

	public void testJustClassWithNoFilter() {
		String fl = OsgiFilterUtils.unifyFilter(classes[0], null);
		String filter = OsgiFilterUtils.unifyFilter((String) null, fl);

		assertEquals("filter shouldn't have been modified", fl, filter);
	}

	public void testClassWithExistingFilter() {
		String filter = "(o=univ*of*mich*)";
		String fl = OsgiFilterUtils.unifyFilter(classes[0], filter);
		assertTrue(OsgiFilterUtils.isValidFilter(fl));
	}

	public void testMultipleClassesWithExistingFilter() {
		String filter = "(|(sn=Jensen)(cn=Babs J*))";
		String fl = OsgiFilterUtils.unifyFilter(classes, filter);
		assertTrue(OsgiFilterUtils.isValidFilter(fl));
	}

	public void testMultipleClassesAddedOneByOne() {
		String filter = OsgiFilterUtils.unifyFilter(classes[0], null);
		filter = OsgiFilterUtils.unifyFilter(classes[1], filter);
		filter = OsgiFilterUtils.unifyFilter(classes[2], filter);

		Filter osgiFilter = OsgiFilterUtils.createFilter(filter);

		// verify the filter using the matching against a dictionary
		assertTrue(osgiFilter.matchCase(dictionary));
	}

	public void testMultipleClassesAddedAtOnce() {
		String filter = OsgiFilterUtils.unifyFilter(classes, null);
		Filter osgiFilter = OsgiFilterUtils.createFilter(filter);
		// verify the filter using the matching against a dictionary
		assertTrue(osgiFilter.matchCase(dictionary));
	}

	public void testNonMatching() {
		String filter = OsgiFilterUtils.unifyFilter(classes, null);
		Filter osgiFilter = OsgiFilterUtils.createFilter(filter);
		dictionary.put(Constants.OBJECTCLASS, new String[] { classes[0] });

		// verify the filter using the matching against a dictionary
		assertFalse(osgiFilter.matchCase(dictionary));
	}

	public void testNoKeyOrItemSpecified() {
		try {
			OsgiFilterUtils.unifyFilter(null, null, null);
			fail("should have thrown exception");
		}
		catch (IllegalArgumentException ex) {
			// expected
		}
	}

	public void testNoKeySpecified() {
		try {
			OsgiFilterUtils.unifyFilter(null, new String[] { classes[0] }, null);
			fail("should have thrown exception");
		}
		catch (IllegalArgumentException ex) {
		}
	}

	public void testNoItemSpecified() {
		try {
			OsgiFilterUtils.unifyFilter(Constants.OBJECTCLASS, null, null);
			fail("should have thrown exception");
		}
		catch (IllegalArgumentException ex) {
		}
	}

	public void testNoKeyOrItemButFilterSpecified() {
		String filter = OsgiFilterUtils.unifyFilter("beanName", new String[] { "myBean" }, null);
		assertTrue(OsgiFilterUtils.isValidFilter(filter));
	}

	public void testAddItemsUnderMultipleKeys() {
		String filterA = OsgiFilterUtils.unifyFilter("firstKey", new String[] { "A", "B", "valueA" }, "(c=*)");
		String filterB = OsgiFilterUtils.unifyFilter("secondKey", new String[] { "X", "Y", "valueZ" }, filterA);
		assertTrue(OsgiFilterUtils.isValidFilter(filterB));
	}

	public void testUnifyWhenNoItemIsSpecified() {
		String fl = "(c=*)";
		String filter = OsgiFilterUtils.unifyFilter("someKey", null, fl);
		assertEquals(fl, filter);

		filter = OsgiFilterUtils.unifyFilter("someKey", new String[0], fl);
		assertEquals(fl, filter);

		filter = OsgiFilterUtils.unifyFilter("someKey", new String[] { null }, fl);
		assertEquals(fl, filter);

	}

    protected BundleContext getBundleContext() {
        return new MockBundleContext() {
            public Filter createFilter(String filter) throws InvalidSyntaxException {
                return FrameworkUtil.createFilter(filter);
            }
        };
    }
}


text:
package openstack

import (
	"github.com/solo-io/unik/pkg/providers"
)

func (p *OpenstackProvider) GetConfig() providers.ProviderConfig {
	return providers.ProviderConfig{
		UsePartitionTables: true,
	}
}


text:
using System.Reflection;

[assembly: AssemblyTitle("NUnit3TestReport")]
[assembly: AssemblyDescription("Processes a set of NUnit3 Xml files and makes an Html summary report file.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NUnit3 Test Report")]
[assembly: AssemblyCopyright("MIT Licence")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("1.0.*")]


text:
[See html formatted version](https://huasofoundries.github.io/google-maps-documentation/StreetViewPov.html)

StreetViewPov interface
-----------------------

google.maps.StreetViewPov interface

A point of view object which specifies the camera's orientation at the Street View panorama's position. The point of view is defined as heading and pitch.

Properties

[heading](#StreetViewPov.heading)

**Type:**  number

The camera heading in degrees relative to true north. True north is 0°, east is 90°, south is 180°, west is 270°.

[pitch](#StreetViewPov.pitch)

**Type:**  number

The camera pitch in degrees, relative to the street view vehicle. Ranges from 90° (directly upwards) to -90° (directly downwards).


text:
package de.morphbit.thymeleaf.model;

public class ThymeleafComponent {

	private String name;
	private String fragmentTemplate;

	public ThymeleafComponent(String name, String fragmentTemplate) {
		this.name = name;
		this.fragmentTemplate = fragmentTemplate;
	}

	/**
	 * Returns the name of the component (e.g. panel)
	 *
	 * @return Component name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the name of the component (e.g. panel). This will be uses as the
	 * selector in the html file like.
	 *
	 * @param name
	 *            Component name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Returns the thymeleaf fragment template
	 *
	 * @return Fragment template
	 */
	public String getFragmentTemplate() {
		return fragmentTemplate;
	}

	/**
	 * Sets the thymeleaf fragment template (e.g components/panel :: panel). The
	 * pattern is without the fragments parameters, so 'components/panel ::
	 * panel(title)' will throw an error.
	 *
	 * @param fragmentTemplate
	 *            Fragment template
	 */
	public void setFragmentTemplate(String fragmentTemplate) {
		this.fragmentTemplate = fragmentTemplate;
	}

	@Override
	public String toString() {
		return "Component [name=" + name + ", fragmentTemplate="
		        + fragmentTemplate + "]";
	}

}


text:
<?php

// USERDETAILS.PHP LANGUAGE FILE

$language["USERNAME"]           = "Gebruikersnaam";
$language["EMAIL"]              = "Email";
$language["LAST_IP"]            = "Laatst Bekende Ip";
$language["USER_LEVEL"]         = "Level";
$language["USER_JOINED"]        = "Aangemeld Op";
$language["USER_LASTACCESS"]    = "Laatste Gezien";
$language["PEER_COUNTRY"]       = "Land";
$language["USER_LOCAL_TIME"]    = "Gebruik Zijn/Haar Locale Tijd";
$language["DOWNLOADED"]         = "Gedownload";
$language["UPLOADED"]           = "Geupload";
$language["RATIO"]              = "Deelverhouding";
$language["FORUM"]              = "Forum";
$language["POSTS"]              = "Posts";
$language["POSTS_PER_DAY"]      = "%s posts per dag";
$language["TORRENTS"]           = "Torrents";
$language["FILE"]               = "Bestand";
$language["ADDED"]              = "Toegevoegd";
$language["SIZE"]               = "Grootte";
$language["SHORT_S"]            = "S";
$language["SHORT_L"]            = "L";
$language["SHORT_C"]            = "C";
$language["NO_TORR_UP_USER"]    = "Deze gebruiker heeft nog geen torrent geupload!";
$language["ACTIVE_TORRENT"]     = "Actieve Torrents";
$language["PEER_STATUS"]        = "Status";
$language["NO_ACTIVE_TORR"]     = "Geen Actieve Torrents";
$language["PEER_CLIENT"]        = "Cliënt";
$language["EDIT"]               = "Veranderen";
$language["DELETE"]             = "Verwijderen";
$language["PM"]                 = "PM";
$language["BACK"]               = "Terug";
$language["NO_HISTORY"]         = "Geen geschiedenis om te laten zien...";$language["WHOIS"]              = "Whois";
?>


text:
package org.apache.jackrabbit.commons.predicate;

import javax.jcr.Item;
import javax.jcr.RepositoryException;

/**
 * Filters items according to their names.
 *
 */
public class NamePredicate extends DepthPredicate {

    /**
     * The name to filter on
     */
    protected final String name;

    /**
     * Creates a new name filter with the given name and depths
     * @param name the name to filter on
     * @param minDepth the minimal depth
     * @param maxDepth the maximal depth
     */
    public NamePredicate(String name, int minDepth, int maxDepth) {
        super(minDepth, maxDepth);
        this.name = name;
    }

    /**
     * Creates a new name filter with the given name.
     * @param name the name to filter on
     */
    public NamePredicate(String name) {
        this(name, 0, Integer.MAX_VALUE);
    }

    /**
     * Returns true if the name of the given item is equal to
     * the configured name.
     * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
     */
    @Override
    protected boolean matches(Item item) throws RepositoryException {
        return item.getName().equals(name);
    }
}


text:
{% extends 'manage/manage_base.html' %}
{% set page = 'home' %}

{% block manage_title %}
    Welcome!
{% endblock %}

{% block manage_content %}

Welcome to the Air Mozilla Manager.

If you have any questions, please contact

    {% for email in admin_email_addresses -%}
    {{ email }}{% if not loop.last %}, {% endif %}
    {%- endfor -%}.

    {% if git_revision %}

Current version of airmozilla installed.

    {% endif %}

{% endblock %}


text:
package net.sourceforge.pmd.properties;

import net.sourceforge.pmd.PropertyDescriptor;
import net.sourceforge.pmd.lang.rule.properties.DoubleMultiProperty;
import net.sourceforge.pmd.lang.rule.properties.DoubleProperty;

/**
 * Evaluates the functionality of the DoubleProperty descriptor by testing its ability to catch creation
 * errors (illegal args), flag out-of-range test values, and serialize/deserialize groups of double values
 * onto/from a string buffer.
 *
 * @author Brian Remedios
 */
public class DoublePropertyTest extends AbstractPropertyDescriptorTester {

	private static final double MIN = -10.0;
	private static final double MAX = 100.0;
	private static final double SHIFT = 5.0;

	public DoublePropertyTest() {
		super();
	}

	/**
	 * Creates and returns (count) number of legal Double values
	 *
	 * @param count int
	 * @return Object
	 */
	protected Object createValue(int count) {

		if (count == 1) return Double.valueOf(randomDouble(MIN, MAX));

		Double[] values = new Double[count];
		for (int i=0; i<values.length; i++) values[i] = (Double)createValue(1);
		return values;
	}

	/**
	 * Creates and returns (count) number of out-of-range values
	 *
	 * @param count int
	 * @return Object
	 */
	protected Object createBadValue(int count) {

		if (count == 1) return Double.valueOf(
				randomBool() ?
						randomDouble(MIN - SHIFT, MIN - 0.01) :
						randomDouble(MAX + 0.01, MAX + SHIFT)
						);

		Double[] values = new Double[count];
		for (int i=0; i<values.length; i++) values[i] = (Double)createBadValue(1);
		return values;
	}

	/**
	 * Creates and returns a property with a (maxCount) value cardinality.
	 *
	 * @param multiValue boolean
	 * @return PropertyDescriptor
	 */
	protected PropertyDescriptor createProperty(boolean multiValue) {

		return multiValue ?
			new DoubleMultiProperty("testDouble", "Test double property", MIN, MAX, new Double[] {-1d,0d,1d,2d}, 1.0f) :
			new DoubleProperty("testDouble", "Test double property", MIN, MAX, 9.0, 1.0f);
	}

	/**
	 * Attempts to create a property with invalid constructor arguments.
	 *
	 * @param multiValue boolean
	 * @return PropertyDescriptor
	 */
	protected PropertyDescriptor createBadProperty(boolean multiValue) {

		return multiValue ?
			new DoubleMultiProperty("testDouble", "Test double property", MIN, MAX, new Double[] {MIN-SHIFT,MIN,MIN+SHIFT,MAX+SHIFT}, 1.0f) :
			new DoubleProperty("testDouble", "Test double property", MAX, MIN, 9.0, 1.0f) ;
		}

    public static junit.framework.Test suite() {
        return new junit.framework.JUnit4TestAdapter(DoublePropertyTest.class);
    }
}


text:
"""Copyright 2015 Roger R Labbe Jr.

filterpy library.
http://github.com/rlabbe/filterpy

Documentation at:
https://filterpy.readthedocs.org

Supporting book at:
https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python

This is licensed under an MIT license. See the readme.MD file
for more information.
"""

__version__ = "1.2.1"


text:
package apple.foundation;

import java.io.*;
import java.nio.*;
import java.util.*;
import com.google.j2objc.annotations.*;
import com.google.j2objc.runtime.*;
import com.google.j2objc.runtime.block.*;
import apple.audiotoolbox.*;
import apple.corefoundation.*;
import apple.coregraphics.*;
import apple.coreservices.*;
import apple.uikit.*;
import apple.coreanimation.*;
import apple.coredata.*;
import apple.coremedia.*;
import apple.security.*;
import apple.dispatch.*;

@Library("Foundation/Foundation.h") @Mapping("NSMessagePort")
public class NSMessagePort
    extends NSPort
     {

    @Mapping("initWithCoder:")
    public NSMessagePort(NSCoder aDecoder) { }
    @Mapping("init")
    public NSMessagePort() { }

}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Anz. Akad. Wiss. Wien, Math. -Naturwiss. Kl. 60:96. 1924 ("1923") "<I>Pirus</I>"

#### Original name
null

### Remarks
null


text:
#include "lapacke_utils.h"

double LAPACKE_dlapy2_work( double x, double y )
{
    double res = 0.;
    /* Call LAPACK function and adjust info */
    res = LAPACK_dlapy2( &x, &y );
    return res;
}


text:
import Ember from 'ember';
import layout from '../templates/components/my-better-panel-footer';

export default Ember.Component.extend({
  layout
});


text:
package network;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashSet;

import model.Game;

/**
 * Network specific code is derived from publicly available code provided by
 * London Metropolitan University. Any game-specific code and/or logic is my own work.
 */
public class GameServer {

    private static HashSet<PrintWriter> uniquePrintWriters = new HashSet<PrintWriter>();
    public static final int PORT = 9090;

    public GameServer(int port) {

    	try (ServerSocket listener = new ServerSocket(9090)) {

            while (true) {

                new ClientHandler(listener.accept()).start();

            }

        } catch (IOException e) {

        	e.printStackTrace();

        }

    }

    public static void main(String[] args) throws IOException {

        if (args.length == 1) {

        	new GameServer(Integer.parseInt(args[0]));

        } else {

        	new GameServer(PORT);

        }

    }

    public static <E> void removeIfNotNull(HashSet<E> set, E element) {

        if (element == null) {

            return;

        } else {

            set.remove(element);

        }

    }

    private static class ClientHandler extends Thread {

        private Socket socket;
        private BufferedReader clientReader;
        private PrintWriter clientWriter;

        public ClientHandler(Socket socket) {

            this.socket = socket;

        }

        public void run() {

            try {

                System.out.println("Connection initiated from: " + socket.getInetAddress());

                clientReader = new BufferedReader(new InputStreamReader(
                    socket.getInputStream()));

                clientWriter = new PrintWriter(socket.getOutputStream(), true);

                uniquePrintWriters.add(clientWriter);

                String userInput;

                Game game = new Game();

                clientWriter.println(game.getIntroMessage());

                while ((userInput = clientReader.readLine()) != null) {

                    if (userInput.equals("EXIT")) {

                        this.closeConnection();

                        break;

                    }

                    int userChoice = -1;

                    try {

                        userChoice = Integer.parseInt(userInput);

                    } catch (NumberFormatException e) {

                        e.printStackTrace();
                        continue;

                    }

                    if (0 > userChoice || userChoice > 3) continue;

                    game.singleMatch(userChoice);

                    clientWriter.println(game.getGameState());

                }

            } catch (IOException e) {

                System.out.println(e);

            } finally {

                this.terminateSession();

            }

        }

        public void closeConnection() {

        	try {

                socket.close();
                System.out.println("Connection terminated gracefully.");

            } catch (IOException e) {

                e.printStackTrace();

            }

        }

        public void terminateSession() {

        	removeIfNotNull(uniquePrintWriters, clientWriter);

            try {

                if (!socket.isClosed()) socket.close();

            } catch (IOException e) {

            	e.printStackTrace();

            }

        }

    }

}


text:
//Guaranteed to be lazy initialized and that it will be destroyed correctly
//Copy constructor and assignement operator should not be implemented
//DO NOT define public constructors but implement the private one (and destructor)
#define LAG_GENERATE_SINGLETON(Type) public:\
static Type& getInstance() {\
	static Type instance;\
	return instance;\
}\
private:\
Type();\
~Type();\
Type(const Type &copy) = delete;\
Type& operator=(const Type &copy) = delete;


text:
Rails.application.routes.draw do
  get "/404", to: "errors#not_found"
  get "/422", to: "errors#unacceptable"
  get "/500", to: "errors#server_error"
end


text:
package org.osgi.test.cases.framework.secure.lifecycle.tb5;

import java.util.Hashtable;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

/**
 * Bundle for the event test.
 *
 * @author Ericsson Radio Systems AB
 */
public class EventTest implements BundleActivator {
	ServiceRegistration<EventTest> _sr;

	/**
	 * Starts the bundle. Registers a service.
	 */
	public void start(BundleContext bc) {
		Hashtable<String,Object> props;
		props = new Hashtable<>();
		props.put("Service-Name", "EventTest");
		_sr = bc.registerService(EventTest.class, this, props);
	}

	/**
	 * Stops the bundle. Unregisters the service.
	 */
	public void stop(BundleContext bc) {
		try {
			_sr.unregister();
		}
		catch (IllegalStateException e) { /* Ignore */
		}
	}
}


text:
using System.Collections.Generic;

using MediatR;

namespace vivego.Collection.Queue.GetAll
{
	public sealed record GetAllRequest : IRequest<IAsyncEnumerable<IQueueEntry>>
	{
		public string Id { get; }
		public long? Skip { get; }

		public GetAllRequest(string id, long? skip)
		{
			Id = id;
			Skip = skip;
		}
	}
}