text:
module RuboCop
  module Cop
    module Style
      # This cop checks how the *when*s of a *case* expression
      # are indented in relation to its *case* or *end* keyword.
      #
      # It will register a separate offense for each misaligned *when*.
      class CaseIndentation < Cop
        include AutocorrectAlignment
        include ConfigurableEnforcedStyle

        MSG = 'Indent `when` %s `%s`.'.freeze

        def on_case(case_node)
          return if case_node.single_line?

          case_node.each_when do |when_node|
            check_when(when_node)
          end
        end

        private

        def check_when(when_node)
          when_column = when_node.loc.keyword.column
          base_column = base_column(when_node.parent, style)

          if when_column == base_column + indentation_width
            correct_style_detected
          else
            incorrect_style(when_node)
          end
        end

        def indent_one_step?
          cop_config['IndentOneStep']
        end

        def indentation_width
          indent_one_step? ? configured_indentation_width : 0
        end

        def incorrect_style(when_node)
          when_column = when_node.loc.keyword.column
          base_column = base_column(when_node.parent, alternative_style)

          add_offense(when_node, :keyword, message(style)) do
            if when_column == base_column
              opposite_style_detected
            else
              unrecognized_style_detected
            end
          end
        end

        def message(base)
          depth = indent_one_step? ? 'one step more than' : 'as deep as'

          format(MSG, depth, base)
        end

        def base_column(case_node, base)
          case base
          when :case then case_node.location.keyword.column
          when :end  then case_node.location.end.column
          end
        end

        def autocorrect(node)
          whitespace = whitespace_range(node)

          return false unless whitespace.source.strip.empty?

          lambda do |corrector|
            corrector.replace(whitespace, replacement(node))
          end
        end

        def whitespace_range(node)
          when_column = node.location.keyword.column
          begin_pos = node.loc.keyword.begin_pos

          range_between(begin_pos - when_column, begin_pos)
        end

        def replacement(node)
          case_node = node.each_ancestor(:case).first
          base_type = cop_config[style_parameter_name] == 'end' ? :end : :case

          column = base_column(case_node, base_type)
          column += indentation_width

          ' ' * column
        end
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class Probe
   | Sensus Documentation </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class Probe
   | Sensus Documentation ">
    <meta name="generator" content="docfx 2.31.0.0">

    <link rel="shortcut icon" href="../images/favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">

    <meta property="docfx:rel" content="../">

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                Toggle navigation

              </button>

              <form class="navbar-form navbar-right" role="search" id="search">

                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">

              </form>

          Show / Hide Table of Contents

Class Probe

Each Probe collects data of a particular type from the device. Sensus contains Probes for many of the hardware sensors present on many
smartphones. Sensus also contains Probes that can prompt the user for information, which the user supplies via speech or textual input.
Sensus defines a variety of Probes, with platform availability and quality varying by device manufacturer (e.g., Apple, Motorola, Samsung,
etc.). Availability and reliability of Probes will depend on the device being used.

Inheritance

System.Object

Probe

ListeningProbe

PollingProbe

ScriptProbe

Implements

System.ComponentModel.INotifyPropertyChanged

Namespace: Sensus.Probes

Assembly: SensusAndroid.dll

Syntax

public abstract class Probe : Object, INotifyPropertyChanged

Constructors

Probe()

Declaration

protected Probe()

Properties

Caption

Declaration

public string Caption { get; }

Property Value

        Type
        Description

        System.String

CollectionDescription

Declaration

public abstract string CollectionDescription { get; }

Property Value

        Type
        Description

        System.String

DatumType

Declaration

public abstract Type DatumType { get; }

Property Value

        Type
        Description

        System.Type

DisplayName

Declaration

public abstract string DisplayName { get; }

Property Value

        Type
        Description

        System.String

Enabled

Whether the Probe should be turned on when the user starts the Protocol.

Declaration

[OnOffUiProperty("Enabled:", true, 2)]
public bool Enabled { get; set; }

Property Value

        Type
        Description

        System.Boolean

true if enabled; otherwise, false.

MaxChartDataCount

How much data to save from the Probe  for the purpose of charting within the Sensus app.

Declaration

[EntryIntegerUiProperty("Max Chart Data Count:", true, 50)]
public int MaxChartDataCount { get; set; }

Property Value

        Type
        Description

        System.Int32

The maximum chart data count.

MostRecentStoreTimestamp

Declaration

public Nullable<DateTimeOffset> MostRecentStoreTimestamp { get; }

Property Value

        Type
        Description

        System.Nullable<System.DateTimeOffset>

OriginallyEnabled

Gets or sets whether or not this probe was originally enabled within the protocol. Some probes can become disabled when
attempting to start them. For example, the temperature probe might not be supported on all hardware and will thus become
disabled after its failed initialization. Thus, we need a separate variable (other than Enabled) to tell us whether the
probe was originally enabled. We use this value to calculate participation levels and also to restore the probe before
sharing it with others (e.g., since other people might have temperature hardware in their devices).

Declaration

public bool OriginallyEnabled { get; set; }

Property Value

        Type
        Description

        System.Boolean

Whether or not this probe was enabled the first time the protocol was started.

Protocol

Declaration

public Protocol Protocol { get; set; }

Property Value

        Type
        Description

        Protocol

RawParticipation

Declaration

protected abstract double RawParticipation { get; }

Property Value

        Type
        Description

        System.Double

Running

Declaration

public bool Running { get; }

Property Value

        Type
        Description

        System.Boolean

StartStopTimes

Gets a list of times at which the probe was started (tuple bool = True) and stopped (tuple bool = False). Only includes
those that have occurred within the protocol's participation horizon.

Declaration

public List<Tuple<bool, DateTime>> StartStopTimes { get; }

Property Value

        Type
        Description

        System.Collections.Generic.List<System.Tuple<System.Boolean, System.DateTime>>

The start stop times.

StoreData

Whether the Probe should store the data it collects. This might be turned off if the Probe is used to trigger
the ScriptProbe but the probed data are not needed.

Declaration

[OnOffUiProperty("Store Data:", true, 3)]
public bool StoreData { get; set; }

Property Value

        Type
        Description

        System.Boolean

true if store data; otherwise, false.

SubCaption

Declaration

public string SubCaption { get; }

Property Value

        Type
        Description

        System.String

SuccessfulHealthTestTimes

Gets the successful health test times. Only includes those that have occurred within the
protocol's participation horizon.

Declaration

public List<DateTime> SuccessfulHealthTestTimes { get; }

Property Value

        Type
        Description

        System.Collections.Generic.List<System.DateTime>

The successful health test times.

Methods

GetAll()

Declaration

public static List<Probe> GetAll()

Returns

        Type
        Description

        System.Collections.Generic.List<Probe>

GetChart()

Declaration

public SfChart GetChart()

Returns

        Type
        Description

        Syncfusion.SfChart.XForms.SfChart

GetChartDataPointFromDatum(Datum)

Declaration

protected abstract ChartDataPoint GetChartDataPointFromDatum(Datum datum)

Parameters

        Type
        Name
        Description

        Datum
        datum

Returns

        Type
        Description

        Syncfusion.SfChart.XForms.ChartDataPoint

GetChartPrimaryAxis()

Declaration

protected abstract ChartAxis GetChartPrimaryAxis()

Returns

        Type
        Description

        Syncfusion.SfChart.XForms.ChartAxis

GetChartSecondaryAxis()

Declaration

protected abstract RangeAxisBase GetChartSecondaryAxis()

Returns

        Type
        Description

        Syncfusion.SfChart.XForms.RangeAxisBase

GetChartSeries()

Declaration

protected abstract ChartSeries GetChartSeries()

Returns

        Type
        Description

        Syncfusion.SfChart.XForms.ChartSeries

GetParticipation()

Gets the participation level for the current probe. If this probe was originally enabled within the protocol, then
this will be a value between 0 and 1, with 1 indicating perfect participation and 0 indicating no participation. If
this probe was not originally enabled within the protocol, then the returned value will be null, indicating that this
probe should not be included in calculations of overall protocol participation. Probes can become disabled if they
are not supported on the current device or if the user refuses to initialize them (e.g., by not signing into Facebook).
Although they become disabled, they were originally enabled within the protocol and participation should reflect this.
Lastly, this will return null if the probe is not storing its data, as might be the case if a probe is enabled in order
to trigger scripts but not told to store its data.

Declaration

public Nullable<double> GetParticipation()

Returns

        Type
        Description

        System.Nullable<System.Double>

The participation level (null, or somewhere 0-1).

Initialize()

Initializes this probe. Throws an exception if initialization fails. After successful completion the probe is considered to be
running and a candidate for stopping at some future point.

Declaration

protected virtual void Initialize()

InternalStart()

Throws an exception if start fails. Should be called first within child-class overrides. This should only be called within Start. This setup
allows for child-class overrides, but since InternalStart is protected, it cannot be called from the outside. Outsiders only have access to
Start (perhaps via Enabled), which takes care of any exceptions arising from the entire chain of InternalStart overrides.

Declaration

protected virtual void InternalStart()

Reset()

Declaration

public virtual void Reset()

Restart()

Declaration

public void Restart()

Start()

Start this instance, throwing an exception if anything goes wrong. If an exception is thrown, the caller can assume that any relevant
information will have already been logged and displayed. Thus, the caller doesn't need to do anything with the exception information.

Declaration

public void Start()

StartAsync()

Declaration

protected void StartAsync()

Stop()

Should be called first within child-class overrides.

Declaration

public virtual void Stop()

StopAsync()

Declaration

protected void StopAsync()

StoreDatumAsync(Datum, Nullable<CancellationToken>)

Stores a Datum within the System.LocalDataStore. Will not throw an System.Exception.

Declaration

public virtual Task<bool> StoreDatumAsync(Datum datum, Nullable<CancellationToken> cancellationToken)

Parameters

        Type
        Name
        Description

        Datum
        datum

Datum.

        System.Nullable<System.Threading.CancellationToken>
        cancellationToken

Cancellation token.

Returns

        Type
        Description

        System.Threading.Tasks.Task<System.Boolean>

The datum async.

TestHealth(ref List<Tuple<String, Dictionary<String, String>>>)

Declaration

public virtual bool TestHealth(ref List<Tuple<string, Dictionary<string, string>>> events)

Parameters

        Type
        Name
        Description

        System.Collections.Generic.List<System.Tuple<System.String, System.Collections.Generic.Dictionary<System.String, System.String>>>
        events

Returns

        Type
        Description

        System.Boolean

Events

MostRecentDatumChanged

Fired when the most recently sensed datum is changed, regardless of whether the datum was stored.

Declaration

public event EventHandler<Tuple<Datum, Datum>> MostRecentDatumChanged

Event Type

        Type
        Description

        System.EventHandler<System.Tuple<Datum, Datum>>

PropertyChanged

Declaration

public event PropertyChangedEventHandler PropertyChanged

Event Type

        Type
        Description

        System.ComponentModel.PropertyChangedEventHandler

Implements

      System.ComponentModel.INotifyPropertyChanged

              Back to top

            Copyright © 2014-2018 University of Virginia
Generated by DocFX


text:
	  	      <form role="form">

Company Registration

					        Company Name
					        <input type="text" class="form-control" id="Text1" placeholder="Company Name" ng-model="name">

{{message}}

					    <input type="submit" class="btn btn-primary" style="float:right;" ng-click="registerCompany(name)" ng-disabled="!validate(name) || name === undefined" value="Register Company"></input>
					    <button type="submit" class="btn btn-default" style="float:right;" ng-click="back()">Back</button>

                </form>

	  			<form role="form" name="passwordForm">

Registration

					        Name
					        <input type="text" class="form-control" id="txtEmail" placeholder="Name" ng-model="name">

					        Surname
					        <input type="text" class="form-control" id="txtPassword" placeholder="Surname" ng-model="surname">

					        Username
					        <input type="text" class="form-control" id="Password1" placeholder="Username" ng-model="username">

					        Email
					        <input type="text" class="form-control" id="txtPasswordConfirm" placeholder="Email" ng-model="email">

					        Password
					        <input type="password" class="form-control" id="txtPassword" placeholder="Password" ng-model="password" name="password" password-strength="password">

                            This password is {{strength}} !

					        Confirm Password
					        <input type="password" class="form-control" id="txtConfirmPassword" placeholder="Confirm Password" ng-model="confirmPassword">

{{message}}

					<input type="submit" class="btn btn-primary" style="float:right;" value="Register" ng-click="registerAdminUser(name, surname, username, email, password, confirmPassword)" ng-disabled="!validate(name) ||
                                                                                !validate(surname) ||
                                                                                !validate(username) ||
                                                                                !validate(email) ||
                                                                                !validate(password) ||
                                                                                !validate(confirmPassword) ||
                                                                                name === undefined ||
                                                                                surname === undefined ||
                                                                                username === undefined ||
                                                                                email === undefined ||
                                                                                password === undefined ||
                                                                                confirmPassword === undefined"></input>
					<button type="submit" class="btn btn-default" style="float:right;" ng-click="back()">Back</button>

                </form>


text:
/**
 * Expects an input with three names (first, middle, last)
 * and returns the full name with an abbreviated middle initial, properly capitalized.
 * eg. 'Leslie Barbara Knope' should return 'Leslie B. Knope'
 * eg. 'ann meredith perkeins' should return 'Ann M. Perkins'
 *
 * @param {String} name
 * @return {String}
 */

function abbreviateMiddleName (name) {
  if((/[^a-z|A-Z| ]/g).test(name) === false) {
    if (typeof(name) === "string") {
      let f = name.split(" ");
      if (f.length > 2) {
        let first = f[0].split("");
        let middle = f[1].split("")[0].toUpperCase();
        let last = f[2].split("");
        first[0] = first[0].toUpperCase();
        last[0] = last[0].toUpperCase();
        return first.join("") + " " + middle + "." + " " + last.join("");
      }
      else throw new Error("Argument is less than 2 words");
    }
    else throw Error("Argument is not a string");
  }
  else throw new Error("Argument has non alphabet character");
}

module.exports = abbreviateMiddleName;


text:
package com.vladsch.md.nav.parser.api;

import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.vladsch.md.nav.psi.util.TextMapElementType;
import com.vladsch.md.nav.psi.util.TextMapMatch;
import com.vladsch.md.nav.settings.MdRenderingProfile;
import com.vladsch.md.nav.util.MdExtensions;
import com.vladsch.md.nav.util.Want;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.Map;

public interface MdLinkMapProvider {
    ExtensionPointName<MdLinkMapProvider> EP_NAME = ExtensionPointName.create("com.vladsch.idea.multimarkdown.linkMapProvider");
    MdExtensions<MdLinkMapProvider> EXTENSIONS = new MdExtensions<>(EP_NAME, new MdLinkMapProvider[0]);

    @Nullable
    String mapRefLink(@NotNull String referenceId, @NotNull MdRenderingProfile renderingProfile);

    @Nullable
    String mapLinkRef(@NotNull String linkRef, @NotNull MdRenderingProfile renderingProfile);

    @Nullable
    String mapLinkText(@NotNull String linkText, @NotNull MdRenderingProfile renderingProfile);

    @Nullable
    String mapFileRef(@NotNull TextMapElementType elementType, @NotNull String text, MdRenderingProfile renderingProfile);

    @Nullable
    ArrayList<TextMapMatch> getMatchList(@NotNull TextMapElementType textMapElementType, @NotNull String referenceableText, @NotNull MdRenderingProfile renderingProfile);

    @Nullable
    Boolean getOpenRemoteLinks(@NotNull MdRenderingProfile renderingProfile);

    @Nullable
    String mapTargetFilePath(@NotNull Project project, @NotNull VirtualFile file);

    @Nullable
    Want.Options.Remotes getRemoteFormat(@NotNull MdRenderingProfile renderingProfile);

    @Nullable
    Want.Options.Locals getLocalFormat(@NotNull MdRenderingProfile renderingProfile);

    @Nullable
    Boolean showUnresolvedLinkRefs(@NotNull MdRenderingProfile renderingProfile);

    @Nullable
    Boolean getIncludeDirsInCompletion(@Nullable MdRenderingProfile renderingProfile);

    @Nullable
    Map<String, String> getLinkExclusionMap(@Nullable MdRenderingProfile renderingProfile);
}


text:
    <ba-card cardTitle="Formulario creación entrada" baCardClass="with-scroll">

    Vigencia
    <input type="text" class="form-control" id="input05" placeholder="" value = 2017 disabled>

    Observaciones
    <textarea placeholder="Observaciones de la entrada" class="form-control" id="textarea01"></textarea>

            <ba-file-uploader [fileUploaderOptions]="fileUploaderOptions"></ba-file-uploader>

  Acta de Recibido
  <select class="form-control" id="exampleSelect1">
    <option>Acta 1</option>
    <option>Acta 2</option>
    <option>Acta 3</option>
    <option>Acta 4</option>
    <option>Acta 5</option>
  </select>

    </ba-card>

     <ba-card cardTitle="Acta Recibido Seleccionada" baCardClass="with-scroll">

    Número
    <input type="text" class="form-control" id="input05" placeholder="" value = 1 disabled>

    Vigencia
    <input type="text" class="form-control" id="input05" placeholder="" value = 2017 disabled>

    Fecha recibido acta
    <input type="text" class="form-control" id="input05" placeholder="" value = "Agosto 01/2017" disabled>

    Revisor
    <input type="text" class="form-control" id="input05" placeholder="" value = "Camilo Torres" disabled>

    Sede donde se recibió
    <input type="text" class="form-control" id="input05" placeholder="" value = "Facultad de Ingeniería" disabled>

    Observaciones
    <input type="text" class="form-control" id="input05" placeholder="" value = "Observaciones observadas observadamente" disabled>

    Contrato número
    <input type="text" class="form-control" id="input05" placeholder="" value = "1 - 2017" disabled>

      </ba-card>


text:
FROM ubuntu:latest
MAINTAINER 583114@bah.com

#Install necessary software
RUN apt-get update && apt-get install -y apt-utils
RUN apt-get update && \
    apt-get install -y wget supervisor dnsutils curl jq net-tools
RUN apt-get update && \
    apt-get install -y default-jdk
RUN apt-get update && \
    apt-get install -y vim
RUN apt-get update && \
    apt-get install -y nano && \
	apt-get clean

##install docker
#RUN apt-get install -y apt-transport-https ca-certificates
#RUN apt-key adv \
#  --keyserver hkp://ha.pool.sks-keyservers.net:80 \
#  --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
#RUN echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | tee /etc/apt/sources.list.d/docker.list
#RUN apt-get update && apt-get install -y docker docker-engine
#RUN apt-cache policy docker-engine
##RUN apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
#RUN service docker start

#Add files
ADD jpo-ode-svcs/target/jpo-ode-svcs-0.0.1-SNAPSHOT.jar /home
ADD docker/start-ode.sh /usr/bin/start-ode.sh
ADD jpo-ode-svcs/src/main/resources/application.properties /home
ADD jpo-ode-svcs/src/main/resources/logback.xml /home

#Change permissions and run scripts
RUN chmod a+x /usr/bin/start-ode.sh

# Use "exec" form so that it runs as PID 1 (useful for graceful shutdown)
#CMD bash -c 'start-kafka.sh & ; start-ode.sh'
CMD bash -c 'start-ode.sh'


text:
package VMOMI::UncustomizableGuest;
use parent 'VMOMI::CustomizationFault';

use strict;
use warnings;

our @class_ancestors = (
    'CustomizationFault',
    'VimFault',
    'MethodFault',
);

our @class_members = (
    ['uncustomizableGuestOS', undef, 0, ],
);

sub get_class_ancestors {
    return @class_ancestors;
}

sub get_class_members {
    my $class = shift;
    my @super_members = $class->SUPER::get_class_members();
    return (@super_members, @class_members);
}

1;


text:
package com.collective.celos;

import junit.framework.Assert;
import org.junit.Test;

import java.net.URISyntaxException;

/**
 * Created by akonopko on 09.12.14.
 */
public class AugmentedHdfsPathTest {

    @Test
    public void testAugmentedHdfsPath() throws URISyntaxException {
        Assert.assertEquals(Util.augmentHdfsPath("/myprefix", "/originalPath/${var1}/path/${var2}"), "/myprefix/originalPath/${var1}/path/${var2}");
        Assert.assertEquals(Util.augmentHdfsPath("/myprefix", "hdfs:/originalPath/${var1}/path/${var2}"), "hdfs:/myprefix/originalPath/${var1}/path/${var2}");
        Assert.assertEquals(Util.augmentHdfsPath("/myprefix", "hdfs:///originalPath/${var1}/path/${var2}"), "hdfs:///myprefix/originalPath/${var1}/path/${var2}");
        Assert.assertEquals(Util.augmentHdfsPath("/myprefix", "hdfs://nameservice/originalPath/${var1}/path/${var2}"), "hdfs://nameservice/myprefix/originalPath/${var1}/path/${var2}");
        Assert.assertEquals(Util.augmentHdfsPath("/myprefix", "hdfs://nameservice:2345/originalPath/${var1}/path/${var2}"), "hdfs://nameservice:2345/myprefix/originalPath/${var1}/path/${var2}");

        Assert.assertEquals(Util.augmentHdfsPath("/", "/originalPath/${var1}/path/${var2}"), "/originalPath/${var1}/path/${var2}");
        Assert.assertEquals(Util.augmentHdfsPath("/", "hdfs:/originalPath/${var1}/path/${var2}"), "hdfs:/originalPath/${var1}/path/${var2}");
        Assert.assertEquals(Util.augmentHdfsPath("/", "hdfs:///originalPath/${var1}/path/${var2}"), "hdfs:///originalPath/${var1}/path/${var2}");
        Assert.assertEquals(Util.augmentHdfsPath("/", "hdfs://nameservice/originalPath/${var1}/path/${var2}"), "hdfs://nameservice/originalPath/${var1}/path/${var2}");
        Assert.assertEquals(Util.augmentHdfsPath("/", "hdfs://nameservice:2345/originalPath/${var1}/path/${var2}"), "hdfs://nameservice:2345/originalPath/${var1}/path/${var2}");
    }

}


text:
package br.edu.utfpr.recominer.metric.network;

import br.edu.utfpr.recominer.model.Commenter;
import edu.uci.ics.jung.graph.Graph;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Rodrigo T. Kuroda <rodrigokuroda at alunos.utfpr.edu.br>
 * @param <V> vertice type
 * @param <E> edge type
 */
public class Network<V, E> {

    private final Graph<V, E> network;
    private final Map<V, Integer> edgesWeigth;
    private final List<Commenter> commenters;

    public Network(Graph<V, E> network, Map<V, Integer> edgesWeigth, List<Commenter> commenters) {
        this.network = network;
        this.edgesWeigth = edgesWeigth;
        this.commenters = commenters;
    }

    public Graph<V, E> getNetwork() {
        return network;
    }

    public Map<V, Integer> getEdgesWeigth() {
        return Collections.unmodifiableMap(edgesWeigth);
    }

    public List<Commenter> getCommenters() {
        return commenters;
    }

}


text:
@ echo off
REM --------------------------------------
REM installing EYE in C:\Program Files\eye
REM --------------------------------------
if not exist "C:\Program Files\eye\src" mkdir "C:\Program Files\eye\src"
copy /Y "%~dp0eye.pl" "C:\Program Files\eye\src"
if not exist "C:\Program Files\eye\lib" mkdir "C:\Program Files\eye\lib"
pushd "C:\Program Files\eye\lib"
swipl -q -f ../src/eye.pl -g main -- --image eye.pvm
popd
if not exist "C:\Program Files\eye\bin" mkdir "C:\Program Files\eye\bin"
copy /Y "%~dp0eye.cmd" "C:\Program Files\eye\bin"


text:
Create client object

```
import wda

client = wda.Client('http://10.0.0.1:8100')
client.status()

se = client.session('com.example.demo')
se.tap(150, 150) # alias
se.click(150, 150) # alias of tap
se.long_tap(150, 150) # also long_click
se.swipe(50, 60, 70, 80, step=10)

se.screenshot(filename=None) # return PIL object
se(className='Button', text='update').click()
se(text='update').exists # return bool
se(className='Button').count # return number
se(className='EditText').set_text("hello") # input something
se.close()
```


text:
static NSString *str_sequeID_DetailViewController = @"showDetail";
//static NSString *str_sequeID_DetailViewController = @"showResponse";

static NSString * const		  test_routeID   = @"71";
static NSString * const		  test_stopID    = @"2021";
static CLLocationCoordinate2D test_location  = { +42.373600, -71.118962 };

static NSUInteger	sSection_gets	  = 0;
static NSUInteger	sSection_requests = 1;

// ----------------------------------------------------------------------
#pragma mark -
// ----------------------------------------------------------------------

@interface MasterViewController ()
@property (strong, nonatomic) ApiRoutes					*routes;
@property (strong, nonatomic) ApiRoute					*route71;
@property (strong, nonatomic) ApiRoutesByStop			*routesByStop;
@property (strong, nonatomic) ApiStopsByRoute			*stopsByRoute;
@property (strong, nonatomic) ApiStopsByLocation		*stopsByLocation;

@property (strong, nonatomic) ApiTimeRequest			*timeRequest;
@property (strong, nonatomic) ApiRoutesRequest			*routesRequest;
@property (strong, nonatomic) ApiRoutesByStopRequest	*routesByStopRequest;
@property (strong, nonatomic) ApiStopsByRouteRequest	*stopsByRouteRequest;
@property (strong, nonatomic) ApiStopsByLocationRequest	*stopsByLocationRequest;
@end

// ----------------------------------------------------------------------
#pragma mark -
// ----------------------------------------------------------------------

@implementation MasterViewController

// ----------------------------------------------------------------------
//#pragma mark -
// ----------------------------------------------------------------------

//	http://realtime.mbta.com/developer/api/v2/servertime?api_key=<myKey>&format=[json/xml]
- (void)get_servertime {
	@weakify(self)
	[ApiTime get_success:^(ApiTime *servertime) {
		MyLog(@"\n\n%s servertime = %@\n\n", __FUNCTION__, servertime);
		@strongify(self)
		[self show_success:servertime verb:verb_servertime section:sSection_gets];
	} failure:^(NSError *error) {
		NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
		@strongify(self)
		[self show_failure_verb:verb_servertime section:sSection_gets];
	}];
}

- (void)request_servertime {
	if (self.timeRequest == nil)
		self.timeRequest = [[ApiTimeRequest alloc] init];
	@weakify(self)
	[self.timeRequest refresh_success:^(ApiRequest *request) {
		ApiData *time = [request response];
		ApiTime *servertime = (ApiTime *)time;
		MyLog(@"\n\n%s servertime = %@\n\n", __FUNCTION__, servertime);
		@strongify(self)
		[self show_success:servertime verb:verb_servertime section:sSection_requests];
	} failure:^(NSError *error) {
		NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
		@strongify(self)
		[self show_failure_verb:verb_servertime section:sSection_requests];
	}];
}

// ----------------------------------------------------------------------
//	http://realtime.mbta.com/developer/api/v2/routes?api_key=<myKey>&format=[json/xml]
- (void)get_routes {
	@weakify(self)
	[ApiRoutes get_success:^(ApiRoutes *routes) {
		MyLog(@"\n\n%s routes = %@\n\n", __FUNCTION__, routes);

		self.routes = routes;

		// enable table row(s) that require 'self.routes'
		NSIndexPath *indexPath = [NSIndexPath indexPathForRow:e_verb_stopsbyroute inSection:sSection_gets];
		// either gets existing cell directly from cache
		// or creates new one via call to our '-tableView:cellForRowAtIndexPath:'
		UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
		if (cell) {
			cell.userInteractionEnabled = cell.textLabel.enabled = cell.detailTextLabel.enabled = YES;
		}

		@strongify(self)
		[self show_success:routes verb:verb_routes section:sSection_gets];
	} failure:^(NSError *error) {
		NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
		@strongify(self)
		[self show_failure_verb:verb_routes section:sSection_gets];
	}];
}
- (void)update_routes {
	if (self.routes) {
		@weakify(self)
		[self.routes update_success:^(ApiRoutes *routes) {
			MyLog(@"\n\n%s routes = %@\n\n", __FUNCTION__, routes);
			@strongify(self)
			[self show_success:routes verb:verb_routes section:sSection_gets];
		} failure:^(NSError *error) {
			NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
			@strongify(self)
			[self show_failure_verb:verb_routes section:sSection_gets];
		}];
	}
	else
		[self show_failure_verb:verb_routes section:sSection_gets];
}

- (void)request_routes {
	if (self.routesRequest == nil)
		self.routesRequest = [[ApiRoutesRequest alloc] init];
	@weakify(self)
	[self.routesRequest refresh_success:^(ApiRequest *request) {
		ApiRoutes *routes = (ApiRoutes *)[request response];
		@strongify(self)
		[self show_success:routes verb:verb_routes section:sSection_requests];
	} failure:^(NSError *error) {
		NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
		@strongify(self)
		[self show_failure_verb:verb_routes section:sSection_requests];
	}];
}

// ----------------------------------------------------------------------
- (void)get_routesbystop {
	@weakify(self)
	[ApiRoutesByStop get4stop:test_stopID success:^(ApiRoutesByStop *routes) {
		MyLog(@"\n\n%s routes = %@\n\n", __FUNCTION__, routes);

		self.routesByStop = routes;

		@strongify(self)
		[self show_success:routes verb:verb_routesbystop section:sSection_gets];
	} failure:^(NSError *error) {
		NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
		@strongify(self)
		[self show_failure_verb:verb_routesbystop section:sSection_gets];
	}];
}
- (void)update_routesbystop {
	if (self.routesByStop) {
		@weakify(self)
		[self.routesByStop update_success:^(ApiRoutesByStop *routes) {
			MyLog(@"\n\n%s routesbystop = %@\n\n", __FUNCTION__, routes);
			@strongify(self)
			[self show_success:routes verb:verb_routesbystop section:sSection_gets];
		} failure:^(NSError *error) {
			NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
			@strongify(self)
			[self show_failure_verb:verb_routesbystop section:sSection_gets];
		}];
	}
	else
		[self show_failure_verb:verb_routesbystop section:sSection_gets];
}

- (void)request_routesbystop {
	if (self.routesByStopRequest == nil)
		self.routesByStopRequest = [[ApiRoutesByStopRequest alloc] init4stop:test_stopID];
	@weakify(self)
	[self.routesByStopRequest refresh_success:^(ApiRequest *request) {
		ApiRoutesByStop *routes = (ApiRoutesByStop *)[request response];
		@strongify(self)
		[self show_success:routes verb:verb_routesbystop section:sSection_requests];
	} failure:^(NSError *error) {
		NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
		@strongify(self)
		[self show_failure_verb:verb_routesbystop section:sSection_requests];
	}];
}

// ----------------------------------------------------------------------
- (void)get_stopsbyroute {
#if CONFIG_stops_update_route
	if (self.routes) {

		sRoute71 = [self.routes routeByID:test_routeID];

		if (sRoute71) {
			@weakify(self)
			[sRoute71 addStops_success:^(ApiRoute *route) {
				MyLog(@"\n\n%s route 71 => %@\n\n", __FUNCTION__, sRoute71);
				@strongify(self)
				[self show_success:sRoute71 verb:verb_stopsbyroute section:sSection_gets];
			} failure:^(NSError *error) {
				NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
				@strongify(self)
				[self show_failure_verb:verb_stopsbyroute section:sSection_gets];
			}];
		}
		else
			[self show_failure_verb:verb_stopsbyroute section:sSection_gets];
	}
	else
		[self show_failure_verb:verb_stopsbyroute];
#else
	@weakify(self)
	[ApiStopsByRoute get4route:test_routeID success:^(ApiStopsByRoute *stops) {
		MyLog(@"\n\n%s stops = %@\n\n", __FUNCTION__, stops);

		self.stopsByRoute = stops;

		@strongify(self)
		[self show_success:stops verb:verb_stopsbyroute section:sSection_gets];
	} failure:^(NSError *error) {
		NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
		@strongify(self)
		[self show_failure_verb:verb_stopsbyroute section:sSection_gets];
	}];
#endif
}
- (void)update_stopsbyroute {
#if CONFIG_stops_update_route
	if (sRoute71) {
#warning TODO
		@weakify(self)
		[sRoute71 updateStops_success:^(ApiRoute *route) {
			@strongify(self)
			[self show_success:route verb:verb_stopsbyroute section:sSection_gets];
		} failure:^(NSError *error) {
			NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
			@strongify(self)
			[self show_failure_verb:verb_stopsbyroute section:sSection_gets];
		}];
	}
	else
		[self show_failure_verb:verb_stopsbyroute];
#else
	if (self.stopsByRoute) {
		@weakify(self)
		[self.stopsByRoute update_success:^(ApiStopsByRoute *stops) {
			MyLog(@"\n\n%s stops = %@\n\n", __FUNCTION__, stops);
			@strongify(self)
			[self show_success:stops verb:verb_stopsbyroute section:sSection_gets];
		} failure:^(NSError *error) {
			NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
			@strongify(self)
			[self show_failure_verb:verb_stopsbyroute section:sSection_gets];
		}];
	}
	else
		[self show_failure_verb:verb_stopsbyroute section:sSection_gets];
#endif
}

- (void)request_stopsbyroute {
#if CONFIG_stops_update_route
	// no request object; call is made directly on the ApiRoute object
#else
	if (self.stopsByRouteRequest == nil)
		self.stopsByRouteRequest = [[ApiStopsByRouteRequest alloc] init4route:test_routeID];
	@weakify(self)
	[self.stopsByRouteRequest refresh_success:^(ApiRequest *request) {
		ApiStopsByRoute *stops = (ApiStopsByRoute *)[request response];
		@strongify(self)
		[self show_success:stops verb:verb_stopsbyroute section:sSection_requests];
	} failure:^(NSError *error) {
		NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
		@strongify(self)
		[self show_failure_verb:verb_routesbystop section:sSection_requests];
	}];
#endif
}

// ----------------------------------------------------------------------
- (void)get_stopsbylocation {
	@weakify(self)
	[ApiStopsByLocation get4location:test_location success:^(ApiStopsByLocation *stops) {
		MyLog(@"\n\n%s stops = %@\n\n", __FUNCTION__, stops);

		self.stopsByLocation = stops;

		@strongify(self)
		[self show_success:stops verb:verb_stopsbylocation section:sSection_gets];
	} failure:^(NSError *error) {
		NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
		@strongify(self)
		[self show_failure_verb:verb_stopsbylocation section:sSection_gets];
	}];
}
// a real app would never 'update' an existing stops-by-location object
// as a user's location is infinitely variable in two dimensions
- (void)update_stopsbylocation {
	if (self.stopsByLocation) {
		@weakify(self)
		[self.stopsByLocation update_success:^(ApiStopsByLocation *stops) {
			MyLog(@"\n\n%s stops = %@\n\n", __FUNCTION__, stops);
			@strongify(self)
			[self show_success:stops verb:verb_stopsbylocation section:sSection_gets];
		} failure:^(NSError *error) {
			NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
			@strongify(self)
			[self show_failure_verb:verb_stopsbylocation section:sSection_gets];
		}];
	}
	else
		[self show_failure_verb:verb_stopsbylocation section:sSection_gets];
}

- (void)request_stopsbylocation {
	if (self.stopsByLocationRequest == nil)
		self.stopsByLocationRequest = [[ApiStopsByLocationRequest alloc] init4location:test_location];
	@weakify(self)
	[self.stopsByLocationRequest refresh_success:^(ApiRequest *request) {
		ApiStopsByLocation *stops = (ApiStopsByLocation *)[request response];
		@strongify(self)
		[self show_success:stops verb:verb_stopsbylocation section:sSection_requests];
	} failure:^(NSError *error) {
		NSLog(@"\n\n%s %@", __FUNCTION__, [error localizedDescription]);
		@strongify(self)
		[self show_failure_verb:verb_stopsbylocation section:sSection_requests];
	}];
}

// ----------------------------------------------------------------------
#pragma mark -
// ----------------------------------------------------------------------

- (void)awakeFromNib {
	[super awakeFromNib];
}

- (void)viewDidLoad {
	[super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
	[super didReceiveMemoryWarning];
	// Dispose of any resources that can be recreated.
}

- (void)dealloc {
	// in case someday this VC is not the only one in this app
	// cancel any '-performSelector:' calls before we go away
	[NSObject cancelPreviousPerformRequestsWithTarget:self];
}

// ----------------------------------------------------------------------
#pragma mark - Segues
// ----------------------------------------------------------------------

- (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
	return NO;
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
	if ([[segue identifier] isEqualToString:@"showDetail"]) {
//	    NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
		NSDate *object = [NSDate date];
	    [[segue destinationViewController] setDetailItem:object];
	}
}

// ----------------------------------------------------------------------
#pragma mark - UITableViewDataSource
// ----------------------------------------------------------------------
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
	return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
	return [ServiceMBTA verbCount];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];

	NSString *text = [ServiceMBTA verbForIndex:indexPath.row];

	BOOL enabled = NO;
	switch (indexPath.row) {
		case e_verb_servertime:
		case e_verb_routes:
		case e_verb_routesbystop:
		case e_verb_stopsbylocation:
			enabled = YES;
			break;
		case e_verb_stopsbyroute:
#if CONFIG_stops_update_route
			enabled = (self.routes != nil && indexPath.section == 0); // only ever enabled for 'gets'
#else
			enabled = (indexPath.section == 1);
#endif
			break;
		default:
			break;
	}
	cell.userInteractionEnabled = cell.textLabel.enabled = cell.detailTextLabel.enabled = enabled;

	cell.textLabel.text = text;
	cell.detailTextLabel.text = @"idle";

	UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
	spinner.hidesWhenStopped = YES;
	[cell setAccessoryView:spinner];

//	cell.selectionStyle = UITableViewCellSelectionStyleNone;

	return cell;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
	NSString *result = @"???";
	switch (section) {
		case 0:
			result = @"get data (no caching)";
			break;
		case 1:
			result = @"request data (with caching)";
			break;
		default:
			break;
	}
	return result;
}

// ----------------------------------------------------------------------
#pragma mark - UITableViewDelegate
// ----------------------------------------------------------------------

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

	UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
	// clear selection on table cell with animation delay
	// (if we don't call 'cell.selectionStyle = UITableViewCellSelectionStyleNone' above)
	[cell setSelected:NO animated:YES];

	UIActivityIndicatorView *spinner = nil;
	UIView *accessoryView = cell.accessoryView;
	if ([accessoryView isKindOfClass:[UIActivityIndicatorView class]]) {
		spinner = (UIActivityIndicatorView *)accessoryView;
		[spinner startAnimating];
	}
	cell.detailTextLabel.text = @"requesting ...";

	if (indexPath.section == 0) {
		switch (indexPath.row) {

			case e_verb_servertime:
				[self get_servertime];
				break;

			case e_verb_routes:
				if (self.routes == nil)
					[self get_routes];
				else
					[self update_routes];
				break;

			case e_verb_routesbystop:
				if (self.routesByStop == nil)
					[self get_routesbystop];
				else
					[self update_routesbystop];
				break;

			case e_verb_stopsbyroute:
				if (self.routes) {
#if CONFIG_stops_update_route
					if (sRoute71 == nil)
						[self get_stopsbyroute];
					else
						[self update_stopsbyroute];
#else
					if (self.stopsByRoute == nil)
						[self get_stopsbyroute];
					else
						[self update_stopsbyroute];
#endif
				}
				else { // stop spinner, reset cell to pre-request state
					[spinner stopAnimating];
					cell.detailTextLabel.text = @"idle";
				}
				break;
			case e_verb_stopsbylocation:
				if (self.stopsByLocation == nil) {
					[self get_stopsbylocation];
				}
				else
					// but see comment above on this method
					[self update_stopsbylocation];
				break;

			default:
				[spinner stopAnimating];
				cell.detailTextLabel.text = @"idle";
				break;
		}
	}
	else if (indexPath.section == 1) {
		switch (indexPath.row) {
			case e_verb_servertime:
				[self request_servertime];
				break;
			case e_verb_routes:
				[self request_routes];
				break;
			case e_verb_routesbystop:
				[self request_routesbystop];
				break;
			case e_verb_stopsbyroute:
				[self request_stopsbyroute];
				break;
			case e_verb_stopsbylocation:
				[self request_stopsbylocation];
				break;
			default:
				[spinner stopAnimating];
				cell.detailTextLabel.text = @"idle";
				break;
		}
	}
}

// ----------------------------------------------------------------------
#pragma mark - show success/failure
// ----------------------------------------------------------------------

- (void)show_success:(ApiData *)data verb:(NSString *)verb section:(NSUInteger)section {
	NSString *text = nil;

	NSUInteger index = [ServiceMBTA indexForVerb:verb];
	switch (index) {
		case e_verb_servertime: {
			ApiTime *servertime = (ApiTime *)data;
			text = [NSString stringWithFormat:@"%@ => %@", verb, [servertime time]];
		}	break;
		case e_verb_routes: {
			ApiRoutes *routes = (ApiRoutes *)data;
			text = [NSString stringWithFormat:@"%@ => %@", verb, [self routes_in_modes:routes.modes]];
		}	break;
		case e_verb_routesbystop: {
			ApiRoutesByStop *routes = (ApiRoutesByStop *)data;
			text = [NSString stringWithFormat:@"%@ => %@", verb, [self routes_in_modes:routes.modes]];
		}	break;
		case e_verb_stopsbyroute: {
#if CONFIG_stops_update_route
			ApiRoute *route71 = (ApiRoute *)data;
			text = [NSString stringWithFormat:@"%@ => %@", verb, [self stops_in_directions:route71.directions]];
#else
			ApiStopsByRoute *stops = (ApiStopsByRoute *)data;
			text = [NSString stringWithFormat:@"%@ => %@", verb, [self stops_in_directions:stops.directions]];
#endif
		}	break;
		case e_verb_stopsbylocation: {
			ApiStopsByLocation *stopsbylocation = (ApiStopsByLocation *)data;
			text = [NSString stringWithFormat:@"%@ => %@", verb, [self stops:stopsbylocation.stops near_location:stopsbylocation.location]];
		}	break;
		default:
			MyLog(@"%s NO CODE FOR VERB '%@'", __FUNCTION__, verb);
			text = @"NO CODE";
			break;
	}
	MyLog(@"%s shows '%@'", __FUNCTION__, text);

	if (text)
		[self setResponse:text forVerb:verb section:section];
}

- (void)show_failure_verb:(NSString *)verb section:(NSUInteger)section {
	NSString *text = [NSString stringWithFormat:@"%@ request failed", verb];
	[self setResponse:text forVerb:verb section:section];
}

// ----------------------------------------------------------------------
// return short string summarizing (sub)response to request
// ----------------------------------------------------------------------

// returns string "<num> routes in <num> modes"
- (NSString *)routes_in_modes:(NSArray *)modes {
	NSUInteger num_routes = 0;
	for (ApiRouteMode *mode in modes) {
		num_routes += [mode.routes count];
	}
	NSString *result = [NSString stringWithFormat:@"%i routes in %i modes", (int)num_routes, (int)[modes count]];
	return result;
}

// returns string "<num> stops in <num> directions"
- (NSString *)stops_in_directions:(NSArray *)directions {
	NSUInteger num_stops = 0;
	for (ApiRouteDirection *direction in directions) {
		num_stops += [direction.stops count];
	}
	NSString *result = [NSString stringWithFormat:@"%i stops in %i directions", (int)num_stops, (int)[directions count]];
	return result;
}

// returns string "<num> stops near <lat>, <lon> (lat,lon)"
- (NSString *)stops:(NSArray *)stops near_location:(CLLocationCoordinate2D)location {
	NSString *result = [NSString stringWithFormat:@"%i stops near %.3f, %.3f (lat,lon)", (int)[stops count], location.latitude, location.longitude];
	return result;
}

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

- (void)setResponse:(NSString *)text forVerb:(NSString *)verb section:(NSUInteger)section {
	if ([verb length]) {
		NSUInteger row = [ServiceMBTA indexForVerb:verb];
		if (row < [ServiceMBTA verbCount]) { // get NSNotFound for unknown verb
			NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section];
			UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];

			// flash cell briefly to indicate response has arrived
			[cell setSelected:YES animated:YES];
			[cell setSelected: NO animated:YES];

			// stop spinner
			UIView *accessoryView = cell.accessoryView;
			if ([accessoryView isKindOfClass:[UIActivityIndicatorView class]]) {
				UIActivityIndicatorView *spinner = (UIActivityIndicatorView *)accessoryView;
				[spinner stopAnimating];
			}

			// show success/failure (even empty text string)
//			if ([text length]) {
				cell.detailTextLabel.text = text;
//			}

			// cancel any previously posted 'reset' calls
			[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(resetForIndexPath:) object:indexPath];

			// now post new 'reset' for this row: after X seconds, reset to its original state
			[self performSelector:@selector(resetForIndexPath:) withObject:indexPath afterDelay:3.0];
		}
	}
}

- (void)resetForIndexPath:(NSIndexPath *)indexPath {
	NSUInteger row = indexPath.row;
	if (row < [ServiceMBTA verbCount]) { // get NSNotFound for unknown verb
		UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
		cell.detailTextLabel.text = @"idle";
	}
}

@end


text:
package uk.ac.ox.oucs.oxpoints.gaboto.entities;

import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;

import java.lang.reflect.Method;

import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

import net.sf.gaboto.GabotoSnapshot;

import net.sf.gaboto.node.GabotoEntity;

import net.sf.gaboto.node.annotation.PassiveProperty;
import net.sf.gaboto.node.annotation.SimpleLiteralProperty;

import net.sf.gaboto.node.pool.EntityPool;
import net.sf.gaboto.node.pool.PassiveEntitiesRequest;

import uk.ac.ox.oucs.oxpoints.gaboto.entities.OxpEntity;

/**
 * Gaboto generated Entity.
 * @see net.sf.gaboto.generation.GabotoGenerator
 */
public class Image extends OxpEntity {
  protected String width;
  protected String height;
  protected String title;
  protected String date;
  protected Float longitude;
  protected Float latitude;
  private Collection<OxpEntity> imageContents;

  private static Map<String, List<Method>> indirectPropertyLookupTable;
  static{
    indirectPropertyLookupTable = new HashMap<String, List<Method>>();
  }

  @Override
  public String getType(){
    return "http://xmlns.com/foaf/0.1/Image";
  }

  @SimpleLiteralProperty(
    value = "http://www.w3.org/2003/12/exif/ns#width",
    datatypeType = "javaprimitive",
    javaType = "String"
  )
  public String getWidth(){
    return this.width;
  }

  @SimpleLiteralProperty(
    value = "http://www.w3.org/2003/12/exif/ns#width",
    datatypeType = "javaprimitive",
    javaType = "String"
  )
  public void setWidth(String width){
    this.width = width;
  }

  @SimpleLiteralProperty(
    value = "http://www.w3.org/2003/12/exif/ns#height",
    datatypeType = "javaprimitive",
    javaType = "String"
  )
  public String getHeight(){
    return this.height;
  }

  @SimpleLiteralProperty(
    value = "http://www.w3.org/2003/12/exif/ns#height",
    datatypeType = "javaprimitive",
    javaType = "String"
  )
  public void setHeight(String height){
    this.height = height;
  }

  @SimpleLiteralProperty(
    value = "http://purl.org/dc/elements/1.1/title",
    datatypeType = "javaprimitive",
    javaType = "String"
  )
  public String getTitle(){
    return this.title;
  }

  @SimpleLiteralProperty(
    value = "http://purl.org/dc/elements/1.1/title",
    datatypeType = "javaprimitive",
    javaType = "String"
  )
  public void setTitle(String title){
    this.title = title;
  }

  @SimpleLiteralProperty(
    value = "http://purl.org/dc/elements/1.1/date",
    datatypeType = "javaprimitive",
    javaType = "String"
  )
  public String getDate(){
    return this.date;
  }

  @SimpleLiteralProperty(
    value = "http://purl.org/dc/elements/1.1/date",
    datatypeType = "javaprimitive",
    javaType = "String"
  )
  public void setDate(String date){
    this.date = date;
  }

  @SimpleLiteralProperty(
    value = "http://www.w3.org/2003/01/geo/wgs84_pos#long",
    datatypeType = "javaprimitive",
    javaType = "Float"
  )
  public Float getLongitude(){
    return this.longitude;
  }

  @SimpleLiteralProperty(
    value = "http://www.w3.org/2003/01/geo/wgs84_pos#long",
    datatypeType = "javaprimitive",
    javaType = "Float"
  )
  public void setLongitude(Float longitude){
    this.longitude = longitude;
  }

  @SimpleLiteralProperty(
    value = "http://www.w3.org/2003/01/geo/wgs84_pos#lat",
    datatypeType = "javaprimitive",
    javaType = "Float"
  )
  public Float getLatitude(){
    return this.latitude;
  }

  @SimpleLiteralProperty(
    value = "http://www.w3.org/2003/01/geo/wgs84_pos#lat",
    datatypeType = "javaprimitive",
    javaType = "Float"
  )
  public void setLatitude(Float latitude){
    this.latitude = latitude;
  }

  @PassiveProperty(
    uri = "http://xmlns.com/foaf/0.1/depiction",
    entity = "OxpEntity"
  )
  public Collection<OxpEntity> getImageContents(){
    if(! isPassiveEntitiesLoaded() )
      loadPassiveEntities();
    return this.imageContents;
  }

  @PassiveProperty(
    uri = "http://xmlns.com/foaf/0.1/depiction",
    entity = "OxpEntity"
  )
  private void setImageContents(Collection<OxpEntity> imageContents){
    this.imageContents = imageContents;
  }

  private void addImageContent(OxpEntity imageContentP){
    if(this.imageContents == null)
      setImageContents( new HashSet<OxpEntity>() );
    this.imageContents.add(imageContentP);
  }

  public Collection<PassiveEntitiesRequest> getPassiveEntitiesRequest(){
    Collection<PassiveEntitiesRequest> requests = super.getPassiveEntitiesRequest();
    if(requests == null)
      requests = new HashSet<PassiveEntitiesRequest>();
    requests.add(new PassiveEntitiesRequest(){
      public String getType() {
        return "http://ns.ox.ac.uk/namespace/oxpoints/2009/02/owl#OxpEntity";
      }

      public String getUri() {
        return "http://xmlns.com/foaf/0.1/depiction";
      }

      public int getCollectionType() {
        return EntityPool.PASSIVE_PROPERTY_COLLECTION_TYPE_BAG;
      }

      public void passiveEntityLoaded(GabotoEntity entity) {
        addImageContent((OxpEntity)entity);
      }
    });
    return requests;
  }

  public void loadFromSnapshot(Resource res, GabotoSnapshot snapshot, EntityPool pool) {
    super.loadFromSnapshot(res, snapshot, pool);
    Statement stmt;

    // Load SIMPLE_LITERAL_PROPERTY width
    stmt = res.getProperty(snapshot.getProperty("http://www.w3.org/2003/12/exif/ns#width"));
    if(stmt != null && stmt.getObject().isLiteral())
      this.setWidth(((Literal)stmt.getObject()).getString());

    // Load SIMPLE_LITERAL_PROPERTY height
    stmt = res.getProperty(snapshot.getProperty("http://www.w3.org/2003/12/exif/ns#height"));
    if(stmt != null && stmt.getObject().isLiteral())
      this.setHeight(((Literal)stmt.getObject()).getString());

    // Load SIMPLE_LITERAL_PROPERTY title
    stmt = res.getProperty(snapshot.getProperty("http://purl.org/dc/elements/1.1/title"));
    if(stmt != null && stmt.getObject().isLiteral())
      this.setTitle(((Literal)stmt.getObject()).getString());

    // Load SIMPLE_LITERAL_PROPERTY date
    stmt = res.getProperty(snapshot.getProperty("http://purl.org/dc/elements/1.1/date"));
    if(stmt != null && stmt.getObject().isLiteral())
      this.setDate(((Literal)stmt.getObject()).getString());

    // Load SIMPLE_LITERAL_PROPERTY longitude
    stmt = res.getProperty(snapshot.getProperty("http://www.w3.org/2003/01/geo/wgs84_pos#long"));
    if(stmt != null && stmt.getObject().isLiteral())
      this.setLongitude(((Literal)stmt.getObject()).getFloat());

    // Load SIMPLE_LITERAL_PROPERTY latitude
    stmt = res.getProperty(snapshot.getProperty("http://www.w3.org/2003/01/geo/wgs84_pos#lat"));
    if(stmt != null && stmt.getObject().isLiteral())
      this.setLatitude(((Literal)stmt.getObject()).getFloat());

  }
  protected List<Method> getIndirectMethodsForProperty(String propertyURI){
    List<Method> list = super.getIndirectMethodsForProperty(propertyURI);
    if(list == null)
      return indirectPropertyLookupTable.get(propertyURI);

    else{
      List<Method> tmp = indirectPropertyLookupTable.get(propertyURI);
      if(tmp != null)
        list.addAll(tmp);
    }
    return list;
  }

}


text:
package  com.agileEAP.workflow.service;

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

import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.agileEAP.utils.*;
import com.agileEAP.data.PageDataResult;
import com.agileEAP.workflow.entity.ProcessDef;
import com.agileEAP.workflow.repository.ProcessDefRepository;

/**
* 流程定义Service
*
* @author trh
*/
@Component
@Transactional
public class ProcessDefService {
    @Autowired
    private ProcessDefRepository processDefRepository;

    public ProcessDef get(String id) {
        return processDefRepository.get(id);
    }

    public List<ProcessDef> search(Map<String, Object> parameters) {
        return processDefRepository.search(parameters);
    }

    public PageDataResult searchByPage(Map<String, Object> parameters) {
        PageDataResult pageDataResult=new PageDataResult();
        pageDataResult.setTotal(processDefRepository.count(parameters));
        pageDataResult.setData(processDefRepository.searchByPage(parameters));

        return pageDataResult;
    }

    public void update(ProcessDef processDef) {
        processDefRepository.update(processDef);
    }

    void updateByWhere(ProcessDef processDef,Map<String, Object> parameters){
        processDefRepository.updateByWhere(processDef,parameters);
    }

    public void save(ProcessDef processDef) {
        processDefRepository.save(processDef);
    }

    public void delete(String id) {
        processDefRepository.delete(id);
    }

    public void saveOrUpdate(ProcessDef processDef) {
    	if(processDefRepository.get(processDef.getId())==null)
    	{
    		processDefRepository.save(processDef);
    	}
    	else
    	{
    		processDefRepository.update(processDef);
    	}
    }

    public void deleteByWhere(Map<String, Object> parameters) {
        processDefRepository.deleteByWhere(parameters);
    }

    public void batchDelete(List<String> ids) {
        processDefRepository.batchDelete(ids);
    }

}


text:
var injector = angular.injector(['ng', 'ladda']);
test('ladda test', function(){
    var scope = injector.get('$rootScope').$new(),
        $compile = injector.get('$compile'),
        element;
    scope.laddaLoading = true;
    element = angular.element('

');
    $compile(element)(scope);
    scope.$digest();
    ok(element.attr('ladda-button') === 'true');
});


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Blog - Business Casual - Start Bootstrap Theme</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/business-casual.css" rel="stylesheet">

    <link href="http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Josefin+Slab:100,300,400,600,700,100italic,300italic,400italic,600italic,700italic" rel="stylesheet" type="text/css">

Kazi Sabiha

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>

                Business Casual

                        About Me

                        Education

                        Interests

                        Skills

                        Resume

                        Contact

Skills

Some skills that come into play in my everyday life are:

-communicating clearly with others

-working well with team members

-listening and being able to follow instructions

-being able to think critically when solving problems

-working hard and always being on task

-displaying postive work ethic

Copyright © Your Website 2014


text:
osgpyplusplus
=============

Python bindings for OpenSceneGraph 3D graphics API, created using Boost.Python and Py++

There exist already two projects that provide python bindings for OpenSceneGraph: osgswig and osgboostpython.
So why am I trying to create yet another?

Currency: The competing project osgswig has not been updated for a couple of years (I'm writing in 2014). So
I created a fork of osgswig (elsewhere) here on github, and I modified osgswig to work with OpenSceneGraph
version 3.2.1. I also added support to osgswig for the osgVolume module. I learned enough about osgswig in
this process to convince me that I would prefer to work with bindings based on Boost.Python, rather than on
SWIG. So I created this osgpyplusplus project too.

Completeness: The other competing project, osgboostpython, contains impressive manually coded bindings
based on Boost.Python. I predict that osgboostpython will never be complete, because manually coding those
bindings is an overly ambitious goal. So I have chosen to use the Py++ code generator to automate the creation
of Boost.Python bindings for OpenSceneGraph. I am fortunate to have the osgboostpython project available,
to serve as a gold-standard touchstone for what these semi-automatically generated bindings should look like.

Control: I am maintaining an application (Neuroptikon) that depends critically on Python bindings for OpenSceneGraph.
I appreciate having both projects controlled by me, so I can improve them together, without necessarily needing to
negotiate features with others.

One special feature of these osgpyplusplus bindings is built-in API documentation. OpenSceneGraph
source code contains DOXYGEN comments to document the API. osgpyplusplus parses these comments, and
creates python docstrings, so they can be used for interactive API documentation. Further, these docstrings
are formatted so that python API documentation could be generated using the epydoc tool. The intention
is that the OpenSceneGraph python API documentation created with epydoc, would resemble the C++
documentation created with DOXYGEN.

The Janelia Farm Research Campus Software Copyright 1.1
Copyright (c) 2014, Howard Hughes Medical Institute, All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
  * Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer.
  * Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.
  * Neither the name of the Howard Hughes Medical Institute nor the names of
  its contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
REASONABLE ROYALTIES; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


text:
import { Component, Input, ViewChild } from '@angular/core';
import { Http, Response } from '@angular/http';
import { ScannerComponent } from './scanner/scanner.component';
import { ResultsComponent } from './results/results.component';
import { AttacksetComponent } from './attackset/attackset.component';

@Component({
  selector: 'body',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
  host: {
    "[class.dark-theme]": "darkMode",
    "[class.light-theme]": "!darkMode"
  },
})

export class AppComponent {

  @ViewChild(ScannerComponent)
  private scannerComponent: ScannerComponent;
  @ViewChild(ResultsComponent)
  private resultsComponent: ResultsComponent;
  @ViewChild(AttacksetComponent)
  private attacksetComponent: AttacksetComponent;

  constructor(private _http: Http) { }

  "darkMode": boolean = false;
  targetURL = 'http://127.0.0.1:8080';
  selectedIndex = 0;
  isLoading = false;

  runAttack() {
    this.scannerComponent.runAllSelected();
  }

  onSelect($event: any) {
    console.log($event);
    if (this.selectedIndex == 0) {
      this.attacksetComponent.getAttackset();
    }
    if (this.selectedIndex == 3) {
       this.resultsComponent.refresh();
    }
  }

  title = 'app';
}


text:
from akara.dist import setup

setup(name="missing",
      version="1.0",
)


text:
using System;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Complex;
using MathNet.Numerics.LinearAlgebra.Complex.Solvers;
using MathNet.Numerics.LinearAlgebra.Solvers;
using NUnit.Framework;

namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.Solvers.Iterative
{
#if NOSYSNUMERICS
    using Complex = Numerics.Complex;
#else
    using Complex = System.Numerics.Complex;

#endif

    /// <summary>
    /// Tests for Multiple-Lanczos Bi-Conjugate Gradient stabilized iterative matrix solver.
    /// </summary>
    [TestFixture, Category("LASolver")]
    public class MlkBiCgStabTest
    {
        /// <summary>
        /// Convergence boundary.
        /// </summary>
        const double ConvergenceBoundary = 1e-10;

        /// <summary>
        /// Maximum iterations.
        /// </summary>
        const int MaximumIterations = 1000;

        /// <summary>
        /// Solve wide matrix throws <c>ArgumentException</c>.
        /// </summary>
        [Test]
        public void SolveWideMatrixThrowsArgumentException()
        {
            var matrix = new SparseMatrix(2, 3);
            var input = new DenseVector(2);

            var solver = new MlkBiCgStab();
            Assert.That(() => matrix.SolveIterative(input, solver), Throws.ArgumentException);
        }

        /// <summary>
        /// Solve long matrix throws <c>ArgumentException</c>.
        /// </summary>
        [Test]
        public void SolveLongMatrixThrowsArgumentException()
        {
            var matrix = new SparseMatrix(3, 2);
            var input = new DenseVector(3);

            var solver = new MlkBiCgStab();
            Assert.That(() => matrix.SolveIterative(input, solver), Throws.ArgumentException);
        }

        /// <summary>
        /// Solve unit matrix and back multiply.
        /// </summary>
        [Test]
        public void SolveUnitMatrixAndBackMultiply()
        {
            // Create the identity matrix
            var matrix = SparseMatrix.CreateIdentity(100);

            // Create the y vector
            var y = Vector<Complex>.Build.Dense(matrix.RowCount, 1);

            // Create an iteration monitor which will keep track of iterative convergence
            var monitor = new Iterator<Complex>(
                new IterationCountStopCriterion<Complex>(MaximumIterations),
                new ResidualStopCriterion<Complex>(ConvergenceBoundary),
                new DivergenceStopCriterion<Complex>(),
                new FailureStopCriterion<Complex>());

            var solver = new MlkBiCgStab();

            // Solve equation Ax = y
            var x = matrix.SolveIterative(y, solver, monitor);

            // Now compare the results
            Assert.IsNotNull(x, "#02");
            Assert.AreEqual(y.Count, x.Count, "#03");

            // Back multiply the vector
            var z = matrix.Multiply(x);

            // Check that the solution converged
            Assert.IsTrue(monitor.Status == IterationStatus.Converged, "#04");

            // Now compare the vectors
            for (var i = 0; i < y.Count; i++)
            {
                Assert.GreaterOrEqual(ConvergenceBoundary, (y[i] - z[i]).Magnitude, "#05-" + i);
            }
        }

        /// <summary>
        /// Solve scaled unit matrix and back multiply.
        /// </summary>
        [Test]
        public void SolveScaledUnitMatrixAndBackMultiply()
        {
            // Create the identity matrix
            var matrix = SparseMatrix.CreateIdentity(100);

            // Scale it with a funny number
            matrix.Multiply(Math.PI, matrix);

            // Create the y vector
            var y = Vector<Complex>.Build.Dense(matrix.RowCount, 1);

            // Create an iteration monitor which will keep track of iterative convergence
            var monitor = new Iterator<Complex>(
                new IterationCountStopCriterion<Complex>(MaximumIterations),
                new ResidualStopCriterion<Complex>(ConvergenceBoundary),
                new DivergenceStopCriterion<Complex>(),
                new FailureStopCriterion<Complex>());

            var solver = new MlkBiCgStab();

            // Solve equation Ax = y
            var x = matrix.SolveIterative(y, solver, monitor);

            // Now compare the results
            Assert.IsNotNull(x, "#02");
            Assert.AreEqual(y.Count, x.Count, "#03");

            // Back multiply the vector
            var z = matrix.Multiply(x);

            // Check that the solution converged
            Assert.IsTrue(monitor.Status == IterationStatus.Converged, "#04");

            // Now compare the vectors
            for (var i = 0; i < y.Count; i++)
            {
                Assert.GreaterOrEqual(ConvergenceBoundary, (y[i] - z[i]).Magnitude, "#05-" + i);
            }
        }

        /// <summary>
        /// Solve poisson matrix and back multiply.
        /// </summary>
        [Test]
        public void SolvePoissonMatrixAndBackMultiply()
        {
            // Create the matrix
            var matrix = new SparseMatrix(100);

            // Assemble the matrix. We assume we're solving the Poisson equation
            // on a rectangular 10 x 10 grid
            const int GridSize = 10;

            // The pattern is:
            // 0 .... 0 -1 0 0 0 0 0 0 0 0 -1 4 -1 0 0 0 0 0 0 0 0 -1 0 0 ... 0
            for (var i = 0; i < matrix.RowCount; i++)
            {
                // Insert the first set of -1's
                if (i > (GridSize - 1))
                {
                    matrix[i, i - GridSize] = -1;
                }

                // Insert the second set of -1's
                if (i > 0)
                {
                    matrix[i, i - 1] = -1;
                }

                // Insert the centerline values
                matrix[i, i] = 4;

                // Insert the first trailing set of -1's
                if (i < matrix.RowCount - 1)
                {
                    matrix[i, i + 1] = -1;
                }

                // Insert the second trailing set of -1's
                if (i < matrix.RowCount - GridSize)
                {
                    matrix[i, i + GridSize] = -1;
                }
            }

            // Create the y vector
            var y = Vector<Complex>.Build.Dense(matrix.RowCount, 1);

            // Create an iteration monitor which will keep track of iterative convergence
            var monitor = new Iterator<Complex>(
                new IterationCountStopCriterion<Complex>(MaximumIterations),
                new ResidualStopCriterion<Complex>(ConvergenceBoundary),
                new DivergenceStopCriterion<Complex>(),
                new FailureStopCriterion<Complex>());

            var solver = new MlkBiCgStab();

            // Solve equation Ax = y
            var x = matrix.SolveIterative(y, solver, monitor);

            // Now compare the results
            Assert.IsNotNull(x, "#02");
            Assert.AreEqual(y.Count, x.Count, "#03");

            // Back multiply the vector
            var z = matrix.Multiply(x);

            // Check that the solution converged
            Assert.IsTrue(monitor.Status == IterationStatus.Converged, "#04");

            // Now compare the vectors
            for (var i = 0; i < y.Count; i++)
            {
                Assert.GreaterOrEqual(ConvergenceBoundary, (y[i] - z[i]).Magnitude, "#05-" + i);
            }
        }

        /// <summary>
        /// Can solve for a random vector.
        /// </summary>
        /// <param name="order">Matrix order.</param>
        [TestCase(4)]
        [TestCase(8)]
        [TestCase(10)]
        public void CanSolveForRandomVector(int order)
        {
            var matrixA = Matrix<Complex>.Build.Random(order, order, 1);
            var vectorb = Vector<Complex>.Build.Random(order, 1);

            var monitor = new Iterator<Complex>(
                new IterationCountStopCriterion<Complex>(1000),
                new ResidualStopCriterion<Complex>(1e-10));

            var solver = new MlkBiCgStab();

            var resultx = matrixA.SolveIterative(vectorb, solver, monitor);
            Assert.AreEqual(matrixA.ColumnCount, resultx.Count);

            var matrixBReconstruct = matrixA*resultx;

            // Check the reconstruction.
            for (var i = 0; i < order; i++)
            {
                Assert.AreEqual(vectorb[i].Real, matrixBReconstruct[i].Real, 1e-5);
                Assert.AreEqual(vectorb[i].Imaginary, matrixBReconstruct[i].Imaginary, 1e-5);
            }
        }

        /// <summary>
        /// Can solve for random matrix.
        /// </summary>
        /// <param name="order">Matrix order.</param>
        [TestCase(4)]
        [TestCase(8)]
        [TestCase(10)]
        public void CanSolveForRandomMatrix(int order)
        {
            var matrixA = Matrix<Complex>.Build.Random(order, order, 1);
            var matrixB = Matrix<Complex>.Build.Random(order, order, 1);

            var monitor = new Iterator<Complex>(
                new IterationCountStopCriterion<Complex>(1000),
                new ResidualStopCriterion<Complex>(1e-10));

            var solver = new MlkBiCgStab();
            var matrixX = matrixA.SolveIterative(matrixB, solver, monitor);

            // The solution X row dimension is equal to the column dimension of A
            Assert.AreEqual(matrixA.ColumnCount, matrixX.RowCount);

            // The solution X has the same number of columns as B
            Assert.AreEqual(matrixB.ColumnCount, matrixX.ColumnCount);

            var matrixBReconstruct = matrixA*matrixX;

            // Check the reconstruction.
            for (var i = 0; i < matrixB.RowCount; i++)
            {
                for (var j = 0; j < matrixB.ColumnCount; j++)
                {
                    Assert.AreEqual(matrixB[i, j].Real, matrixBReconstruct[i, j].Real, 1.0e-5);
                    Assert.AreEqual(matrixB[i, j].Imaginary, matrixBReconstruct[i, j].Imaginary, 1.0e-5);
                }
            }
        }
    }
}


text:
#import "PBCodable.h"

#import "NSCopying-Protocol.h"

@class GEOUser, NSString;

@interface GEOReview : PBCodable <NSCopying>
{
    double _reviewTime;
    double _score;
    GEOUser *_reviewer;
    NSString *_snippet;
    NSString *_uid;
    struct {
        unsigned int reviewTime:1;
        unsigned int score:1;
    } _has;
}

@property(retain, nonatomic) NSString *uid; // @synthesize uid=_uid;
@property(retain, nonatomic) GEOUser *reviewer; // @synthesize reviewer=_reviewer;
@property(nonatomic) double reviewTime; // @synthesize reviewTime=_reviewTime;
@property(nonatomic) double score; // @synthesize score=_score;
@property(retain, nonatomic) NSString *snippet; // @synthesize snippet=_snippet;
- (unsigned long long)hash;
- (_Bool)isEqual:(id)arg1;
- (id)copyWithZone:(struct _NSZone *)arg1;
- (void)copyTo:(id)arg1;
- (void)writeTo:(id)arg1;
- (_Bool)readFrom:(id)arg1;
- (id)dictionaryRepresentation;
- (id)description;
@property(readonly, nonatomic) _Bool hasUid;
@property(readonly, nonatomic) _Bool hasReviewer;
@property(nonatomic) _Bool hasReviewTime;
@property(nonatomic) _Bool hasScore;
@property(readonly, nonatomic) _Bool hasSnippet;
- (void)dealloc;

@end


text:
module.exports = function (config, logger) {
	var
		http = require("http");

		config.httpServer.callback = config.httpServer.callback.bind(config.httpServer);

		config.webSockets(http.createServer(config.app), logger)
			.listen(config.httpServer.port, config.httpServer.callback);

};


text:
package btf

import (
	"errors"
	"fmt"
	"os"

	"github.com/cilium/ebpf/internal/sys"
	"github.com/cilium/ebpf/internal/unix"
)

// HandleInfo describes a Handle.
type HandleInfo struct {
	// ID of this handle in the kernel. The ID is only valid as long as the
	// associated handle is kept alive.
	ID ID

	// Name is an identifying name for the BTF, currently only used by the
	// kernel.
	Name string

	// IsKernel is true if the BTF originated with the kernel and not
	// userspace.
	IsKernel bool

	// Size of the raw BTF in bytes.
	size uint32
}

func newHandleInfoFromFD(fd *sys.FD) (*HandleInfo, error) {
	// We invoke the syscall once with a empty BTF and name buffers to get size
	// information to allocate buffers. Then we invoke it a second time with
	// buffers to receive the data.
	var btfInfo sys.BtfInfo
	if err := sys.ObjInfo(fd, &btfInfo); err != nil {
		return nil, fmt.Errorf("get BTF info for fd %s: %w", fd, err)
	}

	if btfInfo.NameLen > 0 {
		// NameLen doesn't account for the terminating NUL.
		btfInfo.NameLen++
	}

	// Don't pull raw BTF by default, since it may be quite large.
	btfSize := btfInfo.BtfSize
	btfInfo.BtfSize = 0

	nameBuffer := make([]byte, btfInfo.NameLen)
	btfInfo.Name, btfInfo.NameLen = sys.NewSlicePointerLen(nameBuffer)
	if err := sys.ObjInfo(fd, &btfInfo); err != nil {
		return nil, err
	}

	return &HandleInfo{
		ID:       ID(btfInfo.Id),
		Name:     unix.ByteSliceToString(nameBuffer),
		IsKernel: btfInfo.KernelBtf != 0,
		size:     btfSize,
	}, nil
}

// IsModule returns true if the BTF is for the kernel itself.
func (i *HandleInfo) IsVmlinux() bool {
	return i.IsKernel && i.Name == "vmlinux"
}

// IsModule returns true if the BTF is for a kernel module.
func (i *HandleInfo) IsModule() bool {
	return i.IsKernel && i.Name != "vmlinux"
}

// HandleIterator allows enumerating BTF blobs loaded into the kernel.
type HandleIterator struct {
	// The ID of the current handle. Only valid after a call to Next.
	ID ID
	// The current Handle. Only valid until a call to Next.
	// See Take if you want to retain the handle.
	Handle *Handle
	err    error
}

// Next retrieves a handle for the next BTF object.
//
// Returns true if another BTF object was found. Call [HandleIterator.Err] after
// the function returns false.
func (it *HandleIterator) Next() bool {
	id := it.ID
	for {
		attr := &sys.BtfGetNextIdAttr{Id: id}
		err := sys.BtfGetNextId(attr)
		if errors.Is(err, os.ErrNotExist) {
			// There are no more BTF objects.
			break
		} else if err != nil {
			it.err = fmt.Errorf("get next BTF ID: %w", err)
			break
		}

		id = attr.NextId
		handle, err := NewHandleFromID(id)
		if errors.Is(err, os.ErrNotExist) {
			// Try again with the next ID.
			continue
		} else if err != nil {
			it.err = fmt.Errorf("retrieve handle for ID %d: %w", id, err)
			break
		}

		it.Handle.Close()
		it.ID, it.Handle = id, handle
		return true
	}

	// No more handles or we encountered an error.
	it.Handle.Close()
	it.Handle = nil
	return false
}

// Take the ownership of the current handle.
//
// It's the callers responsibility to close the handle.
func (it *HandleIterator) Take() *Handle {
	handle := it.Handle
	it.Handle = nil
	return handle
}

// Err returns an error if iteration failed for some reason.
func (it *HandleIterator) Err() error {
	return it.err
}

// FindHandle returns the first handle for which predicate returns true.
//
// Requires CAP_SYS_ADMIN.
//
// Returns an error wrapping ErrNotFound if predicate never returns true or if
// there is no BTF loaded into the kernel.
func FindHandle(predicate func(info *HandleInfo) bool) (*Handle, error) {
	it := new(HandleIterator)
	defer it.Handle.Close()

	for it.Next() {
		info, err := it.Handle.Info()
		if err != nil {
			return nil, fmt.Errorf("info for ID %d: %w", it.ID, err)
		}

		if predicate(info) {
			return it.Take(), nil
		}
	}
	if err := it.Err(); err != nil {
		return nil, fmt.Errorf("iterate handles: %w", err)
	}

	return nil, fmt.Errorf("find handle: %w", ErrNotFound)
}


text:
package com.thinkaurelius.titan.hadoop;

import com.google.common.base.Preconditions;
import com.thinkaurelius.titan.core.EdgeLabel;
import com.thinkaurelius.titan.core.TitanVertex;
import com.tinkerpop.blueprints.Direction;

/**
 * @author Matthias Broecheler (me@matthiasb.com)
 */
public class SimpleFaunusEdge extends SimpleFaunusRelation implements FaunusEdge {

    private final FaunusEdgeLabel label;
    private final FaunusVertex vertex;

    public SimpleFaunusEdge(FaunusEdgeLabel label, FaunusVertex vertex) {
        Preconditions.checkArgument(label.isUnidirected(),"Invalid edge label: %s",label);
        this.label = label;
        this.vertex = vertex;
    }

    @Override
    protected Object otherValue() {
        return vertex;
    }

    @Override
    public EdgeLabel getEdgeLabel() {
        return label;
    }

    @Override
    public TitanVertex getVertex(Direction dir) {
        if (dir!=Direction.IN) throw new UnsupportedOperationException();
        return vertex;
    }

    @Override
    public long getVertexId(Direction dir) {
        if (dir!=Direction.IN) throw new UnsupportedOperationException();
        return vertex.getLongId();
    }

    @Override
    public String getLabel() {
        return label.getName();
    }

    @Override
    public TitanVertex getOtherVertex(TitanVertex vertex) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean isDirected() {
        return label.isDirected();
    }

    @Override
    public boolean isUnidirected() {
        return label.isUnidirected();
    }

    @Override
    public FaunusRelationType getType() {
        return label;
    }

}


text:
from endpoints import build_call

class followAPI(object):

    def __init__(self, username, authstring, token = False):
        self.requester = username
        self.authstring = authstring
        self.istoken = token

    def my_followers(self):
        return build_call("get", "user/followers", self.requester, self.authstring, {}, self.istoken)

    def get_followers(self,username):
        return build_call("get", "users/" + username + "/followers", self.requester, self.authstring, {}, self.istoken)

    def my_following(self):
        return build_call("get", "user/following", self.requester, self.authstring, {}, self.istoken)

    def get_following(self,username):
        return build_call("get", "users/" + username + "/following", self.requester, self.authstring, {}, self.istoken)


text:
angular.module('FurloughModule')
    .controller('EditFurloughController', ['$scope', '$state', 'toastr', 'Furloughs', '$stateParams', '$rootScope',
        function ($scope, $state, toastr, Furloughs, $stateParams, $rootScope) {
            $scope.me = window.SAILS_LOCALS.me;
            $scope.edit = $state.includes('home.admin.furloughs.edit');
            //if(!$scope.me.admin) $location.path('/') ;
            $scope.data = {
                cb1: false
            };
            $scope.intersecArea= 'учитывает пересечения';
            $scope.intersecNoArea= 'не учитывает пересечения';
            $scope.help = {
                intersec:' Данная опция позволяет установить логику обработки данного типа ' +
                'отпуска в системе. Если не требуется учитывать пересечение отпуска этого типа с ' +
                'собственными уже установленными отпусками, то нужно включить опцию в ' +
                'позицию \"не учитывает пересечения\". В противном случаи сделать наоборот.' +
                ' По умолчанию учитывает пересечения.',
                header:'Информация',
                showHelp: function (text, header) {
                    toastr.info(text, header,{
                        "allowHtml": true,
                        // iconClass:'toast-pink',
                        // autoDismiss: false,
                        // containerId: 'toast-container',
                        // maxOpened: 1,
                        // newestOnTop: true,
                        // positionClass: 'toast-top-right',
                        // // positionClass: 'toast-top-left',
                        // positionClass: "toast-top-full-width",
                         preventDuplicates: true,
                         //preventOpenDuplicates: true,
                        // target: 'body',
                        // // closeButton:true,
                        // extendedTimeOut:1000,
                        // "showDuration": "100",
                        // "hideDuration": "300",
                        // "timeOut": "5000",
                        "progressBar": true
                    });
                }
            };

            $scope.refresh = function () {
                var item = $scope.item = Furloughs.get({id: $stateParams.furloughId}, function (furloughs) {
                    $scope.furloughs = furloughs;
                    item.getBirthday();
                    item.getDateInWork();
                    item.getFiredDate();
                }, function (err) {
                    // активируем по умолчанию создаваемую запись
                    item.action = true;
                    item.sc = function () {
                        return 'Тип отпуска';
                    };

                });
            };

            $scope.delete = function (item) {
                console.log(item);
                item.$delete(item, function (success) {
                    toastr.success('Объект удалён.', 'OK! ');
                    $state.go('home.admin.furloughs');
                }, function (err) {
                    toastr.error(err, 'Ошибка 3 EditFurloughController!');
                })
            };

            $scope.saveEdit = function (item) {
                if (angular.isDefined(item.id)) {
                    item.$update(item, function (success) {
                            toastr.success('Данные обновлены!');
                            $scope.refresh();
                        },
                        function (err) {
                            toastr.error(err.message, 'Ошибка!');
                        }
                    );
                } else {
                    $scope.refresh();
                    item.$save(item, function (success) {
                            toastr.success('Новая должность создана.');
                            $state.go('home.admin.furlough', {furloughId: success.id});
                        },
                        function (err) {
                            toastr.error(err.data, 'Ошибка 101!');
                            //toastr.error(err.data.originalError.errmsg,'Ошибка! EditFurloughController!');
                        });
                }
            };

            $scope.addContact = function () {
                if (angular.isArray(item.contacts)) {
                    item.contacts.push({type: "телефон", value: ""});
                } else {
                    item.contacts = [{type: "телефон", value: ""}];
                }
            };

            $scope.removeContact = function (contact) {
                var contacts = $scope.item.contacts;
                for (var i = 0, ii = contacts.length; i < ii; i++) {
                    if (contact === contacts[i]) {
                        contacts.splice(i, 1);
                    }
                }
            };

            $scope.isCancelDisabled = function () {
                return angular.equals(master, $scope.form);
            };

            $scope.isSaveDisabled = function () {
                return $scope.myForm.$invalid || angular.equals(item, $scope.form);
            };

            var original = angular.copy($scope.item);

            $scope.revert = function () {
                $scope.item = angular.copy(original);
                $scope.passwordRepeat = $scope.item.password;
                $scope.userInfoForm.$setPristine();
            };

            $scope.canRevert = function () {
                return !angular.equals($scope.item, original);
            };

            $scope.refresh();
        }]);


text:
package mkyong;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@Entity
@Table(name="teacher")

@org.hibernate.annotations.GenericGenerator(
name = "test-increment-strategy",
strategy = "increment")
@XmlRootElement(name="teacher")
public class Teacher implements Serializable{

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

	Integer tid;

	String sname;

	Set<Student> student;

	@Id
	@GeneratedValue(generator = "test-increment-strategy")
	@Column(name = "tid")
	public Integer getTid() {
		return tid;
	}

	public void setTid(Integer tid) {
		this.tid = tid;
	}

	@Column(name = "sname")
	public String getSname() {
		return sname;
	}

	public void setSname(String sname) {
		this.sname = sname;
	}

	@OneToMany(mappedBy="teacher", fetch=FetchType.LAZY
			,cascade=CascadeType.ALL
			)
	@XmlTransient
	public Set<Student> getStudent() {
		return student;
	}

	public void setStudent(Set<Student> student) {
		this.student = student;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Teacher [tid=");
		builder.append(tid);
		builder.append(", sname=");
		builder.append(sname);
		//builder.append(", student=");
		//builder.append(student);
		builder.append("]");
		return builder.toString();
	}

}


text:
use crossbeam_channel::Sender;
use std::fmt::Display;

use pueue_lib::network::message::*;
use pueue_lib::state::SharedState;

use crate::network::response_helper::*;

mod add;
mod clean;
mod edit;
mod enqueue;
mod group;
mod kill;
mod log;
mod parallel;
mod pause;
mod remove;
mod restart;
mod send;
mod start;
mod stash;
mod switch;

pub static SENDER_ERR: &str = "Failed to send message to task handler thread";

pub fn handle_message(message: Message, sender: &Sender<Message>, state: &SharedState) -> Message {
    match message {
        Message::Add(message) => add::add_task(message, sender, state),
        Message::Clean(message) => clean::clean(message, state),
        Message::Edit(message) => edit::edit(message, state),
        Message::EditRequest(task_id) => edit::edit_request(task_id, state),
        Message::EditRestore(task_id) => edit::edit_restore(task_id, state),
        Message::Enqueue(message) => enqueue::enqueue(message, state),
        Message::Group(message) => group::group(message, sender, state),
        Message::Kill(message) => kill::kill(message, sender, state),
        Message::Log(message) => log::get_log(message, state),
        Message::Parallel(message) => parallel::set_parallel_tasks(message, state),
        Message::Pause(message) => pause::pause(message, sender, state),
        Message::Remove(task_ids) => remove::remove(task_ids, state),
        Message::Reset(message) => reset(message, sender),
        Message::Restart(message) => restart::restart_multiple(message, sender, state),
        Message::Send(message) => send::send(message, sender, state),
        Message::Start(message) => start::start(message, sender, state),
        Message::Stash(task_ids) => stash::stash(task_ids, state),
        Message::Switch(message) => switch::switch(message, state),
        Message::Status => get_status(state),
        _ => create_failure_message("Not yet implemented"),
    }
}

/// Invoked when calling `pueue reset`.
/// Forward the reset request to the task handler.
/// The handler then kills all children and clears the task queue.
fn reset(message: ResetMessage, sender: &Sender<Message>) -> Message {
    sender.send(Message::Reset(message)).expect(SENDER_ERR);
    create_success_message("Everything is being reset right now.")
}

/// Invoked when calling `pueue status`.
/// Return the current state.
fn get_status(state: &SharedState) -> Message {
    let state = state.lock().unwrap().clone();
    Message::StatusResponse(Box::new(state))
}

fn ok_or_failure_message<T, E: Display>(result: Result<T, E>) -> Result<T, Message> {
    match result {
        Ok(inner) => Ok(inner),
        Err(error) => Err(create_failure_message(format!(
            "Failed to save state. This is a bug: {error}"
        ))),
    }
}

#[macro_export]
macro_rules! ok_or_return_failure_message {
    ($expression:expr) => {
        match ok_or_failure_message($expression) {
            Ok(task_id) => task_id,
            Err(error) => return error,
        }
    };
}

#[cfg(test)]
mod fixtures {
    pub use crossbeam_channel::Sender;
    use std::collections::HashMap;
    use std::path::PathBuf;
    use std::sync::{Arc, Mutex};
    use tempfile::TempDir;

    pub use pueue_lib::network::message::*;
    pub use pueue_lib::network::protocol::socket_cleanup;
    pub use pueue_lib::settings::Settings;
    pub use pueue_lib::state::{SharedState, State, PUEUE_DEFAULT_GROUP};
    pub use pueue_lib::task::{Task, TaskResult, TaskStatus};

    pub use super::*;
    pub use crate::network::response_helper::*;

    pub fn get_settings() -> (Settings, TempDir) {
        let tempdir = TempDir::new().expect("Failed to create test pueue directory");
        let mut settings = Settings::default();
        settings.shared.pueue_directory = Some(tempdir.path().to_owned());

        (settings, tempdir)
    }

    pub fn get_state() -> (SharedState, TempDir) {
        let (settings, tempdir) = get_settings();

        // Create the normal pueue directories.
        let log_dir = tempdir.path().join("log");
        if !log_dir.exists() {
            std::fs::create_dir(log_dir).expect("Failed to create test log dir");
        }
        let task_log_dir = tempdir.path().join("task_log");
        if !task_log_dir.exists() {
            std::fs::create_dir(task_log_dir).expect("Failed to create test task log dir");
        }

        let state = State::new(&settings, None);
        (Arc::new(Mutex::new(state)), tempdir)
    }

    /// Create a new task with stub data in the given group
    pub fn get_stub_task_in_group(id: &str, group: &str, status: TaskStatus) -> Task {
        Task::new(
            id.to_string(),
            PathBuf::from("/tmp"),
            HashMap::new(),
            group.to_string(),
            status,
            Vec::new(),
            None,
        )
    }

    /// Create a new task with stub data
    pub fn get_stub_task(id: &str, status: TaskStatus) -> Task {
        get_stub_task_in_group(id, PUEUE_DEFAULT_GROUP, status)
    }

    pub fn get_stub_state() -> (SharedState, TempDir) {
        let (state, tempdir) = get_state();
        {
            // Queued task
            let mut state = state.lock().unwrap();
            let task = get_stub_task("0", TaskStatus::Queued);
            state.add_task(task);

            // Finished task
            let task = get_stub_task("1", TaskStatus::Done(TaskResult::Success));
            state.add_task(task);

            // Stashed task
            let task = get_stub_task("2", TaskStatus::Stashed { enqueue_at: None });
            state.add_task(task);

            // Running task
            let task = get_stub_task("3", TaskStatus::Running);
            state.add_task(task);

            // Paused task
            let task = get_stub_task("4", TaskStatus::Paused);
            state.add_task(task);
        }

        (state, tempdir)
    }
}


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [("order", "0009_auto_20151201_0820")]

    operations = [
        migrations.RemoveField(model_name="deliverygroup", name="shipping_method"),
        migrations.RemoveField(model_name="deliverygroup", name="shipping_required"),
        migrations.RemoveField(model_name="order", name="shipping_method"),
        migrations.AddField(
            model_name="deliverygroup",
            name="shipping_method_name",
            field=models.CharField(
                blank=True, default=None, editable=False, max_length=255, null=True
            ),
        ),
    ]