text:
const axios = require('axios')

class FormPoster
{
    constructor() {
        const _this = this;
        this.events = {
            'api-progress': this.handleApiProgress,
            'api-prepare':  this.handleApiPrepare,
            'api-error':    this.handleApiError,
            'api-success':  this.handleApiSuccess,
            'api-done':     this.handleApiDone
        };

        if(typeof(document) === 'undefined')
            return;

        document.addEventListener('submit', (e) => {
            const elm = e.target;
            if(!elm || (elm.tagName && String(elm.tagName).toLowerCase() !== 'form') || !elm.getAttribute('action') || e.defaultPrevented)
                return;

            e.preventDefault()
            this.handleFormSubmit(elm);
        })
    }

    notify(type, message) {
        // console.log('todo notify', type, message);
    }

    handleApiError(form, data)
    {
        var msg = "An error occured while processing your request";
        const err = data.error;

        if(typeof(err) == 'object' || typeof(err) == "array")
        {
            if(typeof(err.error) == 'string')
                msg = err.error;
        }
        else if(typeof(err) == "string")
            msg = err;

        this.notify('danger', msg);
    }

    handleApiSuccess(form, data)
    {
        const msg = data.result;

        if(form.hasAttribute('SuccessMessage'))
           return this.notify('success', form.getAttribute('SuccessMessage'));

        if(typeof(msg) == 'string')
            return this.notify('success', msg);

        if(typeof(msg) == 'object')
        {
            if(typeof(msg.result) == 'string')
                return this.notify('success', msg.result);
        }

        return this.notify('success', msg.message || 'Data successfully updated!');
    }

    handleApiPrepare(form, data)
    {
        //$(form).find('input, textarea, select, button').not(':disabled').attr('disabled', true).attr('predisabled', true);

        //ToDo: set loader icon
    }

    handleApiProgress(form, data)
    {
        //ToDo set progress in button
    }

    handleApiDone(form)
    {
        //$(form).find('[predisabled]').removeAttr('disabled').removeAttr('predisabled');
    }

    trigger(elm, eventName, data)
    {
        try
        {
            const secondName = eventName.replace(/-\S*/g, function(txt){ return txt.charAt(1).toUpperCase() + txt.substr(2).toLowerCase();});

            if(secondName !== eventName)
            {
                if(!this.trigger(elm, secondName, data))
                    return;
            }

            //------------------------------------------------------------------------

            var event; // The custom event that will be created

            if (document.createEvent) {
                event = document.createEvent("HTMLEvents");
                event.initEvent(eventName, true, true);
            } else {
                event = document.createEventObject();
                event.eventType = eventName;
            }

            event.eventName = eventName;

            for(var key in data)
                event[key] = data[key];

            if (document.createEvent)
                elm.dispatchEvent(event);
            else
                elm.fireEvent("on" + event.eventType, event);

            if(event.defaultPrevented)
                return false;
        }
        catch(e)
        {
            console.error(e);
        }

        try
        {
            if(this.events[eventName])
                this.events[eventName].call(this, elm, data);
        }
        catch(e)
        {
            console.error(e);
        }

        return true;
    }

    handleFormSubmit(elm)
    {
        const api = elm.getAttribute('action');
        var data  = null;

        //that.trigger('api-before-submit', elm);
        this.trigger(elm, 'api-before-submit', { api: api });

        if(elm.querySelectorAll('input[type="file"]:not([disabled])').length > 0) {
            elm.attr('enctype', 'multipart/form-data');
            data = new FormData(elm);
        }
        else {
            elm.setAttribute('enctype', 'application/json');
            data = this.$api.mergePost(serializeObject(elm), api);
        }

        this.trigger(elm, 'api-prepare', { api: api });

        return this.$post(api, data).then((res) => {
            this.trigger(elm, 'api-success', { api: api, result: res });
            return res;
        }).catch((err) => {
            if(err.status == 524)
                this.trigger(elm, 'api-error', { api: api, result: err, error: "timeout", status: err.status });
            else
                this.trigger(elm, 'api-error', { api: api, result: err, error: err.error || err.message || err, status: err.status });
            return err;
        }).then((res) => {
            this.trigger(elm, 'api-done', { api: api, result: res });
        });
    }

    $post(api, post) {
        return axios.post(api.substr(0, 1) === '/' ? api : '/api/' + api, post).then((res) => {
            return res.data
        }).catch((err) => {
            const isStatus = (status) => (err.status === status || (err.response && err.response.status === status))
            if(isStatus(401) || isStatus(403)) {
                var data = (err && err.response && err.response.data) || err
                if(isStatus(401) && data.location)
                    location.href = data.location
            }

            if(err && err.response && err.response.data) {
                var data = err.response.data;
                try {
                    data = typeof(err.response.data) !== "object" ? JSON.parse(err.response.data) : err.response.data;
                } catch(e) {
                    console.error('error with data', err.response.data, '=>', e);
                }

                throw({
                    error: data ? (data.error || data.message || data) : data,
                    status: err.response.status || err.status,
                })
            }

            throw({
                error: err.error || err.message || err,
                status: (err.response && err.response.status) || err.status,
            })
        })
    }
}

if(!FormPoster.shared)
    FormPoster.shared = new FormPoster();

export default FormPoster.shared;

// ------------

function serializeObject(form) {
    var o = {};
    var elements = form.querySelectorAll(("input,textarea"));
    for(var key in elements) {
        const elm = elements[key]
        if(elm.disabled || !elm.name || typeof(elm) === 'function')
            continue

        if (o[elm.name] !== undefined) {
            if (!o[elm.name].push) {
                o[elm.name] = [o[elm.name]];
            }

            o[elm.name].push(elm.value || '');
        } else {
            o[elm.name] = elm.value || '';
        }
    }

    return o;
};


text: {{ site.author }} - Source

redpajama_set_name: RedPajamaGithub


text:
layout: post
status: publish
published: true
title: Improve Magento URL's for SEO
author:
  display_name: davidmataro
  login: admin
  email: jo@davidmataro.com
  url: http://www.davidmataro.com
author_login: admin
author_email: jo@davidmataro.com
author_url: http://www.davidmataro.com
wordpress_id: 506
wordpress_url: http://www.davidmataro.com/?p=506
date: !binary |-
  MjAxMi0xMS0xNiAyMToxMjoyNSArMDAwMA==
date_gmt: !binary |-
  MjAxMi0xMS0xNiAxOToxMjoyNSArMDAwMA==
tags:
- magento
- seo
comments: []
---

There are a lot of thing to do to improve the magento seo. But one of this is improve de Magento URL. To improve the Magento URL SEO, we need make some change in the Magneto configuration.

1. Use server rewrites. This allow you have more user friendly URL's like example.com/example-product.html and not example.com/?p=125. The search engine use

Set System > Configuration > Web > "Use Web Server Rewrites" to Yes

2. Prevent Magento to duplicate URL contents.

Set System > Configuration > Catalog > "Use Categories Path for Product URLs" to No

3. Use Tag canonical to say to the search engine that the page is the main page. The search engine will give the page the highest priority.

Set System > Configuration > Catalog > "Use Canonical Link Meta Tag For Categories" to Yes


text:
module ServiceSpecsHelpers
  module TMSScraperHelpers
    def stub_tms_scraper_api_calls(course, *options)
      response = ScraperResponseDouble.build(course, *options)
      request_url = TMSScraperService::SCRAPER_URL + course.level.to_s
      allow(HTTParty).to receive(:get).with(request_url).and_return(response)
    end

    class ScraperResponseDouble
      include RSpec::Mocks::ExampleMethods

      def self.build(course, *options)
        new(course, *options).outer_response
      end

      attr_reader :outer_response

      def initialize(course, *options)
        @course = course
        @options = options
        @attrs = FactoryGirl.attributes_for :course,
                                            :with_prerequisite,
                                            :with_corequisite
        @parsed_response = {}
        build_response
      end

      def build_response
        build_response_code
        build_title
        build_description
        build_prerequisite
        build_corequisite
        build_inner_response
        build_outer_response
      end

      def build_response_code
        if @options.any? { |option| option == :bad_response_code }
          @response_code = "404"
        else
          @response_code = "200"
        end
      end

      def build_title
        return if @options.any? { |option| option == :nil_title_text }
        if @options.any? { |option| option == :blank_title_text }
          @parsed_response.merge!("title" => "")
        else
          @parsed_response.merge!("title" => @attrs[:title])
        end
      end

      def build_description
        return if @options.any? { |option| option == :nil_description_text }
        if @options.any? { |option| option == :blank_description_text }
          @parsed_response.merge!("courseDescription" => "")
        else
          @parsed_response.merge!("courseDescription" => @attrs[:description])
        end
      end

      def build_prerequisite
        return if @options.any? { |option| option == :nil_prerequisite_text }
        @parsed_response.merge!("prerequisite" => @attrs[:prerequisite])
      end

      def build_corequisite
        return if @options.any? { |option| option == :nil_corequisite_text }
        @parsed_response.merge!("corequisite" => @attrs[:corequisite])
      end

      def build_inner_response
        @inner_response = double(code: @response_code)
      end

      def build_outer_response
        @outer_response = double(parsed_response: @parsed_response,
                                 response: @inner_response)
      end
    end
  end
end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

        <title>Reverse lyric search</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link href="lyricushelp.css" rel="stylesheet" type="text/css">

        <meta name="AppleTitle" content="Reverse lyric search" />
        <meta name="AppleIcon" content="help/helpicon.png" />
        <meta name="description" content="Describes how to use the reverse lyric search window" />

Reverse lyric search

The reverse lyric search window allows you to find all songs that contain a certain word or phrase, in essence the opposite of the program's normal function.

To open the reverse lyric search window, press ⌘R or click Lyric > "Reverse lyric search...".

To use the window, simply start typing text into the search field, and a list of matching lyrics will be updated as you type. Click a result to view the complete lyrics.

Lyricus needs an index of your lyrics to be able to search, and will ask you to create an index the first time you open the window. You can also update the index manually by pressing ⇧⌘R or clicking Lyric > "Update reverse search index".

Lyricus will warn you when your index hasn't been updated in the last week. To remove this reminder, see Preferences.

Please note that the index is only used for the reverse lyric search. No index is necessary nor used in the main lyric display window.


text:
<?php

namespace Drupal\config_filter\Config;

use Drupal\Core\Config\StorageInterface;

/**
 * Class FilteredStorage.
 *
 * This class wraps another storage.
 * It filters the arguments before passing them on to the storage for write
 * operations and filters the result of read operations before returning them.
 *
 * @package Drupal\config_filter\Config
 */
class FilteredStorage implements FilteredStorageInterface {

  /**
   * The storage container that we are wrapping.
   *
   * @var \Drupal\Core\Config\StorageInterface
   */
  protected $storage;

  /**
   * The storage filters.
   *
   * @var \Drupal\config_filter\Config\StorageFilterInterface[]
   */
  protected $filters;

  /**
   * Create a FilteredStorage with some storage and a filter.
   *
   * @param \Drupal\Core\Config\StorageInterface $storage
   *   The decorated storage.
   * @param \Drupal\config_filter\Config\StorageFilterInterface[] $filters
   *   The filters to apply in the given order.
   */
  public function __construct(StorageInterface $storage, array $filters) {
    $this->storage = $storage;
    $this->filters = $filters;

    // Set the storage to all the filters.
    foreach ($this->filters as $filter) {
      $filter->setSourceStorage(new ReadOnlyStorage($storage));
      $filter->setFilteredStorage($this);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function exists($name) {
    $exists = $this->storage->exists($name);
    foreach ($this->filters as $filter) {
      $exists = $filter->filterExists($name, $exists);
    }

    return $exists;
  }

  /**
   * {@inheritdoc}
   */
  public function read($name) {
    $data = $this->storage->read($name);
    foreach ($this->filters as $filter) {
      $data = $filter->filterRead($name, $data);
    }

    return $data;
  }

  /**
   * {@inheritdoc}
   */
  public function readMultiple(array $names) {
    $data = $this->storage->readMultiple($names);
    foreach ($this->filters as $filter) {
      $data = $filter->filterReadMultiple($names, $data);
    }

    return $data;
  }

  /**
   * {@inheritdoc}
   */
  public function write($name, array $data) {
    foreach ($this->filters as $filter) {
      if ($data) {
        $data = $filter->filterWrite($name, $data);
      }
    }

    if ($data) {
      return $this->storage->write($name, $data);
    }

    // The data has been unset, check if it should be deleted.
    if ($this->storage->exists($name)) {
      foreach ($this->filters as $filter) {
        if ($filter->filterWriteEmptyIsDelete($name)) {
          return $this->storage->delete($name);
        }
      }
    }

    // The data was not written, but it is not an error.
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function delete($name) {
    $success = TRUE;
    foreach ($this->filters as $filter) {
      $success = $filter->filterDelete($name, $success);
    }

    if ($success) {
      $success = $this->storage->delete($name);
    }

    return $success;
  }

  /**
   * {@inheritdoc}
   */
  public function rename($name, $new_name) {
    $success = TRUE;
    foreach ($this->filters as $filter) {
      $success = $filter->filterRename($name, $new_name, $success);
    }

    if ($success) {
      $success = $this->storage->rename($name, $new_name);
    }

    return $success;
  }

  /**
   * {@inheritdoc}
   */
  public function encode($data) {
    return $this->storage->encode($data);
  }

  /**
   * {@inheritdoc}
   */
  public function decode($raw) {
    return $this->storage->decode($raw);
  }

  /**
   * {@inheritdoc}
   */
  public function listAll($prefix = '') {
    $data = $this->storage->listAll($prefix);
    foreach ($this->filters as $filter) {
      $data = $filter->filterListAll($prefix, $data);
    }

    return $data;
  }

  /**
   * {@inheritdoc}
   */
  public function deleteAll($prefix = '') {
    $delete = TRUE;
    foreach ($this->filters as $filter) {
      $delete = $filter->filterDeleteAll($prefix, $delete);
    }

    if ($delete) {
      return $this->storage->deleteAll($prefix);
    }

    // The filters returned FALSE for $delete, so we delete the names
    // individually and allow filters to prevent deleting the config.
    foreach ($this->storage->listAll($prefix) as $name) {
      $this->delete($name);
    }

    // The filters wanted to prevent deleting all and were called to delete the
    // individual config name, is this a success? Let us say it is.
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function createCollection($collection) {
    $filters = [];
    foreach ($this->filters as $filter) {
      $filter = $filter->filterCreateCollection($collection);
      if ($filter) {
        $filters[] = $filter;
      }
    }

    return new static($this->storage->createCollection($collection), $filters);
  }

  /**
   * {@inheritdoc}
   */
  public function getAllCollectionNames() {
    $collections = $this->storage->getAllCollectionNames();
    foreach ($this->filters as $filter) {
      $collections = $filter->filterGetAllCollectionNames($collections);
    }

    return $collections;
  }

  /**
   * {@inheritdoc}
   */
  public function getCollectionName() {
    $collection = $this->storage->getCollectionName();
    foreach ($this->filters as $filter) {
      $collection = $filter->filterGetCollectionName($collection);
    }

    return $collection;
  }

}


text:
package org.wallride.core.service;

import org.joda.time.LocalDateTime;

import java.io.Serializable;
import java.util.List;

public class ArticleBulkPublishRequest implements Serializable {

	private List<Long> ids;
	private LocalDateTime date;
	private String language;

	public List<Long> getIds() {
		return ids;
	}

	public void setIds(List<Long> ids) {
		this.ids = ids;
	}

	public LocalDateTime getDate() {
		return date;
	}

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

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}
}


text:
using System.Threading.Tasks;
using RapidCore.FunctionalTests.Migration.Implementation;
using RapidCore.Migration;

namespace RapidCore.FunctionalTests.Migration.TheMigrations
{
    public class Migration03 : MigrationBase
    {
        protected override void ConfigureUpgrade(IMigrationBuilder builder)
        {
            var db = ContextAs<FuncMigrationContext>().Database;

            builder.Step("Add 'Mucho' to 'five'", async () =>
            {
                var kewl = db.GetKewlById("five");
                kewl.Reference = $"Mucho {kewl.Reference}";

                db.UpsertKewl(kewl);
                await Task.CompletedTask;
            });

            builder.Step("Add 'Mucho' to 'seven'", async () =>
            {
                var kewl = db.GetKewlById("seven");
                kewl.Reference = $"Mucho {kewl.Reference}";

                db.UpsertKewl(kewl);
                await Task.CompletedTask;
            });
        }

        protected override void ConfigureDowngrade(IMigrationBuilder builder)
        {
            throw new System.NotImplementedException();
        }
    }
}


text:
import os

from setuptools import (
    setup,
    find_packages,
)

DIR = os.path.dirname(os.path.abspath(__file__))

readme = open(os.path.join(DIR, 'README.md')).read()

setup(
    name='web3',
    version='3.2.0',
    description="""Web3.py""",
    long_description=readme,
    author='Piper Merriam',
    author_email='pipermerriam@gmail.com',
    url='https://github.com/pipermerriam/web3.py',
    download_url="https://github.com/pipermerriam/web3.py/tarball/0.1.9",
    include_package_data=True,
    install_requires=[
        "pysha3>=0.3",
        "rlp>=0.4.6",
        "gevent>=1.1.1",
        "geventhttpclient>=1.3.1",
        "ethereum-abi-utils>=0.2.1",
        "pysha3>=0.3",
        "pylru>=1.0.9",
    ],
    py_modules=['web3'],
    license="MIT",
    zip_safe=False,
    keywords='ethereum',
    packages=find_packages(exclude=["tests", "tests.*"]),
    classifiers=[
        'Development Status :: 2 - Pre-Alpha',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Natural Language :: English',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
    ],
)


text:
package com.microsoft.azure.management.recoveryservices.backup.v2017_07_01;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Filters to list backup items.
 */
public class GetProtectedItemQueryObject {
    /**
     * Specifies if the additional information should be provided for this
     * item.
     */
    @JsonProperty(value = "expand")
    private String expand;

    /**
     * Get specifies if the additional information should be provided for this item.
     *
     * @return the expand value
     */
    public String expand() {
        return this.expand;
    }

    /**
     * Set specifies if the additional information should be provided for this item.
     *
     * @param expand the expand value to set
     * @return the GetProtectedItemQueryObject object itself.
     */
    public GetProtectedItemQueryObject withExpand(String expand) {
        this.expand = expand;
        return this;
    }

}


text:
  <?php
    print drupal_render($form['filter0']);
    print drupal_render($form['submit']);
  ?>
  <div class="search-adv-link <?php print $advanced ? 'search-hidden' : '' ?>">

Advanced Search

    <?php print theme('image', 'misc/arrow-asc.png') ?>

  <div class="search-basic-link <?php print !$advanced ? 'search-hidden' : '' ?>">

Basic Search

    <?php print theme('image', 'misc/arrow-desc.png') ?>

<div class="search-adv <?php print !$advanced ? 'search-hidden' : '' ?>">
  These advanced filters will be applied to your search query.

    <?php
      print drupal_render($form['filter1']);
      print drupal_render($form['filter2']);
      print drupal_render($form['filter3']);
      print drupal_render($form['filter4']);
    ?>

  <?php
    print drupal_render($form);
  ?>


text:
.class Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;
.super Landroid/database/Observable;
.source "RecyclerView.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v7/widget/RecyclerView;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = "AdapterDataObservable"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/database/Observable",
        "<",
        "Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;",
        ">;"
    }
.end annotation

# direct methods
.method constructor <init>()V
    .locals 0

    invoke-direct {p0}, Landroid/database/Observable;-><init>()V

    return-void
.end method

# virtual methods
.method public hasObservers()Z
    .locals 1

    iget-object v0, p0, Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;->mObservers:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->isEmpty()Z

    move-result v0

    xor-int/lit8 v0, v0, 0x1

    return v0
.end method

.method public notifyChanged()V
    .locals 2

    iget-object v1, p0, Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;->mObservers:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    add-int/lit8 v0, v1, -0x1

    :goto_0
    if-ltz v0, :cond_0

    iget-object v1, p0, Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;->mObservers:Ljava/util/ArrayList;

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

    move-result-object v1

    check-cast v1, Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;

    invoke-virtual {v1}, Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;->onChanged()V

    add-int/lit8 v0, v0, -0x1

    goto :goto_0

    :cond_0
    return-void
.end method

.method public notifyItemMoved(II)V
    .locals 3

    iget-object v1, p0, Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;->mObservers:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    add-int/lit8 v0, v1, -0x1

    :goto_0
    if-ltz v0, :cond_0

    iget-object v1, p0, Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;->mObservers:Ljava/util/ArrayList;

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

    move-result-object v1

    check-cast v1, Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;

    const/4 v2, 0x1

    invoke-virtual {v1, p1, p2, v2}, Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;->onItemRangeMoved(III)V

    add-int/lit8 v0, v0, -0x1

    goto :goto_0

    :cond_0
    return-void
.end method

.method public notifyItemRangeChanged(II)V
    .locals 1

    const/4 v0, 0x0

    invoke-virtual {p0, p1, p2, v0}, Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;->notifyItemRangeChanged(IILjava/lang/Object;)V

    return-void
.end method

.method public notifyItemRangeChanged(IILjava/lang/Object;)V
    .locals 2

    iget-object v1, p0, Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;->mObservers:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    add-int/lit8 v0, v1, -0x1

    :goto_0
    if-ltz v0, :cond_0

    iget-object v1, p0, Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;->mObservers:Ljava/util/ArrayList;

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

    move-result-object v1

    check-cast v1, Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;

    invoke-virtual {v1, p1, p2, p3}, Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;->onItemRangeChanged(IILjava/lang/Object;)V

    add-int/lit8 v0, v0, -0x1

    goto :goto_0

    :cond_0
    return-void
.end method

.method public notifyItemRangeInserted(II)V
    .locals 2

    iget-object v1, p0, Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;->mObservers:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    add-int/lit8 v0, v1, -0x1

    :goto_0
    if-ltz v0, :cond_0

    iget-object v1, p0, Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;->mObservers:Ljava/util/ArrayList;

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

    move-result-object v1

    check-cast v1, Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;

    invoke-virtual {v1, p1, p2}, Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;->onItemRangeInserted(II)V

    add-int/lit8 v0, v0, -0x1

    goto :goto_0

    :cond_0
    return-void
.end method

.method public notifyItemRangeRemoved(II)V
    .locals 2

    iget-object v1, p0, Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;->mObservers:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    add-int/lit8 v0, v1, -0x1

    :goto_0
    if-ltz v0, :cond_0

    iget-object v1, p0, Landroid/support/v7/widget/RecyclerView$AdapterDataObservable;->mObservers:Ljava/util/ArrayList;

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

    move-result-object v1

    check-cast v1, Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;

    invoke-virtual {v1, p1, p2}, Landroid/support/v7/widget/RecyclerView$AdapterDataObserver;->onItemRangeRemoved(II)V

    add-int/lit8 v0, v0, -0x1

    goto :goto_0

    :cond_0
    return-void
.end method


text:
<?php

class Google_Service_Compute_CustomerEncryptionKey extends Google_Model
{
  public $kmsKeyName;
  public $kmsKeyServiceAccount;
  public $rawKey;
  public $sha256;

  public function setKmsKeyName($kmsKeyName)
  {
    $this->kmsKeyName = $kmsKeyName;
  }
  public function getKmsKeyName()
  {
    return $this->kmsKeyName;
  }
  public function setKmsKeyServiceAccount($kmsKeyServiceAccount)
  {
    $this->kmsKeyServiceAccount = $kmsKeyServiceAccount;
  }
  public function getKmsKeyServiceAccount()
  {
    return $this->kmsKeyServiceAccount;
  }
  public function setRawKey($rawKey)
  {
    $this->rawKey = $rawKey;
  }
  public function getRawKey()
  {
    return $this->rawKey;
  }
  public function setSha256($sha256)
  {
    $this->sha256 = $sha256;
  }
  public function getSha256()
  {
    return $this->sha256;
  }
}


text:
namespace pp {

// This function is implemented in the .cc file to avoid including completion
// callback all over the project.
void Core::CallOnMainThread(int32_t delay_in_milliseconds,
                            const CompletionCallback& callback,
                            int32_t result) {
  return interface_->CallOnMainThread(delay_in_milliseconds,
                                      callback.pp_completion_callback(),
                                      result);
}

bool Core::IsMainThread() {
  return PPBoolToBool(interface_->IsMainThread());
}

}  // namespace pp


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<TITLE
>Conventions</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 9.2.8 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Preface"
HREF="preface.html"><LINK
REL="PREVIOUS"
TITLE="A Brief History of PostgreSQL"
HREF="history.html"><LINK
REL="NEXT"
TITLE="Further Information"
HREF="resources.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2014-03-17T19:46:29">

PostgreSQL 9.2.8 Documentation

Prev	Up	Preface	Next

Conventions

  This book uses the following typographical conventions to mark
  certain portions of text: new terms, foreign phrases, and other
  important passages are emphasized in italics.
  Everything that represents input or output of the computer, in
  particular commands, program code, and screen output, is shown in a
  monospaced font (<TT
CLASS="LITERAL"
>example</TT
>).  Within such
  passages, italics (<TT
CLASS="REPLACEABLE"
>example</TT
>) indicate
  placeholders; you must insert an actual value instead of the placeholder.
  On occasion, parts of program code are emphasized in bold face
  (<TT
CLASS="LITERAL"
>example</TT
>), if they have been
  added or changed since the preceding example.

  The following conventions are used in the synopsis of a command:
  brackets (<TT
CLASS="LITERAL"
>[</TT
> and <TT
CLASS="LITERAL"
>]</TT
>) indicate
  optional parts.  (In the synopsis of a Tcl command, question marks
  (<TT
CLASS="LITERAL"
>?</TT
>) are used instead, as is usual in Tcl.)  Braces
  (<TT
CLASS="LITERAL"
>{</TT
> and <TT
CLASS="LITERAL"
>}</TT
>) and vertical lines
  (<TT
CLASS="LITERAL"
>|</TT
>) indicate that you must choose one
  alternative.  Dots (<TT
CLASS="LITERAL"
>...</TT
>) mean that the preceding element
  can be repeated.

  Where it enhances the clarity, SQL commands are preceded by the
  prompt <TT
CLASS="LITERAL"
>=></TT
>, and shell commands are preceded by the
  prompt <TT
CLASS="LITERAL"
>$</TT
>.  Normally, prompts are not shown, though.

  An administrator is generally a person who is
  in charge of installing and running the server.  A user
  could be anyone who is using, or wants to use, any part of the
  PostgreSQL system.  These terms should not
  be interpreted too narrowly; this book does not have fixed
  presumptions about system administration procedures.

Prev	Home	Next

A Brief History of PostgreSQL	Up	Further Information


text:
/**
 * Bean Validation TCK
 *
 * License: Apache License, Version 2.0
 * See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
 */
package org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints;

import static org.hibernate.beanvalidation.tck.util.ConstraintViolationAssert.assertNumberOfViolations;
import static org.hibernate.beanvalidation.tck.util.ConstraintViolationAssert.assertThat;
import static org.hibernate.beanvalidation.tck.util.ConstraintViolationAssert.pathWith;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Set;

import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

import org.hibernate.beanvalidation.tck.beanvalidation.Sections;
import org.hibernate.beanvalidation.tck.tests.AbstractTCKTest;
import org.hibernate.beanvalidation.tck.util.TestUtil;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.test.audit.annotations.SpecAssertion;
import org.jboss.test.audit.annotations.SpecVersion;
import org.testng.annotations.Test;

/**
 * Tests for {@link Min} and {@link Max} built-in constraints.
 *
 * @author Hardy Ferentschik
 */
@SpecVersion(spec = "beanvalidation", version = "2.0.0")
public class MinMaxConstraintsTest extends AbstractTCKTest {

	@Deployment
	public static WebArchive createTestArchive() {
		return webArchiveBuilder()
				.withTestClass( MinMaxConstraintsTest.class )
				.build();
	}

	@Test
	@SpecAssertion(section = Sections.BUILTINCONSTRAINTS, id = "a")
	@SpecAssertion(section = Sections.BUILTINCONSTRAINTS_MIN, id = "a")
	public void testMinConstraint() {
		Validator validator = TestUtil.getValidatorUnderTest();
		MinDummyEntity dummy = new MinDummyEntity();

		Set<ConstraintViolation<MinDummyEntity>> constraintViolations = validator.validate( dummy );
		// only the min constraints on the primitive values should fail. Object values re still null and should pass per spec
		assertNumberOfViolations( constraintViolations, 4 );
		assertThat( constraintViolations ).containsOnlyPaths(
				pathWith()
						.property( "bytePrimitive" ),
				pathWith()
						.property( "intPrimitive" ),
				pathWith()
						.property( "longPrimitive" ),
				pathWith()
						.property( "shortPrimitive" )
		);

		dummy.intPrimitive = 101;
		dummy.longPrimitive = 1001;
		dummy.bytePrimitive = 111;
		dummy.shortPrimitive = 142;

		dummy.intObject = Integer.valueOf( "100" );
		dummy.longObject = Long.valueOf( "0" );
		dummy.byteObject = Byte.parseByte( "-1" );
		dummy.shortObject = Short.parseShort( "3" );
		dummy.bigDecimal = BigDecimal.valueOf( 100.9 );
		dummy.bigInteger = BigInteger.valueOf( 100 );

		constraintViolations = validator.validate( dummy );
		assertNumberOfViolations( constraintViolations, 6 );
		assertThat( constraintViolations ).containsOnlyPaths(
				pathWith()
						.property( "byteObject" ),
				pathWith()
						.property( "intObject" ),
				pathWith()
						.property( "longObject" ),
				pathWith()
						.property( "shortObject" ),
				pathWith()
						.property( "bigDecimal" ),
				pathWith()
						.property( "bigInteger" )
		);

		dummy.intObject = Integer.valueOf( "101" );
		dummy.longObject = Long.valueOf( "12345" );
		dummy.byteObject = Byte.parseByte( "102" );
		dummy.shortObject = Short.parseShort( "111" );
		dummy.bigDecimal = BigDecimal.valueOf( 101.1 );
		dummy.bigInteger = BigInteger.valueOf( 101 );

		constraintViolations = validator.validate( dummy );
		assertNumberOfViolations( constraintViolations, 0 );
	}

	@Test
	@SpecAssertion(section = Sections.BUILTINCONSTRAINTS, id = "a")
	@SpecAssertion(section = Sections.BUILTINCONSTRAINTS_MAX, id = "a")
	public void testMaxConstraint() {
		Validator validator = TestUtil.getValidatorUnderTest();
		MaxDummyEntity dummy = new MaxDummyEntity();

		dummy.intPrimitive = 102;
		dummy.longPrimitive = 1234;
		dummy.bytePrimitive = 102;
		dummy.shortPrimitive = 102;

		Set<ConstraintViolation<MaxDummyEntity>> constraintViolations = validator.validate( dummy );
		// only the max constraints on the primitive values should fail. Object values re still null and should pass per spec
		assertNumberOfViolations( constraintViolations, 4 );
		assertThat( constraintViolations ).containsOnlyPaths(
				pathWith()
						.property( "bytePrimitive" ),
				pathWith()
						.property( "intPrimitive" ),
				pathWith()
						.property( "longPrimitive" ),
				pathWith()
						.property( "shortPrimitive" )
		);

		dummy.intPrimitive = 101;
		dummy.longPrimitive = 100;
		dummy.bytePrimitive = 99;
		dummy.shortPrimitive = 42;

		dummy.intObject = Integer.valueOf( "102" );
		dummy.longObject = Long.valueOf( "12345" );
		dummy.byteObject = Byte.parseByte( "111" );
		dummy.shortObject = Short.parseShort( "1234" );
		dummy.bigDecimal = BigDecimal.valueOf( 102 );
		dummy.bigInteger = BigInteger.valueOf( 102 );

		constraintViolations = validator.validate( dummy );
		assertNumberOfViolations( constraintViolations, 6 );
		assertThat( constraintViolations ).containsOnlyPaths(
				pathWith()
						.property( "byteObject" ),
				pathWith()
						.property( "intObject" ),
				pathWith()
						.property( "longObject" ),
				pathWith()
						.property( "shortObject" ),
				pathWith()
						.property( "bigDecimal" ),
				pathWith()
						.property( "bigInteger" )
		);

		dummy.intObject = Integer.valueOf( "101" );
		dummy.longObject = Long.valueOf( "100" );
		dummy.byteObject = Byte.parseByte( "100" );
		dummy.shortObject = Short.parseShort( "101" );
		dummy.bigDecimal = BigDecimal.valueOf( 100.9 );
		dummy.bigInteger = BigInteger.valueOf( 100 );

		constraintViolations = validator.validate( dummy );
		assertNumberOfViolations( constraintViolations, 0 );
	}

	private static class MinDummyEntity {
		@Min(101)
		private BigDecimal bigDecimal;

		@Min(101)
		private BigInteger bigInteger;

		@Min(101)
		private byte bytePrimitive;

		@Min(101)
		private short shortPrimitive;

		@Min(101)
		private int intPrimitive;

		@Min(101)
		private long longPrimitive;

		@Min(101)
		private Byte byteObject;

		@Min(101)
		private Short shortObject;

		@Min(101)
		private Integer intObject;

		@Min(101)
		private Long longObject;
	}

	private static class MaxDummyEntity {
		@Max(101)
		private BigDecimal bigDecimal;

		@Max(101)
		private BigInteger bigInteger;

		@Max(101)
		private byte bytePrimitive;

		@Max(101)
		private short shortPrimitive;

		@Max(101)
		private int intPrimitive;

		@Max(101)
		private long longPrimitive;

		@Max(101)
		private Byte byteObject;

		@Max(101)
		private Short shortObject;

		@Max(101)
		private Integer intObject;

		@Max(101)
		private Long longObject;
	}

}


text:
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 9/27/2017
 * Time: 3:08 AM
 */

class Items_model extends  MY_Model
{
    public function set_table_name($table)
    {
        $this->_table = $table;
    }
    public function get_lastval_item_id()
    {

    }
    public function  get_diamond_price_arr()
    {
        $arr = $this->_database->query('SELECT item_id,price FROM items_ WHERE item_type = 2 ORDER BY item_id ASC ')->result();
        $ret_arr = array();
        foreach ($arr as $key => $val)
        {
            $ret_arr[$key]= array('item_id'=> $val->item_id,'price' => $val->price);
        }
        return $ret_arr;

    }
    public function  get_bound_rate_by_itemid($item_id)
    {
        $this->_database->select('bound_rate');
        $this->_database->from('items_');
        $this->_database->where('item_id', $item_id);
        $query = $this->_database->get();

        return $query->row()->bound_rate;
    }
    public function  get_unbound_rate_by_itemid($item_id)
    {
        $this->_database->select('unbound_rate');
        $this->_database->from('items_');
        $this->_database->where('item_id', $item_id);
        $query = $this->_database->get();

        return $query->row()->unbound_rate;
    }
    public  function  get_prices_by_level($level) {

/*        $this->_database->select('item_id ,price');
        $this->_database->from('items_');
        $this->_database->where('alivelevel', $level);
        $this->_database->where('show', true);
        $query = $this->_database->get();*/

        $arr = $this->_database->query('SELECT item_id,price FROM items_ WHERE item_type = 2 AND alivelevel = '.$level.' AND show = true AND enable = true ORDER BY item_id ASC ')->result();
        $ret_arr = array();
        foreach ($arr as $key => $val)
        {
            $ret_arr[$key]= array('item_id'=> $val->item_id,'price' => $val->price);
        }
        return $ret_arr;
    }

}


text:
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../paper-dialog/paper-dialog.html">
<link rel="import" href="../paper-dialog-scrollable/paper-dialog-scrollable.html">
<link rel="import" href="../paper-button/paper-button.html">

<dom-module id="glg-gift-card-thumbnail">
  <template>

[[giftCardDetails.brandName]] ([[_getCurrency(giftCardDetails)]])

  </template>
</dome-module>


text:
var FunctionNode = require(__dirname + '/FunctionNode');
var ParameterNode = require(__dirname + '/ParameterNode');
var ConstantNode = require(__dirname + '/ConstantNode');

/**
	randomInteger
	generate a random integer between min and max§
 **/
Math.randomInteger = function(min, max){
	return Math.floor( Math.random() * (max - min + 1) ) + min;
};

/**
	TreeFactory
	The class for creating tree programs and manipulate them
 **/
var TreeFactory = function(numberOfProgramParameters, functionsList){
	this.numberOfProgramParameters = numberOfProgramParameters;
	this.functionsList = functionsList;
};

/**
	createRandom
	creates random tree
	it starts with creating a node with a random function
	then looks to see how many child nodes this function require.
	for every child node required, the function calls itself to create a new node.
	in this way an entire tree is constructed, with branches ending only if the function requires no more child nodes (that is if function returns a constant or an input variable)
 **/
TreeFactory.prototype.createRandom = function(maxDepthOfTheTree, probabilityOfNodeIsFunctionNode, probabilityOfNodeIsParameterNode){

	maxDepthOfTheTree = (maxDepthOfTheTree === null || maxDepthOfTheTree === undefined)? 4 : maxDepthOfTheTree;
	probabilityOfNodeIsFunctionNode = probabilityOfNodeIsFunctionNode || 0.5;
	probabilityOfNodeIsParameterNode = probabilityOfNodeIsParameterNode || 0.6;

	if(Math.random() < probabilityOfNodeIsFunctionNode && maxDepthOfTheTree > 0)
	{
		var method = this.functionsList[ Math.randomInteger(0, this.functionsList.length - 1) ];

		var children = [];

		for(var i = 0; i < method.childCount; i++)
			children[i] = this.createRandom(maxDepthOfTheTree - 1, probabilityOfNodeIsFunctionNode, probabilityOfNodeIsParameterNode);

		return new FunctionNode(method, children);
	}
	else if(Math.random() < probabilityOfNodeIsParameterNode)
		return new ParameterNode( Math.randomInteger(0, this.numberOfProgramParameters - 1) );
	else
		return new ConstantNode( Math.randomInteger(0, 10) );
};

/**
	mutate
	mutate a tree by replacing a subtree with an entirely new one
 **/
TreeFactory.prototype.mutate = function(tree, probabilityOfChange){

	probabilityOfChange = probabilityOfChange || 0.1;

	if(Math.random() < probabilityOfChange)
	{
		return this.createRandom();
	}
	else
	{
		if(typeof tree === 'FunctionNode')
		{
			var children = [];

			for(var i = 0; i < tree.children.length; i++)
			{
				children[i] = this.mutate(tree.children[i], probabilityOfChange);
			}

			tree.children = children;
		}

		return tree;
	}
};

/**
	crossover
	crossover two trees by replacing a branch from one with a branch from other
 **/
TreeFactory.prototype.crossover = function(tree1, tree2, probabilityOfSwap, iAmAtTheTopOfTheTree){

	probabilityOfSwap = probabilityOfSwap || 0.7;
	iAmAtTheTopOfTheTree = (iAmAtTheTopOfTheTree === null || iAmAtTheTopOfTheTree === undefined)? true : iAmAtTheTopOfTheTree;

	if(Math.random() < probabilityOfSwap && !iAmAtTheTopOfTheTree)
	{
		return tree2;
	}
	else
	{
		if(typeof tree1 === 'FunctionNode' && typeof tree2 === 'FunctionNode')
		{
			var children = [];

			for(var i = 0; i < tree1.children.length; i++)
			{
				children[i] = this.crossover(tree1.children[i], tree2.children[ Math.randomInteger(0, this.tree2.children.length - 1) ], probabilityOfSwap, false);
			}

			tree1.children = children;
		}

		return tree1;
	}
};

module.exports = TreeFactory;


text:
import {Grammar} from './Grammar.js';
import {GrammarDecl} from './GrammarDecl.js';
import * as pexprs from './pexprs.js';

// --------------------------------------------------------------------
// Private stuff
// --------------------------------------------------------------------

export function Builder() {}

Builder.prototype = {
  currentDecl: null,
  currentRuleName: null,

  newGrammar(name) {
    return new GrammarDecl(name);
  },

  grammar(metaInfo, name, superGrammar, defaultStartRule, rules) {
    const gDecl = new GrammarDecl(name);
    if (superGrammar) {
      // `superGrammar` may be a recipe (i.e. an Array), or an actual grammar instance.
      gDecl.withSuperGrammar(
        superGrammar instanceof Grammar ? superGrammar : this.fromRecipe(superGrammar),
      );
    }
    if (defaultStartRule) {
      gDecl.withDefaultStartRule(defaultStartRule);
    }
    if (metaInfo && metaInfo.source) {
      gDecl.withSource(metaInfo.source);
    }

    this.currentDecl = gDecl;
    Object.keys(rules).forEach(ruleName => {
      this.currentRuleName = ruleName;
      const ruleRecipe = rules[ruleName];

      const action = ruleRecipe[0]; // define/extend/override
      const metaInfo = ruleRecipe[1];
      const description = ruleRecipe[2];
      const formals = ruleRecipe[3];
      const body = this.fromRecipe(ruleRecipe[4]);

      let source;
      if (gDecl.source && metaInfo && metaInfo.sourceInterval) {
        source = gDecl.source.subInterval(
            metaInfo.sourceInterval[0],
            metaInfo.sourceInterval[1] - metaInfo.sourceInterval[0],
        );
      }
      gDecl[action](ruleName, formals, body, description, source);
    });
    this.currentRuleName = this.currentDecl = null;
    return gDecl.build();
  },

  terminal(x) {
    return new pexprs.Terminal(x);
  },

  range(from, to) {
    return new pexprs.Range(from, to);
  },

  param(index) {
    return new pexprs.Param(index);
  },

  alt(...termArgs) {
    let terms = [];
    for (let arg of termArgs) {
      if (!(arg instanceof pexprs.PExpr)) {
        arg = this.fromRecipe(arg);
      }
      if (arg instanceof pexprs.Alt) {
        terms = terms.concat(arg.terms);
      } else {
        terms.push(arg);
      }
    }
    return terms.length === 1 ? terms[0] : new pexprs.Alt(terms);
  },

  seq(...factorArgs) {
    let factors = [];
    for (let arg of factorArgs) {
      if (!(arg instanceof pexprs.PExpr)) {
        arg = this.fromRecipe(arg);
      }
      if (arg instanceof pexprs.Seq) {
        factors = factors.concat(arg.factors);
      } else {
        factors.push(arg);
      }
    }
    return factors.length === 1 ? factors[0] : new pexprs.Seq(factors);
  },

  star(expr) {
    if (!(expr instanceof pexprs.PExpr)) {
      expr = this.fromRecipe(expr);
    }
    return new pexprs.Star(expr);
  },

  plus(expr) {
    if (!(expr instanceof pexprs.PExpr)) {
      expr = this.fromRecipe(expr);
    }
    return new pexprs.Plus(expr);
  },

  opt(expr) {
    if (!(expr instanceof pexprs.PExpr)) {
      expr = this.fromRecipe(expr);
    }
    return new pexprs.Opt(expr);
  },

  not(expr) {
    if (!(expr instanceof pexprs.PExpr)) {
      expr = this.fromRecipe(expr);
    }
    return new pexprs.Not(expr);
  },

  la(expr) {
    // TODO: temporary to still be able to read old recipes
    return this.lookahead(expr);
  },

  lookahead(expr) {
    if (!(expr instanceof pexprs.PExpr)) {
      expr = this.fromRecipe(expr);
    }
    return new pexprs.Lookahead(expr);
  },

  lex(expr) {
    if (!(expr instanceof pexprs.PExpr)) {
      expr = this.fromRecipe(expr);
    }
    return new pexprs.Lex(expr);
  },

  app(ruleName, optParams) {
    if (optParams && optParams.length > 0) {
      optParams = optParams.map(function(param) {
        return param instanceof pexprs.PExpr ? param : this.fromRecipe(param);
      }, this);
    }
    return new pexprs.Apply(ruleName, optParams);
  },

  // Note that unlike other methods in this class, this method cannot be used as a
  // convenience constructor. It only works with recipes, because it relies on
  // `this.currentDecl` and `this.currentRuleName` being set.
  splice(beforeTerms, afterTerms) {
    return new pexprs.Splice(
        this.currentDecl.superGrammar,
        this.currentRuleName,
        beforeTerms.map(term => this.fromRecipe(term)),
        afterTerms.map(term => this.fromRecipe(term)),
    );
  },

  fromRecipe(recipe) {
    // the meta-info of 'grammar' is processed in Builder.grammar
    const args = recipe[0] === 'grammar' ? recipe.slice(1) : recipe.slice(2);
    const result = this[recipe[0]](...args);

    const metaInfo = recipe[1];
    if (metaInfo) {
      if (metaInfo.sourceInterval && this.currentDecl) {
        result.withSource(this.currentDecl.sourceInterval(...metaInfo.sourceInterval));
      }
    }
    return result;
  },
};


text:
package jp.riken.kscope.xcodeml.xml.gen;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import jp.riken.kscope.xcodeml.xml.*;

/**
 *

 * Java class for anonymous complex type.
 *
 *

 * The following schema fragment specifies the expected content contained within
 * this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <group ref="{}defModelLValue"/>
 *       </sequence>
 *       <attGroup ref="{}defAttrTypeName"/>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "var", "farrayRef", "fcharacterRef",
        "fmemberRef", "fcoArrayRef" })
@XmlRootElement(name = "varRef")
public class VarRef implements IXmlNode {

    @XmlElement(name = "Var")
    protected Var var;
    @XmlElement(name = "FarrayRef")
    protected FarrayRef farrayRef;
    @XmlElement(name = "FcharacterRef")
    protected FcharacterRef fcharacterRef;
    @XmlElement(name = "FmemberRef")
    protected FmemberRef fmemberRef;
    @XmlElement(name = "FcoArrayRef")
    protected FcoArrayRef fcoArrayRef;
    @XmlAttribute
    protected String type;

    /**
     * Gets the value of the var property.
     *
     * @return possible object is {@link Var }
     *
     */
    public Var getVar() {
        return var;
    }

    /**
     * Sets the value of the var property.
     *
     * @param value
     *            allowed object is {@link Var }
     *
     */
    public void setVar(Var value) {
        this.var = value;
    }

    /**
     * Gets the value of the farrayRef property.
     *
     * @return possible object is {@link FarrayRef }
     *
     */
    public FarrayRef getFarrayRef() {
        return farrayRef;
    }

    /**
     * Sets the value of the farrayRef property.
     *
     * @param value
     *            allowed object is {@link FarrayRef }
     *
     */
    public void setFarrayRef(FarrayRef value) {
        this.farrayRef = value;
    }

    /**
     * Gets the value of the fcharacterRef property.
     *
     * @return possible object is {@link FcharacterRef }
     *
     */
    public FcharacterRef getFcharacterRef() {
        return fcharacterRef;
    }

    /**
     * Sets the value of the fcharacterRef property.
     *
     * @param value
     *            allowed object is {@link FcharacterRef }
     *
     */
    public void setFcharacterRef(FcharacterRef value) {
        this.fcharacterRef = value;
    }

    /**
     * Gets the value of the fmemberRef property.
     *
     * @return possible object is {@link FmemberRef }
     *
     */
    public FmemberRef getFmemberRef() {
        return fmemberRef;
    }

    /**
     * Sets the value of the fmemberRef property.
     *
     * @param value
     *            allowed object is {@link FmemberRef }
     *
     */
    public void setFmemberRef(FmemberRef value) {
        this.fmemberRef = value;
    }

    /**
     * Gets the value of the fcoArrayRef property.
     *
     * @return possible object is {@link FcoArrayRef }
     *
     */
    public FcoArrayRef getFcoArrayRef() {
        return fcoArrayRef;
    }

    /**
     * Sets the value of the fcoArrayRef property.
     *
     * @param value
     *            allowed object is {@link FcoArrayRef }
     *
     */
    public void setFcoArrayRef(FcoArrayRef value) {
        this.fcoArrayRef = value;
    }

    /**
     * Gets the value of the type property.
     *
     * @return possible object is {@link String }
     *
     */
    public String getType() {
        return type;
    }

    /**
     * Sets the value of the type property.
     *
     * @param value
     *            allowed object is {@link String }
     *
     */
    public void setType(String value) {
        this.type = value;
    }

    @Override
    public boolean enter(jp.riken.kscope.xcodeml.xml.IXmlVisitor visitor) {
        return (visitor.enter(this));
    }

    @Override
    public void leave(jp.riken.kscope.xcodeml.xml.IXmlVisitor visitor) {
        visitor.leave(this);
    }
}


text:
package org.apache.felix.ipojo.test;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.security.cert.X509Certificate;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;

import org.osgi.framework.*;

public class MockBundle implements Bundle {

    private final ClassLoader m_classloader;

    /**
     * @param classloader the Classloader to load classes and resources.
     */
    public MockBundle(ClassLoader cl) {
        m_classloader = cl;
    }

    public int getState() {
        return 0;
    }

    public void start(int i) throws BundleException {
    }

    public void start() throws BundleException {
    }

    public void stop(int i) throws BundleException {
    }

    public void stop() throws BundleException {
    }

    public void update() throws BundleException {
    }

    public void update(InputStream in) throws BundleException {
    }

    public void uninstall() throws BundleException {
    }

    public Dictionary getHeaders() {
        return null;
    }

    public long getBundleId() {
        return 1; // 0 is the system bundle
    }

    public String getLocation() {
        return null;
    }

    public ServiceReference[] getRegisteredServices() {
        return null;
    }

    public ServiceReference[] getServicesInUse() {
        return null;
    }

    public boolean hasPermission(Object permission) {
        return false;
    }

    public URL getResource(String name) {
        return m_classloader.getResource(name);
    }

    public Dictionary getHeaders(String locale) {
        return null;
    }

    public String getSymbolicName() {
        return null;
    }

    public Class loadClass(String name) throws ClassNotFoundException {
        return m_classloader.loadClass(name);
    }

    public Enumeration getResources(String name) throws IOException {
        return m_classloader.getResources(name);
    }

    public Enumeration getEntryPaths(String path) {
        return null;
    }

    public URL getEntry(String name) {
        return null;
    }

    public long getLastModified() {
        return 0;
    }

    public Enumeration findEntries(String path, String filePattern,
            boolean recurse) {
        return null;
    }

    public BundleContext getBundleContext() {
        return null;
    }

    public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int i) {
        return null;
    }

    public Version getVersion() {
        return null;
    }

    public  A adapt(Class aClass) {
        return null;
    }

    public File getDataFile(String s) {
        return null;
    }

    /**
     * Compares this object with the specified object for order.  Returns a
     * negative integer, zero, or a positive integer as this object is less
     * than, equal to, or greater than the specified object.
     *

     *
The implementor must ensure <tt>sgn(x.compareTo(y)) ==
     * -sgn(y.compareTo(x))</tt> for all <tt>x</tt> and <tt>y</tt>.  (This
     * implies that <tt>x.compareTo(y)</tt> must throw an exception iff
     * <tt>y.compareTo(x)</tt> throws an exception.)
     *

     *
The implementor must also ensure that the relation is transitive:
     * <tt>(x.compareTo(y)>0 && y.compareTo(z)>0)</tt> implies
     * <tt>x.compareTo(z)>0</tt>.
     *

     *
Finally, the implementor must ensure that <tt>x.compareTo(y)==0</tt>
     * implies that <tt>sgn(x.compareTo(z)) == sgn(y.compareTo(z))</tt>, for
     * all <tt>z</tt>.
     *

     *
It is strongly recommended, but not strictly required that
     * <tt>(x.compareTo(y)==0) == (x.equals(y))</tt>.  Generally speaking, any
     * class that implements the <tt>Comparable</tt> interface and violates
     * this condition should clearly indicate this fact.  The recommended
     * language is "Note: this class has a natural ordering that is
     * inconsistent with equals."
     *

     *
In the foregoing description, the notation
     * <tt>sgn(</tt>expression<tt>)</tt> designates the mathematical
     * signum function, which is defined to return one of <tt>-1</tt>,
     * <tt>0</tt>, or <tt>1</tt> according to whether the value of
     * expression is negative, zero or positive.
     *
     * @param o the object to be compared.
     * @return a negative integer, zero, or a positive integer as this object
     *         is less than, equal to, or greater than the specified object.
     * @throws ClassCastException if the specified object's type prevents it
     *                            from being compared to this object.
     */
    public int compareTo(Bundle o) {
        return 0;
    }
}


text:
import pytest
import sys


text:
//
//  MainMenuScene.h
//  CCTextureTransform
//
//  Created by bman on 10/27/13.
//
//

#ifndef __CCTextureTransform__MainMenuScene__
#define __CCTextureTransform__MainMenuScene__

#include "cocos2d.h"

USING_NS_CC;

class MainMenuScene : public Layer
{

public:
    static Scene* scene();
    CREATE_FUNC(MainMenuScene);

    virtual ~MainMenuScene ();

    virtual bool init();

};

#endif /* defined(__CCTextureTransform__MainMenuScene__) */


text:
package org.apache.olingo.odata2.core.servicedocument;

import org.apache.olingo.odata2.api.servicedocument.Title;

/**
 *
 */
public class TitleImpl implements Title {
  private String text;

  @Override
  public String getText() {
    return text;
  }

  public TitleImpl setText(final String text) {
    this.text = text;
    return this;
  }
}


text:
/**
 * generated by Xtext 2.10.0
 */
package com.laegler.stubbr.lang.stubbrLang;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.eclipse.emf.common.util.Enumerator;

/**
 *
 * A representation of the literals of the enumeration 'Format Type',
 * and utility methods for working with them.
 *
 * @see com.laegler.stubbr.lang.stubbrLang.StubbrLangPackage#getFormatType()
 * @model
 * @generated
 */
public enum FormatType implements Enumerator
{
  /**
   * The 'BLANK' literal object.
   *
   *
   * @see #BLANK_VALUE
   * @generated
   * @ordered
   */
  BLANK(0, "BLANK", "FormatType not specified"),

  /**
   * The 'BPMN' literal object.
   *
   *
   * @see #BPMN_VALUE
   * @generated
   * @ordered
   */
  BPMN(1, "BPMN", "BPMN"),

  /**
   * The 'BPEL' literal object.
   *
   *
   * @see #BPEL_VALUE
   * @generated
   * @ordered
   */
  BPEL(2, "BPEL", "BPEL"),

  /**
   * The 'JBPM' literal object.
   *
   *
   * @see #JBPM_VALUE
   * @generated
   * @ordered
   */
  JBPM(3, "JBPM", "JBPM"),

  /**
   * The 'UML' literal object.
   *
   *
   * @see #UML_VALUE
   * @generated
   * @ordered
   */
  UML(4, "UML", "UML");

  /**
   * The 'BLANK' literal value.
   *
   *

   * If the meaning of 'BLANK' literal object isn't clear,
   * there really should be more of a description here...
   *

   *
   * @see #BLANK
   * @model literal="FormatType not specified"
   * @generated
   * @ordered
   */
  public static final int BLANK_VALUE = 0;

  /**
   * The 'BPMN' literal value.
   *
   *

   * If the meaning of 'BPMN' literal object isn't clear,
   * there really should be more of a description here...
   *

   *
   * @see #BPMN
   * @model
   * @generated
   * @ordered
   */
  public static final int BPMN_VALUE = 1;

  /**
   * The 'BPEL' literal value.
   *
   *

   * If the meaning of 'BPEL' literal object isn't clear,
   * there really should be more of a description here...
   *

   *
   * @see #BPEL
   * @model
   * @generated
   * @ordered
   */
  public static final int BPEL_VALUE = 2;

  /**
   * The 'JBPM' literal value.
   *
   *

   * If the meaning of 'JBPM' literal object isn't clear,
   * there really should be more of a description here...
   *

   *
   * @see #JBPM
   * @model
   * @generated
   * @ordered
   */
  public static final int JBPM_VALUE = 3;

  /**
   * The 'UML' literal value.
   *
   *

   * If the meaning of 'UML' literal object isn't clear,
   * there really should be more of a description here...
   *

   *
   * @see #UML
   * @model
   * @generated
   * @ordered
   */
  public static final int UML_VALUE = 4;

  /**
   * An array of all the 'Format Type' enumerators.
   *
   *
   * @generated
   */
  private static final FormatType[] VALUES_ARRAY =
    new FormatType[]
    {
      BLANK,
      BPMN,
      BPEL,
      JBPM,
      UML,
    };

  /**
   * A public read-only list of all the 'Format Type' enumerators.
   *
   *
   * @generated
   */
  public static final List<FormatType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));

  /**
   * Returns the 'Format Type' literal with the specified literal value.
   *
   *
   * @param literal the literal.
   * @return the matching enumerator or null.
   * @generated
   */
  public static FormatType get(String literal)
  {
    for (int i = 0; i < VALUES_ARRAY.length; ++i)
    {
      FormatType result = VALUES_ARRAY[i];
      if (result.toString().equals(literal))
      {
        return result;
      }
    }
    return null;
  }

  /**
   * Returns the 'Format Type' literal with the specified name.
   *
   *
   * @param name the name.
   * @return the matching enumerator or null.
   * @generated
   */
  public static FormatType getByName(String name)
  {
    for (int i = 0; i < VALUES_ARRAY.length; ++i)
    {
      FormatType result = VALUES_ARRAY[i];
      if (result.getName().equals(name))
      {
        return result;
      }
    }
    return null;
  }

  /**
   * Returns the 'Format Type' literal with the specified integer value.
   *
   *
   * @param value the integer value.
   * @return the matching enumerator or null.
   * @generated
   */
  public static FormatType get(int value)
  {
    switch (value)
    {
      case BLANK_VALUE: return BLANK;
      case BPMN_VALUE: return BPMN;
      case BPEL_VALUE: return BPEL;
      case JBPM_VALUE: return JBPM;
      case UML_VALUE: return UML;
    }
    return null;
  }

  /**
   *
   *
   * @generated
   */
  private final int value;

  /**
   *
   *
   * @generated
   */
  private final String name;

  /**
   *
   *
   * @generated
   */
  private final String literal;

  /**
   * Only this class can construct instances.
   *
   *
   * @generated
   */
  private FormatType(int value, String name, String literal)
  {
    this.value = value;
    this.name = name;
    this.literal = literal;
  }

  /**
   *
   *
   * @generated
   */
  public int getValue()
  {
    return value;
  }

  /**
   *
   *
   * @generated
   */
  public String getName()
  {
    return name;
  }

  /**
   *
   *
   * @generated
   */
  public String getLiteral()
  {
    return literal;
  }

  /**
   * Returns the literal value of the enumerator, which is its string representation.
   *
   *
   * @generated
   */
  @Override
  public String toString()
  {
    return literal;
  }

} //FormatType


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

package com.google.enterprise.connector.dctm;

import com.google.enterprise.connector.dctm.dctmmockwrap.DmInitialize;
import com.google.enterprise.connector.dctm.dctmmockwrap.MockDmClientX;
import com.google.enterprise.connector.dctm.dfcwrap.IClient;
import com.google.enterprise.connector.dctm.dfcwrap.IClientX;
import com.google.enterprise.connector.dctm.dfcwrap.IId;
import com.google.enterprise.connector.dctm.dfcwrap.ILoginInfo;
import com.google.enterprise.connector.dctm.dfcwrap.ISession;
import com.google.enterprise.connector.dctm.dfcwrap.ISessionManager;
import com.google.enterprise.connector.dctm.dfcwrap.ISysObject;
import com.google.enterprise.connector.dctm.dfcwrap.ITime;
import com.google.enterprise.connector.spi.Property;
import com.google.enterprise.connector.spi.RepositoryException;
import com.google.enterprise.connector.spi.SpiConstants;
import com.google.enterprise.connector.spi.SpiConstants.ActionType;
import com.google.enterprise.connector.spi.Value;

import junit.framework.TestCase;

import java.util.Collections;
import java.util.Set;

public class DctmMockSysobjectPropertyMapTest extends TestCase {
  IClientX dctmClientX = null;
  IClient localClient = null;
  ISessionManager sessionManager = null;
  ISession session;
  DctmTraversalManager traversalManager = null;
  DctmSysobjectDocument document = null;
  ITime lastModifDate;

  @Override
  protected void setUp() throws Exception {
    super.setUp();

    dctmClientX = new MockDmClientX();
    localClient = dctmClientX.getLocalClient();
    sessionManager = localClient.newSessionManager();
    ILoginInfo loginInfo = dctmClientX.getLoginInfo();
    loginInfo.setUser(DmInitialize.DM_LOGIN_OK1);
    loginInfo.setPassword(DmInitialize.DM_PWD_OK1);
    sessionManager.setIdentity(DmInitialize.DM_DOCBASE, loginInfo);

    traversalManager = new DctmTraversalManager(dctmClientX,
        DmInitialize.DM_DOCBASE, DmInitialize.DM_WEBTOP_SERVER_URL,
        DmInitialize.included_meta, sessionManager);

    session = null;
    try {
      session = sessionManager.newSession(DmInitialize.DM_DOCBASE);
    } finally {
      if (session != null) {
        sessionManager.release(session);
      }
    }

    session = sessionManager.getSession(DmInitialize.DM_DOCBASE);
    IId id = dctmClientX.getId(DmInitialize.DM_ID1);
    ISysObject object = (ISysObject) session.getObject(id);
    lastModifDate = object.getTime("r_modify_date");
    document = new DctmSysobjectDocument(traversalManager, session,
        DmInitialize.DM_ID1, null, lastModifDate, ActionType.ADD, null);
  }

  private DctmSysobjectDocument getDocument(Set<String> includedMeta)
      throws RepositoryException {
    DctmTraversalManager traversalManager = new DctmTraversalManager(
        dctmClientX, DmInitialize.DM_DOCBASE,
        DmInitialize.DM_WEBTOP_SERVER_URL, includedMeta, sessionManager);
    return new DctmSysobjectDocument(traversalManager, session,
        DmInitialize.DM_ID1, null, lastModifDate, ActionType.ADD, null);
  }

  public void testGetPropertyNames_empty() throws RepositoryException {
    Set<String> names = document.getPropertyNames();
    assertEquals(6, names.size());
    for (String name : names) {
      assertTrue(name, name.startsWith("google:"));
    }
  }

  public void testGetPropertyNames_folder() throws RepositoryException {
    document = getDocument(
        Collections.singleton(SpiConstants.PROPNAME_FOLDER));
    Set<String> names = document.getPropertyNames();
    assertEquals(7, names.size());
    for (String name : names) {
      assertTrue(name, name.startsWith("google:"));
    }
  }

  public void testGetPropertyNames_objectId() throws RepositoryException {
    document = getDocument(
        Collections.singleton(DctmSysobjectDocument.OBJECT_ID_NAME));
    Set<String> names = document.getPropertyNames();
    assertEquals(7, names.size());
    for (String name : names) {
      assertTrue(name,
          name.startsWith("google:") || name.equals("r_object_id"));
    }
  }

  public void testFindProperty_docid() throws RepositoryException {
    Property property = document.findProperty(SpiConstants.PROPNAME_DOCID);
    assertNotNull(property);
    Value value = property.nextValue();
    assertNotNull(value);
    assertEquals(DmInitialize.DM_ID1, value.toString());
  }

  public void testFindProperty_folder() throws RepositoryException {
    // This does not work because the mock implementation does not
    // support retrieving r_folder path from the parent folders, but
    // it does check that findProperty does not return null.
    Property property;
    try {
      property = document.findProperty(SpiConstants.PROPNAME_FOLDER);
    } catch (Exception e) {
      return;
    }
    assertNotNull(property);
    Value value = property.nextValue();
    assertNotNull(value);
  }

  public void testFindProperty_objectId() throws RepositoryException {
    Property property =
        document.findProperty(DctmSysobjectDocument.OBJECT_ID_NAME);
    assertNotNull(property);
    Value value = property.nextValue();
    assertNotNull(value);
    assertEquals(DmInitialize.DM_ID1, value.toString());
  }

  /**
   * Tests that the unsupported SPI properties are ignored, and only
   * handled once per property name.
   */
  public void testIgnoredSpiProperties() throws RepositoryException {
    Property property;

    assertTrue(DctmSysobjectDocument.UNSUPPORTED_PROPNAMES.toString(),
        DctmSysobjectDocument.UNSUPPORTED_PROPNAMES.isEmpty());

    property = document.findProperty(SpiConstants.PROPNAME_DOCID);
    assertNotNull(SpiConstants.PROPNAME_DOCID, property);

    assertTrue(DctmSysobjectDocument.UNSUPPORTED_PROPNAMES.toString(),
        DctmSysobjectDocument.UNSUPPORTED_PROPNAMES.isEmpty());

    // Retrieve these twice to ensure that the set doesn't grow.
    for (int i = 0; i < 2; i++) {
      property = document.findProperty(SpiConstants.PROPNAME_SEARCHURL);
      assertNull(SpiConstants.PROPNAME_SEARCHURL, property);
      property = document.findProperty(SpiConstants.PROPNAME_FEEDTYPE);
      assertNull(SpiConstants.PROPNAME_FEEDTYPE, property);

      assertEquals(DctmSysobjectDocument.UNSUPPORTED_PROPNAMES.toString(),
          2, DctmSysobjectDocument.UNSUPPORTED_PROPNAMES.size());
      assertTrue(DctmSysobjectDocument.UNSUPPORTED_PROPNAMES.toString(),
          DctmSysobjectDocument.UNSUPPORTED_PROPNAMES.contains(
              SpiConstants.PROPNAME_SEARCHURL));
      assertTrue(DctmSysobjectDocument.UNSUPPORTED_PROPNAMES.toString(),
          DctmSysobjectDocument.UNSUPPORTED_PROPNAMES.contains(
              SpiConstants.PROPNAME_FEEDTYPE));
    }
  }
}


text:
package com.dlgdev.xcom2tools.domain.characters;

public abstract class Character {
	public Stats stats;
}


text:
<?php
/**
 * This is a Anax pagecontroller / frontcontroller.
 *
 */

// Get environment & autoloader and the $app-object.
require __DIR__.'/config_with_app.php';

//

$app->theme->configure(ANAX_APP_PATH . 'config/theme_me.php');

// Set the title of the page
$app->theme->setVariable('title', "Me-sida!");
$app->url->setUrlType(\Anax\Url\CUrl::URL_CLEAN);

$di->session();

// Set database connection
$di->setShared('db', function () {
    $db = new \Mos\Database\CDatabaseBasic();
    $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql.php');
    $db->connect();
    return $db;
});

$di->setShared('user', function () use ($di) {
    $user = new \Anax\Users\User();
    $user->setDI($di);
    return $user;
});

$di->setShared('log', function () {
    $log = new jejd14\clog\CLog();
    return $log;
});

$di->setShared('flashMessage', function () use ($di) {
    $flashMessage = new \Anax\Flash\CFlash();
    $flashMessage->setDI($di);
    return $flashMessage;
});

// Set comment controller
$di->set('CommentController', function () use ($di) {
    $controller = new Anax\Comment\CommentController();
    $controller->setDI($di);
    return $controller;
});

$di->set('CommentformController', function () use ($di) {
     $controller = new \Anax\HTMLForm\CommentformController();
     $controller->setDI($di);
     return $controller;
});

$di->set('UsersController', function () use ($di) {
     $controller = new \Anax\Users\UsersController();
     $controller->setDI($di);
     return $controller;
});

$di->set('UserformController', function () use ($di) {
     $controller = new \Anax\HTMLForm\UserformController();
     $controller->setDI($di);
     return $controller;
});

$di->set('QuestionsController', function () use ($di) {
     $controller = new \Anax\Questions\QuestionsController();
     $controller->setDI($di);
     return $controller;
});

$di->set('QuestionformController', function () use ($di) {
     $controller = new \Anax\HTMLForm\QuestionformController();
     $controller->setDI($di);
     return $controller;
});

$di->set('TagsController', function () use ($di) {
     $controller = new \Anax\Tags\TagsController();
     $controller->setDI($di);
     return $controller;
});

$di->set('Q2tController', function () use ($di) {
     $controller = new \Anax\Tags\Q2tController();
     $controller->setDI($di);
     return $controller;
});

$di->set('ActivitiesController', function () use ($di) {
     $controller = new \Anax\Activity\ActivitiesController();
     $controller->setDI($di);
     return $controller;
});

$di->set('VoteController', function () use ($di) {
     $controller = new \Anax\Vote\VoteController();
     $controller->setDI($di);
     return $controller;
});

$app->router->add('', function () use ($app) {
    $app->theme->setTitle("Home");

    $app->dispatcher->forward([
       'controller' => 'tags',
       'action'     => 'frontpage',
    ]);

    $app->dispatcher->forward([
       'controller' => 'questions',
       'action'     => 'frontpage',
    ]);

    $app->dispatcher->forward([
       'controller' => 'users',
       'action'     => 'frontpage',
    ]);

    $app->dispatcher->forward([
       'controller' => 'activities',
       'action'     => 'frontpage',
    ]);

    //$app->views->addString($footercol1, 'footer-col-1');
});

$app->router->add('questions', function () use ($app) {
    $app->theme->setTitle("Questions");
    $order = $app->request->getGet('order');
    if (!isset($order)) {
        $order = 'created';
    }
    $app->dispatcher->forward([
       'controller' => 'questions',
       'action'     => 'list',
       'params'     => [$order]
    ]);
});

$app->router->add('tags', function () use ($app) {
    $app->theme->setTitle("Tags");

    $app->dispatcher->forward([
        'controller' => 'tags',
        'action'     => 'list',
    ]);
});

$app->router->add('users', function () use ($app) {
    $app->theme->setTitle("Users");

    $app->dispatcher->forward([
        'controller' => 'users',
        'action'     => 'list',
    ]);
});

$app->router->add('about', function () use ($app) {
    $app->theme->setTitle("About");

    $about = $app->fileContent->get('about.md');
    $about = $app->textFilter->doFilter($about, 'shortcode, markdown');

    $app->views->add('me/page', [
        'content' => $about,
    ]);
});

$app->router->add('questions/ask', function () use ($app) {
    $app->theme->setTitle("Ask Question");

    $content = $app->fileContent->get('questionhelp.md');
    $content = $app->textFilter->doFilter($content, 'shortcode, markdown');

    if (!$app->user->isAuthenticated()) {
        $signin = $app->url->create('signin');
        $signup = $app->url->create('signup');
        $app->flashMessage->error("You need to be Signed in to ask a question! Don't got a account yet? Sign up here!");
        $app->views->addString($app->flashMessage->get(), 'flash');
        $app->flashMessage->clear();
    } else {

    }

    $app->views->addString($content, 'main');

    $app->dispatcher->forward([
      'controller' => 'questions',
      'action'     => 'addQuestion',
    ]);
});

$app->router->add('signin', function () use ($app) {
    $app->theme->setTitle("Sign in");
    $app->dispatcher->forward([
       'controller' => 'users',
       'action'     => 'login',
    ]);
});

$app->router->add('signup', function () use ($app) {
    $app->theme->setTitle("Sign in");

    $app->dispatcher->forward([
       'controller' => 'users',
       'action'     => 'add',
    ]);
});

$app->router->handle();
$app->navbar->configure(ANAX_APP_PATH . 'config/navbar_me.php');

// Render the response using theme engine.
$app->theme->render();


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('compta', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='operation',
            name='all_tax_included',
            field=models.BooleanField(default=True, verbose_name='All tax included'),
        ),
    ]


text:
<?php

declare(strict_types=1);

namespace Mwop\App;

use Cache\Hierarchy\HierarchicalPoolInterface;
use Cache\Namespaced\NamespacedCachePool;

/**
 * PSR-6 cache pool implementation for sessions.
 *
 * Empty extension to allow typehinting/`::class` resolution.
 */
class SessionCachePool extends NamespacedCachePool
{
    public function __construct(HierarchicalPoolInterface $cachePool)
    {
        parent::__construct($cachePool, 'session');
    }
}


text:
package frc.team5333.parlez;

import jaci.openrio.toast.core.io.Storage;

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class ProgramLoader {

    public static void init() {
        Storage.USB_Module("lua", (file, usb, device) -> {
            file.delete();
        });
        Storage.USB_Module("parlez", (file, usb, device) -> {
            file.mkdirs();
            File[] files = file.listFiles((f) -> !f.getName().equalsIgnoreCase("locales"));
            if (files != null)
                loadSet(files, "");
        });
    }

    public static void loadSet(File[] files, String sub) {
        for (File file : files) {
            if (file.isDirectory())
                loadSet(file.listFiles(), sub + file.getName() + "/");
            else {
                String[] nameAndExtension = file.getName().split("\\.");
                String filename = nameAndExtension[0];
                String locale = nameAndExtension[1];
                try {
                    String contents = LocaleLoader.getLocale(locale).convert(new FileReader(file));
                    String folder = "lua/" + sub;
                    Storage.highestPriority(folder).mkdirs();
                    FileWriter writer = new FileWriter(Storage.highestPriority(folder + filename + ".lua"));
                    writer.write(contents);
                    writer.close();
                } catch (IOException e) {
                    Parlez.logger.error("Could not load Parlez File " + filename + ": " + e);
                    Parlez.logger.exception(e);
                }
            }
        }
    }

}


text:
layout: post
title: "March 2018 Meetup - Serverless apps + GraphQL w/ AWS AppSync"
description: ""
tags: [node.js, aws, lambda, appsync, serverless, graphql]
---
{% include JB/setup %}

The Seattle Node.js Meetup is pleased to announce our
[meetup](https://www.meetup.com/Seattle-Node-js/events/248518577/)
on **Tuesday, Match 27th**, with two talks discussing using Node.js and
GraphQL with Amazon Web Services' [AppSync](https://aws.amazon.com/appsync/)
data layer.

As always, you can find all things Seattle Node.js-related at the group website:
[http://seanode.github.io/](http://seanode.github.io/). And you can reach out to
us via email at [{{site.author.email}}](mailto:{{site.author.email}}) or Twitter
at [@{{site.author.twitter}}](https://twitter.com/{{ site.author.twitter }}).

See you soon!

## Agenda

* **6:30pm - 7:00pm**: Doors open, hang out with your fellow developers. Grab
  some snacks and beverages courtesy of Gravity Payments.

* **7:00pm - 8:10pm**: Learn how to wire up production, data-backed apps using
  GraphQL and Node.js with two talks. A single Q&A will follow both talks.

* **8:15pm - 8:30pm-ish**: Mingle, mix, chat things Node.js-related and more as
  we wind down.

<!-- more start -->

## Talks

**[Rohan Deshpande](https://twitter.com/appwiz) - Sr. Software Engineer AWS Mobile**

**[Richard Threlkeld](https://twitter.com/undef_obj) - Sr. Product Manager AWS Mobile**

Rohan and Richard are part of the AWS Mobile teams that delivered [AWS
AppSync](https://aws.amazon.com/appsync/) and [AWS
Amplify](https://github.com/aws/aws-amplify) in 2017. They work with customers
building Serverless infrastructures with GraphQL, AWS Lambda, and other AWS
technologies. Prior to this Richard spent several years building Big Data
solutions and mobile architectures for AWS customers, and Rohan worked on
several AWS services such as SNS, Pinpoint, and Device Farm.

### Data fetching & batching with GraphQL using AWS Lambda and AWS AppSync

In this session we'll cover some of the basics of AWS AppSync functionality and
then dive deep on using Node.js in a Lambda function to perform GraphQL
operations and manipulate fields. We'll also show how you can perform fine
grained authorization checks using different controls or database systems.
Finally we'll show how you can use a Node.js client to interact with AWS AppSync
and perform GraphQL operations.

### Queries, Mutations, and Pub/Sub with AWS AppSync and Alexa

In this session, we will build an Alexa skill that interacts with AWS AppSync
and performs queries and mutations. We will show you how to easily synchronize
actions performed by the skill with your mobile and web apps.

## Sponsor

**[Gravity Payments](https://gravitypayments.com/)** has graciously agreed to
host the event. Gravity Payments is located on the rooftop floor of 5601 22nd
Ave NW, Ste 200, Seattle, WA 98107

<!-- more end -->


text:
<?xml version="1.0" encoding="utf-8"?>

<translate
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@integer/duration_normal"
    android:startOffset="0"
    android:fromXDelta="0"
    android:fromYDelta="-100%"
    android:toXDelta="0"
    android:toYDelta="0"
    />


text:
test-unit:
	@./vendor/bin/phpunit -c ./ --group unit

test-functional:
	@./vendor/bin/phpunit -c ./ --group functional

test:
	@./vendor/bin/phpunit -c ./

code-coverage:
	@./vendor/bin/phpunit -c ./ --coverage-html ./Resources/docs/code-coverage
	@open ./Resources/docs/code-coverage/index.html

checkstyle:
	@./vendor/bin/phpcs --standard="vendor/instaclick/symfony2-coding-standard/Symfony2" --ignore=Tests/,vendor/ ./

detectmess:
	@@./vendor/bin/phpmd ./ text codesize,unusedcode,naming,design,controversial --exclude Tests/,vendor/

all: phpunit phpcs phpmd


text:
import * as React from 'react';
import {
  RouterChildContext,
  RouteComponentProps
} from 'react-router';
import {
  BrowserRouter as Router,
  Route,
} from 'react-router-dom';

interface Params {
  id?: string;
}
type Props = RouteComponentProps<Params>;

class ComponentThatUsesContext extends React.Component<Props> {
  static contextTypes = {
    router: React.PropTypes.object.isRequired
  };
  context: RouterChildContext<Params>;
  private onClick = () => {
    const {
      history,
      route: {
        location,
        match
      }
    } = this.context.router;
    history.push('/some/url');
  }
  render() {
    return <div/>;
  }
}

const Test = () => (
  <Router>
    <Route path='/' exact component={ComponentThatUsesContext}/>
  </Router>
);

export default Test;


text:
template <class T>
class TemplatizedBitfield {
    T t : 6;
};


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

Class Model_modal extends CI_Model
{
  public function get_siswa($nisn){
    $query=$this->db->get_where('obj_siswa',array('no_induk'=>$nisn));
    $query=$query->result_array();
    return $query;
  }
  public function get_kelas($id){
    $query=$this->db->get_where('obj_kelas',array('id'=>$id));
    $query=$query->result_array();
    return $query;
  }
  public function get_pengajar($id){
    $query=$this->db->get_where('kbm_mengajar',array('id'=>$id));
    $query=$query->result_array();
    $data=array();
    foreach ($query as $key) {
      $data=$key;
    }
    return $data;
  }
  public function get_jabatan_pegawai($id){
    $query=$this->db->query("SELECT a.id,a.id_kelas,b.nip,b.nama_pegawai,a.jabatan,c.nama_kelas,c.tingkat FROM obj_jabatan a LEFT JOIN obj_pegawai b ON a.id_pegawai=b.id LEFT JOIN obj_kelas c ON a.id_kelas=c.id WHERE a.id=".$id.";");
    $query=$query->result_array();
   return $query;
  }
  public function get_mapel($id){
    $query=$this->db->get_where('obj_mapel',array('id'=>$id));
    $query=$query->result_array();
    return $query;
  }
  public function get_pegawai($id){
    $query=$this->db->get_where('obj_pegawai',array('id'=>$id));
    $query=$query->result_array();
    return $query;
  }
 public function get_bidang($id){
    $query=$this->db->get_where('jur_bidang',array('id'=>$id));
    $query=$query->result_array();
    return $query;
  }
   public function get_program($id){
    $query=$this->db->get_where('jur_program',array('id'=>$id));
    $query=$query->result_array();
    return $query;
  }
  public function get_paket($id){
    $query=$this->db->get_where('jur_paket',array('id'=>$id));
    $query=$query->result_array();
    return $query;
  }
  public function get_program_by_id($idbidang){
    $query=$this->db->get_where('jur_program',array('id_bidang'=>$idbidang));
    $query=$query->result_array();
    return $query;
  }
  public function get_paket_by_id($idpaket){
    $query=$this->db->get_where('jur_paket',array('id_program'=>$idpaket));
    $query=$query->result_array();
    return $query;
  }
  public function get_prov(){
    $query=$this->db->get('tmpt_prov');
    $query=$query->result_array();
    return $query;
  }
  public function get_kabkot($idprov){
    $query=$this->db->get_where('tmpt_kabkot',array('id_provinsi'=>$idprov));
    $query=$query->result_array();
    return $query;
  }
   public function get_kec($idkabkot){
    $query=$this->db->get_where('tmpt_kec',array('id_kabkot'=>$idkabkot));
    $query=$query->result_array();
    return $query;
  }
   public function get_keldesa($idkec){
    $query=$this->db->get_where('tmpt_keldesa',array('id_kec'=>$idkec));
    $query=$query->result_array();
    return $query;
  }
  public function get_nilai($noinduk,$idsk,$ta){
    $this->db->where('no_induk',$noinduk);
    $this->db->where('id_sk',$idsk);
    $this->db->where('ta',$ta);
    $data=$this->db->get('kbm_nilai');
    $data=$data->result();
    return $data;
  }
  public function get_subnilai($noinduk,$idsk){
    $this->db->where('no_induk',$noinduk);
    $this->db->where('id_sk',$idsk);
    $data=$this->db->get('kbm_subnilai');
    $data=$data->result();
    return $data;
  }
  public function update_nilai($data){
    $this->db->where('id',$data['id']);
    $this->db->update('kbm_nilai',$data);
  }
  public function insert_nilai($data){
    $this->db->insert('kbm_nilai',$data);
  }
  public function save_detail($insert,$update){
    $hasil=0;
     if(sizeof($insert)>0){
       $this->db->insert_batch('kbm_subnilai',$insert);
       $hasil=$hasil+$this->db->affected_rows();
      }
     if(sizeof($update)>0){
      $this->db->update_batch('kbm_subnilai',$update,'id');
      $hasil=$hasil+$this->db->affected_rows();
     }
    return true;
  }
}


text:
package org.jboss.arquillian.ajocado.waiting.retrievers;

import org.jboss.arquillian.ajocado.waiting.ajax.JavaScriptRetriever;
import org.jboss.arquillian.ajocado.waiting.selenium.SeleniumRetriever;

/**
 * Composes all types able to retrieve typed object from page.
 *
 * @param <T> the type of object to retrieve from page
 *
 * @author Lukas Fryc
 * @version $Revision$
 */
public interface Retriever<T> extends JavaScriptRetriever<T>, SeleniumRetriever<T> {

}