text:
#pragma once
#include <aws/lambda/Lambda_EXPORTS.h>
#include <aws/lambda/model/AccountLimit.h>
#include <aws/lambda/model/AccountUsage.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace Lambda
{
namespace Model
{
  class AWS_LAMBDA_API GetAccountSettingsResult
  {
  public:
    GetAccountSettingsResult();
    GetAccountSettingsResult(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    GetAccountSettingsResult& operator=(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    inline const AccountLimit& GetAccountLimit() const{ return m_accountLimit; }

    inline void SetAccountLimit(const AccountLimit& value) { m_accountLimit = value; }

    inline void SetAccountLimit(AccountLimit&& value) { m_accountLimit = std::move(value); }

    inline GetAccountSettingsResult& WithAccountLimit(const AccountLimit& value) { SetAccountLimit(value); return *this;}

    inline GetAccountSettingsResult& WithAccountLimit(AccountLimit&& value) { SetAccountLimit(std::move(value)); return *this;}

    inline const AccountUsage& GetAccountUsage() const{ return m_accountUsage; }

    inline void SetAccountUsage(const AccountUsage& value) { m_accountUsage = value; }

    inline void SetAccountUsage(AccountUsage&& value) { m_accountUsage = std::move(value); }

    inline GetAccountSettingsResult& WithAccountUsage(const AccountUsage& value) { SetAccountUsage(value); return *this;}

    inline GetAccountSettingsResult& WithAccountUsage(AccountUsage&& value) { SetAccountUsage(std::move(value)); return *this;}

  private:
    AccountLimit m_accountLimit;
    AccountUsage m_accountUsage;
  };

} // namespace Model
} // namespace Lambda
} // namespace Aws

redpajama_set_name: RedPajamaGithub


text:
"use strict";
(function(){

  function init() {
    LUA.addProcessor("getURL", getGitHub);
  }

function getGitHubOwner(owner,callback){
  var apiUrl = "https://api.github.com/users/" + owner + "/repos";
  $.getJSON(apiUrl,function(data){ callback(data);});
}
function getGitHubRepo(owner,repo,callback){
  var apiUrl = "https://api.github.com/repos/" + owner + "/" + repo + "/contents";
  $.getJSON(apiUrl,function(data){ callback(data);});
}
function getGitHubFile(owner,repo,path,branch,callback){
  var apiUrl="https://api.github.com/repos/"+owner+"/"+repo+"/contents/"+path+"?ref="+branch;
  $.getJSON(apiUrl,function(data){
    if(data.type=="file"&&data.encoding=="base64"){callback(window.atob(data.content));}
    else{console.log("this is no file, I like");}
  }).fail(function(a,b){
    LUA.Core.Notifications.warning("File " + path + " not found on github");
    callback(false);
  });
}

  function getGitHub(data, callback) {
    var match = undefined;
    if (!match) match = data.url.match(/^https?:\/\/github.com\/([^\/]+)\/([^\/]+)\/blob\/([^\/]+)\/(.*)$/);
    if (!match) match = data.url.match(/^https?:\/\/raw.githubusercontent.com\/([^\/]+)\/([^\/]+)\/([^\/]+)\/(.*)$/);
    if (match) {
      var git = {
          owner : match[1],
          repo : match[2],
          branch : match[3],
          path : match[4]
          };

      console.log("Found GitHub", JSON.stringify(git));
      var apiURL = "https://api.github.com/repos/"+git.owner+"/"+git.repo+"/contents/"+git.path+"?ref="+git.branch;
      $.get(apiURL, function(json) {
        if (json.type=="file" &&
            json.encoding=="base64") {
          // just load it...
          data.data = window.atob(json.content);
        } else {
          console.log("GET of "+apiURL+" returned JSON that wasn't a base64 encoded fine");
        }
        callback(data);
      }, "json").fail(function() {
        console.log("GET of "+apiURL+" failed.");
        callback(data);
      });
    } else
      callback(data); // no match - continue as normal
  }

  LUA.Plugins.GetGitHub = {
    init : init,
    getGitHub : getGitHub,
    getGitHubOwner : getGitHubOwner,
    getGutHubRepo : getGitHubRepo,
    getGitHubFile : getGitHubFile
  };
}());


text:
UPDATE wp_postmeta
SET meta_key = REPLACE(meta_key, '_news_', '_blog_')
WHERE meta_key LIKE '%_news_%';


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>energy.usef.mdc.endpoint (usef-root-pom 1.3.6 API)</title>
<meta name="date" content="2016-09-29">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package energy.usef.mdc.endpoint

Class Summary

Class
Description

BalanceResponsiblePartyEndpoint

CommonReferenceOperatorEndpoint

ConnectionEndpoint

DistributionSystemOperatorEndpoint

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Copyright © 2016. All rights reserved.


text:
require "test/unit/testcase"

require 'rexml/document'
require 'rexml/entity'
require 'rexml/source'

module REXMLTests
  class EntityTester < Test::Unit::TestCase
    def test_parse_general_decl
      simple = "<!ENTITY foo 'bar'>"
      simple =~ /#{REXML::Entity::GEDECL}/
      assert $&
      assert_equal simple, $&

      REXML::Entity::ENTITYDECL =~ simple
      assert REXML::Entity::matches?(simple)
      match = REXML::Entity::ENTITYDECL.match(simple)
      assert_equal 'foo', match[1]
      assert_equal "'bar'", match[2]

      simple = '<!ENTITY Pub-Status
      "This is a pre-release of the specification.">'
      assert REXML::Entity::matches?(simple)
      match = REXML::Entity::ENTITYDECL.match(simple)
      assert_equal 'Pub-Status', match[1]
      assert_equal '"This is a pre-release of the specification."', match[2]

      txt = '"This is a
      pre-release of <the> specification."'
      simple = "<!ENTITY     Pub-Status
      #{txt}>"
      assert REXML::Entity::matches?(simple)
      match = REXML::Entity::ENTITYDECL.match(simple)
      assert_equal 'Pub-Status', match[1]
      assert_equal txt, match[2]
    end

    def test_parse_external_decl
      zero = '<!ENTITY open-hatch SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml" >'
      one = '<!ENTITY open-hatch
                SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">'
      two = '<!ENTITY open-hatch
                PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
                "http://www.textuality.com/boilerplate/OpenHatch.xml">'
      three = '<!ENTITY hatch-pic
                SYSTEM "../grafix/OpenHatch.gif"
                NDATA gif >'
      assert REXML::Entity::matches?(zero)
      assert REXML::Entity::matches?(one)
      assert REXML::Entity::matches?(two)
      assert REXML::Entity::matches?(three)
    end

    def test_parse_entity
      one = %q{<!ENTITY % YN '"Yes"'>}
      two = %q{<!ENTITY WhatHeSaid "He said %YN;">}
      assert REXML::Entity::matches?(one)
      assert REXML::Entity::matches?(two)
    end

    def test_constructor
      one = [ %q{<!ENTITY % YN '"Yes"'>},
        %q{<!ENTITY % YN2 "Yes">},
        %q{<!ENTITY WhatHeSaid "He said %YN;">},
        '<!ENTITY open-hatch
                SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">',
        '<!ENTITY open-hatch2
                PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
                "http://www.textuality.com/boilerplate/OpenHatch.xml">',
        '<!ENTITY hatch-pic
                SYSTEM "../grafix/OpenHatch.gif"
                NDATA gif>' ]
      source = %q{<!DOCTYPE foo [
        <!ENTITY % YN '"Yes"'>
        <!ENTITY % YN2 "Yes">
        <!ENTITY WhatHeSaid "He said %YN;">
        <!ENTITY open-hatch
                SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
        <!ENTITY open-hatch2
                PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
                "http://www.textuality.com/boilerplate/OpenHatch.xml">
        <!ENTITY hatch-pic
                SYSTEM "../grafix/OpenHatch.gif"
                NDATA gif>
      ]>}

      d = REXML::Document.new( source )
      dt = d.doctype
      c = 0
      dt.each do |child|
        if child.kind_of? REXML::Entity
          str = one[c].tr("\r\n\t", '   ').squeeze(" ")
          assert_equal str, child.to_s
          c+=1
        end
      end
    end

    def test_replace_entities
      source = "<!DOCTYPE blah [\n<!ENTITY foo \"bar\">\n]>&foo;"
      doc = REXML::Document.new(source)
      assert_equal 'bar', doc.root.text
      out = ''
      doc.write out
      assert_equal source, out
    end

    def test_entity_string_limit
      template = '<!DOCTYPE bomb [ <!ENTITY a "^" > ]> <bomb>$</bomb>'
      len      = 5120 # 5k per entity
      template.sub!(/\^/, "B" * len)

      # 10k is OK
      entities = '&a;' * 2 # 5k entity * 2 = 10k
      xmldoc = REXML::Document.new(template.sub(/\$/, entities))
      assert_equal(len * 2, xmldoc.root.text.bytesize)

      # above 10k explodes
      entities = '&a;' * 3 # 5k entity * 2 = 15k
      xmldoc = REXML::Document.new(template.sub(/\$/, entities))
      assert_raise(RuntimeError) do
        xmldoc.root.text
      end
    end

    def test_entity_string_limit_for_parameter_entity
      template = '<!DOCTYPE bomb [ <!ENTITY % a "^" > <!ENTITY bomb "$" > ]><root/>'
      len      = 5120 # 5k per entity
      template.sub!(/\^/, "B" * len)

      # 10k is OK
      entities = '%a;' * 2 # 5k entity * 2 = 10k
      REXML::Document.new(template.sub(/\$/, entities))

      # above 10k explodes
      entities = '%a;' * 3 # 5k entity * 2 = 15k
      assert_raise(REXML::ParseException) do
        REXML::Document.new(template.sub(/\$/, entities))
      end
    end

    def test_raw
      source = '<!DOCTYPE foo [
<!ENTITY ent "replace">
]>replace &ent;'
      doc = REXML::Document.new( source, {:raw=>:all})
      assert_equal('replace &ent;', doc.root.get_text.to_s)
      assert_equal(source, doc.to_s)
    end

    def test_lazy_evaluation
      source = '<!DOCTYPE foo [
<!ENTITY ent "replace">
]>replace &ent;'
      doc = REXML::Document.new( source )
      assert_equal(source, doc.to_s)
      assert_equal("replace replace", doc.root.text)
      assert_equal(source, doc.to_s)
    end

    # Contributed (not only test, but bug fix!!) by Kouhei Sutou
    def test_entity_replacement
      source = %q{<!DOCTYPE foo [
      <!ENTITY % YN '"Yes"'>
      <!ENTITY WhatHeSaid "He said %YN;">]>
      &WhatHeSaid;}

      d = REXML::Document.new( source )
      dt = d.doctype
      assert_equal( '"Yes"', dt.entities[ "YN" ].value )
      assert_equal( 'He said "Yes"', dt.entities[ "WhatHeSaid" ].value )
      assert_equal( 'He said "Yes"', d.elements[1].text )
    end

    # More unit tests from Kouhei.  I looove users who give me unit tests.
    def test_entity_insertions
      assert_equal("&", REXML::Text.new("&", false, nil, true).to_s)
      #assert_equal("&", REXML::Text.new("&", false, false).to_s)
    end

    def test_single_pass_unnormalization # ticket 123
      assert_equal '&&', REXML::Text::unnormalize('&amp;&')
    end

    def test_entity_filter
      document = REXML::Document.new(<<-XML)
<!DOCTYPE root [
<!ENTITY copy "(c)">
<!ENTITY release-year "2013">
]>
<root/>
XML
      respect_whitespace = false
      parent = document.root
      raw = false
      entity_filter = ["copy"]
      assert_equal("(c) &release-year;",
                   REXML::Text.new("(c) 2013",
                                   respect_whitespace,
                                   parent,
                                   raw,
                                   entity_filter).to_s)
    end
  end
end


text:
require 'spec_helper'
require 'nokogiri'

describe "hdfs-site check for max.transfer.threads" do
        describe file('/etc/hadoop/conf/hdfs-site.xml') do
                #it {should be_file}
                it {should contain /dfs.datanode.max.transfer.threads/}
                it do
                        doc = Nokogiri::XML(File.read("/etc/hadoop/conf/hdfs-site.xml"))
                        d=doc.xpath("//property[name='dfs.datanode.max.transfer.threads']/value").text.to_i
                        expect(d).to be >= 4096
                end
        end
end


text:
#ifndef V4R_IO_EIGEN_H_
#define V4R_IO_EIGEN_H_

#include <string>
#include <vector>
#include <fstream>
#include <iostream>

#include <Eigen/Dense>

#include <v4r/core/macros.h>

namespace v4r
{
      namespace io
      {

        V4R_EXPORTS bool
        writeMatrixToFile (const std::string &file, const Eigen::Matrix4f & matrix);

        DEPRECATED(V4R_EXPORTS bool
        readMatrixFromFile (const std::string &file, Eigen::Matrix4f & matrix, int padding=0));

        V4R_EXPORTS Eigen::Matrix4f
        readMatrixFromFile (const std::string &file, int padding=0);

        template<typename T>
        V4R_EXPORTS
        bool
        writeVectorToFile (const std::string &file, const typename std::vector<T> & centroid);

        V4R_EXPORTS bool
        getCentroidFromFile (const std::string &file, Eigen::Vector3f & centroid);

        V4R_EXPORTS bool
        writeFloatToFile (const std::string &file, const float value);

        V4R_EXPORTS bool
        readFloatFromFile (const std::string &file, float& value);

        V4R_EXPORTS bool
        is_number(const std::string& s);

        V4R_EXPORTS bool
        writeDescrToFile (const std::string &file, const Eigen::MatrixXf &matrix);

        V4R_EXPORTS Eigen::MatrixXf
        readDescrFromFile(const std::string &file, int padding, int rowSize);

        V4R_EXPORTS bool
        writeLabelToFile (const std::string &file, const Eigen::VectorXi &vector);

        V4R_EXPORTS Eigen::VectorXi
        readLabelFromFile(const std::string &file, int padding);

      }

}

namespace Eigen
{
    template<class Matrix>
    V4R_EXPORTS
    inline void write_binary(const std::string &filename, const Matrix& matrix)
    {
        std::ofstream out(filename.c_str(), std::ios::out | std::ios::binary | std::ios::trunc);
        typename Matrix::Index rows=matrix.rows(), cols=matrix.cols();
        out.write((char*) (&rows), sizeof(typename Matrix::Index));
        out.write((char*) (&cols), sizeof(typename Matrix::Index));
        out.write((char*) matrix.data(), rows*cols*sizeof(typename Matrix::Scalar) );
        out.close();
    }
    template<class Matrix>
    V4R_EXPORTS
    inline void read_binary(const std::string &filename, Matrix& matrix)
    {
        std::ifstream in(filename.c_str(), std::ios::in | std::ios::binary);
        typename Matrix::Index rows=0, cols=0;
        in.read((char*) (&rows),sizeof(typename Matrix::Index));
        in.read((char*) (&cols),sizeof(typename Matrix::Index));
        matrix.resize(rows, cols);
        in.read( (char *) matrix.data() , rows*cols*sizeof(typename Matrix::Scalar) );
        in.close();
    }
}

#endif /* V4R_IO_EIGEN_H_ */


text:
package libcore.java.util;

import java.util.Currency;
import java.util.Locale;
import java.util.Set;

public class CurrencyTest extends junit.framework.TestCase {
    // Regression test to ensure that Currency.getSymbol(Locale) returns the
    // currency code if ICU doesn't have a localization of the symbol. The
    // harmony Currency tests don't test this, and their DecimalFormat tests
    // only test it as a side-effect, and in a way that only detected my
    // specific mistake of returning null (returning "stinky" would have
    // passed).
    public void test_getSymbol_fallback() throws Exception {
        // This assumes that AED never becomes a currency important enough to
        // Canada that Canadians give it a localized (to Canada) symbol.
        assertEquals("AED", Currency.getInstance("AED").getSymbol(Locale.CANADA));
    }

    // Regression test to ensure that Currency.getInstance(String) throws if
    // given an invalid ISO currency code.
    public void test_getInstance_illegal_currency_code() throws Exception {
        Currency.getInstance("USD");
        try {
            Currency.getInstance("BOGO-DOLLARS");
            fail("expected IllegalArgumentException for invalid ISO currency code");
        } catch (IllegalArgumentException expected) {
        }
    }

    public void testGetAvailableCurrencies() throws Exception {
        Set<Currency> all = Currency.getAvailableCurrencies();
        // Confirm that a few well-known stable currencies are present.
        assertTrue(all.toString(), all.contains(Currency.getInstance("CHF")));
        assertTrue(all.toString(), all.contains(Currency.getInstance("EUR")));
        assertTrue(all.toString(), all.contains(Currency.getInstance("GBP")));
        assertTrue(all.toString(), all.contains(Currency.getInstance("JPY")));
        assertTrue(all.toString(), all.contains(Currency.getInstance("USD")));
    }

    public void test_getDisplayName() throws Exception {
        assertEquals("Swiss Franc", Currency.getInstance("CHF").getDisplayName(Locale.US));
        assertEquals("Schweizer Franken", Currency.getInstance("CHF").getDisplayName(new Locale("de", "CH")));
        assertEquals("franc suisse", Currency.getInstance("CHF").getDisplayName(new Locale("fr", "CH")));
        assertEquals("Franco Svizzero", Currency.getInstance("CHF").getDisplayName(new Locale("it", "CH")));
    }

    public void test_getDefaultFractionDigits() throws Exception {
        assertEquals(2, Currency.getInstance("USD").getDefaultFractionDigits());
        assertEquals(0, Currency.getInstance("JPY").getDefaultFractionDigits());
        assertEquals(-1, Currency.getInstance("XXX").getDefaultFractionDigits());
    }

    // http://code.google.com/p/android/issues/detail?id=38622
    public void test_getSymbol_38622() throws Exception {
        // The CLDR data had the Portuguese symbol for "EUR" in pt, not in pt_PT.
        // We weren't falling back from pt_PT to pt, so we didn't find it and would
        // default to U+00A4 CURRENCY SIGN (¤) rather than €.
        Locale pt_BR = new Locale("pt", "BR");
        Locale pt_PT = new Locale("pt", "PT");
        assertEquals("R$", Currency.getInstance(pt_BR).getSymbol(pt_BR));
        assertEquals("R$", Currency.getInstance(pt_BR).getSymbol(pt_PT));
        assertEquals("€", Currency.getInstance(pt_PT).getSymbol(pt_BR));
        assertEquals("€", Currency.getInstance(pt_PT).getSymbol(pt_PT));
    }
}


text:
package com.stulsoft.exercises.list

/**
  * Flatten nested structure
  *
  * @author Yuriy Stul
  */
object P07FlattenNestedStructure extends App {
  test(List(List(1, 3, 5), 4, List(8, 7)))
  test(List(List(1, 3, 5), 4, List(8, 7, List(13, 15))))
  test(Seq(Seq(1, 3, 5), 4, Seq(8, 7, Seq(13, 15))))
  test(Seq(Seq(1, 3, 5), "abcd", Seq(8, 7, Seq(13, 15))))

  /**
    * Test runner
    *
    * @param collection the collection
    */
  def test(collection: Seq[Any]): Unit = {
    println(s"Source collection is $collection, flatten collection is ${flattenNestedStructure(collection)}")
  }

  /**
    * Flattens a collection
    *
    * @param collection the collection
    * @return flatten collection
    */
  def flattenNestedStructure(collection: Seq[Any]): Seq[Any] = collection flatMap {
    case aList: Seq[_] => flattenNestedStructure(aList)
    case anItem => List(anItem)
  }
}


text:
from distutils.core import setup, Extension
import sys

if sys.platform == "win32":
    ext = Extension("cryptlib_py",
                    sources=["python.c"],
                    library_dirs=['../binaries'],
                    libraries=['cl32'])
else:
    ext = Extension("cryptlib_py",
                    sources=["python.c"],
                    library_dirs=['..'],
                    libraries=['cl'])

setup(name="cryptlib_py", ext_modules=[ext])


text:
set(c_detect_code "
#if __STDC_VERSION__ >= 201112L
#error STDC_VERSION 2011012L
#else
#error STDC_VERSION 000000L
#endif                                                                                ")

# Set ppc_support to TRUE before including this file or ppc and ppc64
# will be treated as invalid architectures since they are no longer supported by Apple

function(detect_c_version output_var)
        file(WRITE "${CMAKE_BINARY_DIR}/cversion.c" "${c_detect_code}")

        enable_language(C)

        try_run(
            run_result_unused
            compile_result_unused
            "${CMAKE_BINARY_DIR}"
            "${CMAKE_BINARY_DIR}/cversion.c"
            COMPILE_OUTPUT_VARIABLE CVERSION
        )

        # Parse the architecture name from the compiler output
        string(REGEX MATCH "STDC_VERSION ([a-zA-Z0-9_]+)" CVERSION "${CVERSION}")

        # Get rid of the value marker leaving just the architecture name
        string(REPLACE "STDC_VERSION " "" CVERSION "${CVERSION}")

        set(${output_var} "${CVERSION}" PARENT_SCOPE)
endfunction()


text:
package utils

import javax.inject.{Inject, Singleton}

import play.api.mvc._
import service.SecurityService

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future

@Singleton
class CurrentUserOrForbidden @Inject()(securityService: SecurityService) extends Controller {

  def apply[A](userId: Long)(action: Action[A]) = Action.async(action.parser) { implicit request =>
    securityService.getUserId(request).map(currentUserId => {
      if (userId == currentUserId) {
        action(request)
      } else Future {
        Forbidden
      }
    }).getOrElse(Future {
      Forbidden
    })
  }

}


text:
using System;
using System.IO;
using System.Reflection;
using System.Xml;
namespace Cocos2D
{
	public static class Win8IOExtensions
	{
		public static void Close(this Stream stream)
		{
            //stream.Flush();
			stream.Close();
		}
		public static MethodInfo GetMethod(this Type type, string name)
		{
			return type.GetTypeInfo().GetDeclaredMethod(name);
		}
		public static FieldInfo GetField(this Type type, string name)
		{
			return type.GetTypeInfo().GetDeclaredField(name);
		}
		public static AssemblyName GetAssemblyName(this Type type)
		{
			return type.GetTypeInfo().Assembly.GetName();
		}
		public static void Close(this XmlWriter writer)
		{
            //writer.Flush();
			writer.Dispose();
		}
	}
}


text:
exec java -cp ../eigenbase-xom/target/classes \
    org.eigenbase.xom.MetaGenerator \
    src/main/java/org/eigenbase/resgen/Resource.xml \
    src/main/java

# end


text:
<img src="img/logo.png" align="left" alt="Drupaltools logo">

# DrupalTools

Project [drupaltools.github.io](https://drupaltools.github.io/), a list of open-source tools used for
Drupal development and other Drupal related tasks.

## Contributing

Missing a tool here? Just fork the repo and add your tool as a `<name>.yml` in the `_data/projects` folder.

Make sure to follow the following rules:

 - **Open Source:** The tool must have a public repository on Github, Gitlab, Bitbucket etc that we can link to and pull in stats from.
 - **Stick to the format:** Fill out all the same fields as the other tools in `source/projects`.
 - **Short description:** Keep all the details for the body text, keep the description for the overview page short and sweet.
 - Respect the **[Code of Conduct](blob/master/CODE_OF_CONDUCT.md)**.

## Running locally

Drupaltools is built with Jekyll, Bundler and Liquid. To install and run locally:

```bash
gem install jekyll bundler
git clone https://github.com/theodorosploumis/drupaltools.git
cd drupaltools
bundle install
bundle exec jekyll serve --server 8080
```

Or just open in Gitpod!

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/drupaltools/drupaltools.github.io)

## Similar tools

See also:

- https://jakzal.github.io/toolbox

## License

This project is licensed under the [MIT license](http://opensource.org/licenses/MIT).

[Drupal](https://www.drupal.org) is a [registered trademark](http://drupal.com/trademark) of [Dries Buytaert](http://buytaert.net/).


text:
package org.apache.isis.core.metamodel.facets.param.parameter;

import java.lang.reflect.Method;
import org.apache.isis.applib.annotation.Optional;
import org.apache.isis.core.metamodel.facetapi.Facet;
import org.apache.isis.core.metamodel.facets.AbstractFacetFactoryTest;
import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessParameterContext;
import org.apache.isis.core.metamodel.facets.param.parameter.mandatory.MandatoryFacetInvertedByOptionalAnnotationOnParameter;
import org.apache.isis.core.metamodel.facets.objectvalue.mandatory.MandatoryFacet;

public class OptionalAnnotationOnParameterFacetFactoryTest extends AbstractFacetFactoryTest {

    private ParameterAnnotationFacetFactory facetFactory;

    public void setUp() throws Exception {
        super.setUp();
        facetFactory = new ParameterAnnotationFacetFactory();
    }
    public void testOptionalAnnotationPickedUpOnActionParameter() {

        class Customer {
            @SuppressWarnings("unused")
            public void someAction(@Optional final String foo) {
            }
        }
        final Method method = findMethod(Customer.class, "someAction", new Class[] { String.class });

        facetFactory.processParamsOptional(new ProcessParameterContext(Customer.class, method, 0, null, facetedMethodParameter));

        final Facet facet = facetedMethodParameter.getFacet(MandatoryFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof MandatoryFacetInvertedByOptionalAnnotationOnParameter);
    }

    public void testOptionalAnnotationIgnoredForPrimitiveOnActionParameter() {

        class Customer {
            @SuppressWarnings("unused")
            public void someAction(@Optional final int foo) {
            }
        }
        final Method method = findMethod(Customer.class, "someAction", new Class[] { int.class });

        facetFactory.processParamsOptional(new ProcessParameterContext(Customer.class, method, 0, null, facetedMethodParameter));

        assertNull(facetedMethod.getFacet(MandatoryFacet.class));
    }

}


text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Function template assert_matches</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../proto/reference.html#header.boost.proto.debug_hpp" title="Header <boost/proto/debug.hpp>">
<link rel="prev" href="display_expr_idp66182648.html" title="Function display_expr">
<link rel="next" href="assert_matches_not.html" title="Function template assert_matches_not">

Home
Libraries
People
FAQ
More

Function template assert_matches

boost::proto::assert_matches —
          Assert at compile time that a particular expression
          matches the specified grammar.

Synopsis

// In header: <boost/proto/debug.hpp>

template<typename Grammar, typename Expr>
  void assert_matches(Expr const & expr);

Description

            Use proto::assert_matches() to assert at compile-time that
            an expression matches a grammar.

            Example:

typedef proto::plus< proto::terminal< int >, proto::terminal< int > > PlusInts;

proto::assert_matches<PlusInts>( proto::lit(1) + 42 );

            See also:

proto::assert_matches_not()

BOOST_PROTO_ASSERT_MATCHES()

BOOST_PROTO_ASSERT_MATCHES_NOT()

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

Notes:

            Equivalent to BOOST_MPL_ASSERT((proto::matches<Expr, Grammar>)).

Copyright © 2008 Eric Niebler

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
Welcome to this Atoms tutorial. With these ones easy courses we are going to learn to design a different mobile screen prototype.

We will learn to add, modify and delete elements from a single file type, the **YAML** file.

To start with a new project, the easiest way is get the files and directory structure from Atoms [IDE](http://atoms.tapquo.com/session). In addition, the IDE generate all necesary that we need to start the application in our navigator.

*Files and directory structure:*
```
.
├── bower_components
├── bower.json
├── gulpfile.js
├── node_modules
├── package.json
├── source
│   └── entities
│   └── molecules
│   └── organisms
│   └── style
│   └── app.coffee
│   └── app.proxy.coffee
├── www
```

About this tutorial
===================

As you can see, each chapter of this tutorial is displayed in three columns: first one is for description of prototype that we are going to design; the second column shows the **YAML** code that generates the elements; and the last one is to show the result of prototype.

You can touch and edit **YAML** column and see in real time the result of your modifications. Try for example to changing the color of button. Add to style the word `theme`:

```yaml
  - Atom.Button:
      style: fluid big theme
      text: accept
      icon: user
```


text:
const path = require('path');
const fs = require('fs');
const mkdirp = require('mkdirp');
const exec = require('child_process').exec;
const CONFIG_PATH = path.resolve(__dirname, '../runtime/config');

function createFile(dir, filename, content, cb) {
  if (!fs.existsSync(dir)) {
    mkdirp.sync(dir);
  }
  let filePath = path.join(dir, filename);
  fs.openSync(filePath, 'w');
  if (content) {
    fs.writeFile(filePath, content, cb);
  }
}

function touchConfig(config = {}, cb) {
  let json = JSON.stringify(config,function(key, val) {
    if (typeof val === 'function') {
      return val + ''; // implicitly `toString` it
    }
    return val;
  })
  let content = `module.exports = ${json}`;
  createFile(CONFIG_PATH, 'config.js', content);
}

const sleep = time => new Promise(resolve => setTimeout(resolve, time));

const killByPort = (port)=>{
  if(!port){
    return
  }
  exec(`kill -9 $(lsof -t -i:${port})`)
}

module.exports = {
  touchConfig,
  sleep,
  killByPort
}


text:
@page StacheTemplates Stache Templates
@parent Tutorial 5
@disableTableOfContents

@body

- - - -
**In this Chapter**
 - Stache Templates

Get the code for: [chapter: stache templates](/guides/examples/PlaceMyOrder/ch-2_canjs-getting-started.zip)

- - -

Now that we have a basic sketch of our application, and we've covered a few CanJS fundamentals,
it's time for us to start working with the sample application. We'll begin with the
application's templates.

As mentioned in the [introduction](./Tutorial.html), we're using Stache templates in
our app. Remember that when we downloaded our custom build of CanJS, we
included the [can.stache](../docs/can.stache.html) plugin.

We can create a simple template, render it to a document fragment and insert it into the page like
the following:

```
var template = can.stache("<h1>{{message}}</h1>");
var frag = template({message: "Hello World"});
$("body").append(frag);
```

Stache templates look similar to normal HTML, except they contain magic tags that contain
a very simple language that can be used to:

- [lookup and insert values into the html output](#context)
- [loop over arrays and can.Lists](#enumeration)
- [control-flow behavior like if and switch](#conditionallogic)
- [render other templates with partials](#partials)
- perform custom control-flow behavior

Stache templates support both [Mustache](https://github.com/janl/mustache.js/)
and [Handlebar](http://handlebarsjs.com/) syntax. For more
information on the details of these formats, see their respective websites.

It will be easiest for us to look at these with an example, so let's work with
one. Open up your `components/order_details/order_details.stache` file.
It should look like this:

```html
{{#with order}}
  <h3>Thanks for your order {{name}}!</h3>
  <div>
  	<label class="control-label">Confirmation Number: {{_id}}</label>
  </div>

  <h4>Items ordered:</h4>
  <ul class="list-group panel">
    {{#each items}}
      <li class="list-group-item">
        <label>
          {{name}} <span class="badge">${{price}}</span>
        </label>
      </li>
    {{/each}}

    <li class="list-group-item">
      <label>Total <span class="badge">${{total}}</span></label>
    </li>
  </ul>

  <div><label class="control-label">Phone: {{phone}}</label></div>
  <div><label class="control-label">Address: {{address}}</label></div>
{{/with}}
```

## Value lookup

Assume for the moment that we have the following `customerOrder` map passed in to our Stache template:

```
{
   customerNumber: 12543,
   customerType: 'Business',
   order: {
      name: 'Rudloph Steiner',
      _id: 837267,
      items: [
         {
            name: 'Garden Gnome',
            price: 23.70
         }
      ],
      total: 23.70,
      phone: '+49 170 345 6789',
      address: 'Beuselstrasse 15, Berlin',

      total: function(){
        var sum = 0;
        this.items.forEach(function(item){
          sum += item.price;
        });
        return sum;
      }
   }
}
```

If we want to show the `customerType` in a `<span>` we can do that in a stache template like the following:

```
<span>{{customerType}}</span>
```

What's inside the magic tags, in this case `customerType`, is a
[key lookup expression](../docs/can.stache.expressions.html#section_KeyLookupexpressions).
[Keys](../docs/can.stache.key.html) are used to lookup values in the
[template scope](../docs/can.view.Scope.html).

A DOT(`.`) operator
can be used to lookup nested values.  For example:

```
<h3>Thanks for your order {{order.name}}!</h3>
<span>{{customerType}}</span>
```

Similar to variable lookup JavaScript, a stache key lookup can search for a value in multiple places.
Each of these places is called a __context__.  The collection of all available contexts for a key lookup
is called a [scope](../docs/can.view.Scope.html).

The root context is
the data passed to a template. In this case, the root context is the `customerOrder`
object at the begining of this section.  This is why `{{customerType}}` outputs `Business`.

[Sections](../docs/can.stache.tags.section.html)
create contexts in Stache.  A section begins with `{{#EXPRESSION}}` or `{{^EXPRESSION}}`
and ends with `{{/EXPRESSION}}`.  In the following example `{{#with order}}`
defines a section whose scope lookup starts finding values in the
`customerOrder`'s `order` object first:

```html
{{#with order}}
  <h3>Thanks for your order {{name}}!</h3>
  <span>{{customerType}}</span>
{{#with order}}
```

In between `{{#with order}}` and `{{/with}}`, the scope's contexts look like:

```
[
  customerOrder.order,
  customerOrder
]
```

The top of the scope is called the __current context__.  In this case it is `customerOrder.order`.

When `{{name}}` is looked up, it will first look for `name` on the __current context__.  As that value
exists, `Rudloph Steiner` will be returned.

When `{{customerType}}` is looked up, it will look for `customerType` on the __current context__.  As
that value does not exist, the next context, `customerOrder`, will be searched. The value of
`customerOrder.customerType` will be returned.

From within a given scope, you can reference the __current context__ or control which context
should be used to find values.

See examples below:

```html
{{#with order}}
   <div>My Current Context Object: {{.}}</div> <!-- references the order object-->
   <div>My Parent Context Object: {{../.}}</div>  <!-- references the customerOrder object-->
   <div>An Item on my Parent Context's Object: {{../customerNumber}}</div>
   <div>My Parent's Parent Context Object: {{../../.}}</div> <!-- example of how you might access the parent of a parent -->
{{/with}}
```

## Looping over arrays
Enumerating allows you to loop through the contents of an iterable item. We've done this above for
the options in our select dropdown. The `{{#each key}} ... {{/each}}` tag set
is used to iterate over an enumerable collection, such as an array. In the
example above, we are looping over an array of objects. As with [sections](#context),
the properties of the objects we are iterating over are accessible
from data keys inside the `#each` scope without dot notation. In the example
above, we saw:

```html
{{#each items}}
  <li class="list-group-item">
	<label>
	  {{name}} <span class="badge">${{price}}</span>
	</label>
  </li>
{{/each}}
```

Because the context of the `{{#each}}` block is `items`, we can reference
the `name` and `price` properties of `items` directly—i.e, we don't need to
write `{{items.name}}` or `{{items.price}}`, we can just write `{{name}}` or `{{price}}`.

Call expressions can also be passed
to [#each](../docs/can.stache.helpers.each.html). For example, a ViewModel might
have a method to get menu items for a particular menu like `"dinner"` or
`"lunch"` like:

```
var OrderViewModel = can.Map.extend({
  itemsForMenuType: function(type){
    return this.attr("menu.items").filter(function(item){
      return item.attr("type") === type;
    })
  }
})
```

Call this method and return its result to `#each` like:

```
{{#each itemsForMenuType("lunch")}}
  <li>...</li>
{{/each}}
```

Note that [#key](../docs/can.stache.tags.section.html) can also
be used to loop through objects with enumerable properties. In general,
[#each](../docs/can.stache.helpers.each.html) should be used if the key references
[can.List](../docs/can.List.html) or Arrays that have or often have incremental updates. [#key](../docs/can.stache.tags.section.html)
should be used when the list is replaced by a list with items that look
nothing like the previous list's items.

## Conditional Logic
Stache templates have a limited capacity for conditional logic. Open up your
`main.stache` file. It should look like this:

```
{{> header.stache}}

{{#eq page "home"}}
  {{> home.stache}}
{{/eq}}

{{#eq page "restaurants"}}
  {{#if slug}}
    {{#eq action 'order'}}
      <pmo-order {(slug)}="slug"></pmo-order>
    {{/eq}}
    {{^if action}}
      <pmo-restaurant-details {(slug)}="slug"></pmo-restaurant-details>
    {{/if}}
  {{else}}
    <pmo-restaurant-list></pmo-restaurant-list>
  {{/if}}
{{/eq}}

{{#eq page "orders"}}
  <pmo-order-history></pmo-order-history>
{{/eq}}
```

You'll see two different helpers: `eq` and `if`. The `eq` helper takes two
arguments: the first being the key that is within the current section, and
the second a value to compare to the first argument to see if they are equal.
The `if` helper checks for one truthy argument before rendering what the
`if` block contains.

You might also notice the use of the `^` character, which will render the
section if the result of the helper is false. In other words, you can write
`{{^if action}}content{{/if}}` instead of `{{#if action}}{{else}}content{{/if}}`

In general, it's best to keep complex logic out of your templates. Their main function
should be to display data from the view model. If you need to use more complex logic
to display data in your templates, you can use a helper. Helpers are not covered in detail
in this guide; but you can get more information on them in the API: [Helpers](../docs/can.Component.prototype.helpers.html)

## Partials
You can nest templates in other templates by using partials. Partials inherit
the context from which they are called. They are evaluated at render time, so you
should be careful to avoid infinite loops. To include a partial, put its URL or
ID inside `{{> }}`.

In our example above, you can see that `{{> header.stache}}` includes the
`header.stache` file into the template.

- - -

[‹ The Define Plugin](TheDefinePlugin.html)
[App State and Routing ›](AppStateAndRouting.html)


text:
tsCanvas is a series of modules that expose easy functions for creating with the Javascript canvas. This is not a game engine, it is a graphics and audio framework.

### Using tsCanvas
tsCanvas provides methods to manipulate the graphics output of a canvas, currently it is split up into multiple moudles but it will eventually be unified with one master module that brings them all together. Meanwhie, you can build it into JavaScript and use it that way.

### Building tsCanvas into JavaScript
To build tsCanvas you'll need to have [TypeScript](https://github.com/Microsoft/TypeScript) installed on your machine.
1. Clone the repo
2. Navigate into the created directory
3. Run `tsc` in the directory and the built JS files will be created in the 'build' directory


text:
Collision example
===========

This sample is inspired by the [RestrictRectangleMovement] thread.

The sample illustrates (in just one of many ways) how you can restrict movement
of your cursor (character) to stay on screen and not go thru other obstacles.

How the collision works.
========================

Every new frame function love.update() checks if any of the arrow keys is pressed, and if so, computes the new position of the character, keeping the old position ofr reference. Then the function checks if this new position is off-screen (by calling isOnScreen()), or if the character at this new position collides with any other object. If there is collision, then the move is not allowed, so the previously stored position is recalled, and the new position is discarded.

Every object has its position x,y and its size - width w and height. So the collision is detected when any two rectangles collide.

[RestrictRectangleMovement]: http://love2d.org/forums/viewtopic.php?f=3&t=5072


text:
title:  "Apache Beam 2.25.0"
date:   2020-10-23 14:00:00 -0800
categories:
  - blog
authors:
  - robinyq
---
<!--
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.
-->
We are happy to present the new 2.25.0 release of Apache Beam. This release includes both improvements and new functionality.
See the [download page](/get-started/downloads/#2250-2020-10-23) for this release.<!--more-->
For more information on changes in 2.25.0, check out the
[detailed release notes](https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12319527&version=12347147).

## Highlights

* Splittable DoFn is now the default for executing the Read transform for Java based runners (Direct, Flink, Jet, Samza, Twister2). The expected output of the Read transform is unchanged. Users can opt-out using `--experiments=use_deprecated_read`. The Apache Beam community is looking for feedback for this change as the community is planning to make this change permanent with no opt-out. If you run into an issue requiring the opt-out, please send an e-mail to [user@beam.apache.org](mailto:user@beam.apache.org) specifically referencing BEAM-10670 in the subject line and why you needed to opt-out. (Java) ([BEAM-10670](https://issues.apache.org/jira/browse/BEAM-10670))

## I/Os

* Added cross-language support to Java's KinesisIO, now available in the Python module `apache_beam.io.kinesis` ([BEAM-10138](https://issues.apache.org/jira/browse/BEAM-10138), [BEAM-10137](https://issues.apache.org/jira/browse/BEAM-10137)).
* Update Snowflake JDBC dependency for SnowflakeIO ([BEAM-10864](https://issues.apache.org/jira/browse/BEAM-10864))
* Added cross-language support to Java's SnowflakeIO.Write, now available in the Python module `apache_beam.io.snowflake` ([BEAM-9898](https://issues.apache.org/jira/browse/BEAM-9898)).
* Added delete function to Java's `ElasticsearchIO#Write`. Now, Java's ElasticsearchIO can be used to selectively delete documents using `withIsDeleteFn` function ([BEAM-5757](https://issues.apache.org/jira/browse/BEAM-5757)).
* Java SDK: Added new IO connector for InfluxDB - InfluxDbIO ([BEAM-2546](https://issues.apache.org/jira/browse/BEAM-2546)).

## New Features / Improvements

* Support for repeatable fields in JSON decoder for `ReadFromBigQuery` added. (Python) ([BEAM-10524](https://issues.apache.org/jira/browse/BEAM-10524))
* Added an opt-in, performance-driven runtime type checking system for the Python SDK ([BEAM-10549](https://issues.apache.org/jira/browse/BEAM-10549)).
    More details will be in an upcoming [blog post](https://beam.apache.org/blog/python-performance-runtime-type-checking/index.html).
* Added support for Python 3 type annotations on PTransforms using typed PCollections ([BEAM-10258](https://issues.apache.org/jira/browse/BEAM-10258)).
    More details will be in an upcoming [blog post](https://beam.apache.org/blog/python-improved-annotations/index.html).
* Improved the Interactive Beam API where recording streaming jobs now start a long running background recording job. Running ib.show() or ib.collect() samples from the recording ([BEAM-10603](https://issues.apache.org/jira/browse/BEAM-10603)).
* In Interactive Beam, ib.show() and ib.collect() now have "n" and "duration" as parameters. These mean read only up to "n" elements and up to "duration" seconds of data read from the recording ([BEAM-10603](https://issues.apache.org/jira/browse/BEAM-10603)).
* Initial preview of [Dataframes](https://s.apache.org/simpler-python-pipelines-2020#slide=id.g905ac9257b_1_21) support.
    See also example at apache_beam/examples/wordcount_dataframe.py
* Fixed support for type hints on `@ptransform_fn` decorators in the Python SDK.
  ([BEAM-4091](https://issues.apache.org/jira/browse/BEAM-4091))
  This has not enabled by default to preserve backwards compatibility; use the
  `--type_check_additional=ptransform_fn` flag to enable. It may be enabled by
  default in future versions of Beam.

## Breaking Changes

* Python 2 and Python 3.5 support dropped ([BEAM-10644](https://issues.apache.org/jira/browse/BEAM-10644), [BEAM-9372](https://issues.apache.org/jira/browse/BEAM-9372)).
* Pandas 1.x allowed.  Older version of Pandas may still be used, but may not be as well tested.

## Deprecations

* Python transform ReadFromSnowflake has been moved from `apache_beam.io.external.snowflake` to `apache_beam.io.snowflake`. The previous path will be removed in the future versions.

## Known Issues

* Dataflow streaming timers once against not strictly time ordered when set earlier mid-bundle, as the fix for  [BEAM-8543](https://issues.apache.org/jira/browse/BEAM-8543) introduced more severe bugs and has been rolled back.
* Default compressor change breaks dataflow python streaming job update compatibility. Please use python SDK version <= 2.23.0 or > 2.25.0 if job update is critical.([BEAM-11113](https://issues.apache.org/jira/browse/BEAM-11113))

## List of Contributors

According to git shortlog, the following people contributed to the 2.25.0 release. Thank you to all contributors!

Ahmet Altay, Alan Myrvold, Aldair Coronel Ruiz, Alexey Romanenko, Andrew Pilloud, Ankur Goenka,
Ayoub ENNASSIRI, Bipin Upadhyaya, Boyuan Zhang, Brian Hulette, Brian Michalski, Chad Dombrova,
Chamikara Jayalath, Damon Douglas, Daniel Oliveira, David Cavazos, David Janicek, Doug Roeper, Eric
Roshan-Eisner, Etta Rapp, Eugene Kirpichov, Filipe Regadas, Heejong Lee, Ihor Indyk, Irvi Firqotul
Aini, Ismaël Mejía, Jan Lukavský, Jayendra, Jiadai Xia, Jithin Sukumar, Jozsef Bartok, Kamil
Gałuszka, Kamil Wasilewski, Kasia Kucharczyk, Kenneth Jung, Kenneth Knowles, Kevin Puthusseri, Kevin
Sijo Puthusseri, KevinGG, Kyle Weaver, Leiyi Zhang, Lourens Naudé, Luke Cwik, Matthew Ouyang,
Maximilian Michels, Michal Walenia, Milan Cermak, Monica Song, Nelson Osacky, Neville Li, Ning Kang,
Pablo Estrada, Piotr Szuberski, Qihang, Rehman, Reuven Lax, Robert Bradshaw, Robert Burke, Rui Wang,
Saavan Nanavati, Sam Bourne, Sam Rohde, Sam Whittle, Sergiy Kolesnikov, Sindy Li, Siyuan Chen, Steve
Niemitz, Terry Xian, Thomas Weise, Tobiasz Kędzierski, Truc Le, Tyson Hamilton, Udi Meiri, Valentyn
Tymofieiev, Yichi Zhang, Yifan Mai, Yueyang Qiu, annaqin418, danielxjd, dennis, dp, fuyuwei,
lostluck, nehsyc, odeshpande, odidev, pulasthi, purbanow, rworley-monster, sclukas77, terryxian78,
tvalentyn, yoshiki.obata


text:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
        android:src="@drawable/ic_share_black_24dp"
        android:tint="@color/colorPrimaryDark"/>


text:
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:

    3GPP TS 26.073
    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
    Available from http://www.3gpp.org

(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
------------------------------------------------------------------------------

 Filename:  /audio/gsm-amr/c/src/a_refl.c
 Functions: a_refl

     Date: 02/05/2002

------------------------------------------------------------------------------
 REVISION HISTORY

 Description: Removing unneeded include files and the goto statement.

 Description: Changed function name to pv_round to avoid conflict with
              round function in C standard library.

 Description:  Replaced "int" and/or "char" with OSCL defined types.

 Description:  Using inline functions from basic_op.h .
               Removing unneeded include files.

 Description:

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

/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#define LOG_TAG "a_refl"
#include <log/log.h>

#include "a_refl.h"
#include "typedef.h"
#include "cnst.h"
#include "basic_op.h"

/*----------------------------------------------------------------------------
; MACROS [optional]
; [Define module specific macros here]
----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------
; DEFINES [optional]
; [Include all pre-processor statements here. Include conditional
; compile variables also.]
----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
; [List function prototypes here]
----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------
; LOCAL VARIABLE DEFINITIONS
; [Variable declaration - defined here and used outside this module]
----------------------------------------------------------------------------*/

/*
------------------------------------------------------------------------------
 FUNCTION NAME: AMREncode
------------------------------------------------------------------------------
 INPUT AND OUTPUT DEFINITIONS

 Inputs:
    a[] = pointer to directform coefficients of type Word16
    refl[] = pointer to reflection coefficients of type Word16

 Outputs:
    pOverflow = 1 if overflow exists in the math operations else zero.

 Returns:
    None

 Global Variables Used:
    None

 Local Variables Needed:
    None

------------------------------------------------------------------------------
 FUNCTION DESCRIPTION

     File             : a_refl.c
     Purpose          : Convert from direct form coefficients to
                        reflection coefficients

------------------------------------------------------------------------------
 REQUIREMENTS

 None

------------------------------------------------------------------------------
 REFERENCES

 [1] a_refl.c , 3GPP TS 26.101 version 4.1.0 Release 4, June 2001

------------------------------------------------------------------------------
 PSEUDO-CODE

void A_Refl(
   Word16 a[],        // i   : Directform coefficients
   Word16 refl[]      // o   : Reflection coefficients
)
{
   // local variables
   Word16 i,j;
   Word16 aState[M];
   Word16 bState[M];
   Word16 normShift;
   Word16 normProd;
   Word32 L_acc;
   Word16 scale;
   Word32 L_temp;
   Word16 temp;
   Word16 mult;

   // initialize states
   for (i = 0; i < M; i++)
   {
      aState[i] = a[i];
   }

   // backward Levinson recursion
   for (i = M-1; i >= 0; i--)
   {
      if (sub(abs_s(aState[i]), 4096) >= 0)
      {
         goto ExitRefl;
      }

      refl[i] = shl(aState[i], 3);

      L_temp = L_mult(refl[i], refl[i]);
      L_acc = L_sub(MAX_32, L_temp);

      normShift = norm_l(L_acc);
      scale = sub(15, normShift);

      L_acc = L_shl(L_acc, normShift);
      normProd = pv_round(L_acc);

      mult = div_s(16384, normProd);

      for (j = 0; j < i; j++)
      {
         L_acc = L_deposit_h(aState[j]);
         L_acc = L_msu(L_acc, refl[i], aState[i-j-1]);

         temp = pv_round(L_acc);
         L_temp = L_mult(mult, temp);
         L_temp = L_shr_r(L_temp, scale);

         if (L_sub(L_abs(L_temp), 32767) > 0)
         {
            goto ExitRefl;
         }

         bState[j] = extract_l(L_temp);
      }

      for (j = 0; j < i; j++)
      {
         aState[j] = bState[j];
      }
   }
   return;

ExitRefl:
   for (i = 0; i < M; i++)
   {
      refl[i] = 0;
   }
}

------------------------------------------------------------------------------
 RESOURCES USED [optional]

 When the code is written for a specific target processor the
 the resources used should be documented below.

 HEAP MEMORY USED: x bytes

 STACK MEMORY USED: x bytes

 CLOCK CYCLES: (cycle count equation for this function) + (variable
                used to represent cycle count for each subroutine
                called)
     where: (cycle count variable) = cycle count for [subroutine
                                     name]

------------------------------------------------------------------------------
 CAUTION [optional]
 [State any special notes, constraints or cautions for users of this function]

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

void A_Refl(
    Word16 a[],        /* i   : Directform coefficients */
    Word16 refl[],     /* o   : Reflection coefficients */
    Flag   *pOverflow
)
{
    /* local variables */
    Word16 i;
    Word16 j;
    Word16 aState[M];
    Word16 bState[M];
    Word16 normShift;
    Word16 normProd;
    Word32 L_acc;
    Word16 scale;
    Word32 L_temp;
    Word16 temp;
    Word16 mult;

    /* initialize states */
    for (i = 0; i < M; i++)
    {
        aState[i] = a[i];
    }

    /* backward Levinson recursion */
    for (i = M - 1; i >= 0; i--)
    {
        if (abs_s(aState[i]) >= 4096)
        {
            for (i = 0; i < M; i++)
            {
                refl[i] = 0;
            }
            break;
        }

        refl[i] = shl(aState[i], 3, pOverflow);

        L_temp = L_mult(refl[i], refl[i], pOverflow);
        L_acc = L_sub(MAX_32, L_temp, pOverflow);

        normShift = norm_l(L_acc);
        scale = sub(15, normShift, pOverflow);

        L_acc = L_shl(L_acc, normShift, pOverflow);
        normProd = pv_round(L_acc, pOverflow);

        mult = div_s(16384, normProd);

        for (j = 0; j < i; j++)
        {
            L_acc = L_deposit_h(aState[j]);
            L_acc = L_msu(L_acc, refl[i], aState[i-j-1], pOverflow);

            temp = pv_round(L_acc, pOverflow);
            L_temp = L_mult(mult, temp, pOverflow);
            L_temp = L_shr_r(L_temp, scale, pOverflow);

            if (L_abs(L_temp) > 32767)
            {
                for (i = 0; i < M; i++)
                {
                    refl[i] = 0;
                }
                ALOGE("b/23609206");
                return;
            }

            bState[j] = extract_l(L_temp);
        }

        for (j = 0; j < i; j++)
        {
            aState[j] = bState[j];
        }
    }
    return;
}


text:
package cart

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"testing"
	"time"
)

func mockNotFoundHandler(req *http.Request, rsp http.ResponseWriter, params map[string]string) {}
func mockHandler(req *http.Request, rsp http.ResponseWriter, params map[string]string) {
	fmt.Fprintf(rsp, req.URL.Path)
}

func TestFindRoot(t *testing.T) {
	srv := NewServer(8080, mockNotFoundHandler)
	srv.Get("/", mockHandler)
	srv.Get("/hi", mockHandler)
	srv.Get("/hi/dude", mockHandler)
	go srv.Serve()

	time.Sleep(100 * time.Millisecond)
	resp, _ := http.Get("http://localhost:8080/")
	response, _ := ioutil.ReadAll(resp.Body)

	if string(response) != "/" {
		t.Fatalf("Should find root [/] but found [" + string(response) + "]")
	}
}

func TestFindPathWhenMany(t *testing.T) {
	resp, _ := http.Get("http://localhost:8080/hi")
	response, _ := ioutil.ReadAll(resp.Body)

	if string(response) != "/hi" {
		t.Fatalf("Should find path [/hi] but found [" + string(response) + "]")
	}
}

func TestFindRootWhenMany(t *testing.T) {
	resp, _ := http.Get("http://localhost:8080/")
	response, _ := ioutil.ReadAll(resp.Body)

	if string(response) != "/" {
		t.Fatalf("Should find root [/] but found [" + string(response) + "]")
	}
}


text:
User.destroy_all
Unit.destroy_all

admin = User.create(username: 'Admin',         email: 'admin@itnig.net', password: 'iamadmin', admin: true)
user1 = User.create(username: 'Kirthar',       email: 'chris+mw+test+1@itnig.net', password: '12345678')
user2 = User.create(username: 'Gandark',       email: 'chris+mw+test+2@itnig.net', password: '12345678')
user3 = User.create(username: 'Pijus Maximus', email: 'chris+mw+test+3@itnig.net', password: '12345678')
user4 = User.create(username: 'Dummie',        email: 'chris+mw+test+4@itnig.net', password: '12345678')

unit = Units::Archer.create(name: 'Legolas', description: 'Ultra awesome elf. Also very gayer.', user: user1)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/archer_man.jpg").to_s) )
unit = Units::Knight.create(name: 'Jaime Lanister', description: 'Westeros\'s Robert Downey Jr.', user: user1)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/knight_woman.jpg").to_s) )
unit = Units::Priest.create(name: 'Jisus Craist', description: 'The fucking son of God Christian Edition.', user: user1)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/priest_man.jpg").to_s) )
unit = Units::Rogue.create(name: 'Arsen Lupin III', description: 'Gentelman to the death.', user: user1)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/rogue_woman.jpg").to_s) )
unit = Units::Mage.create(name: 'Rincewind', description: 'Poor, coward and useless.', user: user1)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/merlin.jpg").to_s) )

unit = Units::Archer.create(name: 'Robin Scherbatsky', description: 'Ted Mosby\'s ex girlfriend. Isn\'t Robin Hood\'s family', user: user2)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/archer_woman.jpg").to_s) )
unit = Units::Knight.create(name: 'Conan', description: 'Where\'s my horse? My horse is amazing', user: user2)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/knight_man.jpg").to_s) )
unit = Units::Priest.create(name: 'Mahoma', description: 'The fucking mesias of God Muslim Edition.', user: user2)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/dark_priestess.jpg").to_s) )
unit = Units::Rogue.create(name: 'Luis Barcenas', description: 'Never accept an envelop from him.', user: user2)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/rogue_man.jpg").to_s) )
unit = Units::Mage.create(name: 'Voldemort', description: 'Evil noseless.', user: user2)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/witch_queen.jpg").to_s) )

unit = Units::Archer.create(name: 'Legolas', description: 'Ultra awesome elf. Also very gayer.', user: user3)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/archer_man.jpg").to_s) )
unit = Units::Knight.create(name: 'Jaime Lanister', description: 'Westeros\'s Robert Downey Jr.', user: user3)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/knight_woman.jpg").to_s) )
unit = Units::Priest.create(name: 'Jisus Craist', description: 'The fucking son of God Christian Edition.', user: user3)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/priest_man.jpg").to_s) )
unit = Units::Rogue.create(name: 'Arsen Lupin III', description: 'Gentelman to the death.', user: user3)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/rogue_woman.jpg").to_s) )
unit = Units::Mage.create(name: 'Rincewind', description: 'Poor, coward and useless.', user: user3)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/merlin.jpg").to_s) )

unit = Units::Archer.create(name: 'Robin Scherbatsky', description: 'Ted Mosby\'s ex girlfriend. Isn\'t Robin Hood\'s family', user: user4)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/archer_woman.jpg").to_s) )
unit = Units::Knight.create(name: 'Conan', description: 'Where\'s my horse? My horse is amazing', user: user4)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/knight_man.jpg").to_s) )
unit = Units::Priest.create(name: 'Mahoma', description: 'The fucking mesias of God Muslim Edition.', user: user4)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/dark_priestess.jpg").to_s) )
unit = Units::Rogue.create(name: 'Luis Barcenas', description: 'Never accept an envelop from him.', user: user4)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/rogue_man.jpg").to_s) )
unit = Units::Mage.create(name: 'Voldemort', description: 'Evil noseless.', user: user4)
UnitImage.create(unit: unit, image: File.open(Rails.root.join("db/seed_data/unit_images/witch_queen.jpg").to_s) )


text:
<?php

namespace App\Services\RemoteDisbursementData;

use App\Entities\RemoteDisbursementData;
use App\Entities\RemoteDisbursementDataPM;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;

class RemoteDisbursementDataIndex
{

	public function getData($request)
	{

		//get logged in user
        $user = auth()->user();

        //get data
        $data = new RemoteDisbursementData();

        //get params
        $id = $request->id;
        $sync = $request->sync;
        $maxid = $request->maxid;
        $report = $request->report;
        $rx_mobile = $request->rx_mobile;
        $cr_appl_grp_disbrsmnt_id = $request->cr_appl_grp_disbrsmnt_id;
        $member_no = $request->member_no;
        $social_security_no = $request->social_security_no;
        $contact = $request->contact;

        $order_by = $request->order_by;
        $order_style = $request->order_style;

        $start_date = $request->start_date;
        if ($start_date) {
            $start_date = Carbon::parse($request->start_date);
            $start_date = $start_date->startOfDay();
        }
        $end_date = $request->end_date;
        if ($end_date) {
            $end_date = Carbon::parse($request->end_date);
            $end_date = $end_date->endOfDay();
        }

        //filter results
        if ($id) {
            $data = $data->where('cr_appl_member_disbrsmnt_id', $id);
        }
        if ($sync) {
            //sync data between remote and local table
            //get all data in local table that are not in remote table
            //first get all remote data
            $table_name = config('constants.tables.pendo.remote_disbursement_pm_table');
            $existingIds = new RemoteDisbursementDataPM();
            $existingIds = $existingIds::pluck('cr_appl_member_disbrsmnt_id')->all();
            //dump('Existing Ids');
            //dump($existingIds);
            $data = RemoteDisbursementData::whereNotIn('cr_appl_member_disbrsmnt_id', $existingIds);
            //->select('*')->get();
            //$data =$missingIds;
            //dump('Missing Ids');
            //dd($missingIds);
        }
        if ($maxid) {
            $data = $data->where('cr_appl_member_disbrsmnt_id', '>', $id);
        }
        if ($rx_mobile) {
            $data = $data->where('rx_mobile', $rx_mobile);
        }
        if ($cr_appl_grp_disbrsmnt_id) {
            $data = $data->where('cr_appl_grp_disbrsmnt_id', $cr_appl_grp_disbrsmnt_id);
        }
        if ($member_no) {
            $data = $data->where('member_no', 'like', '%' . $member_no . '%');
        }
        if ($social_security_no) {
            $data = $data->where('social_security_no', $social_security_no);
        }
        if ($contact) {
            $data = $data->where('contact', $contact);
        }
        if ($start_date) {
            $data = $data->where('row_ts', '>=', $start_date);
        }
        if ($end_date) {
            $data = $data->where('row_ts', '<=', $end_date);
        }

        //order style - either 'desc' or 'asc'
        if (!$order_style) { $order_style = "desc"; }
        if (!$order_by) { $order_by = "row_ts"; }

        //arrange by column
        $data = $data->orderBy($order_by, $order_style);

        //are we in report mode?
        //if not, set url appended params
        if (!$report) {

            $limit = $request->get('limit', config('app.pagination_limit'));
            $data = $data->paginate($limit);

            //add query params
            if ($request->has('order_by')) {
                $data->appends('order_by', $request->get('order_by'));
            }
            if ($request->has('order_style')) {
                $data->appends('order_style', $request->get('order_style'));
            }
            if ($request->has('rx_mobile')) {
                $data->appends('rx_mobile', $request->get('rx_mobile'));
            }
            if ($request->has('cr_appl_grp_disbrsmnt_id')) {
                $data->appends('cr_appl_grp_disbrsmnt_id', $request->get('cr_appl_grp_disbrsmnt_id'));
            }
            if ($request->has('id')) {
                $data->appends('id', $request->get('id'));
            }
            if ($request->has('member_no')) {
                $data->appends('member_no', $request->get('member_no'));
            }
            if ($request->has('social_security_no')) {
                $data->appends('social_security_no', $request->get('social_security_no'));
            }
            if ($request->has('contact')) {
                $data->appends('contact', $request->get('contact'));
            }
            if ($request->has('start_date')) {
                $data->appends('start_date', $request->get('start_date'));
            }
            if ($request->has('end_date')) {
                $data->appends('end_date', $request->get('end_date'));
            }
            //end query params
        }

		return $data;

	}

}


text:
window.fbAsyncInit = function() {
    // init the FB JS SDK
    FB.init({
        appId      : '424044644444088', //'355416847973535',                    // App ID from the app dashboard
        status     : true,                                 // Check Facebook Login status
        xfbml      : true,                                 // Look for social plugins on the page
        version    : 'v2.3'
    });
};

// Load the SDK asynchronously
(function(d, s, id){
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

function fb_login(login_url) {
    FB.getLoginStatus(function(response) {
        if (response.status === 'connected') {
            // connected
            //alert('Already connected, redirect to login page to create token.');
            document.location = login_url;
        } else {
            // not_authorized
            FB.login(function(response) {
                if (response.authResponse) {
                    document.location = login_url;
                } else {
                    //alert('Cancelled.');
                }
            }, {scope: 'email'});
        }
    });
};

function fb_logout(){
    FB.logout(function(response) {
        // Person is now logged out
        //alert('Logged out.');
    });
};


text:
<?php

declare(strict_types=1);

namespace Grav\Common\Flex\Traits;

use RocketTheme\Toolbox\Event\Event;

/**
 * Trait FlexCollectionTrait
 * @package Grav\Common\Flex\Traits
 */
trait FlexCollectionTrait
{
    use FlexCommonTrait;

    /**
     * @param string $name
     * @param object|null $event
     * @return $this
     */
    public function triggerEvent(string $name, $event = null)
    {
        if (null === $event) {
            $event = new Event([
                'type' => 'flex',
                'directory' => $this->getFlexDirectory(),
                'collection' => $this
            ]);
        }
        if (strpos($name, 'onFlexCollection') !== 0 && strpos($name, 'on') === 0) {
            $name = 'onFlexCollection' . substr($name, 2);
        }

        $container = $this->getContainer();
        if ($event instanceof Event) {
            $container->fireEvent($name, $event);
        } else {
            $container->dispatchEvent($event);
        }

        return $this;
    }
}


text:
Panlog
======

A simple time tracking web application written in Google Dart.

**Update 10/13/13**

Due to a rapid changing API, is a Dart project not suitable for a long term self-education project. :( I hope Google will realese a stable version in 2014.


text:
package com.lotaris.selenium.utils;

import com.lotaris.selenium.page.IPageObject;
import com.lotaris.selenium.page.PageElement;
import com.lotaris.selenium.page.PageElementInitializationException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import org.openqa.selenium.support.FindAll;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.FindBys;

/**
 * Groups some of the reflection utils commonly used in the
 * selenium framework extended by Lotaris.
 *
 * @author Laurent Prevost <laurent.prevost@lotaris.com>
 */
public final class ReflectionUtils {
	/**
	 * Hidden constructor
	 */
	private ReflectionUtils() {}

	/**
	 * Inject the page object into the page element
	 *
	 * @param pageElement The page element where to inject the page object
	 * @param pageObject The page object to inject into the page element
	 */
	public static void injectPageObject(PageElement pageElement, IPageObject pageObject) {
		inejectField(pageElement, "pageObject", pageObject);
	}

	/**
	 * Inject a field
	 *
	 * @param objectToBeInjected The object in which a value is to be injected
	 * @param fieldName The field name where value is to be injected
	 * @param objectToInject The value to inject
	 */
	private static void inejectField(Object objectToBeInjected, String fieldName, Object objectToInject) {
		try {
			// Retrieve the field
			Field field = findField(fieldName, objectToBeInjected.getClass());

			// Be sure the field can be injected
			boolean acc = field.isAccessible();
			if (!acc) {
				field.setAccessible(true);
				acc = false;
			}

			// Inject the value
			field.set(objectToBeInjected, objectToInject);

			// Restore the accessibility if required
			if (!acc) {
				field.setAccessible(false);
			}
		}
		catch (SecurityException | IllegalAccessException | IllegalArgumentException e) {
			throw new PageElementInitializationException(e.getMessage(), e.getCause());
		}
	}

//	!!! For later use !!!
//	public static <T> T extractValue(Class<? extends T> valueType, Field field, Object extractedObject) {
//		try {
//			boolean acc = field.isAccessible();
//
//			if (!acc) {
//				field.setAccessible(true);
//				acc = false;
//			}
//
//			Object result = field.get(extractedObject);
//
//			if (!acc) {
//				field.setAccessible(false);
//			}
//
//			return (T) result;
//		}
//		catch (SecurityException | IllegalAccessException | IllegalArgumentException e) {
//			throw new PageElementInitializationException(e.getMessage(), e.getCause());
//		}
//	}

	/**
	 * Copy an object by reflection
	 *
	 * @param source The object to get the field to copy
	 * @param target The object to put the field
	 */
	public static void copyByReflection(Object source, Object target) {
		Class scannedClass = source.getClass();

		// Recursive copy for each level in the class hierarchy
		do {
			for (Field f : scannedClass.getDeclaredFields()) {
				// Check if the current field can be copied
				if (canBeCopied(f)) {
					copyFieldValue(f, source, target);
				}
			}
			scannedClass = scannedClass.getSuperclass();
		} while (scannedClass != Object.class); // No more to copy
	}

	/**
	 * Check if a field can be copied
	 *
	 * @param field The field to check
	 * @return True if the field is copiable, false otherwise
	 */
	private static boolean canBeCopied(Field field) {
		return
			!Modifier.isFinal(field.getModifiers()) &&
			!Modifier.isStatic(field.getModifiers()) &&
			!field.isAnnotationPresent(FindBy.class) &&
			!field.isAnnotationPresent(FindBys.class) &&
			!field.isAnnotationPresent(FindAll.class);
	}

	/**
	 * Copy from a field of a source object to the field of the target object
	 *
	 * @param field The field to copy
	 * @param source The source object
	 * @param target The target object
	 */
	private static void copyFieldValue(Field field, Object source, Object target) {
		// Be sure that the field can be injected
		boolean acc = false;
		if (!field.isAccessible()) {
			field.setAccessible(true);
			acc = true;
		}

		// Inject the source value to the target value
		try {
			field.set(target, field.get(source));
		}
		catch (IllegalAccessException | IllegalArgumentException e) {
			throw new RuntimeException("Unable to copy " + field.getName() + " from source " + source + " to target " + target);
		}

		// Restore the field to the original visibility
		if (acc) {
			field.setAccessible(false);
		}
	}

	/**
	 * Find a constructor in a class hierarchy
	 *
	 * @param baseClass The class where the constructor must be found
	 * @param classToFindConstructor The class of the argument type to find the constructor on the base class
	 * @return The constructor found, null otherwise
	 */
	public static Constructor recurseFindConstructor(Class baseClass, Class classToFindConstructor) {
		Class scannedClass = classToFindConstructor;

		do {
			// Try to retrieve a constructor that match the scannedClass
			try {
				return baseClass.getConstructor(scannedClass);
			}
			catch (NoSuchMethodException | SecurityException e) {
				// If the class scanned has interfaces, try to find constructor for that interfaces
				for (Class interfaceClass : scannedClass.getInterfaces()) {
					// Do the find recursively in the interface class hierarchy
					Constructor result = recurseFindConstructor(baseClass, interfaceClass);
					if (result != null) {
						return result;
					}
				}

				// Contine the lookup on the super class
				scannedClass = scannedClass.getSuperclass();
			}
		// Check if the class is Object, in that case, no constructor is available. In case of Interface, null scannedClass appears which means
		// there is no super class of the current interface scanned.
		} while (scannedClass != Object.class && scannedClass != null);

		return null;
	}

	/**
	 * Find a field on a class. Do the lookup in the super classes of the
	 * current class.
	 *
	 * @param fieldName The field name to find
	 * @param cl The class
	 * @return The field found, null otherwise
	 */
	public static Field findField(String fieldName, Class cl) {
		Class scannedClass = cl;

		do {
			try {
				// Retrieve the field for the current level of class and field name
				return scannedClass.getDeclaredField(fieldName);
			}
			catch (NoSuchFieldException | SecurityException e) {
				scannedClass = scannedClass.getSuperclass();
			}
		} while (scannedClass != Object.class);

		return null;
	}
}


text:
include(CheckIncludeFile)
include(CheckCSourceCompiles)

check_include_file("ucontext.h" HAVE_UCONTEXT_H)
check_include_file("sys/ucontext.h" HAVE_SYS_UCONTEXT_H)

set(UCONTEXT_INCLUDES)

if (HAVE_UCONTEXT_H)
  set(UCONTEXT_INCLUDES "${UCONTEXT_INCLUDES}\n#include <ucontext.h>")
endif()

if (HAVE_SYS_UCONTEXT_H)
  set(UCONTEXT_INCLUDES "${UCONTEXT_INCLUDES}\n#include <sys/ucontext.h>")
endif()

foreach (pc_field
         "uc_mcontext.gregs[REG_EIP]"
         "uc_mcontext.gregs[REG_RIP]"
         "uc_mcontext.sc_ip"
         "uc_mcontext.uc_regs->gregs[PT_NIP]"
         "uc_mcontext.gregs[R15]"
         "uc_mcontext.arm_pc"
         "uc_mcontext.mc_eip"
         "uc_mcontext.mc_rip"
         "uc_mcontext.__gregs[_REG_EIP]"
         "uc_mcontext.__gregs[_REG_RIP]"
         "uc_mcontext->ss.eip"
         "uc_mcontext->__ss.__eip"
         "uc_mcontext->ss.rip"
         "uc_mcontext->__ss.__rip"
         "uc_mcontext->ss.srr0"
         "uc_mcontext->__ss.__srr0")

  message (STATUS "Checking PC fetch from ucontext: ${pc_field}")

  check_c_source_compiles("
  #define _GNU_SOURCE 1
  ${UCONTEXT_INCLUDES}
  int main(int argc, char** argv) {
    ucontext_t ctx;
    return ctx.${pc_field} == 0;
  }"
  CompilePCFromUContext)

  if (CompilePCFromUContext)
    unset(CompilePCFromUContext CACHE)
    message (STATUS "Found uncontext field: ${pc_field}")
    set(PC_FROM_UCONTEXT ${pc_field})
    break()
  else()
    unset(CompilePCFromUContext CACHE)
  endif()
 endforeach()

 if (NOT PC_FROM_UCONTEXT)
   message (FATAL_ERROR "Failed to detect ucontext structure.")
 endif()

add_definitions(
  -DPC_FROM_UCONTEXT=${PC_FROM_UCONTEXT}
)


text:
import { OperatorFunction, pipe } from "rxjs"
import {
  mapTo,
  startWith,
  switchMap,
  switchMapTo,
  tap
} from "rxjs/operators"

import { setElementFocus } from "browser"

import { useComponent } from "../../../_"
import { watchSearchReset } from "../react"

/* ----------------------------------------------------------------------------
 * Functions
 * ------------------------------------------------------------------------- */

/**
 * Mount search reset from source observable
 *
 * @return Operator function
 */
export function mountSearchReset(): OperatorFunction<HTMLElement, void> {
  return pipe(
    switchMap(el => watchSearchReset(el)
      .pipe(
        switchMapTo(useComponent("search-query")),
        tap(setElementFocus),
        mapTo(undefined)
      )
    ),
    startWith(undefined)
  )
}


text:
[![Build Status](https://travis-ci.org/iamdustan/queryless.png?branch=master)](https://travis-ci.org/iamdustan/queryless)
[![Code Climate](https://codeclimate.com/github/iamdustan/queryless.png)](https://codeclimate.com/github/iamdustan/queryless)

Queryless is a [rework](https://github.com/visionmedia/rework) utility
to automatically create media-query free stylesheets for archaic
browsers such as IE8.

## Usage

Simply pass in queryless to your rework pipeline with an array of
media queries you would like to extract. The match is based on the media
queries you are using in your project. They don't have to be an exact
match, but is a subset. Look in `test/cases` for examples.

```
// Create a stylesheet with all media queries that match
// larger than 600px wide and the print media block.

var keepmatches = [
  'screen and (min-width: 600px)', // assumes the units entered here are the same used in your CSS.
  'print'
];

var css = rework(input)
  .use(queryless(keepmatches))
  .toString();
```

## Upgrade Note

The 0.0.x branch was much more complex and attempted to dynamically
resolve media queries. This was over-complicated waste—you know your
media-queries best.

In 0.1.x the match is string based. It should be much quicker and much
more dependable in complex situations.

## License

MIT.


text:
import sys
import time
from thirdworldwar import *
from _account_ import *

h = ThirdWorldWar(username, password, server)
h.rLogin()

pause = 5
while 1:
    chat = h.getChatAlliance()
    for c in chat:
        age = c['elasped']/60
        if age < 11 and c['message'] == '!ping':
            h.rSendMessageToAlliance('p\nong')
        break
    time.sleep(60*pause)


text:
table.bookings {
	margin-top: 10px;
	width: 80%;
}

div.bookings-paging {
	margin-top: 10px;
}

span.status-confirmed {
	color: darkgreen;
}

span.status-not-confirmed {
	color: darkred;
}


text:
<?php
namespace PROCERGS\LoginCidadao\CoreBundle\Exception;

use Symfony\Component\Form\FormError;

class LcValidationException extends \Exception
{
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<class name="XMLParser" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
	<brief_description>
		Low-level class for creating parsers for XML files.
	</brief_description>
	<description>
		This class can serve as base to make custom XML parsers. Since XML is a very flexible standard, this interface is low level so it can be applied to any possible schema.
	</description>
	<tutorials>
	</tutorials>
	<demos>
	</demos>
	<methods>
		<method name="get_attribute_count" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Get the amount of attributes in the current element.
			</description>
		</method>
		<method name="get_attribute_name" qualifiers="const">
			<return type="String">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
				Get the name of the attribute specified by the index in [code]idx[/code] argument.
			</description>
		</method>
		<method name="get_attribute_value" qualifiers="const">
			<return type="String">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
				Get the value of the attribute specified by the index in [code]idx[/code] argument.
			</description>
		</method>
		<method name="get_current_line" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Get the current line in the parsed file (currently not implemented).
			</description>
		</method>
		<method name="get_named_attribute_value" qualifiers="const">
			<return type="String">
			</return>
			<argument index="0" name="name" type="String">
			</argument>
			<description>
				Get the value of a certain attribute of the current element by name. This will raise an error if the element has no such attribute.
			</description>
		</method>
		<method name="get_named_attribute_value_safe" qualifiers="const">
			<return type="String">
			</return>
			<argument index="0" name="name" type="String">
			</argument>
			<description>
				Get the value of a certain attribute of the current element by name. This will return an empty [String] if the attribute is not found.
			</description>
		</method>
		<method name="get_node_data" qualifiers="const">
			<return type="String">
			</return>
			<description>
				Get the contents of a text node. This will raise an error in any other type of node.
			</description>
		</method>
		<method name="get_node_name" qualifiers="const">
			<return type="String">
			</return>
			<description>
				Get the name of the current element node. This will raise an error if the current node type is not [code]NODE_ELEMENT[/code] nor [code]NODE_ELEMENT_END[/code]
			</description>
		</method>
		<method name="get_node_offset" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Get the byte offset of the current node since the beginning of the file or buffer.
			</description>
		</method>
		<method name="get_node_type">
			<return type="int" enum="XMLParser.NodeType">
			</return>
			<description>
				Get the type of the current node. Compare with [code]NODE_*[/code] constants.
			</description>
		</method>
		<method name="has_attribute" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="name" type="String">
			</argument>
			<description>
				Check whether or not the current element has a certain attribute.
			</description>
		</method>
		<method name="is_empty" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				Check whether the current element is empty (this only works for completely empty tags, e.g. <element \>).
			</description>
		</method>
		<method name="open">
			<return type="int" enum="Error">
			</return>
			<argument index="0" name="file" type="String">
			</argument>
			<description>
				Open a XML file for parsing. This returns an error code.
			</description>
		</method>
		<method name="open_buffer">
			<return type="int" enum="Error">
			</return>
			<argument index="0" name="buffer" type="PoolByteArray">
			</argument>
			<description>
				Open a XML raw buffer for parsing. This returns an error code.
			</description>
		</method>
		<method name="read">
			<return type="int" enum="Error">
			</return>
			<description>
				Read the next node of the file. This returns an error code.
			</description>
		</method>
		<method name="seek">
			<return type="int" enum="Error">
			</return>
			<argument index="0" name="position" type="int">
			</argument>
			<description>
				Move the buffer cursor to a certain offset (since the beginning) and read the next node there. This returns an error code.
			</description>
		</method>
		<method name="skip_section">
			<return type="void">
			</return>
			<description>
				Skips the current section. If the node contains other elements, they will be ignored and the cursor will go to the closing of the current element.
			</description>
		</method>
	</methods>
	<constants>
		<constant name="NODE_NONE" value="0">
			There's no node (no file or buffer opened)
		</constant>
		<constant name="NODE_ELEMENT" value="1">
			Element (tag)
		</constant>
		<constant name="NODE_ELEMENT_END" value="2">
			End of element
		</constant>
		<constant name="NODE_TEXT" value="3">
			Text node
		</constant>
		<constant name="NODE_COMMENT" value="4">
			Comment node
		</constant>
		<constant name="NODE_CDATA" value="5">
			CDATA content
		</constant>
		<constant name="NODE_UNKNOWN" value="6">
			Unknown node
		</constant>
	</constants>
</class>


text:
<?xml version="1.0" encoding="utf-8" ?>
<selector
		xmlns:android="http://schemas.android.com/apk/res/android"

		>
		<item
				android:state_pressed="true"
				android:drawable="@drawable/addpic_icon_shanchu_focused" />
		<item
				android:drawable="@drawable/addpic_icon_shanchu_unfocused" />
</selector>