text:
"""
The Notifications module allows you to configure Jenkins to notify
other applications about various build phases.  It requires the
Jenkins notification plugin.

**Component**: notifications
  :Macro: notification
  :Entry Point: jenkins_jobs.notifications

"""

import xml.etree.ElementTree as XML

from jenkins_jobs.errors import JenkinsJobsException
import jenkins_jobs.modules.base

def http_endpoint(parser, xml_parent, data):
    """yaml: http
    Defines an HTTP notification endpoint.
    Requires the Jenkins :jenkins-wiki:`Notification Plugin
    <Notification+Plugin>`.

    :arg str format: notification payload format, JSON (default) or XML
    :arg str event: job events that trigger notifications: started,
        completed, finalized or all (default)
    :arg str url: URL of the endpoint
    :arg str timeout: Timeout in milliseconds for sending notification
        request (30 seconds by default)
    :arg str log: Number lines of log messages to send (0 by default).
        Use -1 for all (use with caution).

    Example:

    .. literalinclude:: \
    /../../tests/notifications/fixtures/http-endpoint002.yaml
       :language: yaml

    """
    endpoint_element = XML.SubElement(xml_parent,
                                      'com.tikal.hudson.plugins.notification.'
                                      'Endpoint')
    supported_formats = ['JSON', 'XML']
    format = data.get('format', 'JSON').upper()
    if format not in supported_formats:
        raise JenkinsJobsException(
            "format must be one of %s" %
            ", ".join(supported_formats))
    else:
        XML.SubElement(endpoint_element, 'format').text = format

    XML.SubElement(endpoint_element, 'protocol').text = 'HTTP'

    supported_events = ['started', 'completed', 'finalized', 'all']
    event = data.get('event', 'all').lower()
    if event not in supported_events:
        raise JenkinsJobsException(
            "event must be one of %s" %
            ", ".join(supported_events))
    else:
        XML.SubElement(endpoint_element, 'event').text = event

    XML.SubElement(endpoint_element, 'timeout').text = str(data.get('timeout',
                                                           30000))
    XML.SubElement(endpoint_element, 'url').text = data['url']
    XML.SubElement(endpoint_element, 'loglines').text = str(data.get('log', 0))

class Notifications(jenkins_jobs.modules.base.Base):
    sequence = 22

    component_type = 'notification'
    component_list_type = 'notifications'

    def gen_xml(self, parser, xml_parent, data):
        properties = xml_parent.find('properties')
        if properties is None:
            properties = XML.SubElement(xml_parent, 'properties')

        notifications = data.get('notifications', [])
        if notifications:
            notify_element = XML.SubElement(properties,
                                            'com.tikal.hudson.plugins.'
                                            'notification.'
                                            'HudsonNotificationProperty')
            endpoints_element = XML.SubElement(notify_element, 'endpoints')

            for endpoint in notifications:
                self.registry.dispatch('notification',
                                       parser, endpoints_element, endpoint)


text:
set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")

if( MSVC )
    if( MSVC_VERSION VERSION_LESS 1700 )
        set(TBB_COMPILER "vc10")
    else( )
        set(TBB_COMPILER "vc11")
    endif( )
endif( )
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
    set(TBB_COMPILER "clang-3.6")
endif()

if ( NOT TBB_ROOT )
    set(TBB_ROOT $ENV{TBB_DIR})
endif( )

#if ( NOT TBB_ROOT )
#    message( "TBB install not found in the system.")
#else ( )
    # Search for 64bit libs if FIND_LIBRARY_USE_LIB64_PATHS is SetEntity to true in the global environment, 32bit libs else
    get_property( LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS )

#    if( LIB64 )
        set(TBB_ARCH_PLATFORM intel64)
#    else( )
#        SetEntity(TBB_ARCH_PLATFORM ia32)
#    endif( )

    #Find TBB header files
    find_path( TBB_INCLUDE_DIRS
        NAMES tbb/tbb.h
        HINTS ${TBB_ROOT}/include /usr/include
        DOC "TBB header file path"
    )
    mark_as_advanced( TBB_INCLUDE_DIRS )

    #Find TBB Libraries
    set (_TBB_LIBRARY_DIR ${TBB_ROOT}/lib/${TBB_ARCH_PLATFORM} )

    find_library(TBB_LIBRARY ${_TBB_LIB_NAME}   HINTS ${_TBB_LIBRARY_DIR}/${TBB_COMPILER}   /usr/lib/x86_64-linux-gnu/
                PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
    find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_LIBRARY_DIR}/${TBB_COMPILER} /usr/lib/x86_64-linux-gnu/
                PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
    find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}/${TBB_COMPILER} /usr/lib/x86_64-linux-gnu/
                PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
    find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}/${TBB_COMPILER} /usr/lib/x86_64-linux-gnu/
                PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)

    set(TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY})

    mark_as_advanced( TBB_LIBRARIES)
    mark_as_advanced( TBB_LIBRARY )
    mark_as_advanced( TBB_MALLOC_LIBRARY )
    mark_as_advanced( TBB_LIBRARY_DEBUG )
    mark_as_advanced( TBB_MALLOC_LIBRARY_DEBUG )
    mark_as_advanced( TBB_ROOT )

    include( FindPackageHandleStandardArgs )
    FIND_PACKAGE_HANDLE_STANDARD_ARGS( TBB DEFAULT_MSG TBB_LIBRARY TBB_MALLOC_LIBRARY   TBB_INCLUDE_DIRS )

    if( NOT TBB_FOUND )
        message( STATUS "FindTBB looked for libraries named tbb but could not find" )
    endif()
#endif ( )

redpajama_set_name: RedPajamaGithub


text:
package com.konifar.example.fabtransformation.models;

public class SampleMenu {
    private String title;
    private int drawableResId;

    public SampleMenu(String title, int drawableResId) {
        this.title = title;
        this.drawableResId = drawableResId;
    }

    public String getTitle() {
        return title;
    }

    public int getDrawableResId() {
        return drawableResId;
    }

}


text: XMLHttpRequest.open() should be correctly overloaded


text:
$(document).ready(function() {
    var tab = $(".tab-list li");
    var wrapper = $(".wrapper");
    var linkRacing = $(".link-racing");
    var linkXtreme = $(".link-xtreme");
    var actionRacingLink = $(".action-racing-link");
    var actionXtremeLink = $(".action-xtreme-link");
    tab.mouseover(function(){
            if (!$(this).hasClass('active-tab')) {
                tab.removeClass('active-tab');
                $(this).addClass('active-tab');
            }
        }
    );
    linkXtreme.click(function() {
        if (wrapper.hasClass('xtreme-wrapper')) return false;
        else {
            actionXtremeLink.text('перейти в каталог');
            actionRacingLink.text('узнать больше');
            $(this).hide();
            linkRacing.show();
            wrapper.addClass('xtreme-wrapper');
            return false;
        }
    });
    linkRacing.click(function() {
        if (!wrapper.hasClass('xtreme-wrapper')) return false;
        else {
            actionRacingLink.text('перейти в каталог');
            actionXtremeLink.text('узнать больше');
            $(this).hide();
            linkXtreme.show();
            wrapper.removeClass('xtreme-wrapper');
            return false;
        }
    });
});


text:
---
uid: SolidEdgePart.Constructions.MirrorCopyGeometries
summary: This read-only property returns the MirrorCopyGeometries collection object for the referenced Constructions object.
remarks:
---


text:
package com.freiheit.sqlapi4j.query.clause;

import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;

import com.freiheit.sqlapi4j.query.OrderItem;

/**
 * ORDER BY clause for sub SELECTs.
 *
 * @param <T> the result type of the subquery
 */
@ParametersAreNonnullByDefault
public interface SubOrderByClause<T> extends SubLimitClause<T> {

    /**
     * Specify the result ordering for the ORDER BY clause.
     */
    @Nonnull
    SubLimitClause<T> orderBy(OrderItem... item);

}


text:
package com.gemstone.gemfire.admin.jmx;

import com.gemstone.gemfire.InternalGemFireException;
import com.gemstone.gemfire.admin.*;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.internal.Assert;
//import java.util.Properties;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import javax.management.*;

/**
 * An implementation of SystemMember that
 * communicates via JMX.
 *
 * @author Kirk Lund
 */
class JMXSystemMember extends JMXAdminImpl
  implements SystemMember {

  ///////////////////////  Constructors  ///////////////////////

  /**
   * Creates a new JMXSystemMember with the given MBean
   * server and object name.
   */
  JMXSystemMember(MBeanServerConnection mbs, ObjectName objectName) {
    super(mbs, objectName);
    Assert.assertTrue(this.objectName != null);
  }

  public AdminDistributedSystem getDistributedSystem() {
    throw new UnsupportedOperationException("not yet implemented");
  }

  // ---------------------- ATTRIBUTES -----------------------------

  public String getId() {
    try {
      Assert.assertTrue(this.objectName != null);
      return (String) this.mbs.getAttribute(this.objectName, "id");
    } catch (Exception ex) {
      String s = "While calling getId";
      throw new InternalGemFireException(s, ex);
    }
  }

  public String getName() {
    try {
      Assert.assertTrue(this.objectName != null);
      return (String) this.mbs.getAttribute(this.objectName, "name");
    } catch (Exception ex) {
      String s = "While getting the name";
      throw new InternalGemFireException(s, ex);
    }
  }

  public SystemMemberType getType() {
    return SystemMemberType.APPLICATION;
  }

  public String getHost() {
    try {
      Assert.assertTrue(this.objectName != null);
      return (String) this.mbs.getAttribute(this.objectName, "host");
    } catch (Exception ex) {
      String s = "While calling getHost";
      throw new InternalGemFireException(s, ex);
    }
  }

  public InetAddress getHostAddress() {
    try {
      return InetAddress.getByName(getHost());
    } catch (Exception ex) {
      String s = "While calling getHost";
      throw new InternalGemFireException(s, ex);
    }
  }

  public boolean isRunning() {
    try {
      Assert.assertTrue(this.objectName != null);
      return ((Boolean) this.mbs.getAttribute(this.objectName, "running")).booleanValue();

    } catch (Exception ex) {
      String s = "While calling getLog";
      throw new InternalGemFireException(s, ex);
    }
  }

  public String getVersion() {
    try {
      Assert.assertTrue(this.objectName != null);
      return (String) this.mbs.getAttribute(this.objectName, "version");
    } catch (Exception ex) {
      String s = "While calling getVersion";
      throw new InternalGemFireException(s, ex);
    }
  }

  public DistributedMember getDistributedMember() {
    try {
      Assert.assertTrue(this.objectName != null);
      return (DistributedMember) this.mbs.getAttribute(this.objectName, "distributedMember");
    } catch (Exception ex) {
      String s = "While calling getDistributedMember";
      throw new InternalGemFireException(s, ex);
    }
  }

  // ---------------------- OPERATIONS -----------------------------

  public String[] getRoles() {
    try {
      return (String[]) this.mbs.invoke(this.objectName, "getRoles",
                                        new Object[0], new String[0]);
    } catch (Exception ex) {
      String s = "While calling getRoles";
      throw new InternalGemFireException(s, ex);
    }
  }

  public String getLog() {
    try {
      return (String) this.mbs.invoke(this.objectName, "getLog",
                                      new Object[0], new String[0]);

    } catch (Exception ex) {
      String s = "While calling getLog";
      throw new InternalGemFireException(s, ex);
    }
  }

  public java.util.Properties getLicense() {
    try {
      return (java.util.Properties) this.mbs.invoke(this.objectName, "getLicense",
                                      new Object[0], new String[0]);

    } catch (Exception ex) {
      String s = "While calling getLicense";
      throw new InternalGemFireException(s, ex);
    }
  }

  public ConfigurationParameter[] getConfiguration() {
    throw new UnsupportedOperationException("not yet implemented");
  }

  public ConfigurationParameter[] setConfiguration(ConfigurationParameter[] parms) throws com.gemstone.gemfire.admin.AdminException {
    throw new UnsupportedOperationException("not yet implemented");
  }

  public void refreshConfig() throws com.gemstone.gemfire.admin.AdminException {
    try {
      Assert.assertTrue(this.objectName != null);
      this.mbs.invoke(this.objectName, "refreshConfig",
                                      new Object[0], new String[0]);

    } catch (Exception ex) {
      String s = "While calling refreshConfig";
      throw new InternalGemFireException(s, ex);
    }
  }

  public StatisticResource[] getStats() throws AdminException {
    try {
      ObjectName[] names = (ObjectName[])
          this.mbs.invoke(this.objectName, "manageStats",
                          new Object[0], new String[0]);

      StatisticResource[] stats = new StatisticResource[names.length];
      for (int i = 0; i < names.length; i++) {
        stats[i] = new JMXStatisticResource(this.mbs, names[i]);
      }
      return stats;

    } catch (Exception ex) {
      String s = "While calling manageStats";
      throw new InternalGemFireException(s, ex);
    }
  }

  public StatisticResource[] getStat(String statisticsTypeName) throws AdminException {
    try {
      String[] params = {"DistributionStats"};
      ObjectName[] names = (ObjectName[])
          this.mbs.invoke(this.objectName, "manageStat",
                                        params, new String[0]);

      StatisticResource[] stat = new JMXStatisticResource[names.length];
      for (int i=0; i<names.length; i++) {
        stat[i] = new JMXStatisticResource(this.mbs, names[i]);
      }

      return stat;
    } catch (Exception ex) {
      String s = "While calling manageStats";
      throw new InternalGemFireException(s, ex);
    }
  }

  public boolean hasCache() throws AdminException {
    try {
      Assert.assertTrue(this.objectName != null);
      return ((Boolean) this.mbs.getAttribute(this.objectName, "hasCache")).booleanValue();
    } catch (Exception ex) {
      String s = "While calling getVersion";
      throw new InternalGemFireException(s, ex);
    }
  }

  public SystemMemberCache getCache() throws AdminException {
    if (!hasCache()) {
      // Maintain SystemMember semantics
      return null;
    }

    try {
      Assert.assertTrue(this.objectName != null);
      ObjectName name = (ObjectName)
        this.mbs.invoke(this.objectName, "manageCache",
                        new Object[0], new String[0]);
      Assert.assertTrue(name != null);
      return new JMXSystemMemberCache(this.mbs, name);

    } catch (Exception ex) {
      String s = "While calling getCache";
      throw new InternalGemFireException(s, ex);
    }
  }

  // -------------------------------------------------------------------------
  //                         JMX Specific Operations
  // -------------------------------------------------------------------------

  public MBeanInfo getMBeanInfo()
  throws javax.management.JMException, java.io.IOException {
    Assert.assertTrue(this.objectName != null);
      return this.mbs.getMBeanInfo(this.objectName);
  }

  public Object getAttribute(String attribute)
  throws javax.management.JMException, java.io.IOException {
    Assert.assertTrue(this.objectName != null);
    return this.mbs.getAttribute(this.objectName, attribute);
  }

  public void setAttribute(String attribute, Object value)
  throws javax.management.JMException, java.io.IOException {
    Attribute wrapper = new Attribute(attribute, value);
    Assert.assertTrue(this.objectName != null);
    this.mbs.setAttribute(this.objectName, wrapper);
  }

  public String toString() {
    return getName() + " " + getId();
  }
}


text:
package org.apache.zeppelin.resource;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import org.junit.Test;

import java.io.IOException;
import java.nio.ByteBuffer;

import static org.junit.Assert.assertEquals;

/**
 * Test for Resource
 */
public class ResourceTest {
  @Test
  public void testSerializeDeserialize() throws IOException, ClassNotFoundException {
    ByteBuffer buffer = Resource.serializeObject("hello");
    assertEquals("hello", Resource.deserializeObject(buffer));
  }

  @Test
  public void testInvokeMethod_shouldAbleToInvokeMethodWithNoParams() {
    Resource r = new Resource(null, new ResourceId("pool1", "name1"), "object");
    assertEquals(6, r.invokeMethod("length"));
    assertEquals(6, r.invokeMethod("length", new Class[]{}, new Object[]{}));
  }

  @Test
  public void testInvokeMethod_shouldAbleToInvokeMethodWithTypeInference() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    Resource r = new Resource(null, new ResourceId("pool1", "name1"), "object");
    assertEquals("ect", r.invokeMethod("substring", new Object[]{3}));
    assertEquals("obj", r.invokeMethod("substring", new Object[]{0,3}));
    assertEquals(true, r.invokeMethod("startsWith", new Object[]{"obj"}));

    assertEquals(2, r.invokeMethod("indexOf", new Object[]{'j'}));
    assertEquals(4, r.invokeMethod("indexOf", new Object[]{"ct",3}));

    assertEquals("ect", r.invokeMethod("substring", new ArrayList<>(Arrays.asList(3))));
    assertEquals("ec", r.invokeMethod("substring", new ArrayList<>(Arrays.asList(3,5))));
    assertEquals(true, r.invokeMethod("startsWith", new ArrayList<>(Arrays.asList("obj"))));
  }

  @Test(expected = ClassNotFoundException.class)
  public void testInvokeMethod_shouldNotAbleToInvokeMethodWithTypeInference() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    Resource r = new Resource(null, new ResourceId("pool1", "name1"), "object");
    r.invokeMethod("indexOf", new Object[]{"ct",3,4});
  }

    @Test
  public void testInvokeMethod_shouldAbleToInvokeMethodWithParamClassName() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    Resource r = new Resource(null, new ResourceId("pool1", "name1"), "object");
    assertEquals("ect", r.invokeMethod("substring", new String[]{"int"}, new Object[]{3}));
    assertEquals(true, r.invokeMethod("startsWith", new String[]{"java.lang.String"}, new Object[]{"obj"}));

    assertEquals("ect", r.invokeMethod("substring", new ArrayList<>(Arrays.asList("int")), new ArrayList<>(Arrays.asList(3))));
    assertEquals(true, r.invokeMethod("startsWith", new ArrayList<>(Arrays.asList("java.lang.String")), new ArrayList<>(Arrays.asList("obj"))));
  }

  @Test
  public void testInvokeMethod_shouldAbleToInvokeMethodWithClass() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    Resource r = new Resource(null, new ResourceId("pool1", "name1"), "object");
    assertEquals(true, r.invokeMethod("startsWith", new Class[]{ java.lang.String.class }, new Object[]{"obj"}));
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC  "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <meta name="keywords" content="W3C SVG 1.1 Test Suite testsuite mobile"/>
 <meta name="description" content="W3C SVG 1.2 Tiny Test Suite"/>
 <title>
SVG 1.2 Tiny test:animate-elem-09-t </title>

Tiny version

Specification link: 16.2 Animation elements

    animate-elem-08-t ←
    index
    → animate-elem-10-t

animate-elem-09-t

							SVG Image

							PNG Image

   	    		  			<object data="../svggen/animate-elem-09-t.svg" width="480" height="360" type="image/svg+xml">
FAIL
</object>

Test possible values for 'calcMode="discrete"'

        Two animations have been defined. For each animation, ruler lines and text are provided to help show what the
        correct behavior is. The black text and ruler lines help show the sizes and movement of the rectangles over time.

        The discrete animations should show stair-stepping animations, with quantum-level jumps every two seconds in
        these tests. The linear animations change constantly with each keyframe to keyframe section, with the result
        that the change is faster when there is a larger change within a given amount of time. The paced animations
        change constantly over the entire animation, regardless of the values at particular keyframes. For
        calcMode='spline' in this test case, the initial rate of change is defined to be the same as linear, but the
        last jump has an ease-in/ease-out effect where the change is slower at the start and end but faster in the
        middle.

				animate-elem-08-t ←
				index
				→ animate-elem-10-t


text:
namespace Quickpay.Models.Account.Settings
{
    public class Elavon
    {
        public bool active { get; set; }
        public string identification_code { get; set; }
        public string identification_code_int { get; set; }
        public string business_code { get; set; }
        public bool recurring { get; set; }
        public bool americanexpress { get; set; }
        public bool dinersclub { get; set; }
        public bool securepay { get; set; }
        public string visa_mpi_merchant_id { get; set; }
        public string mastercard_mpi_merchant_id { get; set; }
        public string visa_bin { get; set; }
        public string mastercard_bin { get; set; }
    }
}


text:
@protocol PaletteDelegate
@required

@optional

- (void)changeColor:(NSMutableArray *)_colorList;

@end

@interface Palette : UIView{

    UIView *v;

}

@property(strong,nonatomic)UIImage *image;

@property (strong, nonatomic) UIImageView *handel;

@property (strong, nonatomic) UIImageView *imageView;

@property (strong, nonatomic) id<PaletteDelegate> paletteDelegate;

- (void)logTouchInfo:(UITouch *)touch;

@end


text:
using System.Collections.Concurrent;
using System.Collections.Generic;
using SitemapGenerator.Url;

namespace SitemapGenerator.Sitemap
{
    public class ConcurrentSitemap : SitemapBase
    {
        public ConcurrentSitemap(string name, string rootUrl) : base(name, rootUrl)
        {
            urls = new ConcurrentBag<ISitemapUrl>();
        }

        public  override void Add(ISitemapUrl sitemapUrl)
        {
            urls.Add(sitemapUrl);
        }

        public override IEnumerator<ISitemapUrl> GetEnumerator()
        {
            return urls.GetEnumerator();
        }

        private readonly ConcurrentBag<ISitemapUrl> urls;
    }
}


text:
package org.apache.flink.table.plan.nodes.calcite

import org.apache.calcite.plan.{Convention, RelOptCluster, RelTraitSet}
import org.apache.calcite.rel.{RelCollation, RelNode}
import org.apache.calcite.sql.SqlRankFunction
import org.apache.calcite.util.ImmutableBitSet

import java.util

import scala.collection.JavaConversions._

/**
  * Sub-class of [[Rank]] that is a relational expression which returns
  * the rows in which the rank function value of each row is in the given range.
  * This class corresponds to Calcite logical rel.
  */
final class LogicalRank(
    cluster: RelOptCluster,
    traitSet: RelTraitSet,
    input: RelNode,
    rankFunction: SqlRankFunction,
    partitionKey: ImmutableBitSet,
    sortCollation: RelCollation,
    rankRange: RankRange)
  extends Rank(
    cluster,
    traitSet,
    input,
    rankFunction,
    partitionKey,
    sortCollation,
    rankRange) {

  override def copy(traitSet: RelTraitSet, inputs: util.List[RelNode]): RelNode = {
    new LogicalRank(
      cluster,
      traitSet,
      inputs.head,
      rankFunction,
      partitionKey,
      sortCollation,
      rankRange
    )
  }
}

object LogicalRank {

  def create(
      input: RelNode,
      rankFunction: SqlRankFunction,
      partitionKey: ImmutableBitSet,
      sortCollation: RelCollation,
      rankRange: RankRange): LogicalRank = {
    val traits = input.getCluster.traitSetOf(Convention.NONE)
    new LogicalRank(
      input.getCluster,
      traits,
      input,
      rankFunction,
      partitionKey,
      sortCollation,
      rankRange
    )
  }
}


text:
> Compiler for C, C++, and Objective-C source files. Can be used as a drop-in replacement for GCC.

- Compile a source code file into an executable binary:

`clang {{input_source.c}} -o {{output_executable}}`

- Activate output of all errors and warnings:

`clang {{input_source.c}} -Wall -o {{output_executable}}`

- Include libraries located at a different path than the source file:

`clang {{input_source.c}} -o {{output_executable}} -I{{header_path}} -L{{library_path}} -l{{library_name}}`

- Compile source code into LLVM Intermediate Representation (IR):

`clang -S -emit-llvm {{file.c}} -o {{file.ll}}`


text:
from pandas import Series, DataFrame
import pandas as pd
import numpy as np

# create a data series - basically an array
mySeries = Series([4, 3, 5, np.nan, 6, 8])
print mySeries
mySeries.values
mySeries.index

mySeries2 = Series([3,5,7,9], index=['d', 'c', 'a', 'b'])
print mySeries2
mySeries2.values # make them check values
mySeries2.index

# Series work kind of like lists
mySeries[1]
mySeries2['d']
mySeries[['c', 'a', 'd']]
mySeries2[mySeries2 > 0] # equivalent to which() in R
myDoubled = mySeries * 2 # perform functions on your arrays
np.exp(myDoubled)

# Series indices can be thought of like dicts, but are immutable
'b' in mySeries2
'e' in mySeries2

# We can even turn dicts into series
eVotes = {'NC': 15, 'TX': 38, 'CA': 55} # sorted by key
ev = Series(eVotes)
states = ['CA', 'NC', 'TX', 'OH']
ev2 = Series(ev, states)

# Series have a name, as do their indices
ev2.name = "electoral votes"
ev2.index.name = "state"
print ev2

# DataFrames are fun too

data = pd.read_csv("https://raw.githubusercontent.com/mcdickenson/python-washu-2014/master/day9/lab9.csv")
print data.head()
data['State']
# change column names for convenience
data.columns = ['st', 'yr', 'ev', 'pop']

# we can create new columns
data['popm'] = data['pop'] / 1000000.0
data['evs'] = data['ev'] -3
data.head()
del data['evs']
data.head()

# DataFrames can be indexed
data[1:4]
data[data['yr']==2010]
data[data['ev']>40]

# TODO: what's the minimum population in 1990?
# in which state was that?
# how many states had over 35 electoral votes in 2010?

# we can also apply functions to columns
format = lambda x: '%.2f' % x
data['popm'].map(format)

# sort on values
data2 = data.sort_index(by='popm')
data2.head()
data2.tail()

# summary statistics
# d1990.sum()
data.describe()
data.std()

# how much did total population change between 1990 and 2010?
# TODO: how many people did the average congressperson represent in 1990?

# we could also represent a single variable as a series with hierarchical indexing
p = Series(data['pop'].values, index=[data['st'], data['yr']])
p['North Carolina']
p.mean(level='st')
# TODO: calculate standard deviation by year

p.swaplevel('st', 'yr')

# correlation
data['pop'].corr(data['ev'])

# estimate a linear model
model = pd.ols(y=data['ev'], x=data['popm'])
print model
model.beta


text:
package admin

import (
	"github.com/astaxie/beego/orm"
)

// Admin 管理员模型
type Admin struct {
	Id          int64
	Email       string
	Nick        string
	Headpic     string
	Password    string
	Status      int
	CreatedAt   int64
	UpdatedAt   int64
	LastLoginAt int64
	LastLoginIp string
	IsDel       int
}

func init() {
	orm.RegisterModelWithPrefix("lw_", new(Admin))
}


text:
<?php declare(strict_types=1);

namespace GraphQL\Validator\Rules;

use GraphQL\Error\Error;
use GraphQL\Language\AST\ArgumentNode;
use GraphQL\Language\AST\NameNode;
use GraphQL\Language\AST\NodeKind;
use GraphQL\Language\Visitor;
use GraphQL\Language\VisitorOperation;
use GraphQL\Validator\QueryValidationContext;
use GraphQL\Validator\SDLValidationContext;
use GraphQL\Validator\ValidationContext;

/**
 * @phpstan-import-type VisitorArray from Visitor
 */
class UniqueArgumentNames extends ValidationRule
{
    /** @var array<string, NameNode> */
    protected array $knownArgNames;

    public function getSDLVisitor(SDLValidationContext $context): array
    {
        return $this->getASTVisitor($context);
    }

    public function getVisitor(QueryValidationContext $context): array
    {
        return $this->getASTVisitor($context);
    }

    /**
     * @phpstan-return VisitorArray
     */
    public function getASTVisitor(ValidationContext $context): array
    {
        $this->knownArgNames = [];

        return [
            NodeKind::FIELD => function (): void {
                $this->knownArgNames = [];
            },
            NodeKind::DIRECTIVE => function (): void {
                $this->knownArgNames = [];
            },
            NodeKind::ARGUMENT => function (ArgumentNode $node) use ($context): VisitorOperation {
                $argName = $node->name->value;
                if (isset($this->knownArgNames[$argName])) {
                    $context->reportError(new Error(
                        static::duplicateArgMessage($argName),
                        [$this->knownArgNames[$argName], $node->name]
                    ));
                } else {
                    $this->knownArgNames[$argName] = $node->name;
                }

                return Visitor::skipNode();
            },
        ];
    }

    public static function duplicateArgMessage(string $argName): string
    {
        return "There can be only one argument named \"{$argName}\".";
    }
}


text:
var _ = require('lodash');
var RSVP = require('rsvp');
var Promise = RSVP.Promise;

var specialKeys = ['in', 'exists'];

function isSpecial(query){
  return _.every(Object.keys(query), function(key){return key.charAt(0) === '$' || specialKeys.indexOf(key) !== -1});
}

/**
 * registers fortune instance
 * expects that all resources have been defined
 */
exports.init = function(fortune){
  var director, resources, inflect, instance;

/**
 * Query node constructor.
 * @param resource
 * @param query
 * @param [root]
 * @constructor
 */
function QueryNode(request, resource, query, root){
  this.isRoot = !!root;
  this.request = request;
  this.resource = resource;
  this.query = parseQuery(request, query, resource);
}

/**
 * Iterates first level of query detecting filtering by referenced resources fields
 * @param query
 * @param requestedResource
 */
function parseQuery(request, query, requestedResource){
  //If found linked resource - create new node
  var freeze = {};
  _.each(query, function(q, key){
    //find key in cached resources
    var schemaBranch = resources[requestedResource].schema[key];
    if (_.isObject(schemaBranch) && _.isObject(q)){
      //Three options: ref by array, ref by object, business PK, array field
      if (_.isArray(schemaBranch) && (!!schemaBranch[0].ref || _.isString(schemaBranch[0]))){
        //ref by array or $in query. Both types of declarations
        if (isSpecial(q)){
          freeze[key] = q;
        }else{
          freeze[key] = createSubrequest(request, q, schemaBranch[0].ref || schemaBranch[0]);
        }
      }else if (!!schemaBranch.ref && _.isObject(q)){
        //ref by object
        if (q.in || q.$in){
          freeze[key] = {
            $in: _.isArray(q.in || q.$in) ? q.in || q.$in : (q.in && q.in.split(',')) || (q.$in && q.$in.split(','))
          };
        }else if(isSpecial(q)){
          freeze[key] = q;
        }else{
          freeze[key] = createSubrequest(request, q, schemaBranch.ref);
        }
      }else{
        //Business PK in schema or an operator in query
        //Do nothing and skip this query to fetchIds without any change
        freeze[key] = q;
      }
    }else if (_.isString(schemaBranch) && _.isObject(q)){
      //String ref
      freeze[key] = createSubrequest(request, q, schemaBranch);
    }else{
      if (key === 'or' || key === 'and' || key === '$and' || key === '$or'){
        freeze[key] = RSVP.all(_.map(q, function(subq){
          return instance.parse(request, requestedResource, subq);
        }));
      }else{
        //Plain field
        //Do nothing. fetchIds should have this untouched
        freeze[key] = q;
      }
    }
  });
  return RSVP.hash(freeze);
}

/**
 * Initiates new node and returns a promise
 * @param subQuery
 * @param toResource
 */
function createSubrequest(request, subQuery, toResource){
  var node = new QueryNode(request, toResource, subQuery);
  return node.query.then(function(result){
    return fetchIds(request, node.resource, result);
  });
}

/**
 * Converts bottom-level query to {$in: [ids]}
 * @param resource
 * @param query
 * @returns {*}
 */
function fetchIds(request, resource, query){
  var resourceName = inflect.pluralize(resource);
  return director.methods.get(
    resourceName,
    _.extend({}, request, {
      query: {
        filter: query,
        fields: 'id',
        limit: 0
      },
      linker: undefined //Needs to be set according to resource linking logic..
    })
  ).then(function(response){
    return {$in: _.map(response.body[resourceName], 'id')}
  });
}

  //Fortune options will be stored here later
  director = fortune.director;
  resources = fortune._resources;
  inflect = fortune.inflect;

  instance = {
    parse: function(request, resourceName, query){
      var rootNode = new QueryNode(request, resourceName, query, true);
      return rootNode.query;
    },
    _QueryNode: QueryNode
  };

  return instance;
};


text:
NSString * const tmdb_nowPlayingMovies = @"now_playing";
NSString * const tmdb_popularMovies = @"popular";
NSString * const tmdb_topRatedMovies = @"top_rated";
NSString * const tmdb_upcomingMovies = @"upcoming";

@implementation TMDBClient (Movie)

- (RACSignal*)movieWithID:(NSString*)ID
{
    NSString *path = [NSString stringWithFormat:@"movie/%@",ID];
    NSString *imagePath = [NSString stringWithFormat:@"movie/%@/images",ID];
    NSString *videoPath = [NSString stringWithFormat:@"movie/%@/videos",ID];
    NSString *creditPath = [NSString stringWithFormat:@"movie/%@/credits",ID];

    NSURLRequest *request = [self requestWithMethod:@"GET" path:path parameters:nil];
    NSURLRequest *imageRequest = [self requestWithMethod:@"GET" path:imagePath parameters:nil];
    NSURLRequest *videoRequest = [self requestWithMethod:@"GET" path:videoPath parameters:nil];
    NSURLRequest *creditRequest = [self requestWithMethod:@"GET" path:creditPath parameters:nil];

    RACSignal *movieSignal = [self enqueueRequest:request resultClass:TMDBMovie.class ];
    RACSignal *imageSignal = [self enqueueRequest:imageRequest resultClass:TMDBImageResponse.class ];
    RACSignal *videosSignal = [self enqueueRequest:videoRequest resultClass:TMDBVideoResponse.class ];
    RACSignal *creditSignal = [self enqueueRequest:creditRequest resultClass:TMDBCreditsResponse.class ];

    return [[RACSignal combineLatest:@[movieSignal,imageSignal,videosSignal,creditSignal]] map:^id(RACTuple *tuple) {
        TMDBMovie *movie = tuple.first;
        TMDBImageResponse *imageResponse = tuple.second;
        TMDBVideoResponse *videoResponse = tuple.third;
        TMDBCreditsResponse *creditResponse = tuple.fourth;

        [movie updateWithImageResponse:imageResponse];
        [movie updateWithVideoResponse:videoResponse];
        [movie updateWithCreditResponse:creditResponse];
        return movie;
    }];
}

- (RACSignal*)fetchMoviesWithPath:(NSString*)path atPage:(NSNumber*)page
{
    path = [NSString stringWithFormat:@"movie/%@",path];
    NSURLRequest *request = [self requestWithMethod:@"GET" path:path parameters:nil page:page];
    return [[self enqueueRequest:request resultClass:TMDBPageResponse.class ]
            flattenMap:^RACStream *(TMDBPageResponse *response) {
                return [response parseResultWithClass:TMDBMovie.class paged:YES];
            }];
}

- (RACSignal*)similarMoviesFromMovieID:(NSString*)ID
{
    NSString *path = [NSString stringWithFormat:@"movie/%@/similar",ID];
    NSURLRequest *request = [self requestWithMethod:@"GET" path:path parameters:nil];
    return [[self enqueueRequest:request resultClass:TMDBPageResponse.class ]
            flattenMap:^RACStream *(TMDBPageResponse *response) {
                return [response parseResultWithClass:TMDBMovie.class];
            }];
}

- (RACSignal*)latestMovie
{
    NSURLRequest *request = [self requestWithMethod:@"GET" path:@"movie/latest" parameters:nil];
    return [self enqueueRequest:request resultClass:TMDBMovie.class];
}

- (RACSignal*)nowPlayingMovies
{
    return [self nowPlayingMoviesAtPage:@1];
}

- (RACSignal*)nowPlayingMoviesAtPage:(NSNumber*)page
{
    NSURLRequest *request = [self requestWithMethod:@"GET" path:@"movie/now_playing" parameters:nil page:page];
    return [[self enqueueRequest:request resultClass:TMDBPageResponse.class ]
            flattenMap:^RACStream *(TMDBPageResponse *response) {
                return [response parseResultWithClass:TMDBMovie.class];
            }];
}

- (RACSignal*)popularMovies
{
    return [self popularMoviesAtPage:@1];
}

- (RACSignal*)popularMoviesAtPage:(NSNumber*)page
{
    NSURLRequest *request = [self requestWithMethod:@"GET" path:@"movie/popular" parameters:nil page:page];
    return [[self enqueueRequest:request resultClass:TMDBPageResponse.class ]
            flattenMap:^RACStream *(TMDBPageResponse *response) {
                return [response parseResultWithClass:TMDBMovie.class];
            }];
}

- (RACSignal*)topRatedMovies
{
    return [self topRatedMoviesAtPage:@1];
}

- (RACSignal*)topRatedMoviesAtPage:(NSNumber*)page
{
    NSURLRequest *request = [self requestWithMethod:@"GET" path:@"movie/top_rated" parameters:nil page:page];
    return [[self enqueueRequest:request resultClass:TMDBPageResponse.class ]
            flattenMap:^RACStream *(TMDBPageResponse *response) {
                return [response parseResultWithClass:TMDBMovie.class];
            }];
}

- (RACSignal*)upcomingMovies
{
    return [self upcomingMoviesAtPage:@1];
}

- (RACSignal*)upcomingMoviesAtPage:(NSNumber*)page
{
    NSURLRequest *request = [self requestWithMethod:@"GET" path:@"movie/upcoming" parameters:nil page:page];
    return [[self enqueueRequest:request resultClass:TMDBPageResponse.class ]
            flattenMap:^RACStream *(TMDBPageResponse *response) {
                return [response parseResultWithClass:TMDBMovie.class];
            }];
}

@end


text:
package net.md_5.bungee.protocol.packet;

import net.md_5.bungee.protocol.DefinedPacket;
import io.netty.buffer.ByteBuf;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import net.md_5.bungee.protocol.AbstractPacketHandler;

@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class TabCompleteResponse extends DefinedPacket
{

    private List<String> commands;

    @Override
    public void read(ByteBuf buf)
    {
        commands = readStringArray( buf );
    }

    @Override
    public void write(ByteBuf buf)
    {
        writeStringArray( commands, buf );
    }

    @Override
    public void handle(AbstractPacketHandler handler) throws Exception
    {
        handler.handle( this );
    }
}


text:
namespace android.util
{
	[global::MonoJavaBridge.JavaClass()]
	public partial class SparseIntArray : java.lang.Object
	{
		internal new static global::MonoJavaBridge.JniGlobalHandle staticClass;
		protected SparseIntArray(global::MonoJavaBridge.JNIEnv @__env) : base(@__env)
		{
		}
		private static global::MonoJavaBridge.MethodId _m0;
		public virtual int get(int arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.util.SparseIntArray.staticClass, "get", "(I)I", ref global::android.util.SparseIntArray._m0, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m1;
		public virtual int get(int arg0, int arg1)
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.util.SparseIntArray.staticClass, "get", "(II)I", ref global::android.util.SparseIntArray._m1, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m2;
		public virtual void put(int arg0, int arg1)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.util.SparseIntArray.staticClass, "put", "(II)V", ref global::android.util.SparseIntArray._m2, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m3;
		public virtual void append(int arg0, int arg1)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.util.SparseIntArray.staticClass, "append", "(II)V", ref global::android.util.SparseIntArray._m3, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m4;
		public virtual void clear()
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.util.SparseIntArray.staticClass, "clear", "()V", ref global::android.util.SparseIntArray._m4);
		}
		private static global::MonoJavaBridge.MethodId _m5;
		public virtual int size()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.util.SparseIntArray.staticClass, "size", "()I", ref global::android.util.SparseIntArray._m5);
		}
		private static global::MonoJavaBridge.MethodId _m6;
		public virtual void delete(int arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.util.SparseIntArray.staticClass, "delete", "(I)V", ref global::android.util.SparseIntArray._m6, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m7;
		public virtual int keyAt(int arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.util.SparseIntArray.staticClass, "keyAt", "(I)I", ref global::android.util.SparseIntArray._m7, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m8;
		public virtual int valueAt(int arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.util.SparseIntArray.staticClass, "valueAt", "(I)I", ref global::android.util.SparseIntArray._m8, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m9;
		public virtual int indexOfKey(int arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.util.SparseIntArray.staticClass, "indexOfKey", "(I)I", ref global::android.util.SparseIntArray._m9, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m10;
		public virtual int indexOfValue(int arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.util.SparseIntArray.staticClass, "indexOfValue", "(I)I", ref global::android.util.SparseIntArray._m10, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m11;
		public virtual void removeAt(int arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.util.SparseIntArray.staticClass, "removeAt", "(I)V", ref global::android.util.SparseIntArray._m11, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m12;
		public SparseIntArray(int arg0) : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.util.SparseIntArray._m12.native == global::System.IntPtr.Zero)
				global::android.util.SparseIntArray._m12 = @__env.GetMethodIDNoThrow(global::android.util.SparseIntArray.staticClass, "<init>", "(I)V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.util.SparseIntArray.staticClass, global::android.util.SparseIntArray._m12, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
			Init(@__env, handle);
		}
		private static global::MonoJavaBridge.MethodId _m13;
		public SparseIntArray() : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.util.SparseIntArray._m13.native == global::System.IntPtr.Zero)
				global::android.util.SparseIntArray._m13 = @__env.GetMethodIDNoThrow(global::android.util.SparseIntArray.staticClass, "<init>", "()V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.util.SparseIntArray.staticClass, global::android.util.SparseIntArray._m13);
			Init(@__env, handle);
		}
		static SparseIntArray()
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			global::android.util.SparseIntArray.staticClass = @__env.NewGlobalRef(@__env.FindClass("android/util/SparseIntArray"));
		}
	}
}


text:
DELIMITER $$

DROP procedure IF EXISTS _rdebug_import_variable_state $$
CREATE procedure _rdebug_import_variable_state(
    in breakpoint_id int unsigned,
    in rdebug_routine_schema varchar(128) charset utf8,
    in rdebug_routine_name   varchar(128) charset utf8
  )
DETERMINISTIC
NO SQL
SQL SECURITY INVOKER

BEGIN
  select
      concat('
        select ',
          group_concat('max(if(variable_name=', QUOTE(variable_name), ', variable_value, NULL))' order by variable_name), '
        from
          _rdebug_routine_variables_state
        where
          worker_id = CONNECTION_ID()
          and stack_level = @_rdebug_stack_level_
          and routine_schema = ', QUOTE(rdebug_routine_schema), ' and routine_name = ', QUOTE(rdebug_routine_name), '
        into ',
          group_concat(IF(variable_type IN ('param', 'local'), CONCAT('@$_$', variable_name), variable_name) order by variable_name)
      )
    from
      _rdebug_routine_variables
    where
      breakpoint_id between _rdebug_routine_variables.variable_scope_id_start and _rdebug_routine_variables.variable_scope_id_end
      and routine_schema = rdebug_routine_schema and routine_name = rdebug_routine_name
    into @_rdebug_command
  ;
  -- select @_rdebug_command;
  if @_rdebug_command is not null then
    -- Could be NULL when _rdebug_routine_variables has nothing for us
    prepare st from @_rdebug_command;
    execute st;
    deallocate prepare st;
  end if;
END $$

DELIMITER ;


text:
Bidder Order

Set the order in which bidders are called:

        pbjs.setConfig({ bidderSequence: "fixed" })   /* default is "random" */


text:
from django.conf import settings
from django.conf.urls import patterns, url, include
from django.conf.urls.static import static

from django.contrib import admin
from django.views.generic import TemplateView, RedirectView

import symposion.views

admin.autodiscover()

URL_PREFIX = settings.CONFERENCE_URL_PREFIXES[settings.CONFERENCE_ID]

urlpatterns = patterns(
    "",
    url(r"^$", RedirectView.as_view(url="/%s/" % URL_PREFIX)),
    url(r"^%s/" % URL_PREFIX, include(patterns(
        "",
        url(r"^$",
            TemplateView.as_view(template_name="homepage.html"),
            name="home"),
        url(r"^dashboard/$",
            symposion.views.dashboard,
            name="dashboard"),
        url(r"^sitemap/$",
            TemplateView.as_view(template_name="static/sitemap.html"),
            name="sitemap"),
        url(r"^change_language/$",
            symposion.views.change_language,
            name="change_language"),
        url(r"^force500/$", lambda request: xxx),

        # Accounts.
        url(r"^account/signup/$",
            symposion.views.SignupView.as_view(),
            name="account_signup"),
        url(r"^account/login/$",
            symposion.views.LoginView.as_view(),
            name="account_login"),
        url(r"^account/associations/", include("symposion.social_auth.urls")),
        url(r"^account/social/", include("social_auth.urls")),
        url(r"^account/", include("account.urls")),

        url(r"^admin/", include(admin.site.urls)),
        url(r"^blog/", include("biblion.urls")),
        url(r"^boxes/", include("symposion.boxes.urls")),
        url(r"^conference/", include("symposion.conference.urls")),
        url(r"^finaid/", include("pycon.finaid.urls")),
        url(r"^profile/", include("pycon.profile.urls")),
        url(r"^proposals/", include("symposion.proposals.urls")),
        url(r"^pycon_api/", include("pycon.pycon_api.urls")),
        url(r"^registration/", include("pycon.registration.urls")),
        url(r"^reviews/", include("symposion.reviews.urls")),
        url(r"^schedule/", include("pycon.schedule.urls")),
        url(r"^schedule/", include("symposion.schedule.urls")),
        url(r"^selectable/", include("selectable.urls")),
        url(r"^speaker/", include("symposion.speakers.urls")),
        url(r"^sponsors/", include("pycon.sponsorship.urls")),
        url(r"^teams/", include("symposion.teams.urls")),
        url(r"^tutorials/", include("pycon.tutorials.urls")),

        url(r"^", include("pycon.urls")),

        # This should be last, because it will create a new CMS page for
        # any unrecognized URL.
        url(r"^", include("symposion.cms.urls")),
    )))
)

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

if "comps" in settings.INSTALLED_APPS:
    urlpatterns += patterns("", url(r"^", include("comps.urls")))


text:
require 'test/unit'
require 'java'
require ENV.fetch('MIRAHC_JAR',File.expand_path("../../../dist/mirahc.jar",__FILE__))

class BaseMethodLookupTest <  Test::Unit::TestCase
  java_import 'org.mirah.jvm.mirrors.MirrorTypeSystem'
  java_import 'org.mirah.jvm.mirrors.BetterScopeFactory'
  java_import 'org.mirah.jvm.mirrors.BaseType'
  java_import 'org.mirah.jvm.mirrors.MethodLookup'
  java_import 'org.mirah.jvm.mirrors.LookupState'
  java_import 'org.mirah.jvm.mirrors.FakeMember'
  java_import 'org.mirah.jvm.mirrors.Member'
  java_import 'org.mirah.jvm.mirrors.MetaType'
  java_import 'org.mirah.jvm.mirrors.MirrorProxy'
  java_import 'org.mirah.jvm.mirrors.NullType'
  java_import 'org.mirah.jvm.types.MemberKind'
  java_import 'org.mirah.typer.BaseTypeFuture'
  java_import 'org.mirah.typer.ErrorType'
  java_import 'org.mirah.typer.simple.SimpleScoper'
  java_import 'mirah.lang.ast.Script'
  java_import 'org.objectweb.asm.Opcodes'
  java_import 'org.objectweb.asm.Type'

  class FakeMirror < BaseType
    def initialize(desc, superclass=nil, flags=Opcodes.ACC_PUBLIC)
      super(nil, Type.getType(desc), flags, superclass)
      @fields = {}
    end

    def add_field(name, flags=Opcodes.ACC_PUBLIC)
      kind = if (flags & Opcodes.ACC_STATIC) == 0
        MemberKind::FIELD_ACCESS
      else
        MemberKind::STATIC_FIELD_ACCESS
      end
      @fields[name] = Member.new(flags, self, name, [], self, kind)
    end

    def getDeclaredField(name)
      @fields[name]
    end
  end

  def setup
    @types = MirrorTypeSystem.new
    @scope = new_scope
    @lookup = MethodLookup.new(@types.context)
  end

  def new_scope opts={}
    BetterScopeFactory.new.newScope(SimpleScoper.new(nil), opts[:context] || Script.new)
  end

  def jvmtype(internal_name, flags=0, superclass=nil)
    BaseType.new(@types.context, Type.getObjectType(internal_name), flags, superclass || wrap('Ljava/lang/Object;'))
  end

  def wrap(descriptor)
    wrap_type(Type.getType(descriptor))
  end

  def wrap_type(type)
    @types.wrap(type).resolve
  end

  def make_method(tag, flags=Opcodes.ACC_PUBLIC)
    FakeMember.create(@types, tag, flags)
  end
end

class MethodLookupTest < BaseMethodLookupTest
  def test_object_supertype
    main_future = @types.getMainType(nil, nil)
    object = @types.getSuperClass(main_future).resolve
    main = main_future.resolve

    assert(MethodLookup.isSubType(main, main))
    assert(MethodLookup.isSubType(main, object))
    assert_false(MethodLookup.isSubType(object, main))

    error = ErrorType.new([['Error']])

    assert(MethodLookup.isSubType(error, main))
    assert(MethodLookup.isSubType(main, error))
  end

  # TODO interfaces
  def check_supertypes(type, *supertypes)
    supertypes.each do |supertype|
      assert_block("Expected #{type} < #{supertype}") do
        MethodLookup.isSubType(type, supertype)
      end
      assert_block("Expected #{type}.assignableFrom(#{supertype})") do
        supertype.assignableFrom(type)
      end
    end
  end

  def check_not_supertypes(type, *supertypes)
    supertypes.each do |supertype|
      assert_block("Expected !(#{type} < #{supertype})") do
        !MethodLookup.isSubType(type, supertype)
      end
      assert_block("Expected #{type}.assignableFrom(#{supertype}) = false") do
        !supertype.assignableFrom(type)
      end
    end
  end

  def test_primitive_supertypes
    double = wrap('D')
    float = wrap('F')
    long = wrap('J')
    int = wrap('I')
    short = wrap('S')
    char = wrap('C')
    byte = wrap('B')
    bool = wrap('Z')

    check_supertypes(double, double)
    check_not_supertypes(double, float, long, int, short, char, byte, bool)
    check_supertypes(float, double, float)
    check_not_supertypes(float, long, int, short, char, byte, bool)
    check_supertypes(long, double, float, long)
    check_not_supertypes(long, int, short, char, byte, bool)
    check_supertypes(int, double, float, long, int)
    check_not_supertypes(int, short, char, byte, bool)
    check_supertypes(short, double, float, long, int, short)
    check_not_supertypes(short, char, byte, bool)
    check_supertypes(char, double, float, long, int, char)
    check_not_supertypes(char, byte, bool)
    check_supertypes(byte, double, float, long, int, short)
    check_not_supertypes(byte, char, bool)
    check_supertypes(bool, bool)
    check_not_supertypes(bool, double, float, long, int, short, char, byte)
  end

  def array(desc)
    @types.getArrayType(wrap(desc))
  end

  def test_array_supertypes
    check_supertypes(array("I"),
                     array("I"),
                     wrap("Ljava/lang/Object;"),
                     wrap("Ljava/lang/Cloneable;"),
                     wrap("Ljava/io/Serializable;"))
    check_not_supertypes(array("I"), array("J"), array("S"), array("D"),
                         array("Ljava/lang/Object;"))
    check_supertypes(array("Ljava/util/Map;"),
                     wrap("Ljava/lang/Object;"),
                     wrap("Ljava/lang/Cloneable;"),
                     wrap("Ljava/io/Serializable;"),
                     array("Ljava/lang/Object;"),
                     array("Ljava/util/Map;"))
    check_supertypes(array("Ljava/util/HashMap;"),
                     wrap("Ljava/lang/Object;"),
                     wrap("Ljava/lang/Cloneable;"),
                     wrap("Ljava/io/Serializable;"),
                     array("Ljava/lang/Object;"),
                     array("Ljava/util/Map;"),
                     array("Ljava/io/Serializable;"),
                     array("Ljava/util/AbstractMap;"))
  end

  def test_null_subtype
    null = MirrorProxy.new(NullType.new)
    object = wrap("Ljava/lang/Object;")
    assert(MethodLookup.isSubType(null, object))
    assert(MethodLookup.isSubType(null, wrap("Ljava/lang/String;")))
  end

  def test_subtype_comparison
    double = wrap('D')
    int = wrap('I')
    short = wrap('S')

    assert_equal(0.0, MethodLookup.subtypeComparison(double, double))
    assert_equal(0.0, MethodLookup.subtypeComparison(int, int))
    assert_equal(1.0, MethodLookup.subtypeComparison(int, double))
    assert_equal(-1.0, MethodLookup.subtypeComparison(double, int))
    assert_equal(-1.0, MethodLookup.subtypeComparison(int, short))
    assert_equal(1.0, MethodLookup.subtypeComparison(short, int))

    main = @types.getMainType(nil, nil).resolve

    assert_equal(0.0, MethodLookup.subtypeComparison(main, main))
    assert(MethodLookup.subtypeComparison(double, main).nan?)
    assert(MethodLookup.subtypeComparison(main, int).nan?)
  end

  def test_boxing
    a = @types.getBooleanType.resolve
    b = @types.wrap(Type.getType('Ljava/lang/Boolean;')).resolve
    c = @types.getFixnumType(1).resolve

    assert(!MethodLookup.isSubType(a, b))
    assert(!MethodLookup.isSubType(b, a))
    assert(MethodLookup.isSubTypeWithConversion(a, b))
    assert(MethodLookup.isSubTypeWithConversion(b, a))
    assert(!MethodLookup.isSubTypeWithConversion(c, b))
    assert(!MethodLookup.isSubTypeWithConversion(b, c))
  end

  def test_pickMostSpecific
    m = MethodLookup.pickMostSpecific([make_method('@I.()V'), make_method('@Z.()V')])
    # Both ambiguous, one should be picked but it doesn't matter which
    assert_kind_of(FakeMember, m)

    expected = make_method('Z.()V')
    methods = [expected, make_method('@I.()V'), make_method('@S.()V')].shuffle
    assert_same(expected, MethodLookup.pickMostSpecific(methods))
  end

  def test_getPackage
    assert_equal("", MethodLookup.getPackage(jvmtype('Foo')))
    assert_equal("java/lang", MethodLookup.getPackage(wrap('Ljava/lang/String;')))
    assert_equal("java/util", MethodLookup.getPackage(wrap('Ljava/util/Map$Entry;')))
  end

  def visibility_string(flags)
    if 0 != (flags & Opcodes.ACC_PUBLIC)
      return :public
    elsif 0 != (flags & Opcodes.ACC_PROTECTED)
      return :protected
    elsif 0 != (flags & Opcodes.ACC_PRIVATE)
      return :private
    else
      return :'package private'
    end
  end

  def assert_visible(type, flags, visible, invisible=[], target=nil)
    visible.each do |t|
      accessibility_assertion(type, flags, t, true, target)
    end
    invisible.each do |t|
      accessibility_assertion(type, flags, t, false, target)
    end
  end

  def set_self_type(type)
    future = BaseTypeFuture.new
    future.resolved(type)
    @scope.selfType_set(future)
  end

  def accessibility_assertion(a, flags, b, expected, target=nil)
    assert_block "Expected #{visibility_string(flags)} #{a} #{expected ? '' : ' not '} visible from #{b}" do
      set_self_type(b)
      actual = MethodLookup.isAccessible(a, flags, @scope, target)
      actual == expected
    end
  end

  def test_isAccessible
    object = wrap('Ljava/lang/Object;')
    string = wrap('Ljava/lang/String;')
    foo = jvmtype('Foo')
    assert_visible(object, Opcodes.ACC_PUBLIC, [object, string, foo])
    assert_visible(object, Opcodes.ACC_PROTECTED, [object, string, foo])
    assert_visible(object, Opcodes.ACC_PRIVATE, [object], [string, foo])
    assert_visible(object, 0, [object, string], [foo])
    assert_visible(foo, Opcodes.ACC_PRIVATE, [foo], [object, string])
    assert_visible(foo, Opcodes.ACC_PROTECTED, [foo], [object, string])
    assert_visible(string, Opcodes.ACC_PROTECTED, [string, object], [foo])  # visible to same package
    assert_visible(string, 0, [string, object], [foo])

    # instance method from static scope
    assert_visible(object, Opcodes.ACC_PUBLIC, [], [object, foo],
                   MetaType.new(object))
  end

  def assert_methods_visible(methods, type, expected_visible)
    methods_desc = methods.inspect
    expected_invisible = methods - expected_visible
    set_self_type(type)
    invisible = @lookup.removeInaccessible(methods, @scope, nil)

    assert_equal(expected_invisible.map {|m| m.toString}, invisible.map {|m| m.toString})
    assert_equal(expected_visible.map {|m| m.toString}, methods.map {|m| m.toString})
    # TODO: fix protected usage. e.g. Foo can call Object.clone() through a foo instance, but not any Object.
  end

  def test_removeInaccessible
    # test method from an inaccessible class
    methods = [make_method("Ljava/lang/AbstractStringBuilder;.(I)V"), make_method("Ljava/lang/StringBuilder;.(I)V")]
    assert_methods_visible(methods, wrap('Ljava/util/Map;'), [methods[1]])

    # test inaccessible method
    methods = [make_method("Ljava/lang/Object;.()V", Opcodes.ACC_PRIVATE), make_method("Ljava/lang/String;.()V")]
    assert_methods_visible(methods, wrap('Ljava/util/Map;'), [methods[1]])
  end

  def test_gatherMethods
    methods = @lookup.gatherMethods(wrap('Ljava/lang/String;'), 'toString')
    assert_equal(3, methods.size)

    declaring_classes = Set.new(methods.map {|m| m.declaringClass})
    assert_equal(Set.new([wrap('Ljava/lang/Object;'),
                          wrap('Ljava/lang/String;'),
                          wrap('Ljava/lang/CharSequence;')]),
                 declaring_classes)
  end

  def test_method_splitting
    set_self_type(jvmtype('Foo'))
    methods = [make_method("Ljava/lang/Object;.()V", Opcodes.ACC_PRIVATE), make_method("Ljava/lang/String;.()V")]
    state = LookupState.new(@types.context, @scope, wrap('Ljava/lang/String;'), methods, nil)
    assert_equal("{potentials: 1 0 inaccessible: 1 0}", state.toString)
  end

  def test_search
    set_self_type(jvmtype('Foo'))
    methods = [make_method("Ljava/lang/Object;.()V")]
    state = LookupState.new(@types.context, @scope, wrap('Ljava/lang/String;'), methods, nil)
    state.search([], nil)
    assert_equal("{1 methods 0 macros 0 inaccessible}", state.toString)
    future = state.future(false)
    assert_not_nil(future)
    type = future.resolve
    assert(!type.isError)
    assert_equal("Ljava/lang/String;", type.returnType.asm_type.descriptor)
  end

  def test_findMethod
    set_self_type(jvmtype('Foo'))
    type = @lookup.findMethod(@scope, wrap('Ljava/lang/String;'), 'toString', [], nil, nil, false).resolve
    assert(!type.isError, type.toString)
    assert_nil(@lookup.findMethod(@scope, wrap('Ljava/lang/String;'), 'foobar', [], nil, nil, false))
    type = @lookup.findMethod(@scope, wrap('Ljava/lang/Object;'), 'registerNatives', [], nil, nil, false).resolve
    assert(type.isError)
    assert_equal('Cannot access java.lang.Object.registerNatives() from Foo', type.message[0][0])
    pend "Can't tell the difference between 'super' random protected methods" do
      type = @lookup.findMethod(@scope, wrap('Ljava/lang/Object;'), 'clone', [], nil, nil, false).resolve
      assert(type.isError)
      assert_equal('Cannot access java.lang.Object.clone() from Foo', type.message[0][0])
    end
    # TODO test ambiguous
    # TODO check calling instance method from static scope.
  end
end

class CompareSpecificityTest < BaseMethodLookupTest
  def test_same_method
    m = 'I.(I)V'
    assert_specificity_equal(m, m)
  end

  def assert_more_specific(a, b)
    assert_specificity(a, b, 1.0)
    assert_specificity(b, a, -1.0)
  end

  def assert_less_specific(a, b)
    assert_more_specific(b, a)
  end

  def assert_specificity_equal(a, b)
    assert_specificity(a, b, 0.0)
    assert_specificity(b, a, 0.0)
  end

  def assert_ambiguous(a, b)
    nan = 0.0 / 0.0
    assert_specificity(a, b, nan)
    assert_specificity(b, a, nan)
  end

  def assert_specificity(a, b, value)
    actual = MethodLookup.compareSpecificity(make_method(a), make_method(b), [nil, nil])
    assert_block "Expected compareSpecificity(#{a.inspect}, #{b.inspect}) = #{value} but was #{actual}" do
      if value.nan?
        actual.nan?
      else
        actual == value
      end
    end
  end

  def test_target
    a = 'I.()V'
    b = 'S.()V'

    assert_more_specific(b, a)
  end

  def test_target_with_same_args
    a = 'I.(II)V'
    b = 'S.(II)V'

    assert_more_specific(b, a)
  end

  def test_ambiguous_target
    # if the target is ambiguous the result should be equal
    assert_specificity_equal('Z.()V', 'I.()V')
    assert_specificity_equal('Z.(I)V', 'I.(I)V')
    assert_specificity_equal('Z.(II)V', 'I.(II)V')

    # unless the arguments are different
    assert_ambiguous('Z.(S)V', 'I.(I)V')
    assert_ambiguous('Z.(I)V', 'I.(S)V')
  end

  def test_arguments
    assert_more_specific('I.(S)V',  'I.(I)V')
    assert_more_specific('I.(SS)V', 'I.(II)V')
    assert_more_specific('I.(SI)V', 'I.(II)V')
    assert_more_specific('I.(IS)V', 'I.(II)V')
  end

  def test_ambiguous_arguments
    assert_ambiguous('I.(S)V', 'I.(Z)V')
    assert_ambiguous('I.(S)V', 'S.(Z)V')
    assert_ambiguous('S.(S)V', 'I.(Z)V')
  end

  def test_return_type_ignored
    a = 'I.()I'
    b = 'I.()S'
    c = 'C.()D'
    assert_specificity_equal(a, b)
    assert_more_specific(c, a)
    assert_more_specific(c, b)
  end
end

class FindMaximallySpecificTest < BaseMethodLookupTest
  def find_maximally_specific(method_tags)
    methods = {}
    method_tags.each do |m|
      method = make_method(m)
      methods[method] = m
    end
    result = MethodLookup.findMaximallySpecific(methods.keys, [nil, nil])
    result.map {|m| methods[m] || m}
  end

  def assert_most_specific(expected, methods)
    assert_maximal([expected], methods)
  end

  def assert_maximal(expected, methods)
    actual = find_maximally_specific(methods)
    assert_equal(Set.new(expected), Set.new(actual))
  end

  def test_single_method
    m = 'I.()V'
    assert_most_specific(m, [m])
  end

  def test_more_specific
    a = 'I.(I)V'
    b = 'I.(S)V'
    assert_most_specific(b, [a, b])
  end

  def test_ambiguous
    a = 'I.(II)V'
    b = 'I.(SI)V'
    c = 'I.(IS)V'
    assert_maximal([b, c], [a, b, c])
  end

  def test_all_abstract
    a = 'I.(II)V'
    b = '@I.(SI)V'
    c = '@Z.(SI)V'
    result = find_maximally_specific([a, b, c])
    # either b or c should be picked.
    begin
      assert_equal([b], result)
    rescue
      assert_equal([c], result)
    end
  end

  def test_one_not_abstract
    a = 'I.(SI)V'
    b = '@I.(SI)V'
    c = '@Z.(SI)V'
    assert_most_specific(a, [a, b, c])
  end
end

class Phase1Test < BaseMethodLookupTest
  def phase1(methods, params)
    methods = @lookup.phase1(methods.map{|m| make_method(m)}, params.map{|p| wrap(p)})
    methods.map {|m| m.toString } if methods
  end

  def test_no_match
    assert_nil(phase1([], ['I']))
  end

  def test_simpe_match
    assert_equal(['I.()V'], phase1(['I.()V'], []))
    assert_equal(['I.(I)V'], phase1(['I.(I)V'], ['I']))
  end

  def test_arity
    assert_equal(['I.(SI)V'], phase1(['I.(S)V', 'I.(SI)V', 'I.(SII)V'], ['S','I']))
  end

  def test_ambiguous
    assert_equal(Set.new(%w(I.(SI)V I.(IS)V)),
                 Set.new(phase1(%w(I.(SI)V I.(IS)V), %w(S S))))
  end

  def test_ambiguity_resolution
    assert_equal(['I.()V'], phase1(%w(@Z.()V I.()V), []))
  end

  def test_error_least_specific
    error_member = Member.new(
        Opcodes.ACC_PUBLIC, wrap('I'), 'foo', [ErrorType.new([['Error']])], wrap('I'),
        MemberKind::METHOD)
    # The method should match
    assert_equal([error_member],
                 @lookup.phase1([error_member], [wrap('I')]).to_a)
    # And be least specific
    ok_member = make_method('I.(I)S')
    assert_equal([ok_member],
                 @lookup.phase1([error_member, ok_member], [wrap('I')]).to_a)
  end
end

class FieldTest < BaseMethodLookupTest
  def setup
    super
    @a = FakeMirror.new('LA;')
    @b = FakeMirror.new('LB;', @a)
    @scope = new_scope
    @selfType = BaseTypeFuture.new
    @selfType.resolved(@b)
    @scope.selfType_set(@selfType)
  end

  def test_gather_fields
    a_foo = @a.add_field("foo")
    a_bar = @a.add_field("bar")
    b_foo = @b.add_field("foo")
    foos = @lookup.gatherFields(@b, 'foo', []).to_a

    assert_equal([b_foo, a_foo], foos)
    assert_equal([a_bar], @lookup.gatherFields(@b, 'bar', []).to_a)
  end

  def test_find_super_field
    @a.add_field("foo")

    future = @lookup.findMethod(@scope, @b, 'foo', [], nil, nil, false)

    assert_equal("LA;", future.resolve.returnType.asm_type.descriptor)
  end

  def test_field_override
    @a.add_field("foo")
    @b.add_field("foo")

    future = @lookup.findMethod(@scope, @b, 'foo', [], nil, nil, false)

    assert_equal("LB;", future.resolve.returnType.asm_type.descriptor)
  end

  def test_inaccessible_overrides_accessible
    @selfType.resolved(@a)
    @a.add_field("foo", Opcodes.ACC_PUBLIC)
    @b.add_field("foo", Opcodes.ACC_PRIVATE)

    future = @lookup.findMethod(@scope, @b, 'foo', [], nil, nil, false)

    assert_equal("LA;", future.resolve.returnType.asm_type.descriptor)
  end

  def test_inaccessible
    @a.add_field("foo", Opcodes.ACC_PRIVATE)

    future = @lookup.findMethod(@scope, @b, 'foo', [], nil, nil, false)

    assert(future.resolve.isError, "Expected error, got #{future.resolve}")
  end

  def test_field_setter
    @a.add_field("foo")

    future = @lookup.findMethod(@scope, @a, 'foo_set', [@a], nil, nil, false)
  end
end


text:
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({ name: 'oTableRowClass' })
export class OTableRowClassPipe implements PipeTransform {

  transform(rowData: any, rowIndex: number, rowClassFn?: (row: any, index: number) => string | string[]): string | string[] {
    return rowClassFn ? rowClassFn(rowData, rowIndex) : '';
  }

}


text:
@interface DTLocalizableStringAggregator : NSObject

@property (nonatomic, assign) BOOL wantsPositionalParameters;
@property (nonatomic, assign) NSStringEncoding inputEncoding;
@property (nonatomic, retain) NSSet *tablesToSkip;
@property (nonatomic, retain) NSString *customMacroPrefix;
@property (nonatomic, retain) NSString *defaultTableName;

- (void)beginProcessingFile:(NSURL *)fileURL;

// returns an array of DTLocalizableStringTables
// blocks until all enqueued files have been processed
- (NSArray *)aggregatedStringTables;

@end


text:
package com.wiley.driver.factory.capabilities;

import com.wiley.driver.factory.DriverFactory;
import org.openqa.selenium.remote.DesiredCapabilities;

/**
 * Caps for Chrome browser on Android
 */
public class AndroidNativeAppCaps extends TeasyCaps {

    public AndroidNativeAppCaps(DesiredCapabilities customCaps) {
        super(customCaps);
    }

    @Override
    public DesiredCapabilities get() {
        DesiredCapabilities caps = new DesiredCapabilities();
        if (!this.customCaps.asMap().isEmpty()) {
            caps.merge(this.customCaps);
        }
        if (this.customCaps.getBrowserName().equals(DriverFactory.NATIVE_APP)) {
            this.customCaps.setBrowserName(DriverFactory.EMPTY);
        }
        return caps;
    }
}


text:
const http = require("http");
const https = require("https");

/**
 * Returns a promise with response body or error. Use .then afterwards, e.g.:
 *
 *    promiseHttpGet(url).then(
 *      fn(responseBody) {doSomething},
 *      fn(error) {doSomething}
 *    );
 *
 * @param {string} url Valid url with http:// prefix
 * @returns {string}
 */
function promiseHttpGet(url) {
  return new Promise((resolve, reject) => {
    http
      .get(url, (response) => {
        let responseBody = "";
        if (response.statusCode !== 200) {
          reject(response.statusCode);
        }
        response.setEncoding = "utf8";
        response.on("data", (data) => {
          responseBody += data;
        });
        response.on("end", () => {
          resolve(responseBody);
        });
      })
      // Separate error event listener, response.on("error", fn()) is not enough
      .on("error", (error) => {
        reject(error);
      });
  });
}

/**
 * Returns a promise with response body or error. Use .then afterwards, e.g.:
 *
 *    promiseHttpGet(url).then(
 *      fn(responseBody) {doSomething},
 *      fn(error) {doSomething}
 *    );
 *
 * @param {string} url Valid url with https:// prefix
 * @returns {string}
 */
function promiseHttpsGet(url) {
  return new Promise((resolve, reject) => {
    https
      .get(url, (response) => {
        let responseBody = "";
        if (response.statusCode !== 200) {
          reject(response.statusCode);
        }
        response.setEncoding = "utf8";
        response.on("data", (data) => {
          responseBody += data;
        });
        response.on("end", () => {
          resolve(responseBody);
        });
      })
      // Separate error event listener, response.on("error", fn()) is not enough
      .on("error", (error) => {
        reject(error);
      });
  });
}

module.exports = {
  promiseHttpGet,
  promiseHttpsGet,
};


text:
namespace dclass   // open namespace dclass
{

// Forward declaration
class HashGenerator;

// KeywordList this is a list of keywords (see Keyword) that may be set on a particular field.
class KeywordList
{
  public:
    // empty list constructor
    KeywordList();
    // copy constructor
    KeywordList(const KeywordList& copy);
    // copy assignment operator
    void operator = (const KeywordList& copy);

    // has_keyword returns true if this list includes the indicated keyword, false otherwise.
    bool has_keyword(const std::string& name) const;
    // get_num_keywords returns the number of keywords in the list.
    size_t get_num_keywords() const;
    // get_keyword returns the nth keyword in the list.
    const std::string& get_keyword(unsigned int n) const;

    // has_matching_keywords returns true if this list has the same keywords as the other list,
    //     false if some keywords differ. Order is not considered important.
    bool has_matching_keywords(const KeywordList& other) const;

    // copy_keywords replaces this keyword list with those from the other list.
    void copy_keywords(const KeywordList& other);

    // add_keyword adds the indicated keyword to the list.
    //     Returns true if it is added, false if it was already there.
    bool add_keyword(const std::string& keyword);

    // generate_hash accumulates the properties of these keywords into the hash.
    void generate_hash(HashGenerator& hashgen) const;

  private:
    std::vector<std::string> m_keywords; // the actual list of keywords
    std::unordered_set<std::string> m_keywords_by_name; // a map of name to keywords in list
};

} // close namespace dclass