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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>IdentityLink (Flowable - Engine 5.23.0 API)</title>
<meta name="date" content="2017-03-27">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.activiti.engine.task

Interface IdentityLink

public interface IdentityLink

An identity link is used to associate a task with a certain identity.

 For example:
 - a user can be an assignee (= identity link type) for a task
 - a group can be a candidate-group (= identity link type) for a task

Author:

Joram Barrez

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

String
getGroupId()

If the identity link involves a group, then this will be a non-null id of a group.

String
getProcessDefinitionId()

The process definition id associated with this identity link.

String
getProcessInstanceId()

The process instance id associated with this identity link.

String
getTaskId()

The id of the task associated with this identity link.

String
getType()

Returns the type of link.

String
getUserId()

If the identity link involves a user, then this will be a non-null id of a user.

Method Detail

getType

String getType()

Returns the type of link.
 See IdentityLinkType for the native supported types by Activiti.

getUserId

String getUserId()

If the identity link involves a user, then this will be a non-null id of a user.
 That userId can be used to query for user information through the UserQuery API.

getGroupId

String getGroupId()

If the identity link involves a group, then this will be a non-null id of a group.
 That groupId can be used to query for user information through the GroupQuery API.

getTaskId

String getTaskId()

The id of the task associated with this identity link.

getProcessDefinitionId

String getProcessDefinitionId()

The process definition id associated with this identity link.

getProcessInstanceId

String getProcessInstanceId()

The process instance id associated with this identity link.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2017 Flowable. All rights reserved.


text:
using Lime.Protocol;
using System;
using System.Threading.Tasks;
using Takenet.MessagingHub.Client.Listener;
using System.Threading;

namespace Takenet.MessagingHub.Client.Extensions.Tunnel
{
    /// <summary>
    /// Receives envelopes from the tunnel address (in the [destination]@tunnel.msging.net/[originator] format)
    /// and forwards to the original sender.
    /// </summary>
    /// <typeparam name="TEnvelope"></typeparam>
    public class TunnelEnvelopeReceiver<TEnvelope> : IEnvelopeReceiver<TEnvelope> where TEnvelope : Envelope, new()
    {
        private readonly Func<TEnvelope, CancellationToken, Task> _senderFunc;

        public TunnelEnvelopeReceiver(Func<TEnvelope, CancellationToken, Task> senderFunc)
        {
            _senderFunc = senderFunc;
        }

        public virtual async Task ReceiveAsync(TEnvelope envelope, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (!(envelope.From?.Domain?.Equals(TunnelExtension.TunnelAddress.Domain, StringComparison.OrdinalIgnoreCase) ?? false)
                || envelope.From?.Instance == null)
            {
                throw new ArgumentException("Invalid envelope destination for the tunnel receiver. Please check the configured filter.");
            }

            // Retrieve the original destination
            var originator = Node.Parse(Uri.UnescapeDataString(envelope.From.Instance));
            var originatorEnvelope = envelope.ShallowCopy();
            originatorEnvelope.From = null;
            originatorEnvelope.To = originator;
            await _senderFunc(originatorEnvelope, cancellationToken);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace MO.Common.IO
{
   public interface ICharStream : IStream, IReader, IWriter
   {
   }
}


text:
'use strict';

var _ = require('underscore');
var debug = require('debug')('grainstore:mml-builder-child');
var MMLBuilder = require('./mml-builder-inline');

process.on('message', function (input) {
    debug('Child got MML Builder Context');
    try {
        var mmlBuilder = new MMLBuilder(input.context.params, input.context.options);

        // setting mml_builder context from parent process to have updated params before building XML
        _.extend(mmlBuilder, input.context);

        mmlBuilder.toXML(function (err, xml) {
            if (err) {
                return process.send({ err: err.message });
            }

            process.send({ xml: xml });
        });
    } catch (err) {
        return process.send({ err: err.message });
    }
});


text:
/**
 * @file
 * @author Philippe Antoine <contact@catenacyber.fr>
 * fuzz harness for libhtp
 */

#include <errno.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <stdio.h>
#include <inttypes.h>
#include <sys/stat.h>
#include <fcntl.h>

#include "htp/htp.h"
#include "test/test.h"
#include "fuzz_htp.h"

FILE * logfile = NULL;

/**
 * Invoked at the end of every transaction.
 *
 * @param[in] connp
 */
static int HTPCallbackResponse(htp_tx_t *out_tx) {
    if (out_tx != NULL) {
        char *x = bstr_util_strdup_to_c(out_tx->request_line);
        fprintf(logfile, "HTPCallbackResponse %s\n", x);
        free(x);
    }
    return 0;
}

static int HTPCallbackRequestHeaderData(htp_tx_data_t *tx_data)
{
    fprintf(logfile, "HTPCallbackRequestHeaderData %"PRIuMAX"\n", (uintmax_t)tx_data->len);
    if (tx_data->len > 0) {
        fprintf(logfile, "HTPCallbackRequestHeaderData %x %x\n", tx_data->data[0], tx_data->data[(uintmax_t)tx_data->len-1]);
    }
    return 0;
}

static int HTPCallbackResponseHeaderData(htp_tx_data_t *tx_data)
{
    fprintf(logfile, "HTPCallbackResponseHeaderData %"PRIuMAX"\n", (uintmax_t)tx_data->len);
    if (tx_data->len > 0) {
        fprintf(logfile, "HTPCallbackResponseHeaderData %x %x\n", tx_data->data[0], tx_data->data[(uintmax_t)tx_data->len-1]);
    }
    return 0;
}

static int HTPCallbackRequestHasTrailer(htp_tx_t *tx)
{
    fprintf(logfile, "HTPCallbackRequestHasTrailer\n");
    return 0;
}

static int HTPCallbackResponseHasTrailer(htp_tx_t *tx)
{
    fprintf(logfile, "HTPCallbackResponseHasTrailer\n");
    return 0;
}

static int HTPCallbackRequestBodyData(htp_tx_data_t *tx_data)
{
    fprintf(logfile, "HTPCallbackRequestBodyData %"PRIuMAX"\n", (uintmax_t)tx_data->len);
    if (tx_data->len > 0 && tx_data->data != NULL) {
        fprintf(logfile, "HTPCallbackRequestBodyData %x %x\n", tx_data->data[0], tx_data->data[(uintmax_t)tx_data->len-1]);
    }
    return 0;
}

static int HTPCallbackResponseBodyData(htp_tx_data_t *tx_data)
{
    fprintf(logfile, "HTPCallbackResponseBodyData %"PRIuMAX"\n", (uintmax_t)tx_data->len);
    if (tx_data->len > 0 && tx_data->data != NULL) {
        fprintf(logfile, "HTPCallbackResponseBodyData %x %x\n", tx_data->data[0], tx_data->data[(uintmax_t)tx_data->len-1]);
    }
    return 0;
}

static int HTPCallbackRequestStart(htp_tx_t *tx)
{
    fprintf(logfile, "HTPCallbackRequestStart\n");
    return 0;
}

static int HTPCallbackRequest(htp_tx_t *tx)
{
    fprintf(logfile, "HTPCallbackRequest\n");
    return 0;
}

static int HTPCallbackResponseStart(htp_tx_t *tx)
{
    fprintf(logfile, "HTPCallbackResponseStart\n");
    return 0;
}

static int HTPCallbackRequestLine(htp_tx_t *tx)
{
    fprintf(logfile, "HTPCallbackRequestLine\n");
    return 0;
}

/**
 * Invoked every time LibHTP wants to log.
 *
 * @param[in] log
 */
static int HTPCallbackLog(htp_log_t *log) {
    fprintf(logfile, "HTPCallbackLog [%d][code %d][file %s][line %d] %s\n",
        log->level, log->code, log->file, log->line, log->msg);
    return 0;
}

void fuzz_openFile(const char * name) {
    if (logfile != NULL) {
        fclose(logfile);
    }
    logfile = fopen(name, "w");
}

int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
    htp_cfg_t *cfg;
    htp_connp_t * connp;
    int rc;
    test_t test;

    //initialize output file
    if (logfile == NULL) {
        logfile = fopen("/dev/null", "w");
        if (logfile == NULL) {
            abort();
        }
    }

    // Create LibHTP configuration
    cfg = htp_config_create();
    if (htp_config_set_server_personality(cfg, HTP_SERVER_IDS) != HTP_OK) {
        htp_config_destroy(cfg);
        return 0;
    }
    htp_config_register_log(cfg, HTPCallbackLog);
    htp_config_register_request_header_data(cfg, HTPCallbackRequestHeaderData);
    htp_config_register_request_trailer_data(cfg, HTPCallbackRequestHeaderData);
    htp_config_register_response_header_data(cfg, HTPCallbackResponseHeaderData);
    htp_config_register_response_trailer_data(cfg, HTPCallbackResponseHeaderData);
    htp_config_register_request_trailer(cfg, HTPCallbackRequestHasTrailer);
    htp_config_register_response_trailer(cfg, HTPCallbackResponseHasTrailer);
    htp_config_register_request_body_data(cfg, HTPCallbackRequestBodyData);
    htp_config_register_response_body_data(cfg, HTPCallbackResponseBodyData);
    htp_config_register_request_start(cfg, HTPCallbackRequestStart);
    htp_config_register_request_complete(cfg, HTPCallbackRequest);
    htp_config_register_response_start(cfg, HTPCallbackResponseStart);
    htp_config_register_response_complete(cfg, HTPCallbackResponse);
    htp_config_register_request_line(cfg, HTPCallbackRequestLine);

    connp = htp_connp_create(cfg);
    htp_connp_set_user_data(connp, (void *) 0x02);
    htp_connp_open(connp, (const char *) "192.168.2.3", 12345, (const char *) "192.168.2.2", 80, NULL);

    test.buf = (char *)Data;
    test.len = Size;
    test.pos = 0;
    test.chunk = NULL;

    // Find all chunks and feed them to the parser
    int in_data_other = 0;
    char *in_data = NULL;
    size_t in_data_len = 0;
    size_t in_data_offset = 0;
    int out_data_other = 0;
    char *out_data = NULL;
    size_t out_data_len = 0;
    size_t out_data_offset = 0;

    for (;;) {
        if (test_next_chunk(&test) <= 0) {
            break;
        }
        if (test.chunk_len == 0) {
            continue;
        }
        if (test.chunk_direction == CLIENT) {
            if (in_data_other) {
                break;
            }
            rc = htp_connp_req_data(connp, NULL, test.chunk, test.chunk_len);
            if (rc == HTP_STREAM_ERROR) {
                break;
            }
            if (rc == HTP_STREAM_DATA_OTHER) {
                // Parser needs to see the outbound stream in order to continue
                // parsing the inbound stream.
                in_data_other = 1;
                in_data = test.chunk;
                in_data_len = test.chunk_len;
                in_data_offset = htp_connp_req_data_consumed(connp);
            }
        } else {
            if (out_data_other) {
                if (out_data == NULL) {
                    rc = htp_connp_res_data(connp, NULL, NULL, out_data_len - out_data_offset);
                } else {
                    rc = htp_connp_res_data(connp, NULL, out_data + out_data_offset, out_data_len - out_data_offset);
                }
                if (rc == HTP_STREAM_ERROR) {
                    break;
                }
                out_data_other = 0;
            }
            rc = htp_connp_res_data(connp, NULL, test.chunk, test.chunk_len);
            if (rc == HTP_STREAM_ERROR) {
                break;
            }
            if (rc == HTP_STREAM_DATA_OTHER) {
                // Parser needs to see the outbound stream in order to continue
                // parsing the inbound stream.
                out_data_other = 1;
                out_data = test.chunk;
                out_data_len = test.chunk_len;
                out_data_offset = htp_connp_res_data_consumed(connp);
            }
            if (in_data_other) {
                if (in_data == NULL) {
                    rc = htp_connp_req_data(connp, NULL, NULL, in_data_len - in_data_offset);
                } else {
                    rc = htp_connp_req_data(connp, NULL, in_data + in_data_offset, in_data_len - in_data_offset);
                }
                if (rc == HTP_STREAM_ERROR) {
                    break;
                }
                in_data_other = 0;
            }
        }
    }
    if (out_data_other) {
        if (out_data == NULL) {
            (void) htp_connp_res_data(connp, NULL, NULL, out_data_len - out_data_offset);
        } else {
            (void) htp_connp_res_data(connp, NULL, out_data + out_data_offset, out_data_len - out_data_offset);
        }
    }

    htp_connp_close(connp, NULL);
    htp_connp_destroy_all(connp);
    // Destroy LibHTP configuration
    htp_config_destroy(cfg);

    return 0;
}


text:
namespace riakboost{} namespace boost = riakboost; namespace riakboost{
    template< class T >
    struct range_difference : iterator_difference< typename range_iterator<T>::type >
    { };
}

#endif


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

  angular
    .module('horizon.dashboard.project.lbaasv2.listeners')
    .controller('ListenersTableController', ListenersTableController);

  ListenersTableController.$inject = [
    'horizon.app.core.openstack-service-api.lbaasv2',
    '$routeParams',
    'horizon.dashboard.project.lbaasv2.listeners.actions.rowActions',
    'horizon.dashboard.project.lbaasv2.listeners.actions.batchActions'
  ];

  /**
   * @ngdoc controller
   * @name ListenersTableController
   *
   * @description
   * Controller for the LBaaS v2 listeners table. Serves as the focal point for table actions.
   *
   * @param api The LBaaS V2 service API.
   * @param $routeParams The angular $routeParams service.
   * @param rowActions The listener row actions service.
   * @param batchActions The listener batch actions service.
   * @returns undefined
   */

  function ListenersTableController(api, $routeParams, rowActions, batchActions) {

    var ctrl = this;
    ctrl.items = [];
    ctrl.src = [];
    ctrl.checked = {};
    ctrl.loadbalancerId = $routeParams.loadbalancerId;
    ctrl.batchActions = batchActions.init(ctrl.loadbalancerId);
    ctrl.rowActions = rowActions.init(ctrl.loadbalancerId);

    init();

    ////////////////////////////////

    function init() {
      api.getListeners(ctrl.loadbalancerId).success(success);
    }

    function success(response) {
      ctrl.src = response.items;
    }

  }

})();


text:
<?php

/**
 * 事件请求
 * @author ForeverGlory
 */

namespace Glory\AutoReply\Request\Interfaces;

interface EventRequestInterface extends RequestInterface {

    public function setEvent($event);

    public function getEvent();
}


text:
require 'active_support/concern'

module Kpi::UsuarioKpi
  include Kpi::Comun
  extend ActiveSupport::Concern

  included do
    extend ComunScopes
    scopes_comunes

    ESTADO_USUARIO_SIN_ACTIVAR = 0
    ESTADO_USUARIO_NORMAL = 1
    ESTADO_USUARIO_ADMIN = 3
    EXPERTO = 'Experto'

    scope :todos, -> { nil }
    scope :activados, -> { where("estado_id > #{ ESTADO_USUARIO_SIN_ACTIVAR }") }
    scope :sin_activar, -> { where(estado_id: ESTADO_USUARIO_SIN_ACTIVAR) }

    def self.ids_de_expertos
      ::Kpi::Clases.tematizacion_extern.constantize.where(tematizable_type: ::Kpi::Clases.usuario_extern, tematizable_grupo: EXPERTO).pluck(:tematizable_id)
    end

    def self.ids_de_admins
      self.where('estado_id >= ?', ESTADO_USUARIO_ADMIN).pluck(:id)
    end
  end
end


text:
import { MigrationInterface, QueryRunner } from "typeorm";

export class ProjectAdvancedEditFlag1598899242836 implements MigrationInterface {
  name = "ProjectAdvancedEditFlag1598899242836";

  public async up(queryRunner: QueryRunner): Promise<any> {
    await queryRunner.query(
      `ALTER TABLE "project" ADD "advancedEditingEnabled" boolean NOT NULL DEFAULT false`,
      undefined
    );
  }

  public async down(queryRunner: QueryRunner): Promise<any> {
    await queryRunner.query(
      `ALTER TABLE "project" DROP COLUMN "advancedEditingEnabled"`,
      undefined
    );
  }
}


text:
//
// Serializer for com.wilutions.jsfs.BRequest_DispatcherService_registerNotifyService
//
// THIS FILE HAS BEEN GENERATED. DO NOT MODIFY.
//

using System;
using System.Collections.Generic;
using byps;

namespace com.wilutions.jsfs
{

	public class BSerializer_1849102471 : BSerializer {

		public readonly static BSerializer instance = new BSerializer_1849102471();

		public BSerializer_1849102471()
			: base(1849102471) {}

		public BSerializer_1849102471(int typeId)
			: base(typeId) {}

		public override void write(Object obj1, BOutput bout1, long version)
		{
			BRequest_DispatcherService_registerNotifyService obj = (BRequest_DispatcherService_registerNotifyService)obj1;
			BOutputBin bout = (BOutputBin)bout1;
			BBufferBin bbuf = bout.bbuf;
			// checkpoint byps.gen.cs.PrintContext:494
			bbuf.putString(obj.tokenValue);
			// checkpoint byps.gen.cs.PrintContext:494
			bout.writeObj(obj.serviceValue, false, null);
		}

		public override Object read(Object obj1, BInput bin1, long version)
		{
			BInputBin bin = (BInputBin)bin1;
			BRequest_DispatcherService_registerNotifyService obj = (BRequest_DispatcherService_registerNotifyService)(obj1 != null ? obj1 : bin.onObjectCreated(new BRequest_DispatcherService_registerNotifyService()));

			BBufferBin bbuf = bin.bbuf;
			// checkpoint byps.gen.cs.PrintContext:449
			obj.tokenValue = bbuf.getString();
			// checkpoint byps.gen.cs.PrintContext:449
			obj.serviceValue = (com.wilutions.jsfs.FileSystemNotify)bin.readObj(false, null);

			return obj;
		}

	}
} // namespace


text:
package org.gradle.api.internal.artifacts.ivyservice.moduleconverter;

import org.gradle.api.artifacts.Configuration;
import org.gradle.api.internal.artifacts.metadata.MutableLocalComponentMetaData;

public interface ConfigurationsToArtifactsConverter {
    void addArtifacts(MutableLocalComponentMetaData metaData, Iterable<? extends Configuration> configurations);
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;

namespace Granular.Presentation.Generic
{
    [TemplateVisualState(VisualStates.CommonStates, VisualStates.NormalState)]
    [TemplateVisualState(VisualStates.CommonStates, VisualStates.MouseOverState)]
    [TemplateVisualState(VisualStates.CommonStates, VisualStates.PressedState)]
    [TemplateVisualState(VisualStates.CommonStates, VisualStates.DisabledState)]
    [TemplateVisualState(VisualStates.CheckStates, VisualStates.CheckedState)]
    [TemplateVisualState(VisualStates.CheckStates, VisualStates.UncheckedState)]
    [TemplateVisualState(VisualStates.CheckStates, VisualStates.IndeterminateState)]
    public class BulletChrome : Control
    {
        public static readonly DependencyProperty RenderEnabledProperty = DependencyProperty.RegisterAttached("RenderEnabled", typeof(bool), typeof(BulletChrome), new FrameworkPropertyMetadata(FrameworkPropertyMetadataOptions.AffectsVisualState));
        public bool RenderEnabled
        {
            get { return (bool)GetValue(RenderEnabledProperty); }
            set { SetValue(RenderEnabledProperty, value); }
        }

        public static readonly DependencyProperty RenderMouseOverProperty = DependencyProperty.RegisterAttached("RenderMouseOver", typeof(bool), typeof(BulletChrome), new FrameworkPropertyMetadata(FrameworkPropertyMetadataOptions.AffectsVisualState));
        public bool RenderMouseOver
        {
            get { return (bool)GetValue(RenderMouseOverProperty); }
            set { SetValue(RenderMouseOverProperty, value); }
        }

        public static readonly DependencyProperty RenderPressedProperty = DependencyProperty.RegisterAttached("RenderPressed", typeof(bool), typeof(BulletChrome), new FrameworkPropertyMetadata(FrameworkPropertyMetadataOptions.AffectsVisualState));
        public bool RenderPressed
        {
            get { return (bool)GetValue(RenderPressedProperty); }
            set { SetValue(RenderPressedProperty, value); }
        }

        public static readonly DependencyProperty RenderCheckedProperty = DependencyProperty.RegisterAttached("RenderChecked", typeof(bool?), typeof(BulletChrome), new FrameworkPropertyMetadata(FrameworkPropertyMetadataOptions.AffectsVisualState));
        public bool? RenderChecked
        {
            get { return (bool?)GetValue(RenderCheckedProperty); }
            set { SetValue(RenderCheckedProperty, value); }
        }

        public static readonly DependencyProperty RenderRoundProperty = DependencyProperty.RegisterAttached("RenderRound", typeof(bool), typeof(BulletChrome), new FrameworkPropertyMetadata(true));
        public bool RenderRound
        {
            get { return (bool)GetValue(RenderRoundProperty); }
            set { SetValue(RenderRoundProperty, value); }
        }

        public static readonly DependencyProperty BulletTemplateProperty = DependencyProperty.RegisterAttached("BulletTemplate", typeof(ControlTemplate), typeof(BulletChrome), new FrameworkPropertyMetadata());
        public ControlTemplate BulletTemplate
        {
            get { return (ControlTemplate)GetValue(BulletTemplateProperty); }
            set { SetValue(BulletTemplateProperty, value); }
        }

        public static readonly DependencyProperty IndeterminateBulletTemplateProperty = DependencyProperty.RegisterAttached("IndeterminateBulletTemplate", typeof(ControlTemplate), typeof(BulletChrome), new FrameworkPropertyMetadata());
        public ControlTemplate IndeterminateBulletTemplate
        {
            get { return (ControlTemplate)GetValue(IndeterminateBulletTemplateProperty); }
            set { SetValue(IndeterminateBulletTemplateProperty, value); }
        }

        public static readonly DependencyProperty IsThreeStateProperty = DependencyProperty.RegisterAttached("IsThreeState", typeof(bool), typeof(BulletChrome), new FrameworkPropertyMetadata());
        public bool IsThreeState
        {
            get { return (bool)GetValue(IsThreeStateProperty); }
            set { SetValue(IsThreeStateProperty, value); }
        }

        static BulletChrome()
        {
            FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(BulletChrome), new FrameworkPropertyMetadata(new StyleKey(typeof(BulletChrome))));
        }

        protected override void UpdateVisualState(bool useTransitions)
        {
            VisualStateManager.GoToState(this, GetCommonStateName(), useTransitions);
            VisualStateManager.GoToState(this, GetCheckStateName(), useTransitions);
        }

        private string GetCommonStateName()
        {
            if (!RenderEnabled)
            {
                return VisualStates.DisabledState;
            }

            if (RenderPressed)
            {
                return VisualStates.PressedState;
            }

            if (RenderMouseOver)
            {
                return VisualStates.MouseOverState;
            }

            return VisualStates.NormalState;
        }

        private string GetCheckStateName()
        {
            return GetCheckStateName(RenderPressed ? GetPreviewToggledState(RenderChecked, IsThreeState) : RenderChecked);
        }

        private static bool? GetPreviewToggledState(bool? currentState, bool isThreeState)
        {
            bool? toggledState = ToggleButton.GetToggledState(currentState, isThreeState);
            return toggledState == false ? currentState : toggledState;
        }

        private static string GetCheckStateName(bool? isChecked)
        {
            if (isChecked.HasValue)
            {
                return isChecked.Value ? VisualStates.CheckedState : VisualStates.UncheckedState;
            }

            return VisualStates.IndeterminateState;
        }
    }
}


text:
package io.realm.entities;

import io.realm.RealmObject;
import io.realm.RealmResults;
import io.realm.annotations.LinkingObjects;

public class BacklinksMissingFieldTarget extends RealmObject {
    private int id;

    @LinkingObjects("child")
    private final RealmResults<BacklinksMissingFieldSource> parents = null;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public RealmResults<BacklinksMissingFieldSource> getParents() {
        return parents;
    }
}


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

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>2. dossier.store — store feature collections — dossier 0.3.4 documentation</title>

    <link rel="stylesheet" href="_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <link rel="top" title="dossier 0.3.4 documentation" href="index.html" />
    <link rel="next" title="3. dossier.label — store ground truth data as labels" href="dossier.label.html" />
    <link rel="prev" title="1. dossier.fc — feature collections" href="dossier.fc.html" />

Navigation

          index

          modules |

          next |

          previous |

dossier 0.3.4 documentation »

2. dossier.store — store feature collections¶

A simple storage interface for feature collections.

Compatible interfaces on both ElasticSearch and kvlayer
are provided.

2.1. ElasticSearch based storage¶

dossier.store provides an interface to storing feature
collections in ElasticSearch.

class dossier.store.ElasticStore(hosts=None, namespace=None, type='fc', feature_indexes=None, shards=10, replicas=0, fulltext_indexes=None)[source]¶

A feature collection store on ElasticSearch.

Feature collections are maps from feature names to features.
The representation of each feature is unspecified by this
interface.

This class exposes a similar interface to the regular Store
class, with a few additions:

Canopy scans are implemented natively with ElasticSearch,
so they are provided as methods here.

On all retrieval methods, the caller can pass a list of
feature names (or feature name wildcards) to retrieve.
If your FCs have lots of features, this is useful when
you only need to retrieve a small fraction of them.

__init__(hosts=None, namespace=None, type='fc', feature_indexes=None, shards=10, replicas=0, fulltext_indexes=None)[source]¶

Create a new store or connect to an existing one.

<col class="field-name" />
<col class="field-body" />

Parameters:

hosts – Passed directly to elasticsearch.Elasticsearch
constructor. Required.

namespace (str) – Used as the ES index name, prefixed by fcs_. Required.

type (str) – The ES type to use. If this is set to None, then a random
unique string is used.

feature_indexes ([str]) – A list of names of features to index.

shards (int) – The number of shards to use for this index. This only has an
effect if the ES index didn’t previous exist.

replicas (int) – The number of replicas to use for this index. This only has
an effect if the ES index didn’t previous exist.

Return type:
ElasticStore

classmethod configured()[source]¶

Create a new instance from the global configuration.

In order to use this, you must make sure that
ElasticStore has been configured by yakonfig,
usually by passing the class to yakonfig.parse_args.

CRUD operations

get(content_id, feature_names=None)[source]¶

Retrieve a feature collection.

If a feature collection with the given id does not
exist, then None is returned.

<col class="field-name" />
<col class="field-body" />

Parameters:

content_id (str) – Content identifier.

feature_names ([str]) – A list of feature names to retrieve. When None, all
features are retrieved. Wildcards are allowed.

Return type:
dossier.fc.FeatureCollection or None

get_many(content_ids, feature_names=None)[source]¶

Returns an iterable of feature collections.

This efficiently retrieves multiple FCs corresponding to the
list of ids given. Tuples of identifier and feature collection
are yielded. If the feature collection for a given id does not
exist, then None is returned as the second element of the
tuple.

<col class="field-name" />
<col class="field-body" />

Parameters:

content_ids ([str]) – List of content ids.

feature_names ([str]) – A list of feature names to retrieve. When None, all
features are retrieved. Wildcards are allowed.

Return type:
Iterable of (content_id, FC)

put(items, indexes=True)[source]¶

Adds feature collections to the store.

This efficiently adds multiple FCs to the store. The iterable
of items given should yield tuples of (content_id, FC).

<col class="field-name" />
<col class="field-body" />

Parameters:

items – Iterable of (content_id, FC).

feature_names ([str]) – A list of feature names to retrieve. When None, all
features are retrieved. Wildcards are allowed.

delete(content_id)[source]¶

Deletes the corresponding feature collection.

If the FC does not exist, then this is a no-op.

delete_all()[source]¶

Deletes all feature collections.

This does not destroy the ES index, but instead only
deletes all FCs with the configured document type
(defaults to fc).

delete_index()[source]¶

Deletes the underlying ES index.

Only use this if you know what you’re doing. This destroys
the entire underlying ES index, which could be shared by
multiple distinct ElasticStore instances.

Keyword scanning

keyword_scan(query_id=None, query_fc=None, feature_names=None)[source]¶

Keyword scan for feature collections.

This performs a keyword scan using the query given. A keyword
scan searches for FCs with terms in each of the query’s indexed
fields.

At least one of query_id or query_fc must be provided.
If query_fc is None, then the query is retrieved
automatically corresponding to query_id.

<col class="field-name" />
<col class="field-body" />

Parameters:

query_id (str) – Optional query id.

query_fc (dossier.fc.FeatureCollection) – Optional query feature collection.

feature_names ([str]) – A list of feature names to retrieve. When None, all
features are retrieved. Wildcards are allowed.

Return type:
Iterable of (content_id, FC)

keyword_scan_ids(query_id=None, query_fc=None)[source]¶

Keyword scan for ids.

This performs a keyword scan using the query given. A keyword
scan searches for FCs with terms in each of the query’s indexed
fields.

At least one of query_id or query_fc must be provided.
If query_fc is None, then the query is retrieved
automatically corresponding to query_id.

<col class="field-name" />
<col class="field-body" />

Parameters:

query_id (str) – Optional query id.

query_fc (dossier.fc.FeatureCollection) – Optional query feature collection.

Return type:
Iterable of content_id

Scanning ids in lexicographic order

Note that these operations may be inefficient because of
how ElasticSearch handles sorting.

scan(*key_ranges, **kwargs)[source]¶

Scan for FCs in the given id ranges.

<col class="field-name" />
<col class="field-body" />

Parameters:

key_ranges – key_ranges should be a list of pairs of ranges. The first
value is the lower bound id and the second value is the
upper bound id. Use () in either position to leave it
unbounded. If no key_ranges are given, then all FCs in
the store are returned.

feature_names ([str]) – A list of feature names to retrieve. When None, all
features are retrieved. Wildcards are allowed.

Return type:
Iterable of (content_id, FC)

scan_ids(*key_ranges, **kwargs)[source]¶

Scan for ids only in the given id ranges.

<col class="field-name" />
<col class="field-body" />

Parameters:

key_ranges – key_ranges should be a list of pairs of ranges. The first
value is the lower bound id and the second value is the
upper bound id. Use () in either position to leave it
unbounded. If no key_ranges are given, then all FCs in
the store are returned.

feature_names ([str]) – A list of feature names to retrieve. When None, all
features are retrieved. Wildcards are allowed.

Return type:
Iterable of content_id

scan_prefix(prefix, feature_names=None)[source]¶

Scan for FCs with a given prefix.

<col class="field-name" />
<col class="field-body" />

Parameters:

prefix (str) – Identifier prefix.

feature_names ([str]) – A list of feature names to retrieve. When None, all
features are retrieved. Wildcards are allowed.

Return type:
Iterable of (content_id, FC)

scan_prefix_ids(prefix)[source]¶

Scan for ids with a given prefix.

<col class="field-name" />
<col class="field-body" />

Parameters:

prefix (str) – Identifier prefix.

feature_names ([str]) – A list of feature names to retrieve. When None, all
features are retrieved. Wildcards are allowed.

Return type:
Iterable of content_id

Low-level

sync()[source]¶

Tells ES to tell Lucene to do an fsync.

This guarantees that any previous calls to put will be
flushed to disk and available in subsequent searches.

Generally, this should only be used in test code.

index_scan_ids(fname, val)[source]¶

Low-level keyword index scan for ids.

Retrieves identifiers of FCs that have a feature value
val in the feature named fname. Note that
fname must be indexed.

<col class="field-name" />
<col class="field-body" />

Parameters:

fname (str) – Feature name.

val (str) – Feature value.

Return type:
Iterable of content_id

index_names()[source]¶

Returns a list of all defined index names.

Note that this only includes boolean based indexes.

<col class="field-name" />
<col class="field-body" />

Return type:	list of unicode

class dossier.store.ElasticStoreSync(hosts=None, namespace=None, type='fc', feature_indexes=None, shards=10, replicas=0, fulltext_indexes=None)[source]¶

Synchronous ElasticSearch backend.

This is just like ElasticStore, except it will call sync
after every put and delete operation.

This is useful for testing where it is most convenient for every
write operation to be synchronous.

2.2. kvlayer based storage¶

dossier.store also provides a convenient interface to a
kvlayer table for storing dossier.fc.FeatureCollection.
The interface consists of methods to query, search, add and remove
feature collections from the store. It also provides functions for
defining and searching indexes.

Using a storage backend in your code requires a working kvlayer
configuration, which is usually written in a YAML file like so:

kvlayer:
  app_name: store
  namespace: dossier
  storage_type: redis
  storage_addresses: ["redis.example.com:6379"]

And here’s a full working example that uses local memory to store
feature collections:

from dossier.fc import FeatureCollection
from dossier.store import Store
import kvlayer
import yakonfig

yaml = """
kvlayer:
  app_name: store
  namespace: dossier
  storage_type: local
"""
with yakonfig.defaulted_config([kvlayer], yaml=yaml):
    store = Store(kvlayer.client())

    fc = FeatureCollection({u'NAME': {'Foo': 1, 'Bar': 2}})
    store.put([('1', fc)])
    print store.get('1')

See the documentation for yakonfig for more details on the
configuration setup.

Another example showing how to store, retrieve and delete a feature
collection:

fc = dossier.fc.FeatureCollection()
fc[u'NAME'][u'foo'] += 1
fc[u'NAME'][u'bar'] = 42

kvl = kvlayer.client()
store = dossier.store.Store(kvl)

store.put('{yourid}', fc)
assert store.get('{yourid}')[u'NAME'][u'bar'] == 42
store.delete('{yourid}')
assert store.get('{yourid}') is None

Here is another example that demonstrates use of indexing to enable a
poor man’s case insensitive search:

fc = dossier.fc.FeatureCollection()
fc[u'NAME'][u'foo'] += 1
fc[u'NAME'][u'bar'] = 42

kvl = kvlayer.client()
store = dossier.store.Store(kvl)

# Index transforms must be defined on every instance of `Store`.
# (The index data is persisted; the transforms themselves are
# ephemeral.)
store.define_index(u'name_casei',
                   create=feature_index(u'NAME'),
                   transform=lambda s: s.lower().encode('utf-8'))

store.put('{yourid}', fc)  # `put` automatically updates indexes.
assert list(store.index_scan(u'name_casei', 'FoO'))[0] == '{yourid}'

class dossier.store.Store(kvlclient, impl=None, feature_indexes=None)[source]¶

A feature collection database.

A feature collection database stores feature collections for content
objects like profiles from external knowledge bases.

Every feature collection is keyed by its content_id, which is a
byte string. The value of a content_id is specific to the type
of content represented by the feature collection. In other words,
its representation is unspecified.

__init__(kvlclient, impl=None, feature_indexes=None)[source]¶

Connects to a feature collection store.

This also initializes the underlying kvlayer namespace.

<col class="field-name" />
<col class="field-body" />

Parameters:	kvl (kvlayer.AbstractStorage) – kvlayer storage client

Return type:	Store

get(content_id)[source]¶

Retrieve a feature collection from the store.  This is the same as
get_many([content_id])

If the feature collection does not exist None is
returned.

<col class="field-name" />
<col class="field-body" />

Return type:	dossier.fc.FeatureCollection

get_many(content_id_list)[source]¶

Yield (content_id, data) tuples for ids in list.

As with get(), if a content_id in the list is missing,
then it is yielded with a data value of None.

<col class="field-name" />
<col class="field-body" />

Return type:	yields tuple(str, dossier.fc.FeatureCollection)

put(items, indexes=True)[source]¶

Add feature collections to the store.

Given an iterable of tuples of the form
(content_id, feature collection), add each to the store
and overwrite any that already exist.

This method optionally accepts a keyword argument indexes,
which by default is set to True. When it is True,
it will create new indexes for each content object for all
indexes defined on this store.

Note that this will not update existing indexes. (There is
currently no way to do this without running some sort of
garbage collection process.)

<col class="field-name" />
<col class="field-body" />

Parameters:	items (iterable) – iterable of
(content_id, FeatureCollection).

delete(content_id)[source]¶

Delete a feature collection from the store.

Deletes the content item from the store with identifier
content_id.

<col class="field-name" />
<col class="field-body" />

Parameters:	content_id (str) – identifier for the content object
represented by a feature collection

delete_all()[source]¶

Deletes all storage.

This includes every content object and all index data.

scan(*key_ranges)[source]¶

Retrieve feature collections in a range of ids.

Returns a generator of content objects corresponding to the
content identifier ranges given. key_ranges can be a possibly
empty list of 2-tuples, where the first element of the tuple
is the beginning of a range and the second element is the end
of a range. To specify the beginning or end of the table, use
an empty tuple ().

If the list is empty, then this yields all content objects in
the storage.

<col class="field-name" />
<col class="field-body" />

Parameters:	key_ranges – as described in
kvlayer._abstract_storage.AbstractStorage()

Return type:	generator of
(content_id, dossier.fc.FeatureCollection).

scan_ids(*key_ranges)[source]¶

Retrieve content ids in a range of ids.

Returns a generator of content_id corresponding to the
content identifier ranges given. key_ranges can be a possibly
empty list of 2-tuples, where the first element of the tuple
is the beginning of a range and the second element is the end
of a range. To specify the beginning or end of the table, use
an empty tuple ().

If the list is empty, then this yields all content ids in
the storage.

<col class="field-name" />
<col class="field-body" />

Parameters:	key_ranges – as described in
kvlayer._abstract_storage.AbstractStorage()

Return type:	generator of content_id

scan_prefix(prefix)[source]¶

Returns a generator of content objects matching a prefix.

The prefix here is a prefix for content_id.

<col class="field-name" />
<col class="field-body" />

Return type:	generator of
(content_id, dossier.fc.FeatureCollection).

scan_prefix_ids(prefix)[source]¶

Returns a generator of content ids matching a prefix.

The prefix here is a prefix for content_id.

<col class="field-name" />
<col class="field-body" />

Return type:	generator of content_id

Methods for indexing:

index_scan(idx_name, val)[source]¶

Returns ids that match an indexed value.

Returns a generator of content identifiers that have an entry
in the index idx_name with value val (after index
transforms are applied).

If the index named by idx_name is not registered, then a
KeyError is raised.

<col class="field-name" />
<col class="field-body" />

Parameters:

idx_name (unicode) – name of index

val (unspecified (depends on the index, usually unicode)) – the value to use to search the index

Return type:
generator of content_id

Raises:
KeyError

index_scan_prefix(idx_name, val_prefix)[source]¶

Returns ids that match a prefix of an indexed value.

Returns a generator of content identifiers that have an entry
in the index idx_name with prefix val_prefix (after
index transforms are applied).

If the index named by idx_name is not registered, then a
KeyError is raised.

<col class="field-name" />
<col class="field-body" />

Parameters:

idx_name (unicode) – name of index

val_prefix – the value to use to search the index

Return type:
generator of content_id

Raises:
KeyError

index_scan_prefix_and_return_key(idx_name, val_prefix)[source]¶

Returns ids that match a prefix of an indexed value, and the
specific key that matched the search prefix.

Returns a generator of (index key, content identifier) that
have an entry in the index idx_name with prefix
val_prefix (after index transforms are applied).

If the index named by idx_name is not registered, then a
KeyError is raised.

<col class="field-name" />
<col class="field-body" />

Parameters:

idx_name (unicode) – name of index

val_prefix – the value to use to search the index

Return type:
generator of (index key, content_id)

Raises:
KeyError

define_index(idx_name, create, transform)[source]¶

Add an index to this store instance.

Adds an index transform to the current FC store. Once an index
with name idx_name is added, it will be available in all
index_* methods. Additionally, the index will be automatically
updated on calls to put().

If an index with name idx_name already exists, then it is
overwritten.

Note that indexes do not persist. They must be re-defined for
each instance of Store.

For example, to add an index on the boNAME feature, you can
use the feature_index helper function:

store.define_index('boNAME',
                   feature_index('boNAME'),
                   lambda s: s.encode('utf-8'))

Another example for creating an index on names:

store.define_index('NAME',
                   feature_index('canonical_name', 'NAME'),
                   lambda s: s.lower().encode('utf-8'))

<col class="field-name" />
<col class="field-body" />

Parameters:

idx_name (unicode) – The name of the index. Must be UTF-8 encodable.

create – A function that accepts the transform function and
a pair of (content_id, fc) and produces a generator
of index values from the pair given using transform.

transform – A function that accepts an arbitrary value and
applies a transform to it. This transforms the
stored value to the index value. This must
produce a value with type str (or bytes).

dossier.store.feature_index(*feature_names)[source]¶

Returns a index creation function.

Returns a valid index create function for the feature names
given. This can be used with the Store.define_index()
method to create indexes on any combination of features in a
feature collection.

<col class="field-name" />
<col class="field-body" />

Return type:	(val -> index val)
-> (content_id, FeatureCollection)
-> generator of [index val]

Table Of Contents

2. dossier.store — store feature collections

2.1. ElasticSearch based storage

2.2. kvlayer based storage

Previous topic

1. dossier.fc — feature collections

Next topic

3. dossier.label — store ground truth data as labels

This Page

Show Source

Quick search

    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          index

          modules |

          next |

          previous |

dossier 0.3.4 documentation »

        © Copyright 2014, Diffeo, Inc..
      Created using Sphinx 1.3.1.


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>com.brsanthu</groupId>
		<artifactId>force-apijars</artifactId>
		<version>31.0.0-SNAPSHOT</version>
		<relativePath>..</relativePath>
	</parent>
	<artifactId>force-enterprise</artifactId>
	<build>
		<sourceDirectory>./target/src-gen</sourceDirectory>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>1.2.1</version>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>exec</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<executable>java</executable>
					<includeProjectDependencies>true</includeProjectDependencies>
					<arguments>
 						<argument>-classpath</argument>
			            <classpath />
						<argument>com.sforce.ws.tools.wsdlc</argument>
						<argument>-nc</argument>
						<argument>./src/main/wsdls/${project.artifactId}-${project.version}.wsdl</argument>
						<argument>./target/${project.artifactId}-${project.version}.jar</argument>
						<argument>./target/src-gen</argument>
					</arguments>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>


text:
package org.krysalis.barcode4j.tools;

import junit.framework.TestCase;

/**
 * Tests the Length class.
 *
 * @author Jeremias Maerki
 * @version $Id$
 */
public class LengthTest extends TestCase {

    public LengthTest(String name) {
        super(name);
    }

    public void testLength() throws Exception {
        Length l = new Length(1.77, "cm");
        assertNotNull(l);
        assertEquals(1.77, l.getValue(), 0.001);
        assertEquals("cm", l.getUnit());

        l = new Length("1.77cm");
        assertNotNull(l);
        assertEquals(1.77, l.getValue(), 0.001);
        assertEquals("cm", l.getUnit());

        l = new Length("1.77 cm");
        assertNotNull(l);
        assertEquals(1.77, l.getValue(), 0.001);
        assertEquals("cm", l.getUnit());

        l = new Length("1.77 cm gugus");
        assertNotNull(l);
        assertEquals(1.77, l.getValue(), 0.001);
        assertEquals("cm", l.getUnit());

        l = new Length("2,33", "mm");
        assertNotNull(l);
        assertEquals(2.33, l.getValue(), 0.001);
        assertEquals("mm", l.getUnit());

        l = new Length("2,33pt", "mm");
        assertNotNull(l);
        assertEquals(2.33, l.getValue(), 0.001);
        assertEquals("pt", l.getUnit());

        try {
            l = new Length(null);
            fail("Expected NPE on null parameter");
        } catch (NullPointerException npe) {
            //expected
        }

        try {
            l = new Length("garbage");
            fail("Expected IllegalArgumentException on garbage parameter");
        } catch (IllegalArgumentException iae) {
            //expected
        }

        try {
            l = new Length("2.33");
            fail("Expected IllegalArgumentException on incomplete parameter");
        } catch (IllegalArgumentException iae) {
            //expected
        }

        l = new Length("2.34cm");
        assertEquals(23.4, l.getValueAsMillimeter(), 0.001);

        l = new Length("2.835pt");
        assertEquals(1, l.getValueAsMillimeter(), 0.001);

        l = new Length("0.0393700in");
        assertEquals(1, l.getValueAsMillimeter(), 0.001);
    }

    public void testLengthBuilder() throws Exception {
        Length.Builder builder = new Length.Builder();
        try {
            builder.build();
            fail("expected failure due to missing unit and value");
        } catch (IllegalStateException e) {}

        Length expected = new Length(1234.0, "mm");

        Length l = builder.withValue(1234.0).withUnit("mm").build();
        assertEquals(expected, l);

        builder.reset();
        l = builder.withValue("1234.0").withUnit("mm").build();
        assertEquals(expected, l);

        builder.reset();
        l = builder.fromString("1234.0 mm").build();
        assertEquals(expected, l);
    }
}


text:
package com.xiaofong.abstFactory.impl;

import com.xiaofong.abstFactory.pattern.Shape;

public class Rectangle implements Shape{

	@Override
	public void draw() {
		// TODO Auto-generated method stub
		System.out.println("This shape is rectangle");
	}

}


text:
using System;

namespace TubeStarMetro
{
    public class Loan : StoreItem
    {
        public override string Name
        {
            get { return EnglishStrings.LoanStoreItem.Translate(); }
        }

        public override string Description
        {
            get { return String.Format(EnglishStrings.LoanStoreItemDescription.Translate(), Payout.ToCurrencyString(), AdditionalCost.ToCurrencyString(), Interest); }
        }

        public override string ImageName
        {
            get { return "Money"; }
        }

        public override int Cost
        {
            get { return 0; }
        }

        public double AdditionalCost
        {
            get { return 50; }
        }

        public int Payout
        {
            get { return 2000; }
        }

        public int Interest
        {
            get { return 50; }
        }

        public override int SkillModifier
        {
            get { return 0; }
        }

        public override SkillModifierType SkillModifierType
        {
            get { return SkillModifierType.None; }
        }
    }
}


text:
namespace InspectR.Core.RequestLogger
{
    using System;

    using InspectR.Data;
    using InspectR.Hubs;

    using Microsoft.AspNet.SignalR;

    public class RequestLogger
    {
        private readonly IRequestCache _cache;

        private readonly IRequestCollector _collector;

        public RequestLogger(IRequestCache cache, IRequestCollector collector)
        {
            _cache = cache;
            _collector = collector;
        }

        public void LogRequest(InspectorInfo inspector)
        {
            if (inspector == null)
            {
                throw new ArgumentNullException("inspector");
            }

            var request = CreateRequestInfo(inspector);

            _cache.Store(inspector, request);
            BroadcastRequestInfo(inspector, request);
        }

        private void BroadcastRequestInfo(InspectorInfo inspector, RequestInfo request)
        {
            var context = GlobalHost.ConnectionManager.GetHubContext<InspectRHub>();
            context.Clients.Group(inspector.UniqueKey).requestLogged(inspector, request);
        }

        private RequestInfo CreateRequestInfo(InspectorInfo inspector)
        {
            var info = new RequestInfo();
            _collector.Collect(info, inspector);
            return info;
        }
    }
}


text:
<?php

namespace Ddeboer\DataImport\Source;

class HttpSource implements SourceInterface
{
    protected $filters = array();
    protected $username;
    protected $password;

    public function __construct($url, $username = null, $password = null)
    {
        $this->url = $url;
        if ($username && $password) {
            $this->setAuthentication($username, $password);
        }
    }

    public function setAuthentication($username, $password)
    {
        $this->username = $username;
        $this->password = $password;
    }

    /**
     *
     * @return \SplFileObject
     */
    public function getFile()
    {
        $file = $this->downloadFile();
        foreach ($this->filters as $filter) {
            $file = $filter->filter($file);
        }

        return $file;
    }

    /**
     * Download the file from the internet to a temporary location
     *
     * @return \SplFileObject
     */
    public function downloadFile($target = null)
    {
        if (!$target) {
            $target = tempnam('/tmp', 'data_import');
        }

        $context = null;

        if ($this->username && $this->password) {
            $context = stream_context_create(
                array(
                    'http' => array(
                        'header'  => "Authorization: Basic "
                            . base64_encode("{$this->username}:{$this->password}")
                    )
                )
            );
        }

        file_put_contents($target, file_get_contents($this->url, null, $context));

        return new \SplFileObject($target);
    }

    public function addFilter($filter)
    {
        $this->filters[] = $filter;
    }
}


text:
#import "NSObject.h"

#import "IDEReadOnlyItem-Protocol.h"

@class DVTFilePath, IDEContainer, NSURL;

@interface IDEContainerReadOnlyItem : NSObject <IDEReadOnlyItem>
{
    int _readOnlyStatus;
    IDEContainer *_container;
    DVTFilePath *_filePath;
}

@property int readOnlyStatus; // @synthesize readOnlyStatus=_readOnlyStatus;
@property(readonly) IDEContainer *container; // @synthesize container=_container;
@property(readonly) DVTFilePath *filePath; // @synthesize filePath=_filePath;
- (void).cxx_destruct;
- (BOOL)makeWritableWithError:(id *)arg1;
- (void)updateReadOnlyStatus;
@property(readonly) NSURL *readOnlyItemURL;
- (id)description;
- (id)initWithFilePath:(id)arg1 container:(id)arg2;

@end


text:
.class Lcom/android/settings/wfd/WifiDisplaySettings$15;
.super Ljava/lang/Object;
.source "WifiDisplaySettings.java"

# interfaces
.implements Landroid/content/DialogInterface$OnClickListener;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/android/settings/wfd/WifiDisplaySettings;->showWifiDisplayOptionsDialog(Landroid/hardware/display/WifiDisplay;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/settings/wfd/WifiDisplaySettings;

.field final synthetic val$display:Landroid/hardware/display/WifiDisplay;

.field final synthetic val$nameEditText:Landroid/widget/EditText;

# direct methods
.method constructor <init>(Lcom/android/settings/wfd/WifiDisplaySettings;Landroid/widget/EditText;Landroid/hardware/display/WifiDisplay;)V
    .locals 0

    iput-object p1, p0, Lcom/android/settings/wfd/WifiDisplaySettings$15;->this$0:Lcom/android/settings/wfd/WifiDisplaySettings;

    iput-object p2, p0, Lcom/android/settings/wfd/WifiDisplaySettings$15;->val$nameEditText:Landroid/widget/EditText;

    iput-object p3, p0, Lcom/android/settings/wfd/WifiDisplaySettings$15;->val$display:Landroid/hardware/display/WifiDisplay;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public onClick(Landroid/content/DialogInterface;I)V
    .locals 3

    iget-object v1, p0, Lcom/android/settings/wfd/WifiDisplaySettings$15;->val$nameEditText:Landroid/widget/EditText;

    invoke-virtual {v1}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v1

    invoke-interface {v1}, Landroid/text/Editable;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->isEmpty()Z

    move-result v1

    if-nez v1, :cond_0

    iget-object v1, p0, Lcom/android/settings/wfd/WifiDisplaySettings$15;->val$display:Landroid/hardware/display/WifiDisplay;

    invoke-virtual {v1}, Landroid/hardware/display/WifiDisplay;->getDeviceName()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    :cond_0
    const/4 v0, 0x0

    :cond_1
    iget-object v1, p0, Lcom/android/settings/wfd/WifiDisplaySettings$15;->this$0:Lcom/android/settings/wfd/WifiDisplaySettings;

    invoke-static {v1}, Lcom/android/settings/wfd/WifiDisplaySettings;->-get1(Lcom/android/settings/wfd/WifiDisplaySettings;)Landroid/hardware/display/DisplayManager;

    move-result-object v1

    iget-object v2, p0, Lcom/android/settings/wfd/WifiDisplaySettings$15;->val$display:Landroid/hardware/display/WifiDisplay;

    invoke-virtual {v2}, Landroid/hardware/display/WifiDisplay;->getDeviceAddress()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2, v0}, Landroid/hardware/display/DisplayManager;->renameWifiDisplay(Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method


text:
from logging_levels import isolated_logging, log_exceptions
import logging

def test_isolated_module():
    """
    Ensure we can get an isolated logging module to mess with
    """
    my_logging = isolated_logging(
        STUFF=8,
        THINGS=22,
    )

    assert id(logging) != id(my_logging), 'Should not be same reference'

    assert my_logging.THINGS == 22
    assert my_logging.STUFF == 8

    assert not hasattr(logging, 'THINGS')
    assert not hasattr(logging, 'STUFF')

    my_logging2 = isolated_logging(
        HAPPS=8
    )

    assert id(my_logging) != id(my_logging2), 'Should not be same reference'

    assert my_logging2.HAPPS == 8
    assert not hasattr(my_logging, 'HAPPS')

def test_isolated_module_with_exceptions(stream_log):
    """
    Ensure we can create log levels with exceptions
    """
    my_logging = isolated_logging(
        WTF=log_exceptions(100),
    )

    assert my_logging.WTF == 100

    log = stream_log(my_logging)

    try:
        raise Exception('OMG!')
    except:
        log.wtf('Something happened')

    lines = ''.join(log.readlines())
    assert lines.startswith('WTF:')
    assert 'Exception: OMG!' in lines


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
K. H. Rechinger & H. Riedl, Ann. Naturhist. Mus. Wien. 65:30. 1962

#### Original name
null

### Remarks
null


text:
package util

import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"testing"

	"github.com/openshift/source-to-image/pkg/api"
)

func TestCreateInjectedFilesRemovalScript(t *testing.T) {
	files := []string{
		"/foo",
		"/bar/bar",
	}
	name, err := CreateInjectedFilesRemovalScript(files, "/tmp/rm-foo")
	defer os.Remove(name)
	if err != nil {
		t.Errorf("Unexpected error: %v", name)
	}
	_, err = os.Stat(name)
	if err != nil {
		t.Errorf("Expected file %q to exists, got: %v", name, err)
	}
	data, err := ioutil.ReadFile(name)
	if err != nil {
		t.Errorf("Unable to read %q: %v", name, err)
	}
	if !strings.Contains(string(data), fmt.Sprintf("truncate -s0 %q", "/foo")) {
		t.Errorf("Expected script to contain truncate -s0 \"/foo\", got: %q", string(data))
	}
	if !strings.Contains(string(data), fmt.Sprintf("truncate -s0 %q", "/tmp/rm-foo")) {
		t.Errorf("Expected script to truncate itself, got: %q", string(data))
	}
}

func TestExpandInjectedFiles(t *testing.T) {
	tmp, err := ioutil.TempDir("", "s2i-test-")
	tmpNested, err := ioutil.TempDir(tmp, "nested")
	if err != nil {
		t.Errorf("Unable to create temp directory: %v", err)
	}
	defer os.RemoveAll(tmp)
	list := api.VolumeList{{Source: tmp, Destination: "/foo"}}
	f1, _ := ioutil.TempFile(tmp, "foo")
	f2, _ := ioutil.TempFile(tmpNested, "bar")
	files, err := ExpandInjectedFiles(list)
	if err != nil {
		t.Errorf("Unexpected error: %v", err)
	}
	expected := []string{"/foo/" + filepath.Base(f1.Name()), filepath.Join("/foo", filepath.Base(tmpNested), filepath.Base(f2.Name()))}
	for _, exp := range expected {
		found := false
		for _, f := range files {
			if f == exp {
				found = true
				break
			}
		}
		if !found {
			t.Errorf("Expected %q in resulting file list, got %+v", exp, files)
		}
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:descendantFocusability="blocksDescendants"
    android:orientation="vertical"
    android:layout_marginBottom="10dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    <TextView
        android:layout_marginLeft="20dp"
        android:layout_marginTop="15dp"
        android:id="@+id/tv_report_city_name"
        android:text="测试"
        android:textColor="@color/textColorPrimary"
        android:textSize="@dimen/titleSize"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_marginTop="15dp"
        android:layout_marginRight="20dp"
        android:id="@+id/tv_report_time"
        android:text="测试"
        android:textColor="#cccccc"
        android:textSize="15sp"
        android:layout_centerVertical="true"
        android:layout_toLeftOf="@+id/switch_open_report"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <android.support.v7.widget.SwitchCompat
        android:layout_marginTop="15dp"
        android:id="@+id/switch_open_report"
        android:focusable="false"
        android:textIsSelectable="false"
        android:layout_marginRight="10dp"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    </RelativeLayout>
</LinearLayout>


text:
'use strict';

var expect = require('chai').expect;
var numSpellBg = require('../../lib/locales/bg.js');

describe('BG speller', function () {
	it('should convert small numbers to words', function () {
		expect(numSpellBg(1)).to.be.equal('едно');
		expect(numSpellBg(2)).to.be.equal('две');
		expect(numSpellBg(10)).to.be.equal('десет');
		expect(numSpellBg(15)).to.be.equal('петнадесет');
		expect(numSpellBg(25)).to.be.equal('двадесет и пет');
	});

	it('should respect gender of digits in BG', function () {
		expect(numSpellBg(1, numSpellBg.GENDER_MASCULINE)).to.be.equal('един');
		expect(numSpellBg(1, numSpellBg.GENDER_FEMININE)).to.be.equal('една');
		expect(numSpellBg(1, numSpellBg.GENDER_NEITHER)).to.be.equal('едно');

		expect(numSpellBg(2, numSpellBg.GENDER_MASCULINE)).to.be.equal('два');
		expect(numSpellBg(2, numSpellBg.GENDER_FEMININE)).to.be.equal('две');
		expect(numSpellBg(2, numSpellBg.GENDER_NEITHER)).to.be.equal('две');
	});

	it('should convert numbers between 100 and 10000 to words', function () {
		expect(numSpellBg(200)).to.be.equal('двеста');
		expect(numSpellBg(205)).to.be.equal('двеста и пет');
		expect(numSpellBg(255)).to.be.equal('двеста петдесет и пет');
		expect(numSpellBg(1000)).to.be.equal('хиляда');
		expect(numSpellBg(1005)).to.be.equal('хиляда и пет');
		expect(numSpellBg(1050)).to.be.equal('хиляда и петдесет');
		expect(numSpellBg(1052)).to.be.equal('хиляда петдесет и две');
		expect(numSpellBg(1001)).to.be.equal('хиляда и едно');
		expect(numSpellBg(1020)).to.be.equal('хиляда и двадесет');
		expect(numSpellBg(1102)).to.be.equal('хиляда сто и две');
		expect(numSpellBg(2005)).to.be.equal('две хиляди и пет');
		expect(numSpellBg(2055)).to.be.equal('две хиляди петдесет и пет');
		expect(numSpellBg(10000)).to.be.equal('десет хиляди');
		expect(numSpellBg(10001)).to.be.equal('десет хиляди и едно');
		expect(numSpellBg(10201)).to.be.equal('десет хиляди двеста и едно');
	});

	it('should convert numbers between 10000 and 1000000 to words', function () {
		expect(numSpellBg(100000)).to.be.equal('сто хиляди');
		expect(numSpellBg(100010)).to.be.equal('сто хиляди и десет');
		expect(numSpellBg(100201)).to.be.equal('сто хиляди двеста и едно');
		expect(numSpellBg(999999)).to.be.equal('деветстотин деветдесет и девет хиляди деветстотин деветдесет и девет');
	});

	it('should convert numbers between 1000000 and 10000000 to words', function () {
		expect(numSpellBg(1000000)).to.be.equal('един милион');
		expect(numSpellBg(1000100)).to.be.equal('един милион и сто');
		expect(numSpellBg(1000201)).to.be.equal('един милион двеста и едно');
		expect(numSpellBg(999999999)).to.be.equal('деветстотин деветдесет и девет милиона деветстотин деветдесет и девет хиляди деветстотин деветдесет и девет');
	});

	it('should convert milliards to words', function () {
		expect(numSpellBg(1000000000)).to.be.equal('един милиард');
		expect(numSpellBg(1000100000)).to.be.equal('един милиард и сто хиляди');
		expect(numSpellBg(1000200000)).to.be.equal('един милиард и двеста хиляди');
		expect(numSpellBg(1000210000)).to.be.equal('един милиард и двеста и десет хиляди');
		expect(numSpellBg(1000201000)).to.be.equal('един милиард и двеста и една хиляди');
		expect(numSpellBg(1000201842)).to.be.equal('един милиард двеста и една хиляди осемстотин четиридесет и две');
		expect(numSpellBg(999999999999)).to.be.equal('деветстотин деветдесет и девет милиарда деветстотин деветдесет и девет милиона деветстотин деветдесет и девет хиляди деветстотин деветдесет и девет');
	});
});


text:
<?xml version="1.0" encoding="UTF-8"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.4.xsd"
    xmlns:json="http://www.milyn.org/xsd/smooks/json-1.1.xsd"
    xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.2.xsd"
    xsi:schemaLocation="http://www.milyn.org/xsd/smooks-1.1.xsd http://www.milyn.org/xsd/smooks-1.1.xsd
        http://www.milyn.org/xsd/smooks/json-1.1.xsd http://www.milyn.org/xsd/smooks/json-1.1.xsd
        http://www.milyn.org/xsd/smooks/smooks-core-1.4.xsd http://www.milyn.org/xsd/smooks/smooks-core-1.4.xsd
        http://www.milyn.org/xsd/smooks/javabean-1.2.xsd http://www.milyn.org/xsd/smooks/javabean-1.2.xsd">

    <json:reader rootName="json" />

    <core:filterSettings type="SAX" readerPoolSize="5" />

    <jb:bean beanId="attendances" class="java.util.ArrayList" createOnElement="#document">
        <jb:wiring beanIdRef="attendance" />
    </jb:bean>

    <jb:bean beanId="attendance" class="org.slc.sli.ingestion.transformation.SimpleEntity" createOnElement="json">
        <jb:expression property="type">'attendance'</jb:expression>
        <jb:wiring property="body" beanIdRef="attendanceBody" />
    </jb:bean>

    <jb:bean beanId="attendanceBody" class="java.util.HashMap" createOnElement="attributes">
        <jb:value property="schoolYear" data="attributes SchoolYear _value"></jb:value>
        <jb:value property="studentId" data="attributes StudentReference"></jb:value>
        <jb:value property="schoolId" data="attributes SchoolReference"></jb:value>
        <jb:wiring property="attendanceEvent" beanIdRef="attendanceEventsArray"></jb:wiring>
    </jb:bean>

    <jb:bean beanId="attendanceEventsArray" class="java.util.ArrayList" createOnElement="attributes">
        <jb:wiring beanIdRef="attendanceEventMap"></jb:wiring>
    </jb:bean>

    <jb:bean beanId="attendanceEventMap" class="java.util.HashMap" createOnElement="attributes">
        <jb:value property="date" data="attributes EventDate _value"></jb:value>
        <jb:value property="event" data="attributes AttendanceEventCategory _value"></jb:value>
        <jb:value property="reason" data="attributes AttendanceEventReason _value"></jb:value>
        <jb:value property="educationalEnvironment" data="attributes EducationalEnvironment _value"></jb:value>
        <jb:value property="sectionId" data="attributes SectionReference"></jb:value>
    </jb:bean>

</smooks-resource-list>


text:
import React from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import { userLogoutSuccess } from '../../actions/auth-actions';
import logo from '../../assets/JobOrNot_Blue_50.png';

const mapStateToProps = (state) => {
    return {
        user: state.userAuth.user,
    };
};

const mapDispatchToProps = (dispatch) => {
    return {
        handleSignOut() {
            dispatch(userLogoutSuccess());
        }
    };
};

const SignedInNav = (props) => (

                    <Link to='/'></Link>

                    <Link to='/' className='u-pull-right' onClick={(e) => {
                        props.handleSignOut();
                        props.history.push('/');
                        }}>Sign Out</Link>
                    <Link to='/profile' className='u-pull-right'>Profile</Link>
                    Welcome, {props.user.firstName}
                    <Link to='/howitworks' className='u-pull-right'>How It Works</Link>

);

export default connect(mapStateToProps, mapDispatchToProps)(SignedInNav);

SignedInNav.propTypes = {
    user: React.PropTypes.object,
    handleSignOut: React.PropTypes.func,
    history: React.PropTypes.any
};


text:
#ifndef DiGameAppOSX_h__
#define DiGameAppOSX_h__

#ifdef __OBJC__

#include "ArenaGameApp.h"

#import <Cocoa/Cocoa.h>
#import <QuartzCore/CVDisplayLink.h>

@implementation NSApplication(_suppressUnimplementedActionWarning)
- (void)buttonPressed:(id)sender
{
}
@end

#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
@interface AppDelegate : NSObject <NSApplicationDelegate>
#else
@interface AppDelegate : NSObject
#endif
{
    NSTimer             *mTimer;

    NSDate              *mDate;

    NSTimeInterval      mLastFrameTime;

    CVDisplayLinkRef    mDisplayLink; //display link for managing rendering thread
}

-(void)open;
-(void)render:(id)sender;
-(void)shutdown;

@property(retain) NSTimer *mTimer;
@property(nonatomic) NSTimeInterval mLastFrameTime;

@end

static id mAppDelegate;

@implementation AppDelegate

@synthesize mTimer;
@dynamic mLastFrameTime;

-(NSTimeInterval)mLastFrameTime
{
    return mLastFrameTime;
}

-(void)setLastFrameTime:(NSTimeInterval)frameInterval
{
    if (frameInterval >= 1)
    {
        mLastFrameTime = frameInterval;
    }
}

-(void)open
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    mLastFrameTime = 1;
    mTimer = nil;

    // init the engine
    Demi::ArGameApp::Get()->OpenImpl();

    // rendering timer
    mTimer = [NSTimer scheduledTimerWithTimeInterval : (NSTimeInterval)(1.0f / 60.0f) * mLastFrameTime
                                                        target : self
                                                        selector : @selector(render:)
                                                        userInfo:nil
                                                        repeats : YES];
    [pool release];
}

-(void)applicationDidFinishLaunching:(NSNotification *)application
{
    mLastFrameTime = 1;
    mTimer = nil;

    [self open];
}

-(void)shutdown
{
    if (mDisplayLink)
    {
        CVDisplayLinkStop(mDisplayLink);
        CVDisplayLinkRelease(mDisplayLink);
        mDisplayLink = nil;
    }

    [NSApp terminate : nil];
}

-(void)render:(id)sender
{
    if (Demi::ArGameApp::Get() && Demi::ArGameApp::Get()->IsOpen())
    {
        Demi::ArGameApp::Get()->Update();
    }
    else
    {
        if (mTimer)
        {
            [mTimer invalidate];
            mTimer = nil;
        }

        [NSApp performSelector : @selector(terminate:) withObject:nil afterDelay : 0.0];
    }
}

@end

#else
#   error "Please set the compiler as objective c++ mode!"
#endif

#endif // ApplicationOSX_h__


text:
class PostsController < TalkyBaseController
  responders :flash
  respond_to :html

  helper_method :topic_post_path

  def new
    if params[:quote]
      quote_post = Post.find(params[:quote])
      if quote_post
        resource.body = quote_post.body
      end
    end
  end

  def create
    if resource.save
      #flash[:notice] = "Post was successfully created."
      #redirect_to topic_path(@post.topic)
      respond_with resource, location: topic_path(resource.topic)
    else
      render :action => 'new'
    end
  end

  def update
    if resource.update_attributes(params[:post])
      #flash[:notice] = "Post was successfully updated."
      #redirect_to topic_path(@post.topic)
      respond_with resource, location: topic_path(@post.topic)
    else
      render :action => 'edit'
    end
  end

  def destroy
    if resource.topic.posts_count > 1
      if resource.destroy
        #flash[:notice] = "Post was successfully destroyed."
        #redirect_to topic_path(@post.topic)
        respond_with resource, location: topic_path(resource.topic)
      end
    else
      if resource.topic.destroy
        #flash[:notice] = "Topic was successfully deleted."
        #redirect_to forum_path(@post.forum)
        respond_with resource.topic, location: forum_path(resource.forum)
      end
    end
  end

  private

  def resource
    if @post.present?
      @topic = @post.topic
      return @post
    end

    topic_id = params[:topic_id]
    @topic = Topic.find(topic_id) if topic_id.present?

    id = params[:id]
    return @post = Post.find(id) if id.present?

    @post = Post.new(params[:post])
    if @topic.present?
      @post.topic = @topic
      @post.forum = @topic.forum
    end
    @post.user = current_user
  end

  def topic_post_path(topic, post, options)
    post_path(post)
  end
end


text:
package org.caleydo.view.relationshipexplorer.ui.dialog.columnconfig.widget;

import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import org.caleydo.core.util.base.ICallback;
import org.caleydo.core.util.base.Runnables;
import org.caleydo.view.relationshipexplorer.ui.column.item.factory.IConfigurationAddon;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.List;

/**
 * @author Christian
 *
 */
public class MultiAddonSelectionWidget<CreatorType, AddonType extends IConfigurationAddon<CreatorType>> extends
		Composite implements ICallback<CreatorType> {

	// private final ConfigureColumnTypeWizard wizard;

	private List availableRenderersList;
	private List selectedRenderersList;
	private Button addRendererButton;
	private Button removeRendererButton;
	private Map<Integer, AddonType> availableAddonsMap = new HashMap<>();
	private Map<Integer, AddonType> selectedAddonsMap = new HashMap<>();
	private Map<AddonType, CreatorType> addonToCreatorMap = new LinkedHashMap<>();
	private AddonType currentAddon;
	private final ICallback<MultiAddonSelectionWidget<CreatorType, AddonType>> widgetUpdateCallback;

	/**
	 * @param parent
	 * @param style
	 */
	public MultiAddonSelectionWidget(Composite parent,
			final ICallback<MultiAddonSelectionWidget<CreatorType, AddonType>> widgetUpdateCallback, String addonType) {
		super(parent, SWT.NONE);
		// this.wizard = wizard;
		this.widgetUpdateCallback = widgetUpdateCallback;

		setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		setLayout(new GridLayout(2, false));

		Group availableRenderersGroup = new Group(this, SWT.SHADOW_ETCHED_IN);
		availableRenderersGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		availableRenderersGroup.setText("Available " + addonType);
		availableRenderersGroup.setLayout(new GridLayout(1, false));

		availableRenderersList = new List(availableRenderersGroup, SWT.BORDER);
		GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
		gd.heightHint = 100;
		availableRenderersList.setLayoutData(gd);

		availableRenderersList.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				AddonType addon = availableAddonsMap.get(availableRenderersList.getSelectionIndex());
				addRendererButton.setEnabled(!addonToCreatorMap.containsKey(addon));
			}
		});

		addRendererButton = new Button(availableRenderersGroup, SWT.PUSH);
		addRendererButton.setText("Add");
		addRendererButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
		addRendererButton.setEnabled(false);
		addRendererButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				AddonType addon = availableAddonsMap.get(availableRenderersList.getSelectionIndex());
				if (!addonToCreatorMap.containsKey(addon)) {
					currentAddon = addon;
					addon.configure(MultiAddonSelectionWidget.this);
				}
			}
		});

		Group selectedRenderersGroup = new Group(this, SWT.SHADOW_ETCHED_IN);
		selectedRenderersGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		selectedRenderersGroup.setText("Selected " + addonType);
		selectedRenderersGroup.setLayout(new GridLayout(1, false));

		selectedRenderersList = new List(selectedRenderersGroup, SWT.BORDER | SWT.MULTI);
		selectedRenderersList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		selectedRenderersList.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				removeRendererButton.setEnabled(selectedRenderersList.getSelectionIndex() >= 0);
			}
		});
		removeRendererButton = new Button(selectedRenderersGroup, SWT.PUSH);
		removeRendererButton.setText("Remove");
		removeRendererButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
		removeRendererButton.setEnabled(false);
		removeRendererButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				AddonType addon = selectedAddonsMap.get(selectedRenderersList.getSelectionIndex());
				addonToCreatorMap.remove(addon);
				updateSelectedRenderersList();
				widgetUpdateCallback.on(MultiAddonSelectionWidget.this);
			}
		});

	}

	public void updateWidgets(java.util.List<AddonType> addons, java.util.List<CreatorType> existingCreators) {
		availableRenderersList.removeAll();
		availableAddonsMap.clear();
		addonToCreatorMap.clear();
		int index = 0;
		for (AddonType addon : addons) {
			availableAddonsMap.put(index, addon);
			availableRenderersList.add(addon.getLabel());
			index++;

			for (CreatorType creator : existingCreators) {
				if (addon.getConfigObjectClass() == creator.getClass()) {
					addonToCreatorMap.put(addon, creator);
				}
			}
		}

		updateSelectedRenderersList();
		addRendererButton.setEnabled(false);
		removeRendererButton.setEnabled(false);
		widgetUpdateCallback.on(this);
	}

	private void updateSelectedRenderersList() {
		selectedRenderersList.removeAll();
		selectedAddonsMap.clear();
		int index = 0;
		for (AddonType addon : addonToCreatorMap.keySet()) {
			selectedRenderersList.add(addon.getLabel());
			selectedAddonsMap.put(index, addon);
			index++;
		}
	}

	@Override
	public void on(final CreatorType creator) {
		Runnables.withinSWTThread(new Runnable() {

			@Override
			public void run() {
				addonToCreatorMap.put(currentAddon, creator);
				updateSelectedRenderersList();
				currentAddon = null;

				widgetUpdateCallback.on(MultiAddonSelectionWidget.this);
			}

		}).run();
	}

	public Collection<CreatorType> getCreators() {
		return addonToCreatorMap.values();
	}

}


text:
A Webpack loader that prefixes classes with custom prefix in React components

MyComponent.js

```jsx
class MyComponent extends React.Component {
  render () {
    return <div className='myclass'></div>
  }
}

export default MyComponent
```

Output:

```jsx
class MyComponent extends React.Component {
  render () {
    return <div className='your_prefix-myclass'></div>
  }
}

export default MyComponent
```

Also works with [classnames](https://github.com/JedWatson/classnames) module!

## Installation
```
$ npm install react-classname-prefix-loader --save-dev
```

## Usage

```javascript
module: {
 loaders: [
  {
    test: /\.js$/,
    exclude: /node_modules/,
    loaders: ['react-hot', 'babel-loader', 'react-classname-prefix-loader?prefix=your_prefix'],
  },
 ],
},
```

## Recommendation
* Use it with [postcss-class-prefix](https://github.com/thompsongl/postcss-class-prefix) for css files


text:
<?php
$serverName = "172.29.185.108"; //serverName\instanceName
$connectionInfo = array( "Database"=>"Sistema_Cine", "UID"=>"sa", "PWD"=>"Password1.");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$Query = "SELECT * From Tandas ";
if ($conn)
{
	if (($result = sqlsrv_query($conn, $Query)) !== false) 	{
		while ($obj = sqlsrv_fetch_object( $result )) {
			echo '<form>';
				echo'
';
					echo '<input style="border: none" name="name"type="text" readonly value="'.$obj->Id_tandas.'" >	';
					echo '<input style="border: none" name="name"type="text" readonly value="'.$obj->Id_Sala.'" >	';
					echo '<input style="border: none" name="name"type="text" readonly value="'.$obj->Id_pelicula.'" >	';
            echo '<input style="border: none" name="name"type="text" readonly value="'.$obj->Id_UbiCine.'" >	';
				echo '
';
			echo '</form>';
		}
	}
}
else
{
	die(print_r(sqlsrv_errors(), true));
}
sqlsrv_close($conn);
?>


text:
<?php

namespace Jordo\CalendarBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use JMS\SecurityExtraBundle\Annotation\Secure;
use Jordo\CalendarBundle\Entity\Event;
use Jordo\CalendarBundle\Entity\Guest;
use Jordo\CalendarBundle\Form\EventType;

/**
 * Event controller.
 *
 * @Route("/calendar/event")
 */
class EventController extends Controller
{
    static public function notifyWrite($sc, $action, $entity)
    {
        $who = sprintf(
            '%s',
            $entity->getUser() ? $sc->get('router')->generate('user_show', array('id' => $entity->getUser()->getId())) : '#',
            $entity->getUser() ?: 'Anonymous'
        );

        $event = sprintf(
            '%s',
            $sc->get('router')->generate('calendar_event_show', array('id' => $entity->getParam1()->getId())),
            $entity->getParam1()
        );

        $date = $entity->getParam1()->getDateStart()->format('d/m/Y H\hi');

        // jordo.contact.event.$ACTION
        // create = %s a ajouté un évènement (%s)
        // update = %s a modifé une prise de contact avvec %s (par %s)
        switch( $action )
        {
            case 'update' : return sprintf('%s a modifié l\'événement (%s) du %s', $who, $event, $date); break;
            case 'create' : return sprintf('%s a ajouté un évènement (%s) pour le %s', $who, $event, $date); break;
        }
    }

    /**
     * Lists all Event entities.
     *
     * @Route("/", name="calendar_event")
     * @Method("GET")
     * @Template()
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('JordoCalendarBundle:Event')->findAll();

        return array(
            'entities' => $entities,
        );
    }

    /**
     * @Route("/subscribe-new-{event}-{user}/{response}", name="calendar_event_subscribe_new", defaults={"user"=0, "response"=1})
     * @Method("GET")
     * @Template()
     */
    public function subscribeNewAction($event, $user, $response)
    {
        // @TODO {user} subscribe
        $em = $this->getDoctrine()->getManager();

        $event = $em->getRepository('JordoCalendarBundle:Event')->find($event);

        # User
        if( $user )
            $user = $em->getRepository('JordoUserBundle:User')->find($user);
        else
            $user = $this->get('security.context')->getToken()->getUser();

        # Guest
        $guest = new Guest();
        $guest -> setUser($user);
        $guest -> setEvent($event);
        $guest -> setResponse($response);

        $event -> addGuest($guest);

        $em->persist($guest);
        $em->persist($event);
        $em->flush();

        return $this->redirect($this->getRequest()->headers->get('referer'));
    }

    /**
     * @Route("/subscribe-{guest}/{response}", name="calendar_event_subscribe", defaults={"response"=1})
     * @Method("GET")
     * @Template()
     */
    public function subscribeAction($guest, $response)
    {
        $em = $this->getDoctrine()->getManager();

        # Guest
        $guest = $em->getRepository('JordoCalendarBundle:Guest')->find($guest);
        $guest -> setResponse($response);
        $guest -> setDateUpdated(new \DateTime());

        $em->persist($guest);
        $em->flush();

        return $this->redirect($this->getRequest()->headers->get('referer'));
    }

    /**
     * Creates a new Event entity.
     *
     * @Route("/", name="calendar_event_create")
     * @Method("POST")
     * @Template("JordoCalendarBundle:Event:new.html.twig")
     */
    public function createAction(Request $request)
    {
        $entity  = new Event();
        $entity->setAddedBy($this->get('security.context')->getToken()->getUser());

        $form = $this->createForm(new EventType(), $entity);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            $this->get('Thiktak.core.notify')->log($entity);

            return $this->redirect($this->generateUrl('calendar_event_show', array('id' => $entity->getId())));
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
     * Displays a form to create a new Event entity.
     *
     * @Route("/new", name="calendar_event_new")
     * @Method("GET")
     * @Template()
     */
    public function newAction()
    {
        $entity = new Event();
        $form   = $this->createForm(new EventType(), $entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
     * Finds and displays a Event entity.
     *
     * @Route("/{id}", name="calendar_event_show")
     * @Method("GET")
     * @Template()
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('JordoCalendarBundle:Event')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Event entity.');
        }

        $deleteForm = $this->createDeleteForm($id);

        return array(
            'entity'      => $entity,
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * Displays a form to edit an existing Event entity.
     *
     * @Route("/{id}/edit", name="calendar_event_edit")
     * @Method("GET")
     * @Template()
     */
    public function editAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('JordoCalendarBundle:Event')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Event entity.');
        }

        $editForm = $this->createForm(new EventType(), $entity);
        $deleteForm = $this->createDeleteForm($id);

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * Edits an existing Event entity.
     *
     * @Route("/{id}", name="calendar_event_update")
     * @Method("PUT")
     * @Template("JordoCalendarBundle:Event:edit.html.twig")
     */
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('JordoCalendarBundle:Event')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Event entity.');
        }

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createForm(new EventType(), $entity);
        $editForm->bind($request);

        if ($editForm->isValid()) {
            $em->persist($entity);
            $em->flush();

            $this->get('Thiktak.core.notify')->log($entity);

            return $this->redirect($this->generateUrl('calendar_event_show', array('id' => $id)));
        }

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * Deletes a Event entity.
     *
     * @Route("/{id}", name="calendar_event_delete")
     * @Method("DELETE")
     */
    public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository('JordoCalendarBundle:Event')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Event entity.');
            }

            $em->remove($entity);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('calendar_event'));
    }

    /**
     * Creates a form to delete a Event entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id)
    {
        return $this->createFormBuilder(array('id' => $id))
            ->add('id', 'hidden')
            ->getForm()
        ;
    }
}


text:
define({
  "transparencyLabel": "Transparenz",
  "outline": "Umrisslinie",
  "fill": "Füllung (Farbe wird nur angewendet, wenn der Style auf Vollfarbe festgelegt ist)",
  "style": "Style",
  "mandatoryLabel": "Entfernung für obligatorische Evakuierung",
  "mandatoryButtonLabel": "Einstellungen für Entfernung für obligatorische Evakuierung konfigurieren",
  "safeLabel": "Entfernung für sichere Evakuierung",
  "safeButtonLabel": "Einstellungen für Entfernung für sichere Evakuierung konfigurieren",
  "selectOpLayerLabel": "Operationalen Layer für die Ergebnisse auswählen",
  "selectDefaultMeasurementLabel": "Standardmesseinheit auswählen",
  "helpIconTooltip": "Die Liste der operationalen Layer wird mit Layern der aktuellen Webkarte, die einen Polygon-Geometrietyp aufweisen, gefüllt.",
  "lineStyles": {
    "esriSLSDash": "Strich",
    "esriSLSDashDot": "Strich-Punkt",
    "esriSLSDashDotDot": "Strich-Punkt-Punkt",
    "esriSLSDot": "Punkt",
    "esriSLSLongDash": "Langer Strich",
    "esriSLSLongDashDot": "Langer Strich-Punkt",
    "esriSLSNull": "Null",
    "esriSLSShortDash": "Kurzer Strich",
    "esriSLSShortDashDot": "Kurzer Strich-Punkt",
    "esriSLSShortDashDotDot": "Kurzer Strich-Punkt-Punkt",
    "esriSLSShortDot": "Kurzer Punkt",
    "esriSLSSolid": "Vollfarbe"
  },
  "fillStyles": {
    "esriSFSBackwardDiagonal": "Rückwärts",
    "esriSFSCross": "Kreuzförmig",
    "esriSFSDiagonalCross": "Diagonal",
    "esriSFSForwardDiagonal": "Vorwärts",
    "esriSFSHorizontal": "Horizontal",
    "esriSFSNull": "Null",
    "esriSFSSolid": "Vollfarbe",
    "esriSFSVertical": "Vertikal"
  }
});