text:
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=admin
 * [END_COT_EXT]
 */

/**
 * projects module
 *
 * @package projects
 * @version 2.5.2
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */

defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('projects', 'module');

list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('projects', 'any');
cot_block($usr['isadmin']);

$adminpath[] = array(cot_url('admin', 'm=extensions'), $L['Extensions']);
$adminpath[] = array(cot_url('admin', 'm=extensions&a=details&mod='.$m), $cot_modules[$m]['title']);
$adminpath[] = array(cot_url('admin', 'm='.$m), $L['Administration']);

if (!in_array($p, array('types', 'default')))
{
	$p = 'default';
}

require_once cot_incfile('projects', 'module', 'admin.'.$p);


text:
define([
    '../../../shapes/Path',
    '../../../shapes/ShapeAttributes',
    '../../../shapes/SurfacePolyline',
    '../WktElements',
    './WktObject',
    '../WktType'
], function (Path,
             ShapeAttributes,
             SurfacePolyline,
             WktElements,
             WktObject,
             WktType) {
    /**
     * It represents multiple line string as one object.
     * @alias WktMultiLineString
     * @augments WktObject
     * @constructor
     */
    var WktMultiLineString = function () {
        WktObject.call(this, WktType.SupportedGeometries.MULTI_LINE_STRING);

        this.objectBoundaries = [];
    };

    WktMultiLineString.prototype = Object.create(WktObject.prototype);

    /**
     * Specific for Multi objects as it depicts the boundaries.
     */
    WktMultiLineString.prototype.commaWithoutCoordinates = function() {
        this.objectBoundaries.push(this.coordinates.slice());
        this.coordinates = [];
    };

    /**
     * In case of 2D it returns SurfacePolyline, In case of 3D return Path.
     * @inheritDoc
     * @return {Path[]|SurfacePolyline[]}
     */
    WktMultiLineString.prototype.shapes = function() {
        this.commaWithoutCoordinates(); // This needs to be more careful and probably move to the stuff

        if(this._is3d){
            return this.objectBoundaries.map(function(boundaries){
                return new Path(boundaries, new ShapeAttributes(null));
            }.bind(this));
        } else {
            return this.objectBoundaries.map(function(boundaries){
                return new SurfacePolyline(boundaries, new ShapeAttributes(null));
            }.bind(this));
        }
    };

    WktElements['MULTILINESTRING'] = WktMultiLineString;

    return WktMultiLineString;
});

redpajama_set_name: RedPajamaGithub


text:
layout: page
title: About
permalink: /about/
---

### Some words that describe me

* Librarian
* Guitarist
* Dungeon Master
* Sci-Fi Nerd

### Contact me

[durden@umd.edu](mailto:durden@umd.edu)


text:
package org.apache.http.client.fluent;

import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import org.apache.http.concurrent.FutureCallback;

/**
 * This example demonstrates how the he HttpClient fluent API can be used to execute multiple
 * requests asynchronously using background threads.
 */
public class FluentAsync {

    public static void main(String[] args)throws Exception {
        // Use pool of two threads
        ExecutorService threadpool = Executors.newFixedThreadPool(2);
        Async async = Async.newInstance().use(threadpool);

        Request[] requests = new Request[] {
                Request.Get("http://www.google.com/"),
                Request.Get("http://www.yahoo.com/"),
                Request.Get("http://www.apache.com/"),
                Request.Get("http://www.apple.com/")
        };

        Queue<Future<Content>> queue = new LinkedList<Future<Content>>();
        // Execute requests asynchronously
        for (final Request request: requests) {
            Future<Content> future = async.execute(request, new FutureCallback<Content>() {

                public void failed(final Exception ex) {
                    System.out.println(ex.getMessage() + ": " + request);
                }

                public void completed(final Content content) {
                    System.out.println("Request completed: " + request);
                }

                public void cancelled() {
                }

            });
            queue.add(future);
        }

        while(!queue.isEmpty()) {
            Future<Content> future = queue.remove();
            try {
                future.get();
            } catch (ExecutionException ex) {
            }
        }
        System.out.println("Done");
        threadpool.shutdown();
    }

}


text:
module GithubCLI
  class Milestone < API

    class << self

      def all(user, repo, params, options)
        output options do
          github_api(options).issues.milestones.list user, repo, params
        end
      end

      def get(user, repo, id, params, options)
        output options do
          github_api(options).issues.milestones.get user, repo, id, params
        end
      end

      def create(user, repo, params, options)
        output options do
          github_api(options).issues.milestones.create user, repo, params
        end
      end

      def update(user, repo, id, params, options)
        output options do
          github_api(options).issues.milestones.update user, repo, id, params
        end
      end

      def delete(user, repo, id, params, options)
        output options do
          github_api(options).issues.milestones.delete user, repo, id, params
        end
      end
    end

  end # Milestone
end # GithubCLI


text:
<?php

namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;

class SessionController extends Controller
{
    public function saveAction(Request $request)
    {
        $params = array();
        $content = $request->getContent();
        if (!empty($content))
        {
            $params = json_decode($content, true);
        }

        $this->get('session')->set('data', $params);

        return new JsonResponse(array('ok'));
    }

    /**
     * Clears the php session.
     * @return JsonResponse
     */
    public function clearAction() {
        $this->get('session')->clear();
        return new JsonResponse(array('ok'));
    }

    public function getAction()
    {
        $session = $this->get('session');
        $data = $session->get('data');
        return new JsonResponse($data);
    }
}


text:
Each message has a `type` field, which defined in the protocol of this package, as well as associated fields inside `payload` field, depending on the message type, and `id` field so the client can identify each response from the server.

Each WebSocket message is represented in JSON structure, and being stringified before sending it over the network.

This is the structure of each message:

```typescript
export interface OperationMessage {
  payload?: any;
  id?: string;
  type: string;
}
```

### Client -> Server

#### GQL_CONNECTION_INIT
Client sends this message after plain websocket connection to start the communication with the server

The server will response only with `GQL_CONNECTION_ACK` + `GQL_CONNECTION_KEEP_ALIVE` (if used) or `GQL_CONNECTION_ERROR` to this message.

- `payload: Object` : optional parameters that the client specifies in `connectionParams`

#### GQL_START
Client sends this message to execute GraphQL operation
- `id: string` : The id of the GraphQL operation to start
- `payload: Object`:
    * `query: string` : GraphQL operation as string or parsed GraphQL document node
    * `variables?: Object` : Object with GraphQL variables
    * `operationName?: string` : GraphQL operation name

#### GQL_STOP
Client sends this message in order to stop a running GraphQL operation execution (for example: unsubscribe)
- `id: string` : operation id

#### GQL_CONNECTION_TERMINATE
Client sends this message to terminate the connection.

### Server -> Client

#### GQL_CONNECTION_ERROR
The server may responses with this message to the `GQL_CONNECTION_INIT` from client, indicates the server rejected the connection.

It server also respond with this message in case of a parsing errors of the message (which does not disconnect the client, just ignore the message).

- `payload: Object`: the server side error

#### GQL_CONNECTION_ACK
The server may responses with this message to the `GQL_CONNECTION_INIT` from client, indicates the server accepted the connection.
May optionally include a payload.

#### GQL_DATA
The server sends this message to transfter the GraphQL execution result from the server to the client, this message is a response for `GQL_START` message.

For each GraphQL operation send with `GQL_START`, the server will respond with at least one `GQL_DATA` message.

- `id: string` : ID of the operation that was successfully set up
- `payload: Object` :
    * `data: any`: Execution result
    * `errors?: Error[]` : Array of resolvers errors

#### GQL_ERROR
Server sends this message upon a failing operation, before the GraphQL execution, usually due to GraphQL validation errors (resolver errors are part of `GQL_DATA` message, and will be added as `errors` array)
- `payload: Error` : payload with the error attributed to the operation failing on the server
- `id: string` : operation ID of the operation that failed on the server

#### GQL_COMPLETE
Server sends this message to indicate that a GraphQL operation is done, and no more data will arrive for the specific operation.

- `id: string` : operation ID of the operation that completed

#### GQL_CONNECTION_KEEP_ALIVE
Server message that should be sent right after each `GQL_CONNECTION_ACK` processed and then periodically to keep the client connection alive.

The client starts to consider the keep alive message only upon the first received keep alive message from the server.

### Messages Flow

This is a demonstration of client-server communication, in order to get a better understanding of the protocol flow:

#### Session Init Phase

The phase initializes the connection between the client and server, and usually will also build the server-side `context` for the execution.

- Client connected immediately, or stops and wait if using lazy mode (until first operation execution)
- Client sends `GQL_CONNECTION_INIT` message to the server.
- Server calls `onConnect` callback with the init arguments, waits for init to finish and returns it's return value with `GQL_CONNECTION_ACK` + `GQL_CONNECTION_KEEP_ALIVE` (if used), or `GQL_CONNECTION_ERROR` in case of `false` or thrown exception from `onConnect` callback.
- Client gets `GQL_CONNECTION_ACK` + `GQL_CONNECTION_KEEP_ALIVE` (if used) and waits for the client's app to create subscriptions.

#### Connected Phase

This phase called per each operation the client request to execute:

- App creates a subscription using `subscribe` or `query` client's API, and the `GQL_START` message sent to the server.
- Server calls `onOperation` callback, and responds with `GQL_DATA` in case of zero errors, or `GQL_ERROR` if there is a problem with the operation (is might also return `GQL_ERROR` with `errors` array, in case of resolvers errors).
- Client get `GQL_DATA` and handles it.
- Server calls `onOperationDone` if the operation is a query or mutation (for subscriptions, this called when unsubscribing)
- Server sends `GQL_COMPLETE` if the operation is a query or mutation (for subscriptions, this sent when unsubscribing)

For subscriptions:
- App triggers `PubSub`'s publication method, and the server publishes the event, passing it through the `subscribe` executor to create GraphQL execution result
- Client receives `GQL_DATA` with the data, and handles it.
- When client unsubscribe, the server triggers `onOperationDone` and sends `GQL_COMPLETE` message to the client.

When client done with executing GraphQL, it should close the connection and terminate the session using `GQL_CONNECTION_TERMINATE` message.


text:
Laravel Trace to Slack
======================
[![License](https://poser.pugx.org/lfelin/laravel-tracetoslack/license)](https://packagist.org/packages/lfelin/laravel-tracetoslack)
[![Latest Stable Version](https://poser.pugx.org/lfelin/laravel-tracetoslack/v/stable)](https://packagist.org/packages/lfelin/laravel-tracetoslack)
[![Total Downloads](https://poser.pugx.org/lfelin/laravel-tracetoslack/downloads)](https://packagist.org/packages/lfelin/laravel-tracetoslack)
___

#### **For Laravel 4.2, use the** [4.2 branch](https://github.com/LFelin/laravel-tracetoslack/tree/4.2)
___
## About
Trace to slack is a simple package for laravel to notify the errors of your application in slack https://slack.com/

## Installation

Pull this package in through Composer.

```js

    {
        "require": {
            "lfelin/laravel-tracetoslack": "1.*"
        }
    }

```

Dump your autoload
```
composer dump-autoload -o
```

### Laravel 5.* Integration

Add the service provider to your `config/app.php` file:

```php

    'providers'     => array(

        //...
        Lfelin\TraceToSlack\TraceToSlackServiceProvider::class,

    ),

```

In your `app/Exceptions/Handler.php` file:

Replace

```php
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
```

**by**

```php
use Lfelin\TraceToSlack\Handler as ExceptionHandler;
```

## Configuration

Publish configuration

```
php artisan vendor:publish
```

In your `config/tracetoslack.php` file configure the parameters. The parameter webhook_url is required :

```php

    return array(

        /*
         |--------------------------------------------------------------------------
         | Notify on debug
         |--------------------------------------------------------------------------
         | Default: false
         | The notifications are also sent if the debug mode is activated [true]
         |
         */

        'active_on_debug' => false,

        /*
         |--------------------------------------------------------------------------
         | Your private Webhook URL
         |--------------------------------------------------------------------------
         | [Required]
         | Eg: https://hooks.slack.com/services/XXX/XXX
         |
         */

        'webhook_url' => 'https://hooks.slack.com/services/XXX/XXX',

        /*
         |--------------------------------------------------------------------------
         | Username
         |--------------------------------------------------------------------------
         | [Optional]
         | Default: John Bot
         |
         */

        'username' => '',

        /*
         |--------------------------------------------------------------------------
         | Emoji
         |--------------------------------------------------------------------------
         | [Optional]
         | Default: ':warning:'
         | http://www.emoji-cheat-sheet.com/ for example
         |
         */

        'icon_emoji' => '', //  default: ':bug:' => http://www.emoji-cheat-sheet.com/

        /*
         |--------------------------------------------------------------------------
         | Emoji Url
         |--------------------------------------------------------------------------
         | [Optional]
         | This param increase icon_emoji
         | https://slack.com/img/icons/app-57.png for example
         |
         */

        'icon_url' => '',

        /*
         |--------------------------------------------------------------------------
         | Other Channel
         |--------------------------------------------------------------------------
         | [Optional]
         | Default: The default channel is the one set in the web Hook
         | This name start by '#' or '@' for Direct Message
         | Eg: #general - @username
         |
         */

        'other_channel' => '',
    );

```

## Create Incoming WebHooks

Create a new webhook : https://my.slack.com/services/new/incoming-webhook/

Documentation : https://api.slack.com/custom-integrations

## Example on slack
![example](https://cloud.githubusercontent.com/assets/271214/16535835/0f837698-3feb-11e6-92b2-e0bdf74b580a.png)

## Suggestions and issues
Use [github issues](https://github.com/LFelin/laravel-tracetoslack/issues/new) to suggest improvements or reassembling your problems


text:
@interface MOBProjectionEPSG2877 : MOBProjection

@end


text:
var ImageSetControlView = Backbone.View.extend({

  events: {
    "submit #imageSetForm": "goToSpecificImage",
    "click #goImageButton": "goToSpecificImage",
    "click #prevImageButton": "goToPreviousImage",
    "click #nextImageButton": "goToNextImage",
  },

  initialize: function(options) {
    var self = this;
    self.appState = options.appState || self.appState;

    self.render();
  },

  render: function() {
    var self = this;
    self.$("#imageSetIndex").val(self.appState.currentImageSetIndex);
  },

  goToSpecificImage: function() {
    var self = this;
    var index = parseInt(self.$("#imageSetIndex").val());
    if (index && index >= 1 && index <= self.appState.currentImageSet.get("imageIds").length) {
      self.jumpImage(index);
    } else {
      self.appState.pageAlert("warning", "Index is invalid.");
    }
    return false;
  },

  goToPreviousImage: function() {
    var self = this;
    self.offsetImage(-1);
    return false;
  },

  goToNextImage: function() {
    var self = this;
    self.offsetImage(1);
    return false;
  },

  offsetImage: function(offset) {
    var self = this;

    var index = self.appState.currentImageSetIndex;
    var setLength = self.appState.currentImageSet.get("imageIds").length;
    index = (index - 1 + offset + setLength) % setLength + 1;
    self.appState.currentImageSetIndex = index;

    var setIndexUrl = urljoin("parallel-lines/set/", self.appState.currentImageSet.get("name"), self.appState.currentImageSetIndex);
    appRouter.navigate(setIndexUrl, {trigger: true});
  },

  jumpImage: function(index) {
    var self = this;

    var setLength = self.appState.currentImageSet.get("imageIds").length;
    self.appState.currentImageSetIndex = (index - 1) % setLength + 1;

    var setIndexUrl = urljoin("parallel-lines/set/", self.appState.currentImageSet.get("name"), self.appState.currentImageSetIndex);
    appRouter.navigate(setIndexUrl, {trigger: true});
  }

});


text:
<!doctype html>
<!--[if lt IE 7 ]><html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]><html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]><html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]><html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html lang="en" class="no-js"> <!--<![endif]-->
<head>
	<script type="text/javascript">var _sf_startpt = (new Date()).getTime()</script>
	<meta charset="utf-8">
	<!--[if IE]><meta content='IE=8' http-equiv='X-UA-Compatible' /><![endif]-->

	<title>{{ site.data.course.title }} | {{ page.title }}</title>
	<meta name="author" content="metamaquina">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<!--change this to serve from gh pages -->
	<link rel="shortcut icon" href="img/favicon.ico">
	<link rel="apple-touch-icon" href="img/apple-touch-icon.png">

	<!--link rel="stylesheet" href="{{ site.baseurl }}/css/p2pustrap.css" /-->
        <link media="screen" href="{{ site.baseurl }}/css/p2pustrap.css" rel="stylesheet">
	<!--link rel="stylesheet" href="{{ site.baseurl }}/css/p2pustrap-index.css" /-->
	<link rel="stylesheet" href="{{ site.baseurl }}/css/course-style.css" />
	<script type="text/javascript" src="{{ site.baseurl }}/js/modernizr-2.6.2.min.js"></script>

</head>
<body class="{{ page.body-class }}" itemscope itemtype="http://schema.org/WebPage">

{% include navigation.html %}

{{ content }}

{% include footer.html %}

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.js"></script>
<!-- script type="text/javascript" src="http://rawgithub.com/p2pu/p2pu_navigation_widget/master/p2pu_menu_slider.js"></script --->
<script src="{{ site.baseurl }}/js/page-init.js"></script>
<script>
	W4C.Splash.init();
</script>

<!-- Google Analytics -->
{% if site.ga_tracking_code %}
	{% include ga.html %}
{% endif %}
</body>
</html>


text:
namespace nubjs {

class JSThread {
  public:
    JSThread();

    inline v8::Isolate* isolate() const;
    inline nub_thread_t* thread() const;

  private:
    v8::Isolate* isolate_;
    nub_thread_t* thread_;
};

}  // namespace nubjs

#endif  // SRC_JSTHREAD_H_


text:
// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

module.exports = function(config) {
  'use strict';
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: '',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine', 'requirejs'],

    // list of files / patterns to load in the browser
    files: [
      {pattern:'app/bower_components/requirejs-text/text.js', included: false},
      {pattern:'app/bower_components/mustache/mustache.js', included: false},
      {pattern:'app/bower_components/zepto/zepto.js', included: false},
      {pattern:'app/scripts/*.js', included: false},
      {pattern:'app/scripts/**/*.js', included: false},
      {pattern:'app/scripts/**/*.html', included: false},
      {pattern:'test/**/*Spec.js', included: false},
      {pattern:'test/**/*Mock.js', included: false},
      {pattern:'test/test-main.js', included: true},
      {pattern:'test/fixtures/*.html', included: true}
    ],

    // list of files / patterns to exclude
    exclude: ['app/scripts/main.js'],

    // coverage reporter generates the coverage
    reporters: ['dots', 'coverage'],

    preprocessors: {
      // source files, that you wanna generate coverage for
      // do not include tests or libraries
      // (these files will be instrumented by Istanbul)
      'app/scripts/**/*.js': ['coverage']
    },

    coverageReporter: {
      type: 'lcov',
      dir: 'test/coverage'
    },

    // web server port
    port: 9090,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: false,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['PhantomJS'],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: true
  });
};


text:
package biweekly.util;

import java.util.Calendar;

/**
 * Represents each of the seven days of the week.
 * @author Michael Angstadt
 */
public enum DayOfWeek {
	/*
	 * These constants are defined in the order that the days of the week are
	 * arranged on a calendar. Do not rearrange them. Other parts of the code
	 * base rely on this ordering (i.e. this class's ordinal() and values()
	 * methods are used).
	 */
	//@formatter:off
	SUNDAY("SU", Calendar.SUNDAY),
	MONDAY("MO", Calendar.MONDAY),
	TUESDAY("TU", Calendar.TUESDAY),
	WEDNESDAY("WE", Calendar.WEDNESDAY),
	THURSDAY("TH", Calendar.THURSDAY),
	FRIDAY("FR", Calendar.FRIDAY),
	SATURDAY("SA", Calendar.SATURDAY);
	//@formatter:on

	private final String abbr;
	private final int calendarConstant;

	DayOfWeek(String abbr, int calendarConstant) {
		this.abbr = abbr;
		this.calendarConstant = calendarConstant;
	}

	/**
	 * Gets the day's abbreviation.
	 * @return the abbreviation (e.g. "MO" for Monday)
	 */
	public String getAbbr() {
		return abbr;
	}

	/**
	 * Gets the integer constant the {@link Calendar} class uses for this day.
	 * @return the constant
	 */
	public int getCalendarConstant() {
		return calendarConstant;
	}

	/**
	 * Gets a day by its abbreviation.
	 * @param abbr the abbreviation (case-insensitive, e.g. "MO" for Monday)
	 * @return the day or null if not found
	 */
	public static DayOfWeek valueOfAbbr(String abbr) {
		for (DayOfWeek day : values()) {
			if (day.abbr.equalsIgnoreCase(abbr)) {
				return day;
			}
		}
		return null;
	}
}


text:
%make symbolic values for everything:
syms gpsX gpsY gpsZ r a roll pitch yaw bsX bsY bsZ laX laY laZ real;

%put the symbolic values into the functional model (from above)
f = [gpsX gpsY gpsZ]' ...
    - [  cos(pitch)*sin(yaw), sin(pitch)*sin(roll)*sin(yaw) - cos(roll)*cos(yaw), cos(yaw)*sin(roll) + cos(roll)*sin(pitch)*sin(yaw); ...
         cos(pitch)*cos(yaw), cos(roll)*sin(yaw) + cos(yaw)*sin(pitch)*sin(roll), cos(roll)*cos(yaw)*sin(pitch) - sin(roll)*sin(yaw); ...
         -sin(pitch),                               cos(pitch)*sin(roll),                               cos(pitch)*cos(roll) ...
      ]... % this is the rotation from IMU to mapping (ground) coordinates, should be 3 * 3
    * ...
       ([ cos(bsY)*cos(bsZ),                              cos(bsY)*sin(bsZ),          -sin(bsY); ...
          -cos(bsX)*sin(bsZ) - cos(bsZ)*sin(bsX)*sin(bsY), cos(bsX)*cos(bsZ) - sin(bsX)*sin(bsY)*sin(bsZ), -cos(bsY)*sin(bsX); ...
         cos(bsX)*cos(bsZ)*sin(bsY) - sin(bsX)*sin(bsZ), cos(bsZ)*sin(bsX) + cos(bsX)*sin(bsY)*sin(bsZ),  cos(bsX)*cos(bsY) ...
       ] ...% this is the rotation from laser coordinates to IMU coordinates, 3 * 3
        * ...
        (r*[-sin(a) 0 -cos(a)]')... % this is the determination of laser coordinates from range and angle
        +...
        [laX , laY , laZ ]' ) ... % and a lever arm adjustment
    ;

%test the model... does it make sane LiDAR points?
%pointXYZ = subs(f, {gpsX gpsY gpsZ pitch roll yaw bsX bsY bsZ r a laX laY laZ}, {GPSX GPSY GPSZ Pitch Roll Yaw BSx BSy BSz R A LAx LAy LAz});

%now to attempt partial derivatives of the above function
% with respect to each parameter
%GPS first
gpsX_ = diff(f, gpsX)
gpsY_ = diff(f, gpsY)
gpsZ_ = diff(f, gpsZ)

%now IMU orientation - differentiate using symblic math
P_ = diff(f, pitch)
R_ = diff(f, roll)
Y_ = diff(f, yaw)

%now boresight misalignment - differentiate
bsX_ = diff(f, bsX)
bsY_ = diff(f, bsY)
bsZ_ = diff(f, bsZ)

%range and angle from the LIDAR -differentiate
lR_ = diff(f, r)
lA_ = diff(f, a)

%finally the lever arm measurement
laX_ = diff(f, laX)
laY_ = diff(f, laY)
laZ_ = diff(f, laZ)


text:
package org.handwerkszeug.riak.ease.internal;

import org.handwerkszeug.riak.ease.RiakCommand;
import org.handwerkszeug.riak.op.RiakOperations;

/**
 *
 * @author taichi
 *
 * @param <T>
 * @param <CMD>
 */
public interface ExecutionDelegate<T, CMD extends RiakCommand<?>> {
	<RO extends RiakOperations> void execute(CMD cmd, RO operations,
			ResultHolder<T> holder);
}


text:
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
 *
 * LibTomCrypt is a library that provides various cryptographic
 * algorithms in a highly modular and flexible manner.
 *
 * The library is free for all purposes without any express
 * guarantee it works.
 *
 * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
 */
#include "tomcrypt.h"

/**
   @file lrw_done.c
   LRW_MODE implementation, Free resources, Tom St Denis
*/

#ifdef LTC_LRW_MODE

/**
  Terminate a LRW state
  @param lrw   The state to terminate
  @return CRYPT_OK if successful
*/
int lrw_done(symmetric_LRW *lrw)
{
   int err;

   LTC_ARGCHK(lrw != NULL);

   if ((err = cipher_is_valid(lrw->cipher)) != CRYPT_OK) {
      return err;
   }
   cipher_descriptor[lrw->cipher].done(&lrw->key);

   return CRYPT_OK;
}

#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */


text:
<?php

namespace App\Models\Repository;

interface UserRepository
{

<<<<<<< HEAD
    function checkLogin($data);
    function createUser($user);
=======
    function checkLogin(array $data);
//    public function create(array $user);
>>>>>>> phamhoangha

}
?>


text:
<?php

namespace Sistema\Bundle\FrontendBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * LiquidacionMaterial
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Sistema\Bundle\FrontendBundle\Repository\LiquidacionMaterialRepository")
 */
class LiquidacionMaterial
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     *
     * @ORM\ManyToOne(targetEntity="Sistema\Bundle\FrontendBundle\Entity\Cliente")
     */
    private $cliente;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="fecha_liquidacion", type="datetime")
     */
    private $fecha_liquidacion;

    /**
     * @var float
     *
     * @ORM\Column(name="importe", type="decimal", precision=10, scale=2)
     */
    private $importe;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set cliente
     *
     * @param Sistema\Bundle\FrontendBundle\Entity\Cliente $cliente
     * @return LiquidacionMaterial
     */
    public function setCliente(\Sistema\Bundle\FrontendBundle\Entity\Cliente $cliente)
    {
        $this->cliente = $cliente;

        return $this;
    }

    /**
     * Get cliente
     *
     * @return Sistema\Bundle\FrontendBundle\Entity\Cliente
     */
    public function getCliente()
    {
        return $this->cliente;
    }

    /**
     * Set fecha_liquidacion
     *
     * @param \DateTime $fechaLiquidacion
     * @return LiquidacionMaterial
     */
    public function setFechaLiquidacion($fechaLiquidacion)
    {
        $this->fecha_liquidacion = $fechaLiquidacion;

        return $this;
    }

    /**
     * Get fecha_liquidacion
     *
     * @return \DateTime
     */
    public function getFechaLiquidacion()
    {
        return $this->fecha_liquidacion;
    }

    /**
     * Set importe
     *
     * @param float $importe
     * @return LiquidacionMaterial
     */
    public function setImporte($importe)
    {
        $this->importe = $importe;

        return $this;
    }

    /**
     * Get importe
     *
     * @return float
     */
    public function getImporte()
    {
        return $this->importe;
    }
}


text:
@interface UITabBarController (WMFExtensions)

- (void)wmf_setTabBarVisible:(BOOL)visible animated:(BOOL)animated completion:(dispatch_block_t)completion;

@property (nonatomic, assign, readonly) BOOL wmf_tabBarIsVisible;

@end


text:
package org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.actions.global;

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

import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;

public class ESBClipboard {

    private static List<IGraphicalEditPart> editParts = new ArrayList<IGraphicalEditPart>();
    private static boolean cut = false;

    public static boolean isCut() {
        return cut;
    }

    public static void setCut(boolean cut) {
        ESBClipboard.cut = cut;
    }

    public static boolean hasThingsToCopy() {
        return editParts != null && !editParts.isEmpty();
    }

    public static void setToCopyEditParts(List<IGraphicalEditPart> toCopyElements) {
        editParts = toCopyElements;
    }

    public static List<IGraphicalEditPart> getToCopyEditParts() {
        return editParts;
    }
}


text:
from OpenGLCffi.GL import params
@params(api='gl', prms=['count', 'samplers'])
def glGenSamplers(count, samplers):
	pass

@params(api='gl', prms=['count', 'samplers'])
def glDeleteSamplers(count, samplers):
	pass

@params(api='gl', prms=['sampler'])
def glIsSampler(sampler):
	pass

@params(api='gl', prms=['unit', 'sampler'])
def glBindSampler(unit, sampler):
	pass

@params(api='gl', prms=['sampler', 'pname', 'param'])
def glSamplerParameteri(sampler, pname, param):
	pass

@params(api='gl', prms=['sampler', 'pname', 'param'])
def glSamplerParameteriv(sampler, pname, param):
	pass

@params(api='gl', prms=['sampler', 'pname', 'param'])
def glSamplerParameterf(sampler, pname, param):
	pass

@params(api='gl', prms=['sampler', 'pname', 'param'])
def glSamplerParameterfv(sampler, pname, param):
	pass

@params(api='gl', prms=['sampler', 'pname', 'param'])
def glSamplerParameterIiv(sampler, pname, param):
	pass

@params(api='gl', prms=['sampler', 'pname', 'param'])
def glSamplerParameterIuiv(sampler, pname, param):
	pass

@params(api='gl', prms=['sampler', 'pname', 'params'])
def glGetSamplerParameteriv(sampler, pname, params):
	pass

@params(api='gl', prms=['sampler', 'pname', 'params'])
def glGetSamplerParameterIiv(sampler, pname, params):
	pass

@params(api='gl', prms=['sampler', 'pname', 'params'])
def glGetSamplerParameterfv(sampler, pname, params):
	pass

@params(api='gl', prms=['sampler', 'pname', 'params'])
def glGetSamplerParameterIuiv(sampler, pname, params):
	pass


text:
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2020, OpenNebula Project, OpenNebula Systems                */
/*                                                                            */
/* 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.                                             */
/* -------------------------------------------------------------------------- */

#include "GroupPool.h"
#include "Nebula.h"
#include "NebulaLog.h"
#include "OneDB.h"

#include <stdexcept>

using namespace std;

/* -------------------------------------------------------------------------- */
/* There are two default groups boostrapped by the core:                      */
/*   - oneadmin cannot be removed                                            */
/*   - users to place regular users by default                                */
/* The first 100 group IDs are reserved for system groups. Regular ones start */
/* from ID 100                                                                */
/* -------------------------------------------------------------------------- */

const string GroupPool::ONEADMIN_NAME = "oneadmin";
const int    GroupPool::ONEADMIN_ID   = 0;

const string GroupPool::USERS_NAME    = "users";
const int    GroupPool::USERS_ID      = 1;

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

GroupPool::GroupPool(SqlDB * db, bool is_slave,
        vector<const SingleAttribute *>& restricted_attrs)
    : PoolSQL(db, one_db::group_table)
{
    ostringstream oss;
    string        error_str;

    //Federation slaves do not need to init the pool
    if (is_slave)
    {
        return;
    }

    //lastOID is set in PoolSQL::init_cb
    if (get_lastOID() == -1)
    {
        int         rc;
        Group *     group;

        // Build the default oneadmins & users group
        group = new Group(ONEADMIN_ID, ONEADMIN_NAME);

        rc = PoolSQL::allocate(group, error_str);

        if (rc < 0)
        {
            goto error_groups;
        }

        group = new Group(USERS_ID, USERS_NAME);

        group->sunstone_views("cloud","cloud","groupadmin","groupadmin,cloud");

        rc = PoolSQL::allocate(group, error_str);

        if (rc < 0)
        {
            goto error_groups;
        }

        set_lastOID(99);
    }

    // Set restricted attributes
    GroupTemplate::parse_restricted(restricted_attrs);

    return;

error_groups:
    oss << "Error trying to create default group: " << error_str;
    NebulaLog::log("GROUP",Log::ERROR,oss);

    throw runtime_error(oss.str());
}

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

int GroupPool::allocate(string name, int * oid, string& error_str)
{
    int db_oid;

    Group * group;

    ostringstream   oss;

    if (Nebula::instance().is_federation_slave())
    {
        NebulaLog::log("ONE",Log::ERROR,
                "GroupPool::allocate called, but this "
                "OpenNebula is a federation slave");

        return -1;
    }

    // Check name
    if ( !PoolObjectSQL::name_is_valid(name, error_str) )
    {
        goto error_name;
    }

    // Check for duplicates
    db_oid = exist(name);

    if( db_oid != -1 )
    {
        goto error_duplicated;
    }

    // Build a new Group object
    group = new Group(-1, name);

    // Insert the Object in the pool
    *oid = PoolSQL::allocate(group, error_str);

    return *oid;

error_duplicated:
    oss << "NAME is already taken by GROUP " << db_oid << ".";
    error_str = oss.str();

error_name:
    *oid = -1;

    return *oid;
}

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

int GroupPool::update(PoolObjectSQL * objsql)
{
    if (Nebula::instance().is_federation_slave())
    {
        NebulaLog::log("ONE",Log::ERROR,
                "GroupPool::update called, but this "
                "OpenNebula is a federation slave");

        return -1;
    }

    return PoolSQL::update(objsql);
}

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

int GroupPool::update_quotas(Group * group)
{
    return group->update_quotas(db);
}

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

int GroupPool::drop(PoolObjectSQL * objsql, string& error_msg)
{
    Group * group = static_cast<Group*>(objsql);

    int rc;

    if (Nebula::instance().is_federation_slave())
    {
        NebulaLog::log("ONE",Log::ERROR,
                "GroupPool::drop called, but this "
                "OpenNebula is a federation slave");

        return -1;
    }

    // Return error if the group is a default one.
    if( group->get_oid() < 100 )
    {
        error_msg = "System Groups (ID < 100) cannot be deleted.";
        NebulaLog::log("GROUP", Log::ERROR, error_msg);
        return -2;
    }

    if( group->users.size() > 0 )
    {
        ostringstream oss;
        oss << "Group " << group->get_oid() << " is not empty.";
        error_msg = oss.str();
        NebulaLog::log("GROUP", Log::ERROR, error_msg);

        return -3;
    }

    rc = group->drop(db);

    if( rc != 0 )
    {
        error_msg = "SQL DB error";
        rc = -1;
    }

    return rc;
}

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

int GroupPool::dump(string& oss, const string& where, int sid, int eid, bool desc)
{
    int     rc;
    string  def_quota_xml;

    ostringstream cmd;

    cmd << "SELECT " << one_db::group_table << ".body, "
        << one_db::group_quotas_db_table << ".body" << " FROM " << one_db::group_table
        << " LEFT JOIN " << one_db::group_quotas_db_table << " ON "
        << one_db::group_table << ".oid=" << one_db::group_quotas_db_table << ".group_oid";

    if ( !where.empty() )
    {
        cmd << " WHERE " << where;
    }

    cmd << " ORDER BY oid";

    if ( desc == true )
    {
        cmd << " DESC";
    }

    if ( eid != -1 )
    {
        cmd << " " << db->limit_string(sid, eid);
    }

    oss.append("<GROUP_POOL>");

    string_cb cb(2);

    cb.set_callback(&oss);

    rc = db->exec_rd(cmd, &cb);

    cb.unset_callback();

    oss.append(Nebula::instance().get_default_group_quota().to_xml(def_quota_xml));

    oss.append("</GROUP_POOL>");

    return rc;
}

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */


text:
@interface LCSDiskImageInfoCommandTest : GHTestCase
@end

@implementation LCSDiskImageInfoCommandTest
-(void)testDiskImageInfoCommand
{
    LCSDiskImageInfoCommand *cmd = [LCSDiskImageInfoCommand command];

    [cmd start];
    [cmd waitUntilDone];

    GHAssertTrue([cmd.result isKindOfClass:[NSDictionary class]], @"Result should be a dictionary");
    GHAssertTrue([[cmd.result valueForKey:@"images"] isKindOfClass:[NSArray class]],
                 @"Result should contain an array for the key 'images'");
}
@end


text:
#ifndef BABYLON_SHADERS_SHADERS_INCLUDE_DEFAULT_UBO_DECLARATION_FX_H
#define BABYLON_SHADERS_SHADERS_INCLUDE_DEFAULT_UBO_DECLARATION_FX_H

namespace BABYLON {

extern const char* defaultUboDeclaration;

const char* defaultUboDeclaration
  = R"ShaderCode(

layout(std140, column_major) uniform;

uniform Material
{
    vec4 diffuseLeftColor;
    vec4 diffuseRightColor;
    vec4 opacityParts;
    vec4 reflectionLeftColor;
    vec4 reflectionRightColor;
    vec4 refractionLeftColor;
    vec4 refractionRightColor;
    vec4 emissiveLeftColor;
    vec4 emissiveRightColor;
    vec2 vDiffuseInfos;
    vec2 vAmbientInfos;
    vec2 vOpacityInfos;
    vec2 vReflectionInfos;
    vec3 vReflectionPosition;
    vec3 vReflectionSize;
    vec2 vEmissiveInfos;
    vec2 vLightmapInfos;
    vec2 vSpecularInfos;
    vec3 vBumpInfos;
    mat4 diffuseMatrix;
    mat4 ambientMatrix;
    mat4 opacityMatrix;
    mat4 reflectionMatrix;
    mat4 emissiveMatrix;
    mat4 lightmapMatrix;
    mat4 specularMatrix;
    mat4 bumpMatrix;
    vec2 vTangentSpaceParams;
    float pointSize;
    mat4 refractionMatrix;
    vec4 vRefractionInfos;
    vec4 vSpecularColor;
    vec3 vEmissiveColor;
    float visibility;
    vec4 vDiffuseColor;

    vec4 vDetailInfos;
    mat4 detailMatrix;
};

uniform Scene {
    mat4 viewProjection;
#ifdef MULTIVIEW
    mat4 viewProjectionR;
#endif
    mat4 view;
};

)ShaderCode";

} // end of namespace BABYLON

#endif // end of BABYLON_SHADERS_SHADERS_INCLUDE_DEFAULT_UBO_DECLARATION_FX_H


text:
AnalyticsAdminService
---------------------------------------

.. automodule:: google.analytics.admin_v1alpha.services.analytics_admin_service
    :members:
    :inherited-members:

.. automodule:: google.analytics.admin_v1alpha.services.analytics_admin_service.pagers
    :members:
    :inherited-members:


text:
.class public Landroid/appwidget/AppWidgetHost;
.super Ljava/lang/Object;
.source "AppWidgetHost.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Landroid/appwidget/AppWidgetHost$UpdateHandler;,
        Landroid/appwidget/AppWidgetHost$Callbacks;
    }
.end annotation

# static fields
.field static final HANDLE_PROVIDER_CHANGED:I = 0x2

.field static final HANDLE_UPDATE:I = 0x1

.field static final HANDLE_VIEW_DATA_CHANGED:I = 0x3

.field static sService:Lcom/android/internal/appwidget/IAppWidgetService;

.field static final sServiceLock:Ljava/lang/Object;

# instance fields
.field mCallbacks:Landroid/appwidget/AppWidgetHost$Callbacks;

.field mContext:Landroid/content/Context;

.field private mDisplayMetrics:Landroid/util/DisplayMetrics;

.field mHandler:Landroid/os/Handler;

.field mHostId:I

.field mPackageName:Ljava/lang/String;

.field final mViews:Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/Integer;",
            "Landroid/appwidget/AppWidgetHostView;",
            ">;"
        }
    .end annotation
.end field

# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 46
    new-instance v0, Ljava/lang/Object;

    invoke-direct/range {v0 .. v0}, Ljava/lang/Object;-><init>()V

    sput-object v0, Landroid/appwidget/AppWidgetHost;->sServiceLock:Ljava/lang/Object;

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;I)V
    .locals 3
    .parameter "context"
    .parameter "hostId"

    .prologue
    .line 105
    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    .line 102
    new-instance v1, Landroid/appwidget/AppWidgetHost$Callbacks;

    invoke-direct {v1, p0}, Landroid/appwidget/AppWidgetHost$Callbacks;-><init>(Landroid/appwidget/AppWidgetHost;)V

    iput-object v1, p0, Landroid/appwidget/AppWidgetHost;->mCallbacks:Landroid/appwidget/AppWidgetHost$Callbacks;

    .line 103
    new-instance v1, Ljava/util/HashMap;

    invoke-direct {v1}, Ljava/util/HashMap;-><init>()V

    iput-object v1, p0, Landroid/appwidget/AppWidgetHost;->mViews:Ljava/util/HashMap;

    .line 106
    iput-object p1, p0, Landroid/appwidget/AppWidgetHost;->mContext:Landroid/content/Context;

    .line 107
    iput p2, p0, Landroid/appwidget/AppWidgetHost;->mHostId:I

    .line 108
    new-instance v1, Landroid/appwidget/AppWidgetHost$UpdateHandler;

    invoke-virtual {p1}, Landroid/content/Context;->getMainLooper()Landroid/os/Looper;

    move-result-object v2

    invoke-direct {v1, p0, v2}, Landroid/appwidget/AppWidgetHost$UpdateHandler;-><init>(Landroid/appwidget/AppWidgetHost;Landroid/os/Looper;)V

    iput-object v1, p0, Landroid/appwidget/AppWidgetHost;->mHandler:Landroid/os/Handler;

    .line 109
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;

    move-result-object v1

    iput-object v1, p0, Landroid/appwidget/AppWidgetHost;->mDisplayMetrics:Landroid/util/DisplayMetrics;

    .line 110
    sget-object v2, Landroid/appwidget/AppWidgetHost;->sServiceLock:Ljava/lang/Object;

    monitor-enter v2

    .line 111
    :try_start_0
    sget-object v1, Landroid/appwidget/AppWidgetHost;->sService:Lcom/android/internal/appwidget/IAppWidgetService;

    if-nez v1, :cond_0

    .line 112
    const-string v1, "appwidget"

    invoke-static {v1}, Landroid/os/ServiceManager;->getService(Ljava/lang/String;)Landroid/os/IBinder;

    move-result-object v0

    .line 113
    .local v0, b:Landroid/os/IBinder;
    invoke-static {v0}, Lcom/android/internal/appwidget/IAppWidgetService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/appwidget/IAppWidgetService;

    move-result-object v1

    sput-object v1, Landroid/appwidget/AppWidgetHost;->sService:Lcom/android/internal/appwidget/IAppWidgetService;

    .line 115
    .end local v0           #b:Landroid/os/IBinder;
    :cond_0
    monitor-exit v2

    .line 116
    return-void

    .line 115
    :catchall_0
    move-exception v1

    monitor-exit v2
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method

.method public static deleteAllHosts()V
    .locals 3

    .prologue
    .line 214
    :try_start_0
    sget-object v1, Landroid/appwidget/AppWidgetHost;->sService:Lcom/android/internal/appwidget/IAppWidgetService;

    invoke-interface {v1}, Lcom/android/internal/appwidget/IAppWidgetService;->deleteAllHosts()V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    .line 219
    return-void

    .line 216
    :catch_0
    move-exception v0

    .line 217
    .local v0, e:Landroid/os/RemoteException;
    new-instance v1, Ljava/lang/RuntimeException;

    const-string/jumbo v2, "system server dead?"

    invoke-direct {v1, v2, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1
.end method

# virtual methods
.method public allocateAppWidgetId()I
    .locals 4

    .prologue
    .line 162
    :try_start_0
    iget-object v1, p0, Landroid/appwidget/AppWidgetHost;->mPackageName:Ljava/lang/String;

    if-nez v1, :cond_0

    .line 163
    iget-object v1, p0, Landroid/appwidget/AppWidgetHost;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v1

    iput-object v1, p0, Landroid/appwidget/AppWidgetHost;->mPackageName:Ljava/lang/String;

    .line 165
    :cond_0
    sget-object v1, Landroid/appwidget/AppWidgetHost;->sService:Lcom/android/internal/appwidget/IAppWidgetService;

    iget-object v2, p0, Landroid/appwidget/AppWidgetHost;->mPackageName:Ljava/lang/String;

    iget v3, p0, Landroid/appwidget/AppWidgetHost;->mHostId:I

    invoke-interface {v1, v2, v3}, Lcom/android/internal/appwidget/IAppWidgetService;->allocateAppWidgetId(Ljava/lang/String;I)I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v1

    return v1

    .line 167
    :catch_0
    move-exception v0

    .line 168
    .local v0, e:Landroid/os/RemoteException;
    new-instance v1, Ljava/lang/RuntimeException;

    const-string/jumbo v2, "system server dead?"

    invoke-direct {v1, v2, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1
.end method

.method protected clearViews()V
    .locals 1

    .prologue
    .line 301
    iget-object v0, p0, Landroid/appwidget/AppWidgetHost;->mViews:Ljava/util/HashMap;

    invoke-virtual {v0}, Ljava/util/HashMap;->clear()V

    .line 302
    return-void
.end method

.method public final createView(Landroid/content/Context;ILandroid/appwidget/AppWidgetProviderInfo;)Landroid/appwidget/AppWidgetHostView;
    .locals 6
    .parameter "context"
    .parameter "appWidgetId"
    .parameter "appWidget"

    .prologue
    .line 227
    invoke-virtual {p0, p1, p2, p3}, Landroid/appwidget/AppWidgetHost;->onCreateView(Landroid/content/Context;ILandroid/appwidget/AppWidgetProviderInfo;)Landroid/appwidget/AppWidgetHostView;

    move-result-object v1

    .line 228
    .local v1, view:Landroid/appwidget/AppWidgetHostView;
    invoke-virtual {v1, p2, p3}, Landroid/appwidget/AppWidgetHostView;->setAppWidget(ILandroid/appwidget/AppWidgetProviderInfo;)V

    .line 229
    iget-object v4, p0, Landroid/appwidget/AppWidgetHost;->mViews:Ljava/util/HashMap;

    monitor-enter v4

    .line 230
    :try_start_0
    iget-object v3, p0, Landroid/appwidget/AppWidgetHost;->mViews:Ljava/util/HashMap;

    invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    invoke-virtual {v3, v5, v1}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 231
    monitor-exit v4
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 234
    :try_start_1
    sget-object v3, Landroid/appwidget/AppWidgetHost;->sService:Lcom/android/internal/appwidget/IAppWidgetService;

    invoke-interface {v3, p2}, Lcom/android/internal/appwidget/IAppWidgetService;->getAppWidgetViews(I)Landroid/widget/RemoteViews;
    :try_end_1
    .catch Landroid/os/RemoteException; {:try_start_1 .. :try_end_1} :catch_0

    move-result-object v2

    .line 238
    .local v2, views:Landroid/widget/RemoteViews;
    invoke-virtual {v1, v2}, Landroid/appwidget/AppWidgetHostView;->updateAppWidget(Landroid/widget/RemoteViews;)V

    .line 239
    return-object v1

    .line 231
    .end local v2           #views:Landroid/widget/RemoteViews;
    :catchall_0
    move-exception v3

    :try_start_2
    monitor-exit v4
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    throw v3

    .line 235
    :catch_0
    move-exception v0

    .line 236
    .local v0, e:Landroid/os/RemoteException;
    new-instance v3, Ljava/lang/RuntimeException;

    const-string/jumbo v4, "system server dead?"

    invoke-direct {v3, v4, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v3
.end method

.method public deleteAppWidgetId(I)V
    .locals 4
    .parameter "appWidgetId"

    .prologue
    .line 176
    iget-object v2, p0, Landroid/appwidget/AppWidgetHost;->mViews:Ljava/util/HashMap;

    monitor-enter v2

    .line 177
    :try_start_0
    iget-object v1, p0, Landroid/appwidget/AppWidgetHost;->mViews:Ljava/util/HashMap;

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-virtual {v1, v3}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 179
    :try_start_1
    sget-object v1, Landroid/appwidget/AppWidgetHost;->sService:Lcom/android/internal/appwidget/IAppWidgetService;

    invoke-interface {v1, p1}, Lcom/android/internal/appwidget/IAppWidgetService;->deleteAppWidgetId(I)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0
    .catch Landroid/os/RemoteException; {:try_start_1 .. :try_end_1} :catch_0

    .line 184
    :try_start_2
    monitor-exit v2

    .line 185
    return-void

    .line 181
    :catch_0
    move-exception v0

    .line 182
    .local v0, e:Landroid/os/RemoteException;
    new-instance v1, Ljava/lang/RuntimeException;

    const-string/jumbo v3, "system server dead?"

    invoke-direct {v1, v3, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1

    .line 184
    .end local v0           #e:Landroid/os/RemoteException;
    :catchall_0
    move-exception v1

    monitor-exit v2
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    throw v1
.end method

.method public deleteHost()V
    .locals 3

    .prologue
    .line 197
    :try_start_0
    sget-object v1, Landroid/appwidget/AppWidgetHost;->sService:Lcom/android/internal/appwidget/IAppWidgetService;

    iget v2, p0, Landroid/appwidget/AppWidgetHost;->mHostId:I

    invoke-interface {v1, v2}, Lcom/android/internal/appwidget/IAppWidgetService;->deleteHost(I)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    .line 202
    return-void

    .line 199
    :catch_0
    move-exception v0

    .line 200
    .local v0, e:Landroid/os/RemoteException;
    new-instance v1, Ljava/lang/RuntimeException;

    const-string/jumbo v2, "system server dead?"

    invoke-direct {v1, v2, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1
.end method

.method protected onCreateView(Landroid/content/Context;ILandroid/appwidget/AppWidgetProviderInfo;)Landroid/appwidget/AppWidgetHostView;
    .locals 1
    .parameter "context"
    .parameter "appWidgetId"
    .parameter "appWidget"

    .prologue
    .line 248
    new-instance v0, Landroid/appwidget/AppWidgetHostView;

    invoke-direct {v0, p1}, Landroid/appwidget/AppWidgetHostView;-><init>(Landroid/content/Context;)V

    return-object v0
.end method

.method protected onProviderChanged(ILandroid/appwidget/AppWidgetProviderInfo;)V
    .locals 4
    .parameter "appWidgetId"
    .parameter "appWidget"

    .prologue
    .line 260
    iget v1, p2, Landroid/appwidget/AppWidgetProviderInfo;->minWidth:I

    iget-object v2, p0, Landroid/appwidget/AppWidgetHost;->mDisplayMetrics:Landroid/util/DisplayMetrics;

    invoke-static {v1, v2}, Landroid/util/TypedValue;->complexToDimensionPixelSize(ILandroid/util/DisplayMetrics;)I

    move-result v1

    iput v1, p2, Landroid/appwidget/AppWidgetProviderInfo;->minWidth:I

    .line 262
    iget v1, p2, Landroid/appwidget/AppWidgetProviderInfo;->minHeight:I

    iget-object v2, p0, Landroid/appwidget/AppWidgetHost;->mDisplayMetrics:Landroid/util/DisplayMetrics;

    invoke-static {v1, v2}, Landroid/util/TypedValue;->complexToDimensionPixelSize(ILandroid/util/DisplayMetrics;)I

    move-result v1

    iput v1, p2, Landroid/appwidget/AppWidgetProviderInfo;->minHeight:I

    .line 264
    iget v1, p2, Landroid/appwidget/AppWidgetProviderInfo;->minResizeWidth:I

    iget-object v2, p0, Landroid/appwidget/AppWidgetHost;->mDisplayMetrics:Landroid/util/DisplayMetrics;

    invoke-static {v1, v2}, Landroid/util/TypedValue;->complexToDimensionPixelSize(ILandroid/util/DisplayMetrics;)I

    move-result v1

    iput v1, p2, Landroid/appwidget/AppWidgetProviderInfo;->minResizeWidth:I

    .line 266
    iget v1, p2, Landroid/appwidget/AppWidgetProviderInfo;->minResizeHeight:I

    iget-object v2, p0, Landroid/appwidget/AppWidgetHost;->mDisplayMetrics:Landroid/util/DisplayMetrics;

    invoke-static {v1, v2}, Landroid/util/TypedValue;->complexToDimensionPixelSize(ILandroid/util/DisplayMetrics;)I

    move-result v1

    iput v1, p2, Landroid/appwidget/AppWidgetProviderInfo;->minResizeHeight:I

    .line 269
    iget-object v2, p0, Landroid/appwidget/AppWidgetHost;->mViews:Ljava/util/HashMap;

    monitor-enter v2

    .line 270
    :try_start_0
    iget-object v1, p0, Landroid/appwidget/AppWidgetHost;->mViews:Ljava/util/HashMap;

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-virtual {v1, v3}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/appwidget/AppWidgetHostView;

    .line 271
    .local v0, v:Landroid/appwidget/AppWidgetHostView;
    monitor-exit v2
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 272
    if-eqz v0, :cond_0

    .line 273
    invoke-virtual {v0, p2}, Landroid/appwidget/AppWidgetHostView;->resetAppWidget(Landroid/appwidget/AppWidgetProviderInfo;)V

    .line 275
    :cond_0
    return-void

    .line 271
    .end local v0           #v:Landroid/appwidget/AppWidgetHostView;
    :catchall_0
    move-exception v1

    :try_start_1
    monitor-exit v2
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v1
.end method

.method public startListening()V
    .locals 9

    .prologue
    .line 124
    new-instance v4, Ljava/util/ArrayList;

    invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V

    .line 127
    .local v4, updatedViews:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Landroid/widget/RemoteViews;>;"
    :try_start_0
    iget-object v5, p0, Landroid/appwidget/AppWidgetHost;->mPackageName:Ljava/lang/String;

    if-nez v5, :cond_0

    .line 128
    iget-object v5, p0, Landroid/appwidget/AppWidgetHost;->mContext:Landroid/content/Context;

    invoke-virtual {v5}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v5

    iput-object v5, p0, Landroid/appwidget/AppWidgetHost;->mPackageName:Ljava/lang/String;

    .line 130
    :cond_0
    sget-object v5, Landroid/appwidget/AppWidgetHost;->sService:Lcom/android/internal/appwidget/IAppWidgetService;

    iget-object v6, p0, Landroid/appwidget/AppWidgetHost;->mCallbacks:Landroid/appwidget/AppWidgetHost$Callbacks;

    iget-object v7, p0, Landroid/appwidget/AppWidgetHost;->mPackageName:Ljava/lang/String;

    iget v8, p0, Landroid/appwidget/AppWidgetHost;->mHostId:I

    invoke-interface {v5, v6, v7, v8, v4}, Lcom/android/internal/appwidget/IAppWidgetService;->startListening(Lcom/android/internal/appwidget/IAppWidgetHost;Ljava/lang/String;ILjava/util/List;)[I
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v3

    .line 136
    .local v3, updatedIds:[I
    array-length v0, v3

    .line 137
    .local v0, N:I
    const/4 v2, 0x0

    .local v2, i:I
    :goto_0
    if-ge v2, v0, :cond_1

    .line 138
    aget v6, v3, v2

    invoke-virtual {v4, v2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Landroid/widget/RemoteViews;

    invoke-virtual {p0, v6, v5}, Landroid/appwidget/AppWidgetHost;->updateAppWidgetView(ILandroid/widget/RemoteViews;)V

    .line 137
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    .line 132
    .end local v0           #N:I
    .end local v2           #i:I
    .end local v3           #updatedIds:[I
    :catch_0
    move-exception v1

    .line 133
    .local v1, e:Landroid/os/RemoteException;
    new-instance v5, Ljava/lang/RuntimeException;

    const-string/jumbo v6, "system server dead?"

    invoke-direct {v5, v6, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v5

    .line 140
    .end local v1           #e:Landroid/os/RemoteException;
    .restart local v0       #N:I
    .restart local v2       #i:I
    .restart local v3       #updatedIds:[I
    :cond_1
    return-void
.end method

.method public stopListening()V
    .locals 3

    .prologue
    .line 148
    :try_start_0
    sget-object v1, Landroid/appwidget/AppWidgetHost;->sService:Lcom/android/internal/appwidget/IAppWidgetService;

    iget v2, p0, Landroid/appwidget/AppWidgetHost;->mHostId:I

    invoke-interface {v1, v2}, Lcom/android/internal/appwidget/IAppWidgetService;->stopListening(I)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    .line 153
    return-void

    .line 150
    :catch_0
    move-exception v0

    .line 151
    .local v0, e:Landroid/os/RemoteException;
    new-instance v1, Ljava/lang/RuntimeException;

    const-string/jumbo v2, "system server dead?"

    invoke-direct {v1, v2, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1
.end method

.method updateAppWidgetView(ILandroid/widget/RemoteViews;)V
    .locals 4
    .parameter "appWidgetId"
    .parameter "views"

    .prologue
    .line 279
    iget-object v2, p0, Landroid/appwidget/AppWidgetHost;->mViews:Ljava/util/HashMap;

    monitor-enter v2

    .line 280
    :try_start_0
    iget-object v1, p0, Landroid/appwidget/AppWidgetHost;->mViews:Ljava/util/HashMap;

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-virtual {v1, v3}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/appwidget/AppWidgetHostView;

    .line 281
    .local v0, v:Landroid/appwidget/AppWidgetHostView;
    monitor-exit v2
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 282
    if-eqz v0, :cond_0

    .line 283
    invoke-virtual {v0, p2}, Landroid/appwidget/AppWidgetHostView;->updateAppWidget(Landroid/widget/RemoteViews;)V

    .line 285
    :cond_0
    return-void

    .line 281
    .end local v0           #v:Landroid/appwidget/AppWidgetHostView;
    :catchall_0
    move-exception v1

    :try_start_1
    monitor-exit v2
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v1
.end method

.method viewDataChanged(II)V
    .locals 4
    .parameter "appWidgetId"
    .parameter "viewId"

    .prologue
    .line 289
    iget-object v2, p0, Landroid/appwidget/AppWidgetHost;->mViews:Ljava/util/HashMap;

    monitor-enter v2

    .line 290
    :try_start_0
    iget-object v1, p0, Landroid/appwidget/AppWidgetHost;->mViews:Ljava/util/HashMap;

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-virtual {v1, v3}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/appwidget/AppWidgetHostView;

    .line 291
    .local v0, v:Landroid/appwidget/AppWidgetHostView;
    monitor-exit v2
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 292
    if-eqz v0, :cond_0

    .line 293
    invoke-virtual {v0, p2}, Landroid/appwidget/AppWidgetHostView;->viewDataChanged(I)V

    .line 295
    :cond_0
    return-void

    .line 291
    .end local v0           #v:Landroid/appwidget/AppWidgetHostView;
    :catchall_0
    move-exception v1

    :try_start_1
    monitor-exit v2
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v1
.end method


text:
ACCEPTED

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

#### Published in
Sydowia 38: 303 (1986)

#### Original name
Parorbiliopsis minuta Spooner & Dennis, 1986

### Remarks
null


text:
import React, { Component } from 'react';
import {
    View,
    ListView,
    StyleSheet,
    Text,
    Image,
    ScrollView,
    AsyncStorage,
    RefreshControl,
    ActivityIndicator,
    TextInput
} from 'react-native';

import RatingView from 'react-native-star-rating-view/StarRatingBar';

let recommenedApps = [];
let ratingResults = [];
let topApps = [];
let displayingApps = [];
const PLACEHOLDER = "Search for app";

export default class TopAppsListView extends Component {
    constructor(props) {
        super(props);
        this.state = {
            searching: false,
            refreshing: false,
            currentStart: 0,
            queryingRating: true,
            queryingTopApps: true,
            bQueryingRecommendedApps: true,
            page: 1,
            dataSource: new ListView.DataSource({
                rowHasChanged: (row1, row2) => row1 !== row2,
            }),
            dataSourceRecommended: new ListView.DataSource({
                rowHasChanged: (row1, row2) => row1 !== row2,
            }),
        };
    }

    componentDidMount() {
        this.queryTopFreeApps();
        this.queryRecommendedApps();
    }

    componentWillUnmount() {
        // this.timer && this.timer.clearTimeOut(this.timer);
    }

    /**
     * Requests should wrap it in API.js
     */
    async queryTopFreeApps() {
        await fetch("https://itunes.apple.com/hk/rss/topfreeapplications/limit=100/json",
            { method: "GET" })
            .then((response) => {
                return response.json();
            })
            .then(data => {
                this.persistApps('topapps', data.feed.entry);
                this.queryAppDetailById(data.feed.entry);
            })
            .catch((exception) => {
                console.log(exception);
            })
            .done();
    }

    queryAppDetailById(apps) {
        apps.map(function (item) {
            fetch("https://itunes.apple.com/hk/lookup?id=" + item.id.attributes['im:id'], { method: "GET" })
                .then((response) => {
                    return response.json();
                })
                .then(data => {
                    ratingResults.push(data.results[0].averageUserRating);
                })
                .catch((exception) => {
                    console.log(exception);
                })
                .done();
        })
        this.setState({
            queryingTopApps: false,
        })
    }

    async queryRecommendedApps() {
        await fetch("https://itunes.apple.com/hk/rss/topgrossingapplications/limit=10/json", { method: "GET" })
            .then((response) => {
                return response.json();
            })
            .then(data => {
                this.persistRecommendedApps('recommended', data.feed.entry)
            })
            .catch((exception) => {
                console.log(exception);
            })
            .done();
    }

    /**
     * Persist apps to storage
     */

    async persistRecommendedApps(key, json) {
        try {
            await AsyncStorage
                .setItem(key, JSON.stringify(json))
                .then(this.getCachedRecommendedApps(key));
        } catch (error) {
            console.log(error)
        }
    }

    async persistApps(key, json) {
        try {
            await AsyncStorage
                .setItem(key, JSON.stringify(json))
                .then(this.getCachedApps(key));
        } catch (error) {
            console.log(error)
        }
    }

    async getCachedRecommendedApps(key) {
        try {
            await AsyncStorage.getItem(key).then((value) => {
                recommenedApps = JSON.parse(value)
                this.setState({
                    dataSourceRecommended: this.state.dataSourceRecommended.cloneWithRows(recommenedApps),
                    bQueryingRecommendedApps: false
                });
            })
        } catch (error) {
            console.log(error)
        }
    }

    async getCachedApps(key) {
        if (this.state.currentStart != 0) {
            displayingApps = displayingApps.concat(topApps.slice(this.state.currentStart, this.state.currentStart + 10))
        } else {
            try {
                await AsyncStorage.getItem(key).then((value) => {
                    topApps = JSON.parse(value)
                    displayingApps = topApps.slice(0, 10)
                })

            } catch (error) {
                console.log(error)
            }
        }
        this.setState({
            dataSource: this.state.dataSource.cloneWithRows(displayingApps),
            currentStart: this.state.currentStart + 10
        });
    }

    /**
     * Filter functions
     */

    filterApps(keywords) {
        if (keywords.length == 0) {
            this.setState({
                searching: false,
                dataSource: this.state.dataSource.cloneWithRows(topApps.slice(0, 10)),
            })
        } else {
            const filtered = topApps.filter(function (item) {
                const itemData = item['im:name'].label.toLowerCase();
                const searchData = keywords.toLowerCase().replace(/\\/g, "\\\\");
                return itemData.search(searchData) !== -1;
            });

            console.log(filtered)

            this.setState({
                searching: true,
                dataSource: this.state.dataSource.cloneWithRows(filtered),
            })
        }
    }

    filterRecommendedApps(keywords) {
        if (keywords.length == 0) {
            this.setState({
                searching: false,
                dataSourceRecommended: this.state.dataSourceRecommended.cloneWithRows(recommenedApps),
            })
        } else {
            const filtered = recommenedApps.filter(function (item) {
                const itemData = item['im:name'].label.toLowerCase();
                const searchData = keywords.toLowerCase().replace(/\\/g, "\\\\");
                return itemData.search(searchData) !== -1;
            });

            console.log(filtered)

            this.setState({
                searching: true,
                dataSourceRecommended: this.state.dataSourceRecommended.cloneWithRows(filtered),
            })
        }
    }

    /**
     * Render view components
     */
    renderSearchView() {
        return (
            <View style={searchStyles.searchContainer}>
                <TextInput
                    style={searchStyles.input}
                    placeholder={" " + PLACEHOLDER}
                    onChangeText={(keywords) => {
                        this.filterApps(keywords),
                            this.filterRecommendedApps(keywords)
                    }}
                />
            </View>
        )
    }

    renderRecommendedView() {
        return (
            <View style={recommenedStyles.container}>
                <Text style={recommenedStyles.header}>Recommended</Text>
                {
                    !this.state.bQueryingRecommendedApps &&
                    <ListView
                        scrollWi
                        initialListSize={5}
                        enableEmptySections={true}
                        horizontal={true}
                        dataSource={this.state.dataSourceRecommended}
                        renderRow={this._renderRecommendRow}
                    />
                }
            </View>
        )
    }

    renderFooter = () => {
        if (this.state.searching) {
            return
        }
        if (this.state.currentStart == topApps.length) {
            return <View style={{
                justifyContent: 'center',
                alignItems: 'center',
                flex: 1,
                margin: 20,
            }}><Text>END OF FEED</Text></View>
        } else {
            return <ActivityIndicator
                style={[styles.centering
                    , { backgroundColor: '#ffffff', margin: 20 }]}
            />
        }
    }

    /**
     * odd row ? round corner : circle
     */
    _renderRow(rowData, sectionID, rowID) {
        return (
            <View style={styles.itemContainer}>
                <Text style={styles.index}>
                    {parseInt(rowID) + 1}
                </Text>
                {
                    parseInt(rowID) % 2 == 0
                        ?
                        <Image source={{ uri: rowData['im:image'][0].label }} style={styles.thumbnailEven} />
                        :
                        <Image source={{ uri: rowData['im:image'][0].label }} style={styles.thumbnailOdd} />
                }
                <View style={styles.textContainer}>
                    <Text style={styles.name}>
                        {`${rowData['im:name'].label}`}
                    </Text>
                    <Text style={styles.category}>
                        {`${rowData.category.attributes.term}`}
                    </Text>
                    <RatingView
                        score={ratingResults[rowID]}
                        allowsHalfStars={true}
                        tintColor={'red'}
                        scoreTextColor={'red'}
                    />
                </View>

            </View>
        );
    }

    _renderRecommendRow(rowData, sectionID, rowID) {
        return (
            <View style={recommenedStyles.itemContainer}>
                <Image style={recommenedStyles.thumbnail}
                    source={{ uri: rowData['im:image'][0].label }} />
                <Text style={recommenedStyles.name}>
                    {rowData['im:name'].label}
                </Text>
                <Text style={recommenedStyles.category}>
                    {rowData.category.attributes.term}
                </Text>
            </View>
        );
    }

    /**
     * UI Callbacks
     */
    _onEndReached() {
        if (this.state.currentStart == topApps.length || this.state.searching) {
            return
        }
        setTimeout(
            () => {
                if (this.state.currentStart > 0) {
                    this.getCachedApps('topapps')
                }
                this.setState({
                    dataSource: this.state.dataSource.cloneWithRows(displayingApps)
                })
            }, 250);
    }

    _onRefresh() {
        if (this.state.searching) {
            return
        }
        this.setState({
            refreshing: true,
            currentStart: 0,
        })
        displayingApps = [];
        this.queryTopFreeApps();
        this.setState({ refreshing: false })
    }

    render() {
        return (
            <View style={styles.mainContainer}>
                {this.renderSearchView()}
                <View style={{ flex: 1 }}>
                    {
                        !this.state.queryingTopApps &&
                        <ListView
                            initialListSize={5}
                            enableEmptySections={true}
                            dataSource={this.state.dataSource}
                            renderRow={this._renderRow}
                            onEndReachedThreshold={10}
                            onEndReached={this._onEndReached.bind(this)}
                            refreshControl={
                                <RefreshControl
                                    refreshing={this.state.refreshing}
                                    onRefresh={this._onRefresh.bind(this)}
                                />
                            }
                            renderHeader={this.renderRecommendedView.bind(this)}
                            renderFooter={this.renderFooter}
                            renderSeparator={(rowID) => <View key={rowID} style={styles.separator} />
                            }
                        />
                    }
                </View>
            </View>
        );
    }
}

const recommenedStyles = StyleSheet.create({
    container: {
        borderBottomWidth: .25,
        borderColor: 'gray',
        flexDirection: 'column',
        backgroundColor: '#ffffff'
    },
    header: {
        margin: 16,
        color: 'black',
        fontSize: 16,
    },
    itemContainer: {
        width: 75,
        marginLeft: 16,
        marginRight: 16,
        flexDirection: 'column'
    },
    name: {
        marginTop: 8,
        justifyContent: 'center',
        fontSize: 12,
    },
    category: {
        marginTop: 8,
        marginBottom: 8,
        justifyContent: 'center',
        fontSize: 10,
    },
    thumbnail: {
        height: 60,
        width: 60,
        borderRadius: 10,
    },
})

const searchStyles = StyleSheet.create({
    searchContainer: {
        padding: 8,
        backgroundColor: '#FFFFFF',
        borderBottomWidth: .25,
        borderColor: 'gray'
    },
    input: {
        height: 35,
        fontSize: 12,
        backgroundColor: '#EEE9E9',
        borderRadius: 10,
    }
})

const styles = StyleSheet.create({
    mainContainer: {
        flex: 1,
        backgroundColor: '#ffffff'
    },
    itemContainer: {
        flex: 1,
        padding: 10,
        flexDirection: 'row',
    },
    index: {
        lineHeight: 50,
        justifyContent: 'center',
    },
    textContainer: {
        flex: 1,
        flexDirection: 'column'
    },
    name: {
        marginTop: 6,
        fontSize: 16,
    },
    category: {
        marginTop: 6,
        fontSize: 12,
    },
    thumbnailOdd: {
        height: 60,
        width: 60,
        borderRadius: 10,
        margin: 10
    },
    thumbnailEven: {
        height: 60,
        width: 60,
        borderRadius: 30,
        margin: 10
    },
});


text:
<?php

namespace PlentyConnector\DependencyInjection\CompilerPass;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

class ConnectorDefinitionCompilerPass implements CompilerPassInterface
{
    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        if (!$container->has('plenty_connector.connector')) {
            return;
        }

        $definition = $container->findDefinition('plenty_connector.connector');

        $taggedServices = $container->findTaggedServiceIds('plenty_connector.connector_definition');

        foreach ($taggedServices as $id => $tags) {
            $definition->addMethodCall('addDefinition', [new Reference($id)]);
        }
    }
}


text:
package io.searchbox.core;

import io.searchbox.action.BulkableAction;
import io.searchbox.action.SingleResultAbstractDocumentTargetedAction;
import io.searchbox.params.Parameters;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.util.Collection;

/**
 * @author Dogukan Sonmez
 * @author cihat keser
 */
public class Index extends SingleResultAbstractDocumentTargetedAction implements BulkableAction<DocumentResult> {

    protected Index(Builder builder) {
        super(builder);

        this.payload = builder.source;
        setURI(buildURI());
    }

    @Override
    public String getPathToResult() {
        return "ok";
    }

    @Override
    public String getRestMethodName() {
        return (id != null) ? "PUT" : "POST";
    }

    @Override
    public String getBulkMethodName() {
        Collection<Object> opType = getParameter(Parameters.OP_TYPE);
        if (opType != null) {
            if (opType.size() > 1) {
                throw new IllegalArgumentException("Expecting a single value for OP_TYPE parameter, you provided: " + opType.size());
            }
            return (opType.size() == 1 && ((opType.iterator().next()).toString().equalsIgnoreCase("create"))) ? "create" : "index";
        } else {
            return "index";
        }
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder()
                .appendSuper(super.hashCode())
                .toHashCode();
    }

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

        Index rhs = (Index) obj;
        return new EqualsBuilder()
                .appendSuper(super.equals(obj))
                .isEquals();
    }

    public static class Builder extends SingleResultAbstractDocumentTargetedAction.Builder<Index, Builder> {
        private final Object source;

        public Builder(Object source) {
            this.source = source;
            this.id(getIdFromSource(source)); // set the default for id if it exists in source
        }

        public Index build() {
            return new Index(this);
        }
    }
}


text:
import pymongo
coll=pymongo.MongoClient().quantaxis.market_history
for item in coll.find({}):
    if float(item['bid']['price']) > float(item['market']['high']) or float(item['bid']['price']) < float(item['market']['low']):
        print('wrong')
    else: print('ok')


text:
A simple notification system built to be light yet functional.

Use the Table of contents for quick navigation around this readme file.

class_options

Required steps

Usage without php

Usage with php

Animations

Screenshots

##Class options
These are all the options provided by default in the SNS. Have a look at the "Usage" part of this readme to find out how to apply these classes.

		Class
        Function

    	topleft
        Use this class if you want the popup on the top left

    	topright
        Use this class if you want the popup on the top right

    	botleft
        Use this class if you want the popup on the bottom left

    	botright
        Use this class if you want the popup on the bottom right

    	flip
        flip will flip the border from top to bottom, usefull for when you your popup on the top of the page

    	edged
        edged will remove the margin and stick it to the bottom / top

    	lightshadow
        Replaces the default (black) shadow with a white one, perfect for dark backgrounds!

    	blackred
        Default black & red theme

    	whitered
        Default white & red theme

##required steps
To make SNS work you have to add 2 bits of code apart from the actual content div. These should be included on every page with a popup.
One being the link to the css (for best performance you could include the css code in your own stylesheet).
We can add the css as follows:

`<link rel='stylesheet' href='./notifier.css' type='text/css' />`

We will also need to have a jQuery script to start the animation. Examples of these can be found under: Animations

The default script would be as follows:

`<script>$('#notifier').slideDown('slow').delay(5000).slideUp('slow');</script>`

You should add the jQuery to the very bottom of the page, right before the end `</body>` tag.

##Usage without php
Using SNS without php requires you to write the html code yourself, this is fine if you want to have a single or very few popups. If you want to have a side-wide solution I suggest you go to "Usage with php"

To use SNS without php you will have to dig in the css file.
Let's have a look at notifier.css, in notifier.css you'll find 2 themes (blackred & whitered). These themes are examples upon which you can build yourself.
After you've created a css class with your own style (or if you want to use one of the provided themes) we can continue on to the html code.

The popup window will be constructed using a "div", for this explanation we will use the id "notifier" (we will require the id later). The div also requires the class "notifier". For now you should have the following code:
```
<div id="notifier" class = "notifier"><a onclick="document.getElementById('notifier').style.display='none';return false;" href="#" id="close">
X</a>
    <b>Hello world.</b>
    <p>
       Popup box!
    </p>
</div>
```
As you can see, I've added a "close" button and some text to the div.

Now we will have to add more "class_options".
To do this edit the piece of code that says:

`<div id="notifier" class = "notifier">`

to include the new classes like so:

`<div id="notifier" class = "notifier whitered botright edged">`

In this example the popup will appear in the bottom right and will be stuck to the browsers bottom. (screenshot 1)

##Usage with php
If you want to use a popup on many pages I suggest going with this solution.
I will make the assumption that you already have an included footer and header.

To start, place the sns.php file somewhere in your project.
Open up your header include file and add the following line:
`<?php include('sns.php');?>`**You might have to change the path**

Now open up your footer include file and add this line of jQuery:
`<script>$('#notifier').slideDown('slow').delay(5000).slideUp('slow');</script>`

The preparations are now done. You can now simply call a popup from any page with:
`<?php  popUp("notifier botright whitred edged", "Testtext");?>`

Of course you need to replace the parameters to adjust it to your sites look and feel.

##Animation
There are many animations you can do with jQuery, I will be supplying you with 2 of them.

**fadein and fadeout:**

`<script>$('#notifier').fadeIn('slow').delay(5000).fadeOut('slow');</script>`
![gif1](Screenshots/fade.gif)

**Slide in and slide out:**

`<script>$('#notifier').slideDown('slow').delay(5000).slideUp('slow');</script>`
![gif1](Screenshots/slide.gif)

Both examples have a 5000ms delay.

##Screenshots

![screenshot1](Screenshots/s1.png)
![screenshot2](Screenshots/s2.png)
![screenshot3](Screenshots/s3.png)


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _apolloClient = require('apollo-client');

var _apolloCacheInmemory = require('apollo-cache-inmemory');

var _apolloLinkSchema = require('apollo-link-schema');

var _retabulateGraphql = require('retabulate-graphql');

var _retabulateGraphql2 = _interopRequireDefault(_retabulateGraphql);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var RetabulateProvider = function (_React$Component) {
  _inherits(RetabulateProvider, _React$Component);

  function RetabulateProvider(props) {
    _classCallCheck(this, RetabulateProvider);

    var _this = _possibleConstructorReturn(this, (RetabulateProvider.__proto__ || Object.getPrototypeOf(RetabulateProvider)).call(this, props));

    var getDataset = props.getDataset;

    _this.client = new _apolloClient.ApolloClient({
      cache: new _apolloCacheInmemory.InMemoryCache(),
      link: new _apolloLinkSchema.SchemaLink({ schema: _retabulateGraphql2.default, context: { getDataset: getDataset } })
    });
    return _this;
  }

  _createClass(RetabulateProvider, [{
    key: 'getChildContext',
    value: function getChildContext() {
      return { RetabulateClient: this.client };
    }
  }, {
    key: 'render',
    value: function render() {
      return this.props.children;
    }
  }]);

  return RetabulateProvider;
}(_react2.default.Component);

RetabulateProvider.childContextTypes = {
  RetabulateClient: _propTypes2.default.object
};

exports.default = RetabulateProvider;


text:
from tinydb import where

from utils.torrent_util import torrent_to_movie

class Model(object):
    def __init__(self, database, table):
        self.table = database.table(table)

    def find(self, key, value):
        return self.table.get(where(key) == value)

    def contains(self, key, value):
        return self.table.contains(where(key) == value)

    def insert(self, data_dict):
        return self.table.insert(data_dict)

    def update(self, key, value, data_dict):
        return self.table.update(data_dict, where(key) == value)

    def update_by_eid(self, eid, data):
        return self.table.update(data, eids=[eid])

    def remove(self, key, value):
        return self.table.remove(where(key) == value)

    def all(self):
        return self.table.all()

class Movie(Model):
    def get_data(self, movie):
        def test_fn(value_list, name):
            return name in value_list

        def equals_clean_movie_name(value, name):
            return torrent_to_movie(value)["name"] == name

        query = (
            where("search_phrases").test(test_fn, movie["name"]) |
            where("title").test(equals_clean_movie_name, movie["name"]) |
            where("title_swe").test(equals_clean_movie_name, movie["name"])
        )
        if movie["year"]:
            query &= (where("year") == movie["year"])

        records = self.table.search(query)

        if not records:
            return None

        return records[0]

    def has_all_fields(self, movie, mapping):
        record = self.get_data(movie)
        if not record:
            return mapping.keys()

        missing_keys = set(mapping.keys()) - set(record.keys())
        return list(missing_keys)

    def update_movie(self, movie, data):
        record = self.find("id", data["id"])

        # Fallback: Sometimes IMDB id's change, use title and year
        if not record:
            record = self.get_data(movie)

        if record:
            data["search_phrases"] = record.get("search_phrases", [])
            if movie["name"] not in data["search_phrases"]:
                data["search_phrases"].append(movie["name"])

            self.update_by_eid(record.eid, data)
        else:
            data["search_phrases"] = [movie["name"]]
            self.insert(data)


text:
'use strict';

angular.module('mean.icu.ui.discussionlist', [])
    .controller('DiscussionListController', function ($scope,
                                                      $state,
                                                      discussions,
                                                      DiscussionsService,
                                                      context,
                                                      $filter,
                                                      $stateParams) {
        $scope.discussions = discussions;
        $scope.showStarred = false;

        $scope.isCurrentState = function() {
            return $state.current.name.indexOf('main.discussions.byentity') === 0 &&
                $state.current.name.indexOf('details') === -1;
        };

        $scope.changeOrder = function () {
            $scope.sorting.isReverse = !$scope.sorting.isReverse;
        };

        $scope.sorting  = {
            field: 'created',
            isReverse: false
        };

        $scope.discussionOrder = function(task) {
            if (task._id && $scope.sorting) {
                var parts = $scope.sorting.field.split('.');
                var result = task;
                for (var i = 0; i < parts.length; i+=1) {
                    if (result) {
                        result = result[parts[i]];
                    } else {
                        result = undefined;
                    }
                }

                return result;
            }
        };

        function sort() {
            var result = $filter('orderBy')($scope.discussions, $scope.discussionOrder);
            Array.prototype.splice.apply($scope.discussions, [0, $scope.discussions.length].concat(result));
        }

        sort();
        $scope.$watch('sorting.field', function() {
            sort();
        });

        $scope.sortingList = [
            {
                title: 'due',
                value: 'due'
            }, {
                title: 'title',
                value: 'title'
            }, {
                title: 'status',
                value: 'status'
            }, {
                title: 'created',
                value: 'created'
            }
        ];

        function navigateToDetails(discussion, isStarred) {
            $scope.detailsState = context.entityName === 'all' ?
                'main.discussions.all.details' : 'main.discussions.byentity.details';

            $state.go($scope.detailsState, {
                id: discussion._id,
                entity: $scope.currentContext.entityName,
                entityId: $scope.currentContext.entityId,
                starred: isStarred
            });
        }

        $scope.starredOnly = function () {
            $scope.showStarred = !$scope.showStarred;
            if ($scope.showStarred) {
                DiscussionsService.getStarred().then(function (starred) {
                    $scope.discussions = _(discussions).reduce(function (list, item) {
                        var contains = _(starred).any(function (s) {
                            return s._id === item._id;
                        });

                        if (contains) {
                            list.push(item);
                        }

                        return list;
                    }, []);
                    if ($scope.discussions[0]) {
                        navigateToDetails($scope.discussions[0], true);
                    }
                });
            } else {
                $scope.discussions = discussions;
                if ($scope.discussions[0]) {
                    navigateToDetails($scope.discussions[0], false);
                }
            }
        };

        if ($stateParams.starred) {
            $scope.starredOnly();
        }

        if ($scope.discussions.length) {
            if ($state.current.name === 'main.discussions.all' ||
                $state.current.name === 'main.discussions.byentity') {
                navigateToDetails($scope.discussions[0]);
            }
        }
        else {
            if ($state.current.name !== 'main.discussions.byentity.activities' ||
                $state.current.name !== 'main.discussions.byentity.details.activities') {
                $state.go('.activities');
            }
        }
    });