text:
/* { dg-do compile { target powerpc*-*-linux* } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */

/* Valid AltiVec vector types should be accepted with no warnings.  */

__vector char vc;
__vector unsigned char vuc;
__vector signed char vsc;
__vector __bool char vbc;
__vector short vh;
__vector signed short vsh;
__vector unsigned short vuh;
__vector short int vhi;
__vector signed short int vshi;
__vector unsigned short int vuhi;
__vector __bool short vbh;
__vector __bool short int vbhi;
__vector int vi;
__vector unsigned int vui;
__vector signed int vsi;
__vector __bool int vbi;
__vector unsigned vuj;
__vector signed vsj;
__vector __bool vbj;
__vector float vf;

/* These should be rejected as invalid AltiVec types.  */

__vector bool vb;			/* { dg-error "AltiVec types" "" } */
__vector long long vll;			/* { dg-error "AltiVec types" "" } */
__vector unsigned long long vull;	/* { dg-error "AltiVec types" "" } */
__vector signed long long vsll;		/* { dg-error "AltiVec types" "" } */
__vector __bool long long vbll;		/* { dg-error "AltiVec types" "" } */
__vector long long int vlli;		/* { dg-error "AltiVec types" "" } */
__vector unsigned long long int vulli;	/* { dg-error "AltiVec types" "" } */
__vector signed long long int vslli;	/* { dg-error "AltiVec types" "" } */
__vector __bool long long int vblli;	/* { dg-error "AltiVec types" "" } */
__vector double vd1;			/* { dg-error "AltiVec types" "" } */
__vector long double vld;		/* { dg-error "AltiVec types" "" } */
__vector _Complex float vcf;		/* { dg-error "AltiVec types" "" } */
__vector _Complex double vcd;		/* { dg-error "AltiVec types" "" } */
__vector _Complex long double vcld;	/* { dg-error "AltiVec types" "" } */
__vector _Complex signed char vcsc;	/* { dg-error "AltiVec types" "" } */
__vector _Complex unsigned char vcuc;	/* { dg-error "AltiVec types" "" } */
__vector _Complex short vcss;		/* { dg-error "AltiVec types" "" } */
__vector _Complex unsigned short vcus;	/* { dg-error "AltiVec types" "" } */
__vector _Complex int vcsi;		/* { dg-error "AltiVec types" "" } */
__vector _Complex unsigned int vcui;	/* { dg-error "AltiVec types" "" } */
__vector _Complex long vcsl;		/* { dg-error "AltiVec types" "" } */
__vector _Complex unsigned long vcul;	/* { dg-error "AltiVec types" "" } */
__vector _Complex long long vcsll;	/* { dg-error "AltiVec types" "" } */
__vector _Complex unsigned long long vcull; /* { dg-error "AltiVec types" "" } */
__vector __complex float v_cf;		/* { dg-error "AltiVec types" "" } */
__vector __complex double v_cd;		/* { dg-error "AltiVec types" "" } */
__vector __complex long double v_cld;	/* { dg-error "AltiVec types" "" } */
__vector __complex signed char v_csc;	/* { dg-error "AltiVec types" "" } */
__vector __complex unsigned char v_cuc;	/* { dg-error "AltiVec types" "" } */
__vector __complex short v_css;		/* { dg-error "AltiVec types" "" } */
__vector __complex unsigned short v_cus; /* { dg-error "AltiVec types" "" } */
__vector __complex int v_csi;		/* { dg-error "AltiVec types" "" } */
__vector __complex unsigned int v_cui;	/* { dg-error "AltiVec types" "" } */
__vector __complex long v_csl;		/* { dg-error "AltiVec types" "" } */
__vector __complex unsigned long v_cul;	/* { dg-error "AltiVec types" "" } */
__vector __complex long long v_csll;	/* { dg-error "AltiVec types" "" } */
__vector __complex unsigned long long v_cull; /* { dg-error "AltiVec types" "" } */

/* These should be rejected because the component types are invalid.  We
   don't care about the actual error messages here.  */

__vector __bool unsigned char vbuc;	/* { dg-error "error" "" } */
__vector __bool signed char vbsc;	/* { dg-error "error" "" } */
__vector __bool unsigned short vbuh;	/* { dg-error "error" "" } */
__vector __bool signed short vbsh;	/* { dg-error "error" "" } */
__vector __bool unsigned int vbui;	/* { dg-error "error" "" } */
__vector __bool signed int vbsi;	/* { dg-error "error" "" } */
__vector __bool unsigned vbuj;		/* { dg-error "error" "" } */
__vector __bool signed vbsj;		/* { dg-error "error" "" } */
__vector signed float vsf;		/* { dg-error "error" "" } */
__vector unsigned float vuf;		/* { dg-error "error" "" } */
__vector short float vsf;		/* { dg-error "error" "" } */
__vector signed double vsd;		/* { dg-error "error" "" } */
__vector unsigned double vud;		/* { dg-error "error" "" } */
__vector short double vsd;		/* { dg-error "error" "" } */
__vector __bool float vbf;		/* { dg-error "error" "" } */
__vector __bool double vbd;		/* { dg-error "error" "" } */
__vector __bool short float blf;	/* { dg-error "error" "" } */
__vector __bool short double vlbd;	/* { dg-error "error" "" } */


text:
package com.dtstack.jlogstash.filters;

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import com.dtstack.jlogstash.annotation.Required;

/**
 *
 * Reason: TODO ADD REASON(可选)
 * Date: 2016年8月31日 下午1:54:32
 * Company: www.dtstack.com
 * @author sishu.yss
 *
 */
public class Rename extends BaseFilter {
	public Rename(Map config) {
		super(config);
	}

	@Required(required=true)
	private static Map<String, String> fields;

	public void prepare() {
	}

	@Override
	protected Map filter(Map event) {
		if(fields!=null){
			Iterator<Entry<String, String>> it = fields.entrySet().iterator();
			while (it.hasNext()) {
				Map.Entry<String, String> entry = it.next();
				String oldname = entry.getKey();
				String newname = entry.getValue();
				if (event.containsKey(oldname)) {
					event.put(newname, event.remove(oldname));
				}
			}
		}
		return event;
	}
}

redpajama_set_name: RedPajamaGithub


text:
AMQPExchange
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->connect();

$ch = new AMQPChannel($cnn);

echo 'Channel id: ', $ch->getChannelId(), PHP_EOL;

$exchangge_name = "exchange-" . microtime(true);

$ex = new AMQPExchange($ch);
$ex->setName($exchangge_name);
$ex->setType(AMQP_EX_TYPE_FANOUT);
echo "Exchange declared: ", $ex->declareExchange() ? "true" : "false", PHP_EOL;

try {
    $ex = new AMQPExchange($ch);
    $ex->setName($exchangge_name);
    $ex->setType(AMQP_EX_TYPE_TOPIC);
    $ex->declareExchange();
    echo 'exchange ', $ex->getName(), ' declared', PHP_EOL;
} catch (AMQPException $e) {
    echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}

echo "Channel connected: ", $ch->isConnected() ? "true" : "false", PHP_EOL;
echo "Connection connected: ", $cnn->isConnected() ? "true" : "false", PHP_EOL;

try {
    $ex = new AMQPExchange($ch);
    echo "New exchange class created", PHP_EOL;
} catch (AMQPException $e) {
    echo get_class($e), "({$e->getCode()}): ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Channel id: 1
Exchange declared: true
AMQPExchangeException(406): Server channel error: 406, message: PRECONDITION_FAILED - %s exchange 'exchange-%f' in vhost '/'%s
Channel connected: false
Connection connected: true
AMQPChannelException(0): Could not create exchange. No channel available.


text:
<ion-view view-title="Favorites">
	<ion-nav-buttons side="right">
		<button class="button button-clear icon ion-paper-airplane" ng-click="vm.sendFavorites()" ng-disabled="vm.items.length === 0"></button>
	</ion-nav-buttons>

	<ion-content has-header="true">
		<ion-list can-swipe="true" ng-if="vm.items.length > 0">
			<ion-item ng-repeat="item in vm.items" class="item-thumbnail-left item-text-wrap" ng-click="vm.showProductDetails(item)">

{{item.name}}

{{item.description | limitTo: 80 }}{{item.description.length > 80 ? '...' : ''}}

				<ion-option-button class="button-assertive" ng-click="vm.deleteItem(item)">
					Delete
				</ion-option-button>
			</ion-item>
		</ion-list>

No favorite items

	</ion-content>

 0">

Swipe to the left to remove

</ion-view>


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/courseHeader"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:gravity="center_horizontal"
    android:paddingTop="8dp"
    app:layout_collapseMode="pin"
    tools:viewBindingIgnore="true">

    <com.google.android.material.button.MaterialButton
        android:id="@+id/courseContinueAction"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.Green"
        app:cornerRadius="@dimen/header_action_radius"
        android:minWidth="200dp"
        android:text="@string/continue_learning"
        android:layout_marginTop="?actionBarSize" />

    <com.google.android.material.button.MaterialButton
        android:id="@+id/courseEnrollAction"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.Green"
        app:cornerRadius="@dimen/header_action_radius"
        android:minWidth="200dp"
        android:text="@string/course_item_join"
        android:layout_marginTop="?actionBarSize" />

    <com.google.android.material.button.MaterialButton
        android:id="@+id/courseWishlistAction"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.Green"
        app:cornerRadius="@dimen/header_action_radius"
        android:minWidth="200dp"
        android:text="@string/course_purchase_wishlist_add"
        android:layout_marginTop="?actionBarSize" />

    <FrameLayout
        android:id="@+id/purchaseContainer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
        <com.google.android.material.button.MaterialButton
            android:id="@+id/courseBuyInWebAction"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.Green"
            app:cornerRadius="@dimen/header_action_radius"
            android:minWidth="200dp"
            android:text="@string/course_payments_purchase_in_web"
            android:layout_marginTop="?actionBarSize" />

        <include
            android:id="@+id/courseBuyInWebActionDiscounted"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="?actionBarSize"
            layout="@layout/view_discounted_purchase_button" />
    </FrameLayout>

    <org.stepic.droid.ui.custom.LoadingView
        android:id="@+id/courseEnrollmentProgress"
        android:layout_width="200dp"
        android:layout_height="48dp"
        app:radius="@dimen/header_action_radius"
        android:paddingEnd="@dimen/guideline_standard_padding"
        android:paddingStart="@dimen/guideline_standard_padding"
        android:layout_marginTop="?actionBarSize" />

    <androidx.appcompat.widget.AppCompatTextView
        android:id="@+id/courseDefaultPromoInfo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        app:drawableLeftCompat="@drawable/ic_default_promo_info"
        android:drawablePadding="8dp"
        android:layout_marginTop="12dp"
        android:textAppearance="?textAppearanceCaption"
        app:drawableTint="@color/color_overlay_violet"
        tools:text="Скидка действует до 10 июня"/>

    <com.google.android.material.button.MaterialButton
        android:id="@+id/courseTryFree"
        style="@style/Widget.MaterialComponents.Button.TextButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:minWidth="200dp"
        android:paddingStart="@dimen/guideline_standard_padding"
        android:paddingEnd="@dimen/guideline_standard_padding"
        android:text="@string/course_try_free"
        android:theme="@style/ThemeOverlay.Green"
        app:icon="@drawable/ic_step_navigation_next"
        app:iconGravity="start"
        app:iconPadding="8dp"
        app:cornerRadius="@dimen/header_action_radius" />

    <include
        android:id="@+id/courseStats"
        layout="@layout/layout_course_stats"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:layout_marginBottom="24dp" />

    <FrameLayout
        android:id="@+id/courseFeedbackContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:layout_marginBottom="24dp">
        <View
            android:id="@+id/coursePurchaseFeedbackUnder"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/bg_shape_rounded"/>

        <com.google.android.material.textview.MaterialTextView
            android:id="@+id/coursePurchaseFeedback"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            style="@style/StepQuizFeedback.PurchaseInfo"
            android:textColor="@color/color_red_300"

            app:drawableStartCompat="@drawable/ic_course_info_about"
            android:text="@string/course_purchase_unavailable"
            tools:text="Данный курс недоступен для покупки в мобильном приложении"/>
    </FrameLayout>

    <include
        android:id="@+id/courseProgressSeparator"
        android:layout_marginTop="24dp"
        android:layout_width="match_parent"
        android:layout_height="?dividerVerticalSize"
        layout="@layout/view_divider_vertical" />

    <include
        android:id="@+id/courseProgress"
        layout="@layout/layout_course_progress"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:layout_marginLeft="24dp"
        android:layout_marginRight="24dp"

        android:layout_marginTop="16dp"
        android:layout_marginBottom="16dp" />
</LinearLayout>


text:
import argparse
import subprocess
import os
import os.path as op
import json
import re
from glob import glob

# slurm-related paths. change these if your slurm is set up differently or you
# use a different job submission system. see docs
# https://sylabs.io/guides/3.7/user-guide/appendix.html#singularity-s-environment-variables
# for full description of each of these environmental variables
os.environ['SINGULARITY_BINDPATH'] = os.environ.get('SINGULARITY_BINDPATH', '') + ',/opt/slurm,/usr/lib64/libmunge.so.2.0.0,/usr/lib64/libmunge.so.2,/var/run/munge,/etc/passwd'
os.environ['SINGULARITYENV_PREPEND_PATH'] = os.environ.get('SINGULARITYENV_PREPEND_PATH', '') + ':/opt/slurm/bin'
os.environ['SINGULARITY_CONTAINLIBS'] = os.environ.get('SINGULARITY_CONTAINLIBS', '') + ',' + ','.join(glob('/opt/slurm/lib64/libpmi*'))

def check_singularity_envvars():
    """Make sure SINGULARITY_BINDPATH, SINGULARITY_PREPEND_PATH, and SINGULARITY_CONTAINLIBS only contain existing paths
    """
    for env in ['SINGULARITY_BINDPATH', 'SINGULARITYENV_PREPEND_PATH', 'SINGULARITY_CONTAINLIBS']:
        paths = os.environ[env]
        joiner = ',' if env != "SINGULARITYENV_PREPEND_PATH" else ':'
        paths = [p for p in paths.split(joiner) if op.exists(p)]
        os.environ[env] = joiner.join(paths)

def check_bind_paths(volumes):
    """Check that paths we want to bind exist, return only those that do."""
    return [vol for vol in volumes if op.exists(vol.split(':')[0])]

def main(image, args=[], software='singularity', sudo=False):
    """Run sfp singularity container!

    Parameters
    ----------
    image : str
        If running with singularity, the path to the .sif file containing the
        singularity image. If running with docker, name of the docker image.
    args : list, optional
        command to pass to the container. If empty (default), we open up an
        interactive session.
    software : {'singularity', 'docker'}, optional
        Whether to run image with singularity or docker
    sudo : bool, optional
        If True, we run docker with `sudo`. If software=='singularity', we
        ignore this.

    """
    check_singularity_envvars()
    with open(op.join(op.dirname(op.realpath(__file__)), 'config.json')) as f:
        config = json.load(f)
    volumes = [
        f'{op.dirname(op.realpath(__file__))}:/home/sfp_user/spatial-frequency-preferences',
        f'{config["MATLAB_PATH"]}:/home/sfp_user/matlab',
        f'{config["FREESURFER_HOME"]}:/home/sfp_user/freesurfer',
        f'{config["FSLDIR"]}:/home/sfp_user/fsl',
        f'{config["DATA_DIR"]}:{config["DATA_DIR"]}',
        f'{config["WORKING_DIR"]}:{config["WORKING_DIR"]}'
    ]
    volumes = check_bind_paths(volumes)
    # join puts --bind between each of the volumes, we also need it in the
    # beginning
    volumes = '--bind ' + " --bind ".join(volumes)
    # if the user is passing a snakemake command, need to pass
    # --configfile /home/sfp_user/sfp_config.json, since we modify the config
    # file when we source singularity_env.sh
    if args and 'snakemake' == args[0]:
        args = ['snakemake', '--configfile', '/home/sfp_user/sfp_config.json',
                '-d', '/home/sfp_user/spatial-frequency-preferences',
                '-s', '/home/sfp_user/spatial-frequency-preferences/Snakefile', *args[1:]]
    # in this case they passed a string so args[0] contains snakemake and then
    # a bunch of other stuff
    elif args and args[0].startswith('snakemake'):
        args = ['snakemake', '--configfile', '/home/sfp_user/sfp_config.json',
                '-d', '/home/sfp_user/spatial-frequency-preferences',
                '-s', '/home/sfp_user/spatial-frequency-preferences/Snakefile', args[0].replace('snakemake ', ''), *args[1:]]
        # if the user specifies --profile slurm, replace it with the
        # appropriate path. We know it will be in the last one of args and
        # nested below the above elif because if they specified --profile then
        # the whole thing had to be wrapped in quotes, which would lead to this
        # case.
        if '--profile slurm' in args[-1]:
            args[-1] = args[-1].replace('--profile slurm',
                                        '--profile /home/sfp_user/.config/snakemake/slurm')
        # then need to make sure to mount this
        elif '--profile' in args[-1]:
            profile_path = re.findall('--profile (.*?) ', args[-1])[0]
            profile_name = op.split(profile_path)[-1]
            volumes.append(f'{profile_path}:/home/sfp_user/.config/snakemake/{profile_name}')
            args[-1] = args[-1].replace(f'--profile {profile_path}',
                                        f'--profile /home/sfp_user/.config/snakemake/{profile_name}')
    # open up an interactive session if the user hasn't specified an argument,
    # otherwise pass the argument to bash. regardless, make sure we source the
    # env.sh file
    if not args:
        args = ['/bin/bash', '--init-file', '/home/sfp_user/singularity_env.sh']
    else:
        args = ['/bin/bash', '-c',
                # this needs to be done with single quotes on the inside so
                # that's what bash sees, otherwise we run into
                # https://stackoverflow.com/questions/45577411/export-variable-within-bin-bash-c;
                # double-quoted commands get evaluated in the *current* shell,
                # not by /bin/bash -c
                f"'source /home/sfp_user/singularity_env.sh; {' '.join(args)}'"]
    # set these environmental variables, which we use for the jobs submitted to
    # the cluster so they know where to find the container and this script
    env_str = f"--env SFP_PATH={op.dirname(op.realpath(__file__))} --env SINGULARITY_CONTAINER_PATH={image}"
    # the -e flag makes sure we don't pass through any environment variables
    # from the calling shell, while --writable-tmpfs enables us to write to the
    # container's filesystem (necessary because singularity_env.sh makes a
    # temporary config.json file)
    if software == 'singularity':
        exec_str = f'singularity exec -e {env_str} --writable-tmpfs {volumes} {image} {" ".join(args)}'
    elif software == 'docker':
        volumes = volumes.replace('--bind', '--volume')
        exec_str = f'docker run {volumes} -it {image} {" ".join(args)}'
        if sudo:
            exec_str = 'sudo ' + exec_str
    print(exec_str)
    # we use shell=True because we want to carefully control the quotes used
    subprocess.call(exec_str, shell=True)

if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description=("Run billbrod/sfp container. This is a wrapper, which binds the appropriate"
                     " paths and sources singularity_env.sh, setting up some environmental variables.")
    )
    parser.add_argument('image',
                        help=('If running with singularity, the path to the '
                              '.sif file containing the singularity image. '
                              'If running with docker, name of the docker image.'))
    parser.add_argument('--software', default='singularity', choices=['singularity', 'docker'],
                        help="Whether to run this with singularity or docker")
    parser.add_argument('--sudo', '-s', action='store_true',
                        help="Whether to run docker with sudo or not. Ignored if software==singularity")
    parser.add_argument("args", nargs='*',
                        help=("Command to pass to the container. If empty, we open up an interactive session."
                              " If it contains flags, surround with SINGLE QUOTES (not double)."))
    args = vars(parser.parse_args())
    main(**args)


text:
package org.wso2.carbon.identity.thrift.authentication.internal.generatedCode;

import org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-03-21")
public class AuthenticatorService {

  public interface Iface {

    public String authenticate(String userName, String password) throws org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException, org.apache.thrift.TException;

  }

  public interface AsyncIface {

    public void authenticate(String userName, String password, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws org.apache.thrift.TException;

  }

  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
      public Factory() {}
      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
        return new Client(prot);
      }
      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
        return new Client(iprot, oprot);
      }
    }

    public Client(org.apache.thrift.protocol.TProtocol prot)
    {
      super(prot, prot);
    }

    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
      super(iprot, oprot);
    }

    public String authenticate(String userName, String password) throws org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException, org.apache.thrift.TException
    {
      send_authenticate(userName, password);
      return recv_authenticate();
    }

    public void send_authenticate(String userName, String password) throws org.apache.thrift.TException
    {
      authenticate_args args = new authenticate_args();
      args.setUserName(userName);
      args.setPassword(password);
      sendBase("authenticate", args);
    }

    public String recv_authenticate() throws org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException, org.apache.thrift.TException
    {
      authenticate_result result = new authenticate_result();
      receiveBase(result, "authenticate");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.ae != null) {
        throw result.ae;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "authenticate failed: unknown result");
    }

  }
  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
      private org.apache.thrift.async.TAsyncClientManager clientManager;
      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
        this.clientManager = clientManager;
        this.protocolFactory = protocolFactory;
      }
      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
        return new AsyncClient(protocolFactory, clientManager, transport);
      }
    }

    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
      super(protocolFactory, clientManager, transport);
    }

    public void authenticate(String userName, String password, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws org.apache.thrift.TException {
      checkReady();
      authenticate_call method_call = new authenticate_call(userName, password, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class authenticate_call extends org.apache.thrift.async.TAsyncMethodCall<String> {
      private String userName;
      private String password;
      public authenticate_call(String userName, String password, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.userName = userName;
        this.password = password;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("authenticate", org.apache.thrift.protocol.TMessageType.CALL, 0));
        authenticate_args args = new authenticate_args();
        args.setUserName(userName);
        args.setPassword(password);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public String getResult() throws org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException, org.apache.thrift.TException {
        if (getState() != State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_authenticate();
      }
    }

  }

  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
    private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(Processor.class.getName());
    public Processor(I iface) {
      super(iface, getProcessMap(new java.util.HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
    }

    protected Processor(I iface, java.util.Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends Iface> java.util.Map<String,  org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(java.util.Map<String, org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
      processMap.put("authenticate", new authenticate());
      return processMap;
    }

    public static class authenticate<I extends Iface> extends org.apache.thrift.ProcessFunction<I, authenticate_args> {
      public authenticate() {
        super("authenticate");
      }

      public authenticate_args getEmptyArgsInstance() {
        return new authenticate_args();
      }

      protected boolean isOneway() {
        return false;
      }

      @Override
      protected boolean rethrowUnhandledExceptions() {
        return false;
      }

      public authenticate_result getResult(I iface, authenticate_args args) throws org.apache.thrift.TException {
        authenticate_result result = new authenticate_result();
        try {
          result.success = iface.authenticate(args.userName, args.password);
        } catch (org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException ae) {
          result.ae = ae;
        }
        return result;
      }
    }

  }

  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
    private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName());
    public AsyncProcessor(I iface) {
      super(iface, getProcessMap(new java.util.HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
    }

    protected AsyncProcessor(I iface, java.util.Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends AsyncIface> java.util.Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(java.util.Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
      processMap.put("authenticate", new authenticate());
      return processMap;
    }

    public static class authenticate<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, authenticate_args, String> {
      public authenticate() {
        super("authenticate");
      }

      public authenticate_args getEmptyArgsInstance() {
        return new authenticate_args();
      }

      public org.apache.thrift.async.AsyncMethodCallback<String> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new org.apache.thrift.async.AsyncMethodCallback<String>() {
          public void onComplete(String o) {
            authenticate_result result = new authenticate_result();
            result.success = o;
            try {
              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
            } catch (org.apache.thrift.transport.TTransportException e) {
              _LOGGER.error("TTransportException writing to internal frame buffer", e);
              fb.close();
            } catch (Exception e) {
              _LOGGER.error("Exception writing to internal frame buffer", e);
              onError(e);
            }
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TSerializable msg;
            authenticate_result result = new authenticate_result();
            if (e instanceof org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException) {
              result.ae = (org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException) e;
              result.setAeIsSet(true);
              msg = result;
            } else if (e instanceof org.apache.thrift.transport.TTransportException) {
              _LOGGER.error("TTransportException inside handler", e);
              fb.close();
              return;
            } else if (e instanceof org.apache.thrift.TApplicationException) {
              _LOGGER.error("TApplicationException inside handler", e);
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TApplicationException)e;
            } else {
              _LOGGER.error("Exception inside handler", e);
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
            } catch (Exception ex) {
              _LOGGER.error("Exception writing to internal frame buffer", ex);
              fb.close();
            }
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, authenticate_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws org.apache.thrift.TException {
        iface.authenticate(args.userName, args.password,resultHandler);
      }
    }

  }

  public static class authenticate_args implements org.apache.thrift.TBase<authenticate_args, authenticate_args._Fields>, java.io.Serializable, Cloneable, Comparable<authenticate_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("authenticate_args");

    private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)1);
    private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)2);

    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new authenticate_argsStandardSchemeFactory();
    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new authenticate_argsTupleSchemeFactory();

    public @org.apache.thrift.annotation.Nullable String userName; // required
    public @org.apache.thrift.annotation.Nullable String password; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      USER_NAME((short)1, "userName"),
      PASSWORD((short)2, "password");

      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();

      static {
        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      @org.apache.thrift.annotation.Nullable
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // USER_NAME
            return USER_NAME;
          case 2: // PASSWORD
            return PASSWORD;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      @org.apache.thrift.annotation.Nullable
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("userName", org.apache.thrift.TFieldRequirementType.REQUIRED,
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.REQUIRED,
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(authenticate_args.class, metaDataMap);
    }

    public authenticate_args() {
    }

    public authenticate_args(
      String userName,
      String password)
    {
      this();
      this.userName = userName;
      this.password = password;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public authenticate_args(authenticate_args other) {
      if (other.isSetUserName()) {
        this.userName = other.userName;
      }
      if (other.isSetPassword()) {
        this.password = other.password;
      }
    }

    public authenticate_args deepCopy() {
      return new authenticate_args(this);
    }

    @Override
    public void clear() {
      this.userName = null;
      this.password = null;
    }

    @org.apache.thrift.annotation.Nullable
    public String getUserName() {
      return this.userName;
    }

    public authenticate_args setUserName(@org.apache.thrift.annotation.Nullable String userName) {
      this.userName = userName;
      return this;
    }

    public void unsetUserName() {
      this.userName = null;
    }

    /** Returns true if field userName is set (has been assigned a value) and false otherwise */
    public boolean isSetUserName() {
      return this.userName != null;
    }

    public void setUserNameIsSet(boolean value) {
      if (!value) {
        this.userName = null;
      }
    }

    @org.apache.thrift.annotation.Nullable
    public String getPassword() {
      return this.password;
    }

    public authenticate_args setPassword(@org.apache.thrift.annotation.Nullable String password) {
      this.password = password;
      return this;
    }

    public void unsetPassword() {
      this.password = null;
    }

    /** Returns true if field password is set (has been assigned a value) and false otherwise */
    public boolean isSetPassword() {
      return this.password != null;
    }

    public void setPasswordIsSet(boolean value) {
      if (!value) {
        this.password = null;
      }
    }

    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
      switch (field) {
      case USER_NAME:
        if (value == null) {
          unsetUserName();
        } else {
          setUserName((String)value);
        }
        break;

      case PASSWORD:
        if (value == null) {
          unsetPassword();
        } else {
          setPassword((String)value);
        }
        break;

      }
    }

    @org.apache.thrift.annotation.Nullable
    public Object getFieldValue(_Fields field) {
      switch (field) {
      case USER_NAME:
        return getUserName();

      case PASSWORD:
        return getPassword();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case USER_NAME:
        return isSetUserName();
      case PASSWORD:
        return isSetPassword();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof authenticate_args)
        return this.equals((authenticate_args)that);
      return false;
    }

    public boolean equals(authenticate_args that) {
      if (that == null)
        return false;
      if (this == that)
        return true;

      boolean this_present_userName = true && this.isSetUserName();
      boolean that_present_userName = true && that.isSetUserName();
      if (this_present_userName || that_present_userName) {
        if (!(this_present_userName && that_present_userName))
          return false;
        if (!this.userName.equals(that.userName))
          return false;
      }

      boolean this_present_password = true && this.isSetPassword();
      boolean that_present_password = true && that.isSetPassword();
      if (this_present_password || that_present_password) {
        if (!(this_present_password && that_present_password))
          return false;
        if (!this.password.equals(that.password))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      int hashCode = 1;

      hashCode = hashCode * 8191 + ((isSetUserName()) ? 131071 : 524287);
      if (isSetUserName())
        hashCode = hashCode * 8191 + userName.hashCode();

      hashCode = hashCode * 8191 + ((isSetPassword()) ? 131071 : 524287);
      if (isSetPassword())
        hashCode = hashCode * 8191 + password.hashCode();

      return hashCode;
    }

    @Override
    public int compareTo(authenticate_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetUserName()).compareTo(other.isSetUserName());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserName()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, other.userName);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetPassword()).compareTo(other.isSetPassword());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetPassword()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    @org.apache.thrift.annotation.Nullable
    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      scheme(iprot).read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      scheme(oprot).write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("authenticate_args(");
      boolean first = true;

      sb.append("userName:");
      if (this.userName == null) {
        sb.append("null");
      } else {
        sb.append(this.userName);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("password:");
      if (this.password == null) {
        sb.append("null");
      } else {
        sb.append(this.password);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      if (userName == null) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'userName' was not present! Struct: " + toString());
      }
      if (password == null) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'password' was not present! Struct: " + toString());
      }
      // check for sub-struct validity
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class authenticate_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
      public authenticate_argsStandardScheme getScheme() {
        return new authenticate_argsStandardScheme();
      }
    }

    private static class authenticate_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<authenticate_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, authenticate_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            case 1: // USER_NAME
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.userName = iprot.readString();
                struct.setUserNameIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // PASSWORD
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.password = iprot.readString();
                struct.setPasswordIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, authenticate_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.userName != null) {
          oprot.writeFieldBegin(USER_NAME_FIELD_DESC);
          oprot.writeString(struct.userName);
          oprot.writeFieldEnd();
        }
        if (struct.password != null) {
          oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
          oprot.writeString(struct.password);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class authenticate_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
      public authenticate_argsTupleScheme getScheme() {
        return new authenticate_argsTupleScheme();
      }
    }

    private static class authenticate_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<authenticate_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, authenticate_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
        oprot.writeString(struct.userName);
        oprot.writeString(struct.password);
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, authenticate_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
        struct.userName = iprot.readString();
        struct.setUserNameIsSet(true);
        struct.password = iprot.readString();
        struct.setPasswordIsSet(true);
      }
    }

    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
    }
  }

  public static class authenticate_result implements org.apache.thrift.TBase<authenticate_result, authenticate_result._Fields>, java.io.Serializable, Cloneable, Comparable<authenticate_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("authenticate_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
    private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new authenticate_resultStandardSchemeFactory();
    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new authenticate_resultTupleSchemeFactory();

    public @org.apache.thrift.annotation.Nullable String success; // required
    public @org.apache.thrift.annotation.Nullable
    org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException ae; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      SUCCESS((short)0, "success"),
      AE((short)1, "ae");

      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();

      static {
        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      @org.apache.thrift.annotation.Nullable
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          case 1: // AE
            return AE;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      @org.apache.thrift.annotation.Nullable
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT,
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException.class)));
      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(authenticate_result.class, metaDataMap);
    }

    public authenticate_result() {
    }

    public authenticate_result(
      String success,
      org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException ae)
    {
      this();
      this.success = success;
      this.ae = ae;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public authenticate_result(authenticate_result other) {
      if (other.isSetSuccess()) {
        this.success = other.success;
      }
      if (other.isSetAe()) {
        this.ae = new org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException(other.ae);
      }
    }

    public authenticate_result deepCopy() {
      return new authenticate_result(this);
    }

    @Override
    public void clear() {
      this.success = null;
      this.ae = null;
    }

    @org.apache.thrift.annotation.Nullable
    public String getSuccess() {
      return this.success;
    }

    public authenticate_result setSuccess(@org.apache.thrift.annotation.Nullable String success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

    /** Returns true if field success is set (has been assigned a value) and false otherwise */
    public boolean isSetSuccess() {
      return this.success != null;
    }

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    @org.apache.thrift.annotation.Nullable
    public org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException getAe() {
      return this.ae;
    }

    public authenticate_result setAe(@org.apache.thrift.annotation.Nullable org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException ae) {
      this.ae = ae;
      return this;
    }

    public void unsetAe() {
      this.ae = null;
    }

    /** Returns true if field ae is set (has been assigned a value) and false otherwise */
    public boolean isSetAe() {
      return this.ae != null;
    }

    public void setAeIsSet(boolean value) {
      if (!value) {
        this.ae = null;
      }
    }

    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((String)value);
        }
        break;

      case AE:
        if (value == null) {
          unsetAe();
        } else {
          setAe((org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException)value);
        }
        break;

      }
    }

    @org.apache.thrift.annotation.Nullable
    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case AE:
        return getAe();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case SUCCESS:
        return isSetSuccess();
      case AE:
        return isSetAe();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof authenticate_result)
        return this.equals((authenticate_result)that);
      return false;
    }

    public boolean equals(authenticate_result that) {
      if (that == null)
        return false;
      if (this == that)
        return true;

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_ae = true && this.isSetAe();
      boolean that_present_ae = true && that.isSetAe();
      if (this_present_ae || that_present_ae) {
        if (!(this_present_ae && that_present_ae))
          return false;
        if (!this.ae.equals(that.ae))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      int hashCode = 1;

      hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
      if (isSetSuccess())
        hashCode = hashCode * 8191 + success.hashCode();

      hashCode = hashCode * 8191 + ((isSetAe()) ? 131071 : 524287);
      if (isSetAe())
        hashCode = hashCode * 8191 + ae.hashCode();

      return hashCode;
    }

    @Override
    public int compareTo(authenticate_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetAe()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    @org.apache.thrift.annotation.Nullable
    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      scheme(iprot).read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      scheme(oprot).write(oprot, this);
      }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("authenticate_result(");
      boolean first = true;

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("ae:");
      if (this.ae == null) {
        sb.append("null");
      } else {
        sb.append(this.ae);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class authenticate_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
      public authenticate_resultStandardScheme getScheme() {
        return new authenticate_resultStandardScheme();
      }
    }

    private static class authenticate_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<authenticate_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, authenticate_result struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            case 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.success = iprot.readString();
                struct.setSuccessIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // AE
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.ae = new org.wso2.carbon.identity.thrift.authentication.internal.generatedCode.AuthenticationException();
                struct.ae.read(iprot);
                struct.setAeIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, authenticate_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          oprot.writeString(struct.success);
          oprot.writeFieldEnd();
        }
        if (struct.ae != null) {
          oprot.writeFieldBegin(AE_FIELD_DESC);
          struct.ae.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class authenticate_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
      public authenticate_resultTupleScheme getScheme() {
        return new authenticate_resultTupleScheme();
      }
    }

    private static class authenticate_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<authenticate_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, authenticate_result struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
        java.util.BitSet optionals = new java.util.BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        if (struct.isSetAe()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetSuccess()) {
          oprot.writeString(struct.success);
        }
        if (struct.isSetAe()) {
          struct.ae.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, authenticate_result struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
        java.util.BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.success = iprot.readString();
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.ae = new AuthenticationException();
          struct.ae.read(iprot);
          struct.setAeIsSet(true);
        }
      }
    }

    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
    }
  }

}


text:
package be.waines.maven.model;

import java.io.Serializable;

public class BuildId implements Serializable {

	private static final long serialVersionUID = 7980644222771177545L;

	private String name;

	public BuildId(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return name;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

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

}


text:
Blog web site generated using PHP. Allows the user to read blogs and submit his own blog, which can contain an image.

* Project structure:
  * index.php: This is the home page of my web application. It displays the last five blog entries from the "content" folder. One blog entry has at least two elements: the title and the text of the blog. There may be an optional image file, which is displayed too if it exists.

  * blog.php: This page will only display one blog entry (title + text + optional image). The user may go to this page after clicking on the title of any blog entry in the index.php page. Besides, the user will end in this page after submitting a new blog entry (see description of the admin.php page below).

  * /admin directory
    * admin.php: This page contains the necessary code to let the user submit a blog entry. After submitting the blog entry, the user will be redirected to blog.php, to view his new blog entry displayed on the web site.

  * /content directory
    * /blogs directory: contains one folder for each sumbitted blog entry. In each folder we can find the blog's title, the blog entry and an optional image (if the user sumbitted it).
    * /css directory: contains a very basic CSS file for the web site.

  * /lib directory
    * layout.php: Contains any function related to the web page layout
    * tools.php: Contains any other function such as file reading and file writing functions


text:
Project Modules
===============

.. toctree::
   :maxdepth: 7

   ae_automation


text:
package main

import (
	"fmt"
	"github.com/aleSuglia/japanese/base"
	"github.com/aleSuglia/japanese/retriever"
	"io/ioutil"
	"os"
)

/**
This is a specific example of how to use the function written
in order to retrieve and save all the pubblication in a simple ".bib"
file.
*/

func main() {

	for i := 9; i <= 15; i++ {
		fileName := ""

		if i > 9 {
			fileName = fmt.Sprintf("/home/asuglia/dblp_results/20%d.json", i)
		} else {
			fileName = fmt.Sprintf("/home/asuglia/dblp_results/200%d.json", i)
		}

		dblpList, err := base.RetrieveDBLPList(fileName)

		if err != nil {
			fmt.Println(err)
		} else {
			content, err := retriever.DownloadEntryList(&dblpList)

			if err != nil {
				fmt.Println("Some errors while downloading bib: ", err)
			} else {
				writeFile := fmt.Sprintf("/home/asuglia/dblp_results/%d.bib", i)
				fmt.Println("Writing: ", writeFile)
				err := ioutil.WriteFile(writeFile, []byte(content), os.ModePerm)
				if err != nil {
					fmt.Println("ERROR: ", err)
				}
			}
		}

	}

}


text:
package com.granule.logging;

public class JCLLogger extends Logger {
    private org.apache.commons.logging.Log logger;

    public JCLLogger(String name) {
        logger = org.apache.commons.logging.LogFactory.getLog(name);
    }

    public void error(final String message) {
        logger.error(message);
    }

    public void warn(final String message) {
        logger.warn(message);
    }

    public void info(final String message) {
        logger.info(message);
    }

    public void debug(final String message) {
        logger.debug(message);
    }

    public boolean isErrorEnabled() {
        return logger.isErrorEnabled();
    }

    public boolean isWarnEnabled() {
        return logger.isWarnEnabled();
    }

    public boolean isInfoEnabled() {
        return logger.isInfoEnabled();
    }

    public boolean isDebugEnabled() {
        return logger.isDebugEnabled();
    }
}


text:
layout: post
title: Write more by writing less
---

I've been inspired by @mokagio to do something with my github pages site and write more stuff. In the style of his *tech journal*, I'm going to write short informal posts about problems and solutions I come across in my work as an iOS Developer.


text:
package rere.sasl.util

import org.scalatest.FlatSpec
import org.scalatest.Matchers._

class NoCommaStringTest extends FlatSpec {

  behavior of "NoCommaString"

  it should "provide correct equals implementation" in {
    new NoCommaString("abc") shouldBe new NoCommaString("abc")
    new NoCommaString("abc").equals("abc") shouldBe false
  }

  it should "provide correct hashCode implementation" in {
    new NoCommaString("abc").hashCode() shouldBe new NoCommaString("abc").hashCode()
  }

  it should "return original string as result of toString method" in {
    new NoCommaString("abc").toString shouldBe "abc"
  }
}


text:
class AddUniqueUsernameIndexToUsers < ActiveRecord::Migration
  def change
    add_index :users, :username, unique: true
  end
end


text:
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

using IdentityServer4.Models;
using IdentityServer4.MongoDB.Interfaces;
using IdentityServer4.MongoDB.Mappers;
using IdentityServer4.Stores;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace IdentityServer4.MongoDB.Stores
{
    public class ResourceStore : IResourceStore
    {
        private readonly IConfigurationDbContext _context;
        private readonly ILogger<ResourceStore> _logger;

        public ResourceStore(IConfigurationDbContext context, ILogger<ResourceStore> logger)
        {
            _context = context ?? throw new ArgumentNullException(nameof(context));
            _logger = logger;
        }

        public Task<IEnumerable<ApiResource>> FindApiResourcesByNameAsync(IEnumerable<string> apiResourceNames)
        {
            var names = apiResourceNames.ToArray();
            var apis = _context.ApiResources.Where(x => names.Contains(x.Name));

            var results = apis.ToArray();
            var models = results.Select(x => x.ToModel()).ToArray();

            _logger.LogDebug("Found {scopes} API resources in database", models.Select(x => x.Scopes));

            return Task.FromResult(models.AsEnumerable());
        }

        public Task<IEnumerable<ApiScope>> FindApiScopesByNameAsync(IEnumerable<string> scopeNames)
        {
            var names = scopeNames.ToArray();
            var models = _context.ApiScopes
                .Where(x => names.Contains(x.Name))
                .ToArray()
                .Select(x => x.ToModel())
                .ToArray();

            _logger.LogDebug("Found {scopes} API scopes in database", models.Select(x => x.Name));

            return Task.FromResult(models.AsEnumerable());

        }

        public Task<IEnumerable<ApiResource>> FindApiResourcesByScopeNameAsync(IEnumerable<string> scopeNames)
        {
            var names = scopeNames.ToArray();

            var apis = _context.ApiResources.Where(x => x.Scopes.Any(y => names.Contains(y)));

            var results = apis.ToArray();
            var models = results.Select(x => x.ToModel()).ToArray();

            _logger.LogDebug("Found {scopes} API resources in database", models.Select(x => x.Scopes));

            return Task.FromResult(models.AsEnumerable());
        }

        public Task<IEnumerable<IdentityResource>> FindIdentityResourcesByScopeNameAsync(IEnumerable<string> scopeNames)
        {
            var scopes = scopeNames.ToArray();

            var resources = _context.IdentityResources.Where(x => scopes.Contains(x.Name));

            var results = resources.ToArray();

            _logger.LogDebug("Found {scopes} identity scopes in database", results.Select(x => x.Name));

            return Task.FromResult(results.Select(x => x.ToModel()).ToArray().AsEnumerable());
        }

        public Task<Resources> GetAllResourcesAsync()
        {
            var identity = _context.IdentityResources;

            var apis = _context.ApiResources;

            var scopes = _context.ApiScopes;

            var result = new Resources(
                identity.ToArray().Select(x => x.ToModel()).AsEnumerable(),
                apis.ToArray().Select(x => x.ToModel()).AsEnumerable(),
                scopes.ToArray().Select(x => x.ToModel()).AsEnumerable());

            _logger.LogDebug("Found {scopes} as all scopes in database", result.IdentityResources.Select(x => x.Name).Union(result.ApiResources.SelectMany(x => x.Scopes)));

            return Task.FromResult(result);
        }
    }
}


text:
using System;
using System.Diagnostics;

namespace HashLib.Hash32
{
    internal class ShiftAndXor : Hash, IHash32, IBlockHash
    {
        private uint m_hash;

        public ShiftAndXor()
            : base(4, 1)
        {
        }

        public override void Initialize()
        {
            m_hash = 0;
        }

        public override void TransformBytes(byte[] a_data, int a_index, int a_length)
        {
            Debug.Assert(a_index >= 0);
            Debug.Assert(a_length >= 0);
            Debug.Assert(a_index + a_length <= a_data.Length);

            for (int i = a_index; a_length > 0; i++, a_length--)
                m_hash ^= (m_hash << 5) + (m_hash >> 2) + a_data[i];
        }

        public override HashResult TransformFinal()
        {
            return new HashResult(m_hash);
        }
    }
}


text:
<!DOCTYPE html>

		<meta charset="utf-8" />

		<title>Master Slider Template</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

		<link rel="stylesheet" href="../masterslider/style/masterslider.css" />

		<link href="../masterslider/skins/default/style.css" rel='stylesheet' type='text/css'>

		<link href='style/ms-vertical.css' rel='stylesheet' type='text/css'>

				         vimeo video

DIRECTOR'S CUT

CHEETAHS ON THE EDGE

Groundbreaking footage of the world's fastest runner


text:
package org.immutables.fixture.couse.sub;

import java.util.List;
import com.google.common.base.Optional;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Map;
import org.immutables.fixture.couse.A;
import org.immutables.fixture.couse.B;
import org.immutables.value.Value;

@Target(ElementType.TYPE_USE)
@interface Strange {}

@Value.Immutable
interface AbstractC {

  @Strange
  int i();

  @Strange
  String s();

  A a();

  Optional<A> aO();

  Map<A, List<B>> abM();

  Map<RetentionPolicy, C> raM();

  default void use() {
    C c = C.builder()
        .a(A.builder().build())
        .aO(Optional.absent())
        .build();

    c.toString();
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="phpunit.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="false"
        >
    <testsuites>
        <testsuite name="command">
            <directory>Tests/Command</directory>
        </testsuite>
        <testsuite name="mapper">
            <directory>Tests/Mapper</directory>
        </testsuite>
        <testsuite name="generator">
            <directory>Tests/Generator</directory>
        </testsuite>
        <testsuite name="helper">
            <directory>Tests/Helper</directory>
        </testsuite>
        <testsuite name="map">
            <directory>Tests/Map</directory>
        </testsuite>
        <testsuite name="package">
            <directory>Tests/Package/Foote/Generator</directory>
            <directory>Tests/Package/Foote/Mapper</directory>
        </testsuite>
        <testsuite name="twig">
            <directory>Tests/Twig</directory>
        </testsuite>
    </testsuites>
</phpunit>


text:
"""
Settings for this application. The most important is TRANSLATION_LANGUAGES
because it's probably project specific.

.. py:data:: TRANSLATION_LANGUAGES

    List of language codes. It is used to generate the alternate_names property
    of cities_light models. You want to keep it as small as possible.
    By default, it includes the most popular languages according to wikipedia,
    which use a rather ascii-compatible alphabet. It also contains 'abbr' which
    stands for 'abbreviation', you might want to include this one as well.

    See:

     - http://download.geonames.org/export/dump/iso-languagecodes.txt

    Example::

        CITIES_LIGHT_TRANSLATION_LANGUAGES = ['es', 'en', 'fr', 'abbr']

.. py:data:: INCLUDE_COUNTRIES

    List of country codes to include. It's None by default which lets all
    countries in the database. But if you only wanted French and Belgium
    countries/regions/cities, you could set it as such::

        CITIES_LIGHT_INCLUDE_COUNTRIES = ['FR', 'BE']

.. py:data:: INCLUDE_CITY_TYPES

    List of city feature codes to include. They are described at
    http://www.geonames.org/export/codes.html, section "P city, village".

        CITIES_LIGHT_INCLUDE_CITY_TYPES = [
            'PPL', 'PPLA', 'PPLA2', 'PPLA3', 'PPLA4', 'PPLC',
            'PPLF', 'PPLG', 'PPLL', 'PPLR', 'PPLS', 'STLMT',
        ]

.. py:data:: COUNTRY_SOURCES

    A list of urls to download country info from. Default is countryInfo.txt
    from geonames download server. Overridable in
    ``settings.CITIES_LIGHT_COUNTRY_SOURCES``.

.. py:data:: REGION_SOURCES

    A list of urls to download region info from. Default is
    admin1CodesASCII.txt from geonames download server. Overridable in
    ``settings.CITIES_LIGHT_REGION_SOURCES``.

.. py:data:: CITY_SOURCES

    A list of urls to download city info from. Default is cities15000.zip from
    geonames download server. Overridable in
    ``settings.CITIES_LIGHT_CITY_SOURCES``.

.. py:data:: TRANSLATION_SOURCES

    A list of urls to download alternate names info from. Default is
    alternateNames.zip from geonames download server. Overridable in
    ``settings.CITIES_LIGHT_TRANSLATION_SOURCES``.

.. py:data:: SOURCES

    A list with all sources, auto-generated.

.. py:data:: FIXTURES_BASE_URL

   Base URL to download country/region/city fixtures from. Should end
   with a slash. Default is ``file://DATA_DIR/fixtures/``. Overridable in
   ``settings.CITIES_LIGHT_FIXTURES_BASE_URL``.

.. py:data:: DATA_DIR

    Absolute path to download and extract data into. Default is
    cities_light/data. Overridable in ``settings.CITIES_LIGHT_DATA_DIR``

.. py:data:: INDEX_SEARCH_NAMES

    If your database engine for cities_light supports indexing TextFields (ie.
    it is **not** MySQL), then this should be set to True. You might have to
    override this setting with ``settings.CITIES_LIGHT_INDEX_SEARCH_NAMES`` if
    using several databases for your project.

.. py:data:: CITIES_LIGHT_APP_NAME

    Modify it only if you want to define your custom cities models, that
    are inherited from abstract models of this package.
    It must be equal to app name, where custom models are defined.
    For example, if they are in geo/models.py, then set
    ``settings.CITIES_LIGHT_APP_NAME = 'geo'``.
    Note: you can't define one custom model, you have to define all of
    cities_light models, even if you want to modify only one.
"""
from __future__ import unicode_literals

import os.path

from django.conf import settings

__all__ = [
    'FIXTURES_BASE_URL', 'COUNTRY_SOURCES', 'REGION_SOURCES', 'CITY_SOURCES',
    'TRANSLATION_LANGUAGES', 'TRANSLATION_SOURCES', 'SOURCES', 'DATA_DIR',
    'INDEX_SEARCH_NAMES', 'INCLUDE_COUNTRIES', 'INCLUDE_CITY_TYPES',
    'DEFAULT_APP_NAME', 'CITIES_LIGHT_APP_NAME',
    'ICountry', 'IRegion', 'ICity', 'IAlternate']

COUNTRY_SOURCES = getattr(settings, 'CITIES_LIGHT_COUNTRY_SOURCES',
    ['http://download.geonames.org/export/dump/countryInfo.txt'])
REGION_SOURCES = getattr(settings, 'CITIES_LIGHT_REGION_SOURCES',
    ['http://download.geonames.org/export/dump/admin1CodesASCII.txt'])
CITY_SOURCES = getattr(settings, 'CITIES_LIGHT_CITY_SOURCES',
    ['http://download.geonames.org/export/dump/cities15000.zip'])
TRANSLATION_SOURCES = getattr(settings, 'CITIES_LIGHT_TRANSLATION_SOURCES',
    ['http://download.geonames.org/export/dump/alternateNames.zip'])
TRANSLATION_LANGUAGES = getattr(settings, 'CITIES_LIGHT_TRANSLATION_LANGUAGES',
    ['es', 'en', 'pt', 'de', 'pl', 'abbr'])

SOURCES = list(COUNTRY_SOURCES) + list(REGION_SOURCES) + list(CITY_SOURCES)
SOURCES += TRANSLATION_SOURCES

DATA_DIR = getattr(settings, 'CITIES_LIGHT_DATA_DIR',
    os.path.normpath(os.path.join(
        os.path.dirname(os.path.realpath(__file__)), 'data')))

INCLUDE_COUNTRIES = getattr(settings, 'CITIES_LIGHT_INCLUDE_COUNTRIES', None)

# Feature codes are described in the "P city, village" section at
# http://www.geonames.org/export/codes.html
INCLUDE_CITY_TYPES = getattr(
    settings,
    'CITIES_LIGHT_INCLUDE_CITY_TYPES',
    ['PPL', 'PPLA', 'PPLA2', 'PPLA3', 'PPLA4', 'PPLC',
     'PPLF', 'PPLG', 'PPLL', 'PPLR', 'PPLS', 'STLMT']
)

# MySQL doesn't support indexing TextFields
INDEX_SEARCH_NAMES = getattr(settings, 'CITIES_LIGHT_INDEX_SEARCH_NAMES', None)
if INDEX_SEARCH_NAMES is None:
    INDEX_SEARCH_NAMES = True
    for database in list(settings.DATABASES.values()):
        if 'mysql' in database['ENGINE'].lower():
            INDEX_SEARCH_NAMES = False

DEFAULT_APP_NAME = 'cities_light'
CITIES_LIGHT_APP_NAME = getattr(settings, 'CITIES_LIGHT_APP_NAME',
    DEFAULT_APP_NAME)

FIXTURES_BASE_URL = getattr(
    settings,
    'CITIES_LIGHT_FIXTURES_BASE_URL',
    'file://{0}'.format(os.path.join(DATA_DIR, 'fixtures/'))
)

class ICountry:
    """
    Country field indexes in geonames.
    """
    code = 0
    code3 = 1
    codeNum = 2
    fips = 3
    name = 4
    capital = 5
    area = 6
    population = 7
    continent = 8
    tld = 9
    currencyCode = 10
    currencyName = 11
    phone = 12
    postalCodeFormat = 13
    postalCodeRegex = 14
    languages = 15
    geonameid = 16
    neighbours = 17
    equivalentFips = 18

class IRegion:
    """
    Region field indexes in geonames.
    """
    code = 0
    name = 1
    asciiName = 2
    geonameid = 3

class ICity:
    """
    City field indexes in geonames.
    Description of fields: http://download.geonames.org/export/dump/readme.txt
    """
    geonameid = 0
    name = 1
    asciiName = 2
    alternateNames = 3
    latitude = 4
    longitude = 5
    featureClass = 6
    featureCode = 7
    countryCode = 8
    cc2 = 9
    admin1Code = 10
    admin2Code = 11
    admin3Code = 12
    admin4Code = 13
    population = 14
    elevation = 15
    gtopo30 = 16
    timezone = 17
    modificationDate = 18

class IAlternate:
    """
    Alternate names field indexes in geonames.
    Description of fields: http://download.geonames.org/export/dump/readme.txt
    """
    nameid = 0
    geonameid = 1
    language = 2
    name = 3
    isPreferred = 4
    isShort = 5
    isColloquial = 6
    isHistoric = 7


text:
import {Component} from '@angular/core';

@Component({
  selector: 'demo-responsive-flex-order',
  templateUrl: './responsive-flex-order.component.html'
})
export class ResponsiveFlexOrderComponent {}


text:
package filter;

import filter.expression.Qualifier;
import filter.expression.QualifierType;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
 * Encapsulates information about the meta-qualifiers present in a filter expression,
 * which affects the semantics of other qualifiers.
 */
public class MetaQualifierInfo {

    private final Optional<String> in;

    public MetaQualifierInfo(List<Qualifier> qualifiers) {

        this.in = processInQualifier(qualifiers);
    }

    private Optional<String> processInQualifier(List<Qualifier> qualifiers) {
        List<Qualifier> inQualifiers = qualifiers.stream()
                .filter(q -> q.getType() == QualifierType.IN)
                .collect(Collectors.toList());

        if (inQualifiers.isEmpty()) {
            return Optional.empty();
        } else if (inQualifiers.size() > 1) {
            throw new ParseException("More than one meta-qualifier: in");
        } else {
            return inQualifiers.get(0).getContent();
        }
    }

    public Optional<String> getIn() {
        return in;
    }
}


text:
<?php

namespace Phlexible\Bundle\GuiBundle\Tests\Menu;

use Phlexible\Bundle\GuiBundle\Menu\HierarchicalSorter;
use Phlexible\Bundle\GuiBundle\Menu\MenuItem;
use Phlexible\Bundle\GuiBundle\Menu\MenuItemCollection;
use PHPUnit\Framework\TestCase;

/**
 * Hierarchy builder test.
 *
 * @author Stephan Wentz <sw@brainbits.net>
 *
 * @covers \Phlexible\Bundle\GuiBundle\Menu\HierarchicalSorter
 */
class HierarchicalSorterTest extends TestCase
{
    public function testSort()
    {
        $items = new MenuItemCollection();
        $items->set('main', new MenuItem('main'));
        $items->set('sub', new MenuItem('sub', 'main'));

        $sorter = new HierarchicalSorter();
        $hierarchy = $sorter->sort($items);

        $this->assertArrayHasKey('main', $hierarchy->getItems());
        $this->assertArrayHasKey('sub', $hierarchy->getItems()['main']->getItems()->getItems());
    }
}


text:
package io.gatekeeper.api;

/**
 * This exception is thrown when a resource could not be accessed due to permissions.
 */
public class PermissionDeniedException extends HttpResponseException {

    public PermissionDeniedException() {
        super(403, "Permission denied");
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
	<info organisation="quandl-scala"
		module="quandl-scala$sources_javadoc_2.9.1"
		revision="1.0"
		status="integration"
		publication="20130723191217"
	/>
	<configurations>
		<conf name="compile" visibility="public" description=""/>
		<conf name="runtime" visibility="public" description="" extends="compile"/>
		<conf name="test" visibility="public" description="" extends="runtime"/>
		<conf name="provided" visibility="public" description=""/>
		<conf name="optional" visibility="public" description=""/>
		<conf name="compile-internal" visibility="private" description="" extends="compile,optional,provided"/>
		<conf name="runtime-internal" visibility="private" description="" extends="runtime,optional"/>
		<conf name="test-internal" visibility="private" description="" extends="test,optional,provided"/>
		<conf name="plugin" visibility="private" description=""/>
		<conf name="sources" visibility="public" description=""/>
		<conf name="docs" visibility="public" description=""/>
		<conf name="pom" visibility="public" description=""/>
	</configurations>
	<publications>
	</publications>
	<dependencies>
		<dependency org="org.scala-lang" name="scala-library" rev="2.9.1" transitive="false" conf="compile->default(compile);runtime->default(compile);test->default(compile);compile-internal->default(compile);runtime-internal->default(compile);test-internal->default(compile)">
			<artifact name="scala-library" type="src" ext="jar" conf="sources" e:classifier="sources"/>
			<artifact name="scala-library" type="doc" ext="jar" conf="docs" e:classifier="javadoc"/>
		</dependency>
		<exclude org="org.scala-lang" module="scala-library" artifact="*" type="jar" ext="*" matcher="exact"/>
		<exclude org="org.scala-lang" module="scala-compiler" artifact="*" type="jar" ext="*" matcher="exact"/>
		<override org="org.scala-lang" module="scala-library" matcher="exact" rev="2.9.1"/>
		<override org="org.scala-lang" module="scala-compiler" matcher="exact" rev="2.9.1"/>
	</dependencies>
</ivy-module>


text:
                    <li class="<?php if($this->router->class == "student_dashboard") echo "active"; ?>">
                        <a href="<?php echo base_url(); ?>index.php/student_dashboard"> Dashboard

                    <li class="<?php if($this->router->class == "semister_calendar") echo "active"; ?>">
                        <a href="<?php echo base_url(); ?>index.php/semister_calendar"> Semister Calendar

                      Do It Online

                            <li class="<?php if($this->router->class == "do_it_online") echo "active"; ?>">
                                <a href="<?php echo base_url(); ?>index.php/do_it_online"> Attendance Excuse

                      Jobs

                            <li class="<?php if(($this->router->class == "apply_job") && ($this->input->get('action') == "") ) echo "active"; ?>">
                                <a href="<?php echo base_url(); ?>index.php/apply_job"> Job List

                            <li class="<?php if(($this->router->class == "apply_job") && ($this->input->get('action') == "applied") ) echo "active"; ?>">
                                <a href="<?php echo base_url(); ?>index.php/apply_job?action=applied"> Job Applied


text:
package net.sf.jsqlparser.expression;

/**
 * It represents a "-" or "+" before an expression
 */
public class SignedExpression implements Expression {

	private char sign;
	private Expression expression;

	public SignedExpression(char sign, Expression expression) {
		setSign(sign);
		setExpression(expression);
	}

	public char getSign() {
		return sign;
	}

	public final void setSign(char sign) {
		this.sign = sign;
		if (sign != '+' && sign != '-') {
			throw new IllegalArgumentException("illegal sign character, only + - allowed");
		}
	}

	public Expression getExpression() {
		return expression;
	}

	public final void setExpression(Expression expression) {
		this.expression = expression;
	}

	@Override
	public void accept(ExpressionVisitor expressionVisitor) {
		expressionVisitor.visit(this);
	}

	@Override
	public String toString() {
		return getSign() + expression.toString();
	}
}


text:
nagios-snmp-tortilla
====================

Nagios/Icinga SNMP plugin for dummies (and/or lazy administrators).

This script contains prepackaged definitions of miscellaneous
hardware/software which can be modified by Nagios.

Just use:
$ check_snmp_tortilla -c config_file.ini -C community -H host_address

Feel free to send updates.


text:
namespace SubtitleCommunitySystem.Web.Areas.Administration.Models
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Web;

    using AutoMapper;

    using SubtitleCommunitySystem.Model;
    using SubtitleCommunitySystem.Web.Infrastructure.Mappings;

    public class RequestDetailedModel : IMapFrom<PromotionRequest>, IHaveCustomMappings
    {
        public int Id { get; set; }

        [Required]
        [MaxLength(500)]
        public string Content { get; set; }

        public DateTime DateCreated { get; set; }

        public RequestType Type { get; set; }

        public RequestState RequestState { get; set; }

        public string UserName { get; set; }

        public void CreateMappings(IConfiguration configuration)
        {
            configuration.CreateMap<PromotionRequest, RequestDetailedModel>()
                .ForMember(m => m.UserName, opt => opt.MapFrom(u => u.User.UserName));
        }
    }
}