text:
package digger

type Issue struct {
	Id               int                `json:"id"`
	Project          *Name              `json:"project"`
	Tracker          *Name              `json:"tracker"`
	Status           *Name              `json:"status"`
	Priority         *Name              `json:"priority"`
	Author           *Name              `json:"author"`
	Subject          string             `json:"subject"`
	Description      string             `json:"description"`
	Done_Ratio       int                `json:"done_ratio"`
	Custom_Fields    []*Custom_Field    `json:"custom_fields"`
	Created_On       string             `json:"created_on"`
	Updated_On       string             `json:"updated_on"`
	Fixed_Version    *Name              `json:"fixed_version"`
	Assigned_To      *Name              `json:"assigned_to"`
	Parent           *Id                `json:"parent"`
	Watcher_User_IDs []*Id              `json:""`
	Is_Privated      bool               `json:""`
	EstimatedHours   float64            `json:"estimated_hours"`
	StartDate        string             `json:"start_date"`
	DueDate          string             `json:"due_date"`
	SpentHours       float64            `json:"spent_hours"`
	Category         *Name              `json:"category"`
	Relations        []*Issue_Relation  `json:"relations"`
	Children         []*Issue_Child     `json:"children"`
	Attachments      []*Attachment      `json:"attachments"`
	Journals         []*Issue_Journal   `json:"journals"`
	Changesets       []*Issue_Changeset `json:"changesets"`
}

type Id struct {
	Id int `json:"id"`
}

type Name struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

// type Custom_Field struct {
// 	id    int    `json:"id"`
// 	name  string `json:"name"`
// 	value string `json:"value"`
// }

type Issue_Relation struct {
	Id           int    `json:"id"`
	IssueId      int    `json:"issue_id"`
	IssueToId    int    `json:"issue_to_id"`
	RelationType string `json:"relation_type"`
	Delay        Nint   `json:"delay"`
}

type Issue_Child struct {
	Id      int    `json:"id"`
	Subject string `json:"subject"`
	Tracker *Name  `json:"tracker"`
}

type Issue_Journal_Detail struct {
	Name     string `json:"name"`
	Property string `json:"property"`
	NewValue string `json:"new_value"`
}

type Issue_Journal struct {
	Id        int                     `json:"id"`
	User      *Name                   `json:"user"`
	Details   []*Issue_Journal_Detail `json:"details"`
	Notes     string                  `json:"notes"`
	CreatedOn string                  `json:"created_on"`
}

type Issue_Changeset struct {
	Comments    string `json:"comments"`
	Revision    string `json:"revision"`
	CommittedOn string `json:"committed_on"`
	User        *Name  `json:"user"`
}

type Nint int

// type Attachment struct {
// 	Id          int    `json:"id"`
// 	Description string `json:"description"`
// 	Filename    string `json:"filename"`
// 	ContentType string `json:"content_type"`
// 	Filesize    int    `json:"filesize"`
// 	ContentUrl  string `json:"content_url"`
// 	Author      *Name  `json:"author"`
// 	CreatedOn   string `json:"created_on"`
// }


text:
using System;
using System.IO;
using System.Threading;
using System.Web;
using MvcPluginMasterApp.DataLayer.Context;
using MvcPluginMasterApp.PluginsBase;
using MvcPluginMasterApp.Services;
using MvcPluginMasterApp.Services.Contracts;
using StructureMap;
using StructureMap.Graph;
using StructureMap.Web;

namespace MvcPluginMasterApp.IoCConfig
{
    public static class SmObjectFactory
    {
        private static readonly Lazy<Container> _containerBuilder =
            new Lazy<Container>(defaultContainer, LazyThreadSafetyMode.ExecutionAndPublication);

        public static IContainer Container
        {
            get { return _containerBuilder.Value; }
        }

        private static Container defaultContainer()
        {
            return new Container(cfg =>
            {
                //x.For<IConfigService>().Use<ConfigService>(); == scanner.WithDefaultConventions();

                cfg.For<IUnitOfWork>()
                   .HybridHttpOrThreadLocalScoped()
                   .Use<MvcPluginMasterAppContext>();

                cfg.For<ICategoryService>().Use<EfCategoryService>();
                cfg.For<IProductService>().Use<EfProductService>();

                cfg.Scan(scanner =>
                {
                    scanner.AssembliesFromPath(
                        path: Path.Combine(HttpRuntime.AppDomainAppPath, "bin"),
                            // يك اسمبلي نبايد دوبار بارگذاري شود
                        assemblyFilter: assembly =>
                        {
                            return !assembly.FullName.Equals(typeof(IPlugin).Assembly.FullName);
                        });

                    scanner.WithDefaultConventions(); //Connects 'IName' interface to 'Name' class automatically.
                    scanner.AddAllTypesOf<IPlugin>().NameBy(item => item.FullName);
                });
            });
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
/* @migen@ */
/*
   PowerShell Desired State Configuration for Linux

   Copyright (c) Microsoft Corporation

   All rights reserved.

   MIT License

   Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

   The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once

#ifndef _CIM_Error_h
#define _CIM_Error_h

#include <MI.h>

/*
**==============================================================================
**
** CIM_Error [CIM_Error]
**
** Keys:
**
**==============================================================================
*/

typedef struct _CIM_Error
{
    MI_Instance __instance;
    /* CIM_Error properties */
    MI_ConstUint16Field ErrorType;
    MI_ConstStringField OtherErrorType;
    MI_ConstStringField OwningEntity;
    MI_ConstStringField MessageID;
    MI_ConstStringField Message;
    MI_ConstStringAField MessageArguments;
    MI_ConstUint16Field PerceivedSeverity;
    MI_ConstUint16Field ProbableCause;
    MI_ConstStringField ProbableCauseDescription;
    MI_ConstStringAField RecommendedActions;
    MI_ConstStringField ErrorSource;
    MI_ConstUint16Field ErrorSourceFormat;
    MI_ConstStringField OtherErrorSourceFormat;
    MI_ConstUint32Field CIMStatusCode;
    MI_ConstStringField CIMStatusCodeDescription;
}
CIM_Error;

typedef struct _CIM_Error_Ref
{
    CIM_Error* value;
    MI_Boolean exists;
    MI_Uint8 flags;
}
CIM_Error_Ref;

typedef struct _CIM_Error_ConstRef
{
    MI_CONST CIM_Error* value;
    MI_Boolean exists;
    MI_Uint8 flags;
}
CIM_Error_ConstRef;

typedef struct _CIM_Error_Array
{
    struct _CIM_Error** data;
    MI_Uint32 size;
}
CIM_Error_Array;

typedef struct _CIM_Error_ConstArray
{
    struct _CIM_Error MI_CONST* MI_CONST* data;
    MI_Uint32 size;
}
CIM_Error_ConstArray;

typedef struct _CIM_Error_ArrayRef
{
    CIM_Error_Array value;
    MI_Boolean exists;
    MI_Uint8 flags;
}
CIM_Error_ArrayRef;

typedef struct _CIM_Error_ConstArrayRef
{
    CIM_Error_ConstArray value;
    MI_Boolean exists;
    MI_Uint8 flags;
}
CIM_Error_ConstArrayRef;

MI_EXTERN_C MI_CONST MI_ClassDecl CIM_Error_rtti;

MI_INLINE MI_Result MI_CALL CIM_Error_Clone(
    _In_ const CIM_Error* self,
    _Outptr_ CIM_Error** newInstance)
{
    return MI_Instance_Clone(
        &self->__instance, (MI_Instance**)newInstance);
}

MI_INLINE MI_Boolean MI_CALL CIM_Error_IsA(
    _In_ const MI_Instance* self)
{
    MI_Boolean res = MI_FALSE;
    return MI_Instance_IsA(self, &CIM_Error_rtti, &res) == MI_RESULT_OK && res;
}

MI_INLINE MI_Result MI_CALL CIM_Error_Destruct(_Inout_ CIM_Error* self)
{
    return MI_Instance_Destruct(&self->__instance);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Delete(_Inout_ CIM_Error* self)
{
    return MI_Instance_Delete(&self->__instance);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_ErrorType(
    _Inout_ CIM_Error* self,
    _In_ MI_Uint16 x)
{
    ((MI_Uint16Field*)&self->ErrorType)->value = x;
    ((MI_Uint16Field*)&self->ErrorType)->exists = 1;
    return MI_RESULT_OK;
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_ErrorType(
    _Inout_ CIM_Error* self)
{
    memset((void*)&self->ErrorType, 0, sizeof(self->ErrorType));
    return MI_RESULT_OK;
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_OtherErrorType(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        1,
        (MI_Value*)&str,
        MI_STRING,
        0);
}

MI_INLINE MI_Result MI_CALL CIM_Error_SetPtr_OtherErrorType(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        1,
        (MI_Value*)&str,
        MI_STRING,
        MI_FLAG_BORROW);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_OtherErrorType(
    _Inout_ CIM_Error* self)
{
    return self->__instance.ft->ClearElementAt(
        (MI_Instance*)&self->__instance,
        1);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_OwningEntity(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        2,
        (MI_Value*)&str,
        MI_STRING,
        0);
}

MI_INLINE MI_Result MI_CALL CIM_Error_SetPtr_OwningEntity(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        2,
        (MI_Value*)&str,
        MI_STRING,
        MI_FLAG_BORROW);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_OwningEntity(
    _Inout_ CIM_Error* self)
{
    return self->__instance.ft->ClearElementAt(
        (MI_Instance*)&self->__instance,
        2);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_MessageID(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        3,
        (MI_Value*)&str,
        MI_STRING,
        0);
}

MI_INLINE MI_Result MI_CALL CIM_Error_SetPtr_MessageID(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        3,
        (MI_Value*)&str,
        MI_STRING,
        MI_FLAG_BORROW);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_MessageID(
    _Inout_ CIM_Error* self)
{
    return self->__instance.ft->ClearElementAt(
        (MI_Instance*)&self->__instance,
        3);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_Message(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        4,
        (MI_Value*)&str,
        MI_STRING,
        0);
}

MI_INLINE MI_Result MI_CALL CIM_Error_SetPtr_Message(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        4,
        (MI_Value*)&str,
        MI_STRING,
        MI_FLAG_BORROW);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_Message(
    _Inout_ CIM_Error* self)
{
    return self->__instance.ft->ClearElementAt(
        (MI_Instance*)&self->__instance,
        4);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_MessageArguments(
    _Inout_ CIM_Error* self,
    _In_reads_opt_(size) const MI_Char** data,
    _In_ MI_Uint32 size)
{
    MI_Array arr;
    arr.data = (void*)data;
    arr.size = size;
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        5,
        (MI_Value*)&arr,
        MI_STRINGA,
        0);
}

MI_INLINE MI_Result MI_CALL CIM_Error_SetPtr_MessageArguments(
    _Inout_ CIM_Error* self,
    _In_reads_opt_(size) const MI_Char** data,
    _In_ MI_Uint32 size)
{
    MI_Array arr;
    arr.data = (void*)data;
    arr.size = size;
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        5,
        (MI_Value*)&arr,
        MI_STRINGA,
        MI_FLAG_BORROW);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_MessageArguments(
    _Inout_ CIM_Error* self)
{
    return self->__instance.ft->ClearElementAt(
        (MI_Instance*)&self->__instance,
        5);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_PerceivedSeverity(
    _Inout_ CIM_Error* self,
    _In_ MI_Uint16 x)
{
    ((MI_Uint16Field*)&self->PerceivedSeverity)->value = x;
    ((MI_Uint16Field*)&self->PerceivedSeverity)->exists = 1;
    return MI_RESULT_OK;
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_PerceivedSeverity(
    _Inout_ CIM_Error* self)
{
    memset((void*)&self->PerceivedSeverity, 0, sizeof(self->PerceivedSeverity));
    return MI_RESULT_OK;
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_ProbableCause(
    _Inout_ CIM_Error* self,
    _In_ MI_Uint16 x)
{
    ((MI_Uint16Field*)&self->ProbableCause)->value = x;
    ((MI_Uint16Field*)&self->ProbableCause)->exists = 1;
    return MI_RESULT_OK;
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_ProbableCause(
    _Inout_ CIM_Error* self)
{
    memset((void*)&self->ProbableCause, 0, sizeof(self->ProbableCause));
    return MI_RESULT_OK;
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_ProbableCauseDescription(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        8,
        (MI_Value*)&str,
        MI_STRING,
        0);
}

MI_INLINE MI_Result MI_CALL CIM_Error_SetPtr_ProbableCauseDescription(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        8,
        (MI_Value*)&str,
        MI_STRING,
        MI_FLAG_BORROW);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_ProbableCauseDescription(
    _Inout_ CIM_Error* self)
{
    return self->__instance.ft->ClearElementAt(
        (MI_Instance*)&self->__instance,
        8);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_RecommendedActions(
    _Inout_ CIM_Error* self,
    _In_reads_opt_(size) const MI_Char** data,
    _In_ MI_Uint32 size)
{
    MI_Array arr;
    arr.data = (void*)data;
    arr.size = size;
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        9,
        (MI_Value*)&arr,
        MI_STRINGA,
        0);
}

MI_INLINE MI_Result MI_CALL CIM_Error_SetPtr_RecommendedActions(
    _Inout_ CIM_Error* self,
    _In_reads_opt_(size) const MI_Char** data,
    _In_ MI_Uint32 size)
{
    MI_Array arr;
    arr.data = (void*)data;
    arr.size = size;
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        9,
        (MI_Value*)&arr,
        MI_STRINGA,
        MI_FLAG_BORROW);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_RecommendedActions(
    _Inout_ CIM_Error* self)
{
    return self->__instance.ft->ClearElementAt(
        (MI_Instance*)&self->__instance,
        9);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_ErrorSource(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        10,
        (MI_Value*)&str,
        MI_STRING,
        0);
}

MI_INLINE MI_Result MI_CALL CIM_Error_SetPtr_ErrorSource(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        10,
        (MI_Value*)&str,
        MI_STRING,
        MI_FLAG_BORROW);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_ErrorSource(
    _Inout_ CIM_Error* self)
{
    return self->__instance.ft->ClearElementAt(
        (MI_Instance*)&self->__instance,
        10);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_ErrorSourceFormat(
    _Inout_ CIM_Error* self,
    _In_ MI_Uint16 x)
{
    ((MI_Uint16Field*)&self->ErrorSourceFormat)->value = x;
    ((MI_Uint16Field*)&self->ErrorSourceFormat)->exists = 1;
    return MI_RESULT_OK;
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_ErrorSourceFormat(
    _Inout_ CIM_Error* self)
{
    memset((void*)&self->ErrorSourceFormat, 0, sizeof(self->ErrorSourceFormat));
    return MI_RESULT_OK;
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_OtherErrorSourceFormat(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        12,
        (MI_Value*)&str,
        MI_STRING,
        0);
}

MI_INLINE MI_Result MI_CALL CIM_Error_SetPtr_OtherErrorSourceFormat(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        12,
        (MI_Value*)&str,
        MI_STRING,
        MI_FLAG_BORROW);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_OtherErrorSourceFormat(
    _Inout_ CIM_Error* self)
{
    return self->__instance.ft->ClearElementAt(
        (MI_Instance*)&self->__instance,
        12);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_CIMStatusCode(
    _Inout_ CIM_Error* self,
    _In_ MI_Uint32 x)
{
    ((MI_Uint32Field*)&self->CIMStatusCode)->value = x;
    ((MI_Uint32Field*)&self->CIMStatusCode)->exists = 1;
    return MI_RESULT_OK;
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_CIMStatusCode(
    _Inout_ CIM_Error* self)
{
    memset((void*)&self->CIMStatusCode, 0, sizeof(self->CIMStatusCode));
    return MI_RESULT_OK;
}

MI_INLINE MI_Result MI_CALL CIM_Error_Set_CIMStatusCodeDescription(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        14,
        (MI_Value*)&str,
        MI_STRING,
        0);
}

MI_INLINE MI_Result MI_CALL CIM_Error_SetPtr_CIMStatusCodeDescription(
    _Inout_ CIM_Error* self,
    _In_z_ const MI_Char* str)
{
    return self->__instance.ft->SetElementAt(
        (MI_Instance*)&self->__instance,
        14,
        (MI_Value*)&str,
        MI_STRING,
        MI_FLAG_BORROW);
}

MI_INLINE MI_Result MI_CALL CIM_Error_Clear_CIMStatusCodeDescription(
    _Inout_ CIM_Error* self)
{
    return self->__instance.ft->ClearElementAt(
        (MI_Instance*)&self->__instance,
        14);
}

#endif /*_CIM_Error_h*/


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Revis. gen. pl. (Leipzig) 3(2): 531 (1898)

#### Original name
Massaria niessliana Rehm

### Remarks
null


text:
package org.apache.spark

/**
 * A simpler value of [[Accumulable]] where the result type being accumulated is the same
 * as the types of elements being merged, i.e. variables that are only "added" to through an
 * associative and commutative operation and can therefore be efficiently supported in parallel.
 * They can be used to implement counters (as in MapReduce) or sums. Spark natively supports
 * accumulators of numeric value types, and programmers can add support for new types.
 *
 * An accumulator is created from an initial value `v` by calling `SparkContext.accumulator`.
 * Tasks running on the cluster can then add to it using the `+=` operator.
 * However, they cannot read its value. Only the driver program can read the accumulator's value,
 * using its [[#value]] method.
 *
 * The interpreter session below shows an accumulator being used to add up the elements of an array:
 *
 * {{{
 * scala> val accum = sc.accumulator(0)
 * accum: org.apache.spark.Accumulator[Int] = 0
 *
 * scala> sc.parallelize(Array(1, 2, 3, 4)).foreach(x => accum += x)
 * ...
 * 10/09/29 18:41:08 INFO SparkContext: Tasks finished in 0.317106 s
 *
 * scala> accum.value
 * res2: Int = 10
 * }}}
 *
 * @param initialValue initial value of accumulator
 * @param param helper object defining how to add elements of type `T`
 * @param name human-readable name associated with this accumulator
 * @param countFailedValues whether to accumulate values from failed tasks
 * @tparam T result type
*/
@deprecated("use AccumulatorV2", "2.0.0")
class Accumulator[T] private[spark] (
    // SI-8813: This must explicitly be a private val, or else scala 2.11 doesn't compile
    @transient private val initialValue: T,
    param: AccumulatorParam[T],
    name: Option[String] = None,
    countFailedValues: Boolean = false)
  extends Accumulable[T, T](initialValue, param, name, countFailedValues)

/**
 * A simpler version of [[org.apache.spark.AccumulableParam]] where the only data type you can add
 * in is the same type as the accumulated value. An implicit AccumulatorParam object needs to be
 * available when you create Accumulators of a specific type.
 *
 * @tparam T type of value to accumulate
 */
@deprecated("use AccumulatorV2", "2.0.0")
trait AccumulatorParam[T] extends AccumulableParam[T, T] {
  def addAccumulator(t1: T, t2: T): T = {
    addInPlace(t1, t2)
  }
}

@deprecated("use AccumulatorV2", "2.0.0")
object AccumulatorParam {

  // The following implicit objects were in SparkContext before 1.2 and users had to
  // `import SparkContext._` to enable them. Now we move them here to make the compiler find
  // them automatically. However, as there are duplicate codes in SparkContext for backward
  // compatibility, please update them accordingly if you modify the following implicit objects.

  @deprecated("use AccumulatorV2", "2.0.0")
  implicit object DoubleAccumulatorParam extends AccumulatorParam[Double] {
    def addInPlace(t1: Double, t2: Double): Double = t1 + t2
    def zero(initialValue: Double): Double = 0.0
  }

  @deprecated("use AccumulatorV2", "2.0.0")
  implicit object IntAccumulatorParam extends AccumulatorParam[Int] {
    def addInPlace(t1: Int, t2: Int): Int = t1 + t2
    def zero(initialValue: Int): Int = 0
  }

  @deprecated("use AccumulatorV2", "2.0.0")
  implicit object LongAccumulatorParam extends AccumulatorParam[Long] {
    def addInPlace(t1: Long, t2: Long): Long = t1 + t2
    def zero(initialValue: Long): Long = 0L
  }

  @deprecated("use AccumulatorV2", "2.0.0")
  implicit object FloatAccumulatorParam extends AccumulatorParam[Float] {
    def addInPlace(t1: Float, t2: Float): Float = t1 + t2
    def zero(initialValue: Float): Float = 0f
  }

  // Note: when merging values, this param just adopts the newer value. This is used only
  // internally for things that shouldn't really be accumulated across tasks, like input
  // read method, which should be the same across all tasks in the same stage.
  @deprecated("use AccumulatorV2", "2.0.0")
  private[spark] object StringAccumulatorParam extends AccumulatorParam[String] {
    def addInPlace(t1: String, t2: String): String = t2
    def zero(initialValue: String): String = ""
  }
}


text:
package org.apache.rocketmq.test.client.rmq;

import org.apache.log4j.Logger;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendStatus;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageQueue;
import org.apache.rocketmq.test.clientinterface.AbstractMQProducer;
import org.apache.rocketmq.test.sendresult.SendResult;

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

public class RMQNormalProducer extends AbstractMQProducer {
    private static Logger logger = Logger.getLogger(RMQNormalProducer.class);
    private DefaultMQProducer producer = null;
    private String nsAddr = null;

    public RMQNormalProducer(String nsAddr, String topic) {
        super(topic);
        this.nsAddr = nsAddr;
        create();
        start();
    }

    public RMQNormalProducer(String nsAddr, String topic, String producerGroupName,
        String producerInstanceName) {
        super(topic);
        this.producerGroupName = producerGroupName;
        this.producerInstanceName = producerInstanceName;
        this.nsAddr = nsAddr;

        create();
        start();
    }

    public DefaultMQProducer getProducer() {
        return producer;
    }

    public void setProducer(DefaultMQProducer producer) {
        this.producer = producer;
    }

    protected void create() {
        producer = new DefaultMQProducer();
        producer.setProducerGroup(getProducerGroupName());
        producer.setInstanceName(getProducerInstanceName());

        if (nsAddr != null) {
            producer.setNamesrvAddr(nsAddr);
        }

    }

    public void start() {
        try {
            producer.start();
            super.setStartSuccess(true);
        } catch (MQClientException e) {
            super.setStartSuccess(false);
            logger.error("producer start failed!");
            e.printStackTrace();
        }
    }

    public SendResult send(Object msg, Object orderKey) {
        org.apache.rocketmq.client.producer.SendResult metaqResult = null;
        Message metaqMsg = (Message) msg;
        try {
            long start = System.currentTimeMillis();
            metaqResult = producer.send(metaqMsg);
            this.msgRTs.addData(System.currentTimeMillis() - start);
            if (isDebug) {
                logger.info(metaqResult);
            }
            sendResult.setMsgId(metaqResult.getUniqueKey());
            sendResult.setSendResult(metaqResult.getSendStatus().equals(SendStatus.SEND_OK));
            sendResult.setBrokerIp(metaqResult.getMessageQueue().getBrokerName());
            msgBodys.addData(new String(metaqMsg.getBody()));
            originMsgs.addData(msg);
            originMsgIndex.put(new String(metaqMsg.getBody()), metaqResult);
        } catch (Exception e) {
            if (isDebug) {
                e.printStackTrace();
            }

            sendResult.setSendResult(false);
            sendResult.setSendException(e);
            errorMsgs.addData(msg);
        }

        return sendResult;
    }

    public void send(Map<MessageQueue, List<Object>> msgs) {
        for (MessageQueue mq : msgs.keySet()) {
            send(msgs.get(mq), mq);
        }
    }

    public void send(List<Object> msgs, MessageQueue mq) {
        for (Object msg : msgs) {
            sendMQ((Message) msg, mq);
        }
    }

    public SendResult sendMQ(Message msg, MessageQueue mq) {
        org.apache.rocketmq.client.producer.SendResult metaqResult = null;
        try {
            long start = System.currentTimeMillis();
            metaqResult = producer.send(msg, mq);
            this.msgRTs.addData(System.currentTimeMillis() - start);
            if (isDebug) {
                logger.info(metaqResult);
            }
            sendResult.setMsgId(metaqResult.getUniqueKey());
            sendResult.setSendResult(metaqResult.getSendStatus().equals(SendStatus.SEND_OK));
            sendResult.setBrokerIp(metaqResult.getMessageQueue().getBrokerName());
            msgBodys.addData(new String(msg.getBody()));
            originMsgs.addData(msg);
            originMsgIndex.put(new String(msg.getBody()), metaqResult);
        } catch (Exception e) {
            if (isDebug) {
                e.printStackTrace();
            }

            sendResult.setSendResult(false);
            sendResult.setSendException(e);
            errorMsgs.addData(msg);
        }

        return sendResult;
    }

    public void shutdown() {
        producer.shutdown();
    }

    @Override
    public List<MessageQueue> getMessageQueue() {
        List<MessageQueue> mqs = null;
        try {
            mqs = producer.fetchPublishMessageQueues(topic);
        } catch (MQClientException e) {
            e.printStackTrace();
        }
        return mqs;
    }
}


text:
<?php defined('SYSPATH') or die('No direct script access.');

class Controller_student extends Controller_Template {
    public $template = 'student.tpl';

	public function action_index()
    {
//		$sql = 'select * from student';
//		$result = DB::query(Database::SELECT,$sql)->execute()->as_array();
//		print_r($result);
	}
    public function action_getalluser()
    {
        $this -> auto_render = FALSE;
        if ($this -> request -> is_ajax()) //判断是否为ajax请求
        {
            //get $arr here.
            $arr = Student::getAllStudent();
            echo json_encode($arr);//建议这样写,避免0或其他情况.
            exit;
        }
    }

} // End Welcome


text:
package com.intellij.plugins.thrift.config;

import com.intellij.openapi.components.*;
import com.intellij.plugins.thrift.jps.ThriftProjectExtensionSerializer;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * 27.06.2014 10:48
 *
 * @author xBlackCat
 */
@State(
  name = ThriftProjectExtensionSerializer.NAME,
  storages = {
    @Storage(
      id = "default",
      file = StoragePathMacros.PROJECT_FILE
    ),
    @Storage(
      id = "dir",
      file = StoragePathMacros.PROJECT_CONFIG_DIR + "/" + ThriftProjectExtensionSerializer.CONFIG_FILE_NAME,
      scheme = StorageScheme.DIRECTORY_BASED
    )
  }
)
public class ThriftPlugin implements BaseComponent, PersistentStateComponent<Element>, ProjectComponent {
  private ThriftConfig myConfig;

  @Nullable
  @Override
  public Element getState() {
    final Element root = new Element("thrift");

    Element frameWorksList = new Element("compilers");
    if (myConfig != null && StringUtils.isNotBlank(myConfig.getCompilerPath())) {
      Element fw = new Element("compiler");

      fw.setAttribute("url", myConfig.getCompilerPath());
      fw.setAttribute("nowarn", myConfig.isNoWarn() ? "yes" : "no");
      fw.setAttribute("strict", myConfig.isStrict() ? "yes" : "no");
      fw.setAttribute("verbose", myConfig.isVerbose() ? "yes" : "no");
      fw.setAttribute("recurse", myConfig.isRecurse() ? "yes" : "no");
      fw.setAttribute("debug", myConfig.isDebug() ? "yes" : "no");
      fw.setAttribute("allownegkeys", myConfig.isAllowNegKeys() ? "yes" : "no");
      fw.setAttribute("allow64bitconsts", myConfig.isAllow64bitConsts() ? "yes" : "no");

      frameWorksList.addContent(fw);
    }

    root.addContent(frameWorksList);

    return root;
  }

  @Override
  public void loadState(Element state) {
    Element fwList = state.getChild("compilers");
    if (fwList != null) {
      Element fw = fwList.getChild("compiler");
      if (fw != null) {
        String url = fw.getAttributeValue("url");
        if (url != null) {
          boolean noWarn = BooleanUtils.toBoolean(fw.getAttributeValue("nowarn"));
          boolean strict = BooleanUtils.toBoolean(fw.getAttributeValue("strict"));
          boolean verbose = BooleanUtils.toBoolean(fw.getAttributeValue("verbose"));
          boolean recurse = BooleanUtils.toBoolean(fw.getAttributeValue("recurse"));
          boolean debug = BooleanUtils.toBoolean(fw.getAttributeValue("debug"));
          boolean allowNegKeys = BooleanUtils.toBoolean(fw.getAttributeValue("allownegkeys"));
          boolean allow64bitConsts = BooleanUtils.toBoolean(fw.getAttributeValue("allow64bitconsts"));

          myConfig = new ThriftConfig(url, noWarn, strict, verbose, recurse, debug, allowNegKeys, allow64bitConsts);
        }
      }
    }
  }

  @Override
  public void projectOpened() {

  }

  @Override
  public void projectClosed() {

  }

  @Override
  public void initComponent() {

  }

  @Override
  public void disposeComponent() {

  }

  @NotNull
  @Override
  public String getComponentName() {
    return "Thrift";
  }

  public void setConfig(ThriftConfig config) {
    myConfig = config;
  }

  public ThriftConfig getConfig() {
    return myConfig;
  }
}


text:
package export

import (
	"context"
	"database/sql"
	"database/sql/driver"
	"fmt"

	"github.com/DATA-DOG/go-sqlmock"

	tcontext "github.com/pingcap/tidb/dumpling/context"
)

type mockPoisonWriter struct {
	buf string
}

func (m *mockPoisonWriter) Write(_ context.Context, p []byte) (int, error) {
	s := string(p)
	if s == "poison" {
		return 0, fmt.Errorf("poison_error")
	}
	m.buf = s
	return len(s), nil
}

func (m *mockPoisonWriter) Close(_ context.Context) error {
	// noop
	return nil
}

type mockMetaIR struct {
	tarName string
	meta    string
	specCmt []string
}

func (m *mockMetaIR) SpecialComments() StringIter {
	return newStringIter(m.specCmt...)
}

func (m *mockMetaIR) TargetName() string {
	return m.tarName
}

func (m *mockMetaIR) MetaSQL() string {
	return m.meta
}

func newMockMetaIR(targetName string, meta string, specialComments []string) MetaIR {
	return &mockMetaIR{
		tarName: targetName,
		meta:    meta,
		specCmt: specialComments,
	}
}

type mockTableIR struct {
	dbName           string
	tblName          string
	chunIndex        int
	data             [][]driver.Value
	selectedField    string
	selectedLen      int
	specCmt          []string
	colTypes         []string
	colNames         []string
	escapeBackSlash  bool
	hasImplicitRowID bool
	rowErr           error
	rows             *sql.Rows
	SQLRowIter
}

func (m *mockTableIR) RawRows() *sql.Rows {
	return m.rows
}

func (m *mockTableIR) ShowCreateTable() string {
	return ""
}

func (m *mockTableIR) ShowCreateView() string {
	return ""
}

func (m *mockTableIR) AvgRowLength() uint64 {
	return 0
}

func (m *mockTableIR) HasImplicitRowID() bool {
	return m.hasImplicitRowID
}

func (m *mockTableIR) Start(_ *tcontext.Context, conn *sql.Conn) error {
	return nil
}

func (m *mockTableIR) DatabaseName() string {
	return m.dbName
}

func (m *mockTableIR) TableName() string {
	return m.tblName
}

func (m *mockTableIR) ChunkIndex() int {
	return m.chunIndex
}

func (m *mockTableIR) ColumnCount() uint {
	return uint(len(m.colTypes))
}

func (m *mockTableIR) ColumnTypes() []string {
	return m.colTypes
}

func (m *mockTableIR) ColumnNames() []string {
	return m.colNames
}

func (m *mockTableIR) SelectedField() string {
	return m.selectedField
}

func (m *mockTableIR) SelectedLen() int {
	return m.selectedLen
}

func (m *mockTableIR) SpecialComments() StringIter {
	return newStringIter(m.specCmt...)
}

func (m *mockTableIR) Rows() SQLRowIter {
	if m.SQLRowIter == nil {
		mockRows := sqlmock.NewRows(m.colTypes)
		for _, datum := range m.data {
			mockRows.AddRow(datum...)
		}
		db, mock, err := sqlmock.New()
		if err != nil {
			panic(fmt.Sprintf("sqlmock.New return error: %v", err))
		}
		defer db.Close()
		mock.ExpectQuery("select 1").WillReturnRows(mockRows)
		if m.rowErr != nil {
			mockRows.RowError(len(m.data)-1, m.rowErr)
		}
		rows, err := db.Query("select 1")
		if err != nil {
			panic(fmt.Sprintf("sqlmock.New return error: %v", err))
		}
		m.SQLRowIter = newRowIter(rows, len(m.colTypes))
		m.rows = rows
	}
	return m.SQLRowIter
}

func (m *mockTableIR) Close() error {
	return nil
}

func (m *mockTableIR) EscapeBackSlash() bool {
	return m.escapeBackSlash
}

func newMockTableIR(databaseName, tableName string, data [][]driver.Value, specialComments, colTypes []string) *mockTableIR {
	return &mockTableIR{
		dbName:        databaseName,
		tblName:       tableName,
		data:          data,
		specCmt:       specialComments,
		selectedField: "*",
		selectedLen:   len(colTypes),
		colTypes:      colTypes,
		SQLRowIter:    nil,
	}
}


text:
package scouter.server.netio.service.net
import scouter.server.util.ThreadScala
import scouter.util.IntKeyLinkedMap
import scouter.util.LinkedList
import scouter.util.RequestQueue
import scala.util.control.Breaks._
import scouter.server.Configure
import java.util.concurrent.Executors
object TcpAgentManager {
    val pool = Executors.newFixedThreadPool(4)
    val agentTable = new IntKeyLinkedMap[RequestQueue[TcpAgentWorker]]().setMax(5000)

    ThreadScala.startDaemon("scouter.server.netio.service.net.TcpAgentManager", { true }, 5000) {
        val keys = agentTable.keyArray()
        for (k <- keys) {
            val agentSessions = agentTable.get(k)
            if (agentSessions != null) {
                pool.execute(new Runnable() {
                    override def run() {
                        breakable {
                            val cnt = agentSessions.size()
                            for (k <- 0 to cnt) {
                                val item = agentSessions.getNoWait()
                                if (item == null) {
                                    break
                                }
                                if (item.isExpired()) {
                                    item.sendKeepAlive(3000)
                                }
                                if (item.isClosed() == false) {
                                    agentSessions.put(item)
                                }
                            }
                        }
                    }
                });
            }
        }
    }
    val conf = Configure.getInstance()
    def add(objHash: Int, agent: TcpAgentWorker): Int = {
        agentTable.synchronized {
            var session = agentTable.get(objHash)
            if (session == null) {
                session = new RequestQueue[TcpAgentWorker](50);
                agentTable.put(objHash, session)
            }
            session.put(agent);
            return session.size()
        }
    }
    def get(objHash: Int): TcpAgentWorker = {
        var session = agentTable.get(objHash)
        return if (session != null) session.get(conf.tcp_agent_max_wait) else null
    }
}


text:
/**
 *
 */
package com.vito16.shop.controller;

import com.vito16.common.log.Logger;
import com.vito16.common.log.LoggerFactory;
import com.vito16.shop.common.Constants;
import com.vito16.shop.common.Page;
import com.vito16.shop.common.PageUtil;
import com.vito16.shop.model.Picture;
import com.vito16.shop.model.Product;
import com.vito16.shop.service.PictureService;
import com.vito16.shop.service.ProductService;
import com.vito16.shop.util.AdminUtil;
import com.vito16.shop.util.Image;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.*;
import java.util.Date;
import java.util.List;

/**
 * @author Vito zhouwentao16@gmail.com
 * @version 2013-7-17
 */
@Controller
@RequestMapping(value = "/product")
public class ProductController {

    private static final Logger logger = LoggerFactory.getLogger(ProductController.class);
    @Autowired
    ProductService productService;
    @Autowired
    PictureService pictureService;

    @RequestMapping(value = "/new", method = RequestMethod.GET)
    public String newForm(HttpSession session) {
        if (AdminUtil.getAdminFromSession(session) == null) {
            return "redirect:/admin/login?error=true";
        }
        return "product/productNew";
    }

    @RequestMapping(value = "/admin", method = RequestMethod.GET)
    public ModelAndView admin(ModelAndView model, HttpSession session, HttpServletRequest request) {
        if (AdminUtil.getAdminFromSession(session) == null) {
            model.setViewName("redirect:/admin/login?error=true");
            return model;
        }
        Page<Product> page = new Page<Product>(PageUtil.PAGE_SIZE);
        int[] pageParams = PageUtil.init(page, request);
        productService.findProducts(page, pageParams);
        model.addObject("page", page);
        model.setViewName("product/productAdmin");
        return model;
    }

    @RequestMapping(value = "/test", method = RequestMethod.GET)
    @ResponseBody
    public List<Product> test(HttpSession session, HttpServletRequest request) {
        Page<Product> page = new Page<Product>(PageUtil.PAGE_SIZE);
        int[] pageParams = PageUtil.init(page, request);
        productService.findProducts(page, pageParams);
        return page.getResult();
    }

    @RequestMapping(value = "/edit/{id}", method = RequestMethod.GET)
    public ModelAndView edit(ModelAndView model, HttpSession session, @PathVariable Integer id) {
        if (AdminUtil.getAdminFromSession(session) == null) {
            model.setViewName("redirect:/admin/login?error=true");
            return model;
        }
        Product product = productService.findById(id);
        model.addObject("product", product);
        model.setViewName("product/productEdit");
        return model;
    }

    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    public ModelAndView doEdit(ModelAndView model, Product product, HttpSession session, @RequestParam("file") MultipartFile file) {
        if (AdminUtil.getAdminFromSession(session) == null) {
            model.setViewName("redirect:/admin/login?error=true");
            return model;
        }
        if (!file.isEmpty()) {
            uploadImage(product, session, file);
        }
        product.setInputUser(AdminUtil.getAdminFromSession(session));
        productService.save(product);
        model.setViewName("redirect:/product/admin");
        return model;
    }

    private void uploadImage(Product product, HttpSession session, MultipartFile file) {
        String fileName = new Date().getTime() + ".jpg";
        String path = session.getServletContext().getRealPath("/upload");
        String serverFile = path + "/" + fileName;
        Picture picture = new Picture();
        try {
            logger.info(path);
            if (!new File(path).exists()) {
                new File(path).mkdirs();
            }
            if (!new File(serverFile).exists()) {
                new File(serverFile).createNewFile();
            }
            byte[] bytes = file.getBytes();
            BufferedOutputStream stream =
                    new BufferedOutputStream(new FileOutputStream(new File(serverFile)));
            stream.write(bytes);
            stream.close();
            //缩放处理
            Image image = new Image(serverFile);
            image.resize(Constants.IMG_WIDTH,Constants.IMG_HEIGHT);
            image.save();
        } catch (Exception e) {
            e.printStackTrace();
        }
        picture.setMemo("商品上传");
        picture.setTitle("商品上传");
        picture.setUpdateTime(new Date());
        picture.setUrl("/upload/" + fileName);
        picture.setUpdateAdmin(AdminUtil.getAdminFromSession(session));
        pictureService.save(picture);
        product.setMasterPic(picture);
    }

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public ModelAndView listProduct(ModelAndView model, HttpServletRequest request) {
        Page<Product> page = new Page<Product>(PageUtil.PAGE_SIZE);
        int[] pageParams = PageUtil.init(page, request);
        productService.findProducts(page, pageParams);
        model.addObject("page", page);
        model.setViewName("product/productList");
        return model;
    }

    @RequestMapping(value = "/{id}")
    public String showInfo(@PathVariable Integer id, Model model) {
        Product product = productService.findById(id);
        model.addAttribute("product", product);
        return "product/productView";
    }

    @RequestMapping(value = "/new", method = RequestMethod.POST)
    public String doNew(Product product, HttpSession session, @RequestParam("file") MultipartFile file) {
        if (!file.isEmpty()) {
            uploadImage(product, session, file);
        }
        product.setInputUser(AdminUtil.getAdminFromSession(session));
        product.setCreateTime(new Date());
        productService.save(product);
        return "redirect:/product/admin";
    }

}


text:
PYTHON        = python
SPHINXOPTS    =
SPHINXBUILD   = $(PYTHON) `which sphinx-build`
PAPER         =

BUILDDIR = _build

# Internal variables.
PAPEROPT_a4     = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html web pickle htmlhelp latex changes linkcheck

help:
	@echo "Please use \`make <target>' where <target> is one of"
	@echo "  html      to make standalone HTML files"
	@echo "  pickle    to make pickle files"
	@echo "  json      to make JSON files"
	@echo "  htmlhelp  to make HTML files and a HTML help project"
	@echo "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
	@echo "  changes   to make an overview over all changed/added/deprecated items"
	@echo "  linkcheck to check all external links for integrity"

clean:
	-rm -rf $(BUILDDIR)/*

html:
	mkdir -p $(BUILDDIR)/html $(BUILDDIR)/doctrees
	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
	@echo
	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

pickle:
	mkdir -p $(BUILDDIR)/pickle $(BUILDDIR)/doctrees
	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
	@echo
	@echo "Build finished; now you can process the pickle files."

web: pickle

json:
	mkdir -p $(BUILDDIR)/json $(BUILDDIR)/doctrees
	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
	@echo
	@echo "Build finished; now you can process the JSON files."

htmlhelp:
	mkdir -p $(BUILDDIR)/htmlhelp $(BUILDDIR)/doctrees
	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
	@echo
	@echo "Build finished; now you can run HTML Help Workshop with the" \
	      ".hhp project file in $(BUILDDIR)/htmlhelp."

latex:
	mkdir -p $(BUILDDIR)/latex $(BUILDDIR)/doctrees
	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
	@echo
	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
	      "run these through (pdf)latex."

changes:
	mkdir -p $(BUILDDIR)/changes $(BUILDDIR)/doctrees
	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
	@echo
	@echo "The overview file is in $(BUILDDIR)/changes."

linkcheck:
	mkdir -p $(BUILDDIR)/linkcheck $(BUILDDIR)/doctrees
	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
	@echo
	@echo "Link check complete; look for any errors in the above output " \
	      "or in $(BUILDDIR)/linkcheck/output.txt."


text: Adam Joseph Cook <adam.joseph.cook@gmail.com>


text:
package com.lixavier.console.req;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.Date;
import java.util.List;

public class MenuQueryReq extends QueryReq {

    /**
     * @Fields serialVersionUID : 序列化版本号
     */
    private static final long serialVersionUID = 1L;

    private Integer id;
    private List<Integer> idList;
    private String menuName;
    private String menuNameLike;
    private String menuCode;
    private String menuCodeLike;
    private Integer parentId;
    private List<Integer> parentIdList;
    private Integer numOrder;
    private List<Integer> numOrderList;
    private Byte numLevel;
    private List<Byte> numLevelList;
    private Boolean isShow;
    private List<Boolean> isShowList;
    private Byte type;
    private Date createTimeFrom;
    private Date createTimeTo;
    private Date updateTimeFrom;
    private Date updateTimeTo;
    private Boolean delStatus;
    private List<Boolean> delStatusList;

    public Integer getId() {
        return id;
    }

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

    public List<Integer> getIdList() {
        return idList;
    }

    public void setIdList(List<Integer> idList) {
        this.idList = idList;
    }

    public String getMenuName() {
        return menuName;
    }

    public void setMenuName(String menuName) {
        this.menuName = menuName;
    }

    public String getMenuNameLike() {
        return menuNameLike;
    }

    public void setMenuNameLike(String menuNameLike) {
        this.menuNameLike = menuNameLike;
    }

    public String getMenuCode() {
        return menuCode;
    }

    public void setMenuCode(String menuCode) {
        this.menuCode = menuCode;
    }

    public String getMenuCodeLike() {
        return menuCodeLike;
    }

    public void setMenuCodeLike(String menuCodeLike) {
        this.menuCodeLike = menuCodeLike;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public List<Integer> getParentIdList() {
        return parentIdList;
    }

    public void setParentIdList(List<Integer> parentIdList) {
        this.parentIdList = parentIdList;
    }

    public Integer getNumOrder() {
        return numOrder;
    }

    public void setNumOrder(Integer numOrder) {
        this.numOrder = numOrder;
    }

    public List<Integer> getNumOrderList() {
        return numOrderList;
    }

    public void setNumOrderList(List<Integer> numOrderList) {
        this.numOrderList = numOrderList;
    }

    public Byte getNumLevel() {
        return numLevel;
    }

    public void setNumLevel(Byte numLevel) {
        this.numLevel = numLevel;
    }

    public List<Byte> getNumLevelList() {
        return numLevelList;
    }

    public void setNumLevelList(List<Byte> numLevelList) {
        this.numLevelList = numLevelList;
    }

    public Boolean getIsShow() {
        return isShow;
    }

    public void setIsShow(Boolean isShow) {
        this.isShow = isShow;
    }

    public List<Boolean> getIsShowList() {
        return isShowList;
    }

    public void setIsShowList(List<Boolean> isShowList) {
        this.isShowList = isShowList;
    }

    public Byte getType() {
        return type;
    }

    public void setType(Byte type) {
        this.type = type;
    }

    public Date getCreateTimeFrom() {
        return createTimeFrom;
    }

    public void setCreateTimeFrom(Date createTimeFrom) {
        this.createTimeFrom = createTimeFrom;
    }

    public Date getCreateTimeTo() {
        return createTimeTo;
    }

    public void setCreateTimeTo(Date createTimeTo) {
        this.createTimeTo = createTimeTo;
    }

    public Date getUpdateTimeFrom() {
        return updateTimeFrom;
    }

    public void setUpdateTimeFrom(Date updateTimeFrom) {
        this.updateTimeFrom = updateTimeFrom;
    }

    public Date getUpdateTimeTo() {
        return updateTimeTo;
    }

    public void setUpdateTimeTo(Date updateTimeTo) {
        this.updateTimeTo = updateTimeTo;
    }

    public Boolean getDelStatus() {
        return delStatus;
    }

    public void setDelStatus(Boolean delStatus) {
        this.delStatus = delStatus;
    }

    public List<Boolean> getDelStatusList() {
        return delStatusList;
    }

    public void setDelStatusList(List<Boolean> delStatusList) {
        this.delStatusList = delStatusList;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
    }

}


text:
static void update_status(bool success);
static void update_clock();


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="content-type">
  <title>chimera_installguide</title>

<big><big>

Chimera Installation Guide

</big></big>

<big><big>

We have developed and tested Chimera on Linux (Fedora cores, 2,3,4) but
it should work on other Linux distributions.

After downloading the latest version of Chimera, copy the
tarred-gzip file to the directory that you want Chimera to be installed
in.

Go to the directory that you copied the file and run the following
command:

</big></big>tar -xvvzf chimera.tar.gz

This will create the chimera directory and all of its sub-directories
in the current folder.

Chimera uses auto-conf tool, therefore compilation should be
straightforward. Chang directory to the chimera and run the following
commands to compile the code:

./configure --prefix='current directory'

make install

Note: The generic auto-conf installation instruction is included in
INSTALL file in the chimera directory.

At this point you should have the compiled version ready to use. You
can test your installation by running the test program under test
directory.

  Rama Alebouyeh

  Last updated  2/16/06

<big><big>

</big></big>


text:
using System;
using System.Linq;

namespace _03.Wormhole
{
    class Wormhole
    {
        static void Main(string[] args)
        {
            int[] inputSequence = Console.ReadLine()
                .Split(' ')
                .Select(int.Parse)
                .ToArray();

            int stepCounter = 0;

            for (int i = 0; i < inputSequence.Length; i++)
            {
                stepCounter++;

                int currentValue = inputSequence[i];

                if (currentValue != 0)
                {
                    inputSequence[i] = 0;
                    i = currentValue - 1;
                    stepCounter--;
                }
            }

            Console.WriteLine(stepCounter);
        }
    }
}


text:
package org.hibernate.metamodel.domain;

/**
 * A single valued (non-collection) attribute
 *
 * @author Steve Ebersole
 */
public interface SingularAttribute extends Attribute {
	/**
	 * Retrieve the attribute type descriptor.
	 *
	 * @return THe attribute type.
	 */
	public Type getSingularAttributeType();

	public boolean isTypeResolved();

	public void resolveType(Type type);
}


text:
import { useRef, useEffect, useState } from 'react'
import { createPortal } from 'react-dom'

export default function ClientOnlyPortal({ children, selector }) {
  const ref = useRef()
  const [mounted, setMounted] = useState(false)

  useEffect(() => {
    ref.current = document.querySelector(selector)
    setMounted(true)
  }, [selector])

  return mounted ? createPortal(children, ref.current) : null
}


text:
require 'spec_helper'

describe Gitlab::Gfm::UploadsRewriter do
  let(:user) { create(:user) }
  let(:old_project) { create(:project) }
  let(:new_project) { create(:project) }
  let(:rewriter) { described_class.new(text, old_project, user) }

  context 'text contains links to uploads' do
    let(:image_uploader) do
      build(:file_uploader, project: old_project)
    end

    let(:zip_uploader) do
      build(:file_uploader, project: old_project,
                            fixture: 'ci_build_artifacts.zip')
    end

    let(:text) do
      "Text and #{image_uploader.markdown_link} and #{zip_uploader.markdown_link}"
    end

    shared_examples "files are accessible" do
      describe '#rewrite' do
        let!(:new_text) { rewriter.rewrite(new_project) }

        let(:old_files) { [image_uploader, zip_uploader] }
        let(:new_files) do
          described_class.new(new_text, new_project, user).files
        end

        let(:old_paths) { old_files.map(&:path) }
        let(:new_paths) { new_files.map(&:path) }

        it 'rewrites content' do
          expect(new_text).not_to eq text
          expect(new_text.length).to eq text.length
        end

        it 'copies files' do
          expect(new_files).to all(exist)
          expect(old_paths).not_to match_array new_paths
          expect(old_paths).to all(include(old_project.disk_path))
          expect(new_paths).to all(include(new_project.disk_path))
        end

        it 'does not remove old files' do
          expect(old_files).to all(exist)
        end

        it 'generates a new secret for each file' do
          expect(new_paths).not_to include image_uploader.secret
          expect(new_paths).not_to include zip_uploader.secret
        end
      end
    end

    context "file are stored locally" do
      include_examples "files are accessible"
    end

    context "files are stored remotely" do
      before do
        stub_uploads_object_storage(FileUploader)

        old_files.each do |file|
          file.migrate!(ObjectStorage::Store::REMOTE)
        end
      end

      include_examples "files are accessible"
    end

    describe '#needs_rewrite?' do
      subject { rewriter.needs_rewrite? }
      it { is_expected.to eq true }
    end

    describe '#files' do
      subject { rewriter.files }
      it { is_expected.to be_an(Array) }
    end
  end
end


text:
package org.niklas.elemental.Elemental.client.elements;

import com.google.gwt.core.client.js.JsProperty;
import com.google.gwt.core.client.js.JsType;

@JsType(
    prototype = "MediaController"
)
interface MediaController extends EventTarget {
  @JsProperty
  short getReadyState();

  @JsProperty
  TimeRanges getBuffered();

  @JsProperty
  TimeRanges getSeekable();

  @JsProperty
  double getDuration();

  @JsProperty
  double getCurrentTime();

  @JsProperty
  void setCurrentTime(double value);

  @JsProperty
  boolean getPaused();

  @JsProperty
  String getPlaybackState();

  @JsProperty
  TimeRanges getPlayed();

  @JsProperty
  double getDefaultPlaybackRate();

  @JsProperty
  void setDefaultPlaybackRate(double value);

  @JsProperty
  double getPlaybackRate();

  @JsProperty
  void setPlaybackRate(double value);

  @JsProperty
  double getVolume();

  @JsProperty
  void setVolume(double value);

  @JsProperty
  boolean getMuted();

  @JsProperty
  void setMuted(boolean value);

  @JsProperty
  EventHandlerNonNull getOnemptied();

  @JsProperty
  void setOnemptied(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOnloadedmetadata();

  @JsProperty
  void setOnloadedmetadata(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOnloadeddata();

  @JsProperty
  void setOnloadeddata(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOncanplay();

  @JsProperty
  void setOncanplay(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOncanplaythrough();

  @JsProperty
  void setOncanplaythrough(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOnplaying();

  @JsProperty
  void setOnplaying(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOnended();

  @JsProperty
  void setOnended(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOnwaiting();

  @JsProperty
  void setOnwaiting(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOndurationchange();

  @JsProperty
  void setOndurationchange(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOntimeupdate();

  @JsProperty
  void setOntimeupdate(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOnplay();

  @JsProperty
  void setOnplay(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOnpause();

  @JsProperty
  void setOnpause(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOnratechange();

  @JsProperty
  void setOnratechange(EventHandlerNonNull value);

  @JsProperty
  EventHandlerNonNull getOnvolumechange();

  @JsProperty
  void setOnvolumechange(EventHandlerNonNull value);

  void pause();

  void unpause();

  void play();
}


text:
// ShareObject.h: interface for the CShareObject class.
// 2006.4.16 Ò¶Ê÷ÉÇý¶¯Ó¦Óò㹲ÏíÄÚ´æ
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SHAREOBJECT_H__C92017ED_A2C3_4A72_B2E0_D64372816CB2__INCLUDED_)
#define AFX_SHAREOBJECT_H__C92017ED_A2C3_4A72_B2E0_D64372816CB2__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <aclapi.h>
#include "stdio.h"
#include <sddl.h>
#include <AccCtrl.h>
#include "..\TextIoSystem.h"
//std::vector
template<class _Type>
class CShareObject
{
private:
	HANDLE m_DataMutex;		//Ó³Éä²Ù×÷»¥²ð¾ä±ú
	LPVOID m_DataMapView;		//Ó³ÉäÄÚ´æÖ¸Õë
	SECURITY_ATTRIBUTES m_sMapa;
	SECURITY_ATTRIBUTES m_sMutexa;
	BOOL m_bInit;
	HANDLE m_DataMap;
	BOOL m_bPrivate;
	TCHAR m_szPrefix[32];
	ErrorPrinter_OutputDebugString Error;

	typedef BOOL(__stdcall*fp_ConvertStringSecurityDescriptorToSecurityDescriptor)(WCHAR * StringSecurityDescriptor, DWORD StringSDRevision, PSECURITY_DESCRIPTOR* SecurityDescriptor, PULONG SecurityDescriptorSize);

	BOOL SetLowIntegrity(TCHAR *pObjName)
	{

#ifndef LOW_INTEGRITY_SDDL_SACL

#define LOW_INTEGRITY_SDDL_SACL L"S:(ML;;NW;;;LW)"

#endif // !LOW_INTEGRITY_SDDL_SACL

#ifndef LABEL_SECURITY_INFORMATION

#define LABEL_SECURITY_INFORMATION 0x00000010L

#endif // !LOW_INTEGRITY_SDDL_SACL

		DWORD dwErr = ERROR_SUCCESS;
		PSECURITY_DESCRIPTOR pSD = NULL;
		PACL pSacl = NULL; // not allocated
		BOOL fSaclPresent = FALSE;
		BOOL fSaclDefaulted = FALSE;

		fp_ConvertStringSecurityDescriptorToSecurityDescriptor ConvertStringSecurityDescriptorToSecurityDescriptor;
		HMODULE hMod = LoadLibrary(_T("Advapi32.dll"));
		ConvertStringSecurityDescriptorToSecurityDescriptor = (fp_ConvertStringSecurityDescriptorToSecurityDescriptor)GetProcAddress(hMod, "ConvertStringSecurityDescriptorToSecurityDescriptorW");
		if (ConvertStringSecurityDescriptorToSecurityDescriptor != NULL) {
			if (ConvertStringSecurityDescriptorToSecurityDescriptor(LOW_INTEGRITY_SDDL_SACL, SDDL_REVISION_1, &pSD, NULL)) {
				if (GetSecurityDescriptorSacl(pSD, &fSaclPresent, &pSacl,&fSaclDefaulted)) {
					dwErr = SetNamedSecurityInfo(pObjName,SE_KERNEL_OBJECT, LABEL_SECURITY_INFORMATION,NULL, NULL, NULL, pSacl);
				}
				LocalFree(pSD);
				return TRUE;
			}
		}
		return FALSE;
	}

	//ÉèÖð²È«²ÎÊý
	void SetMutexSecurity()
	{

		InitializeSecurityDescriptor(&m_sMutexa,SECURITY_DESCRIPTOR_REVISION);
		SetSecurityDescriptorDacl(&m_sMutexa,TRUE,NULL,FALSE);

		DWORD dwRes=0;
		PSID pEveryoneSID = NULL, pAdminSID = NULL;
		PACL pACL = NULL;
		PSECURITY_DESCRIPTOR pSD = NULL;
		EXPLICIT_ACCESS ea[2];
		SID_IDENTIFIER_AUTHORITY SIDAuthWorld =SECURITY_WORLD_SID_AUTHORITY;
		SID_IDENTIFIER_AUTHORITY SIDAuthNT = SECURITY_NT_AUTHORITY;

		// Create a well-known SID for the Everyone group.
		if(!AllocateAndInitializeSid(&SIDAuthWorld, 1,
    		SECURITY_WORLD_RID,
    		0, 0, 0, 0, 0, 0, 0,
    		&pEveryoneSID))
		{

			goto Cleanup;
		}

		// Initialize an EXPLICIT_ACCESS structure for an ACE.
		// The ACE will allow Everyone read access to the key.
		ZeroMemory(&ea, 2 * sizeof(EXPLICIT_ACCESS));
		ea[0].grfAccessPermissions = EVENT_ALL_ACCESS|MUTEX_ALL_ACCESS;
		ea[0].grfAccessMode = SET_ACCESS;
		ea[0].grfInheritance= NO_INHERITANCE;
		ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID;
		ea[0].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
		ea[0].Trustee.ptstrName  = (LPTSTR) pEveryoneSID;

		dwRes = SetEntriesInAcl(1, ea, NULL, &pACL);
		if (ERROR_SUCCESS != dwRes)
		{

			goto Cleanup;
		}

		// Initialize a security descriptor.
		pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR,
    		SECURITY_DESCRIPTOR_MIN_LENGTH);
		if (NULL == pSD)
		{

			goto Cleanup;
		}

		if (!InitializeSecurityDescriptor(pSD,
    		SECURITY_DESCRIPTOR_REVISION))
		{

			goto Cleanup;
		}

		// Add the ACL to the security descriptor.
		if (!SetSecurityDescriptorDacl(pSD,
    		TRUE,     // bDaclPresent flag
    		pACL,
    		FALSE))   // not a default DACL
		{
			goto Cleanup;
		}

		m_sMutexa.nLength=sizeof(SECURITY_ATTRIBUTES);
		m_sMutexa.bInheritHandle = FALSE;
		m_sMutexa.lpSecurityDescriptor = pSD;

		return ;

		Cleanup:

		if (pEveryoneSID)
			FreeSid(pEveryoneSID);
		if (pAdminSID)
			FreeSid(pAdminSID);
		if (pACL)
			LocalFree(pACL);
		if (pSD)
			LocalFree(pSD);

	}

	TCHAR * GetVistaObjectName(TCHAR * pObjName)
	{
		TCHAR szUserName[MAX_PATH];
		BOOL bSystemProcess = FALSE;
		char * pRetName = pObjName;
		unsigned long nSize = 256;
		if (GetUserName(szUserName, &nSize))
		{
			if (stricmp_t("system", szUserName) == 0)
			{
				if (strstr_t(pObjName,_T("Global\\")))
				{
					pRetName = strchr_t(pObjName, '\\');
					if (pRetName)
					{
						pRetName++;
					}
				}
			}
		}
		else
		{
			return NULL;
		}

		Error(_T("GetVistaObjectName %s"), pRetName);
		return pRetName;

	}

	void SetMapSecurity()
	{
		//2009.12.1Ò¶Ê÷ÉÐÞÕý¶ÔÏó·ÃÎÊÊôÐÔ
		DWORD dwRes=0;
		PSID pEveryoneSID = NULL, pAdminSID = NULL;
		PACL pACL = NULL;
		PSECURITY_DESCRIPTOR pSD = NULL;
		EXPLICIT_ACCESS ea[2];
		SID_IDENTIFIER_AUTHORITY SIDAuthWorld =SECURITY_WORLD_SID_AUTHORITY;
		SID_IDENTIFIER_AUTHORITY SIDAuthNT = SECURITY_NT_AUTHORITY;
		// Create a well-known SID for the Everyone group.
		if(!AllocateAndInitializeSid(&SIDAuthWorld, 1,
    		SECURITY_WORLD_RID,
    		0, 0, 0, 0, 0, 0, 0,
    		&pEveryoneSID))
		{
			goto Cleanup;
		}

		// Initialize an EXPLICIT_ACCESS structure for an ACE.
		// The ACE will allow Everyone read access to the key.
		ZeroMemory(&ea, 2 * sizeof(EXPLICIT_ACCESS));
		ea[0].grfAccessPermissions = FILE_MAP_ALL_ACCESS;
		ea[0].grfAccessMode = SET_ACCESS;
		ea[0].grfInheritance= NO_INHERITANCE;
		ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID;
		ea[0].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
		ea[0].Trustee.ptstrName  = (LPTSTR) pEveryoneSID;

		dwRes = SetEntriesInAcl(1, ea, NULL, &pACL);
		if (ERROR_SUCCESS != dwRes)
		{
			goto Cleanup;
		}

		// Initialize a security descriptor.
		pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR,
    		SECURITY_DESCRIPTOR_MIN_LENGTH);
		if (NULL == pSD)
		{
			goto Cleanup;
		}

		if (!InitializeSecurityDescriptor(pSD,
    		SECURITY_DESCRIPTOR_REVISION))
		{
			goto Cleanup;
		}

		// Add the ACL to the security descriptor.
		if (!SetSecurityDescriptorDacl(pSD,
    		TRUE,     // bDaclPresent flag
    		pACL,
    		FALSE))   // not a default DACL
		{
			goto Cleanup;
		}

		m_sMapa.nLength=sizeof(SECURITY_ATTRIBUTES);
		m_sMapa.bInheritHandle = FALSE;
		m_sMapa.lpSecurityDescriptor = pSD;

		return ;

		Cleanup:

		if (pEveryoneSID)
			FreeSid(pEveryoneSID);
		if (pAdminSID)
			FreeSid(pAdminSID);
		if (pACL)
			LocalFree(pACL);
		if (pSD)
			LocalFree(pSD);
	}

public:

	BOOL EnableDebugPrivilege(BOOL bEnableDebugPrivilege)
	{
		HANDLE hToken;
		TOKEN_PRIVILEGES tp;
		LUID luid;
		UINT	nErrorPos = 0;
		DWORD	nError = 0;
		do
		{
			if (!::OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken))
			{
				nErrorPos = 1;
				nError = GetLastError();
				break;
			}

			if (!::LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid))
			{
				nErrorPos = 2;
				nError = GetLastError();
				::CloseHandle(hToken);
				break;
			}

			tp.PrivilegeCount = 1;
			tp.Privileges[0].Luid = luid;
			if (bEnableDebugPrivilege)
			{
				tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
			}
			else
			{
				tp.Privileges[0].Attributes = 0;
			}

			if (!::AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(tp), NULL, NULL))
			{
				nErrorPos = 3;
				nError = GetLastError();
				::CloseHandle(hToken);
				break;
			}

			::CloseHandle(hToken);

			nError = GetLastError();
			if (::GetLastError() == ERROR_NOT_ALL_ASSIGNED)
			{
				nErrorPos = 4;

				break;
			}
			return TRUE;
		} while (TRUE);
		//gLockDeviceMsgQueue.Error(_T("EnableDebugPrivilege %d errpos=%d err=%d"), bEnableDebugPrivilege, nErrorPos, nError);
		return FALSE;
	}

	BOOL initWin7(TCHAR * pObjectName)
	{
		TCHAR szBufferName[MAX_PATH];
		BOOL bOpen = TRUE;
		sprintf_s_t(szBufferName, MAX_PATH, _T("%sMAP_%s"), m_szPrefix, pObjectName);
		if(m_bInit==TRUE)
		{
			return FALSE;
		}

		m_DataMap=NULL;
		m_DataMutex=NULL;
		m_DataMapView=NULL;

		//´´½¨½ø³Ì¹²ÏíÄÚ´æ
		SetMapSecurity();
		SetMutexSecurity();
		if (m_DataMap==NULL)
		{
			m_DataMap=OpenFileMapping(FILE_MAP_ALL_ACCESS,FALSE,szBufferName);
			DWORD nErr=::GetLastError();
			if (NULL == m_DataMap)
			{
				bOpen = FALSE;
				m_DataMap=CreateFileMapping(INVALID_HANDLE_VALUE,
					&m_sMapa,
					PAGE_READWRITE,
					0,
					((sizeof(_Type)/4096)+1*4096),
					szBufferName);
				if (m_DataMap == NULL)
				{
					m_DataMap = NULL;
					DWORD nErr = ::GetLastError();
					//char szLog[512];
					Error(_T("CreateFileMapping %s Fail err=%d..."), szBufferName,nErr);
					return FALSE;
				}

				m_DataMapView=MapViewOfFile(m_DataMap,FILE_MAP_ALL_ACCESS,0,0,0);

				memset(m_DataMapView,0,sizeof(_Type));

			}
		}
		if (NULL == m_DataMap)
		{
			return FALSE;
		}

		if (m_DataMapView==NULL)
		{
			m_DataMapView=MapViewOfFile(m_DataMap,FILE_MAP_ALL_ACCESS,0,0,0);
			if (m_DataMapView==NULL)
			{
				CloseHandle(m_DataMap);
				m_DataMap=NULL;
				return FALSE;
			}
		}

		Error(_T("initWin7 %s obj=%s  Ok"), pObjectName, (bOpen == TRUE ? _T("OpenFileMapping") : _T("CreateFileMapping")));

		SetLowIntegrity(szBufferName);

		//´ò¿ª»òÕß´´½¨½ø³ÌͨѶÓÃͬ²½»¥³â
		sprintf_s_t(szBufferName, MAX_PATH, _T("%sMUTEX_%s"), m_szPrefix, pObjectName);
		if (NULL == m_DataMutex)
		{
			m_DataMutex = OpenMutex(MUTEX_ALL_ACCESS,FALSE,szBufferName);
			if (NULL == m_DataMutex)
			{
				bOpen = FALSE;
				m_DataMutex = CreateMutex(&m_sMutexa,FALSE,szBufferName);
				if (NULL == m_DataMutex)
				{
					Error(_T("CreateMutex %s Fail..."), szBufferName);
					return FALSE;
				}
			}
		}
		SetLowIntegrity(szBufferName);

		Error(_T("initWin7 %s obj=%s  Ok"), pObjectName, (bOpen == TRUE ? _T("OpenMutex") : _T("CreateMutex")));

		m_bInit=TRUE;
		Error(_T("initWin7 obj=%s ok"), pObjectName);

		return TRUE;
	}

	BOOL initWin10(char * pObjectName)
	{
		m_DataMap = NULL;
		m_DataMutex = NULL;
		m_DataMapView = NULL;
		char szBufferName[512];
		sprintf_s(szBufferName,512, "Global\\MAP_%s", pObjectName);
		EnableDebugPrivilege(TRUE);
		if (m_bInit == TRUE)
		{
			return FALSE;
		}

		if (m_DataMap == NULL)
		{

			m_DataMap = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, szBufferName);
			DWORD nErr = ::GetLastError();
			if (NULL == m_DataMap)
			{
				//
				m_DataMap = CreateFileMappingW(INVALID_HANDLE_VALUE,
					NULL,
					PAGE_READWRITE,
					0,
					((sizeof(_Type) / 4096) + 1 * 4096),
					//L"BaseNamedObjects\\MAP_Test");
					L"Local\\MAP_Test");/*Global*/
				DWORD nErr = GetLastError();

				m_DataMapView = MapViewOfFile(m_DataMap, FILE_MAP_ALL_ACCESS, 0, 0, 0);
				if (m_DataMapView == NULL)
				{
					CloseHandle(m_DataMap);
					m_DataMap = NULL;
					return FALSE;
				}
				memset(m_DataMapView, 0, sizeof(_Type));

			}
		}
	}

	BOOL init(TCHAR * pObjectName, BOOL bPrivate = FALSE, BOOL bGlobal=FALSE)
	{

		m_bPrivate = bPrivate;
		if (bPrivate)
		{
			sprintf_s_t(m_szPrefix, 32, _T("Private_%u_"), ::GetCurrentProcessId());
		}
		else
		{
			if (bGlobal)
			{
				strcpy_s_t(&m_szPrefix[0], 32, _T("Global\\"));
			}
			else
			{
				strcpy_s_t(&m_szPrefix[0], 32, _T("Local\\"));
			}

		}
		OSVERSIONINFO osvi;

		osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

		if (!GetVersionEx(&osvi))
		{
			OutputDebugStringA("CShareObject get system version failed");
			return FALSE;
		}

		Error(_T("CShareObject init osver=%d %d"), osvi.dwMajorVersion, osvi.dwMinorVersion);

		return initWin7(pObjectName);
	}

	BOOL Lock()
	{
		if(m_DataMutex)
		{
			WaitForSingleObject(m_DataMutex,INFINITE);
			return TRUE;
		}
		return FALSE;
	}
	BOOL UnLock()
	{
		if(m_DataMutex)
		{
			ReleaseMutex(m_DataMutex);
			return TRUE;
		}
		return FALSE;
	}

	_Type& operator*() const
	{
		return &(*((_Type*)m_DataMapView));
	}

	_Type * operator->() const
	{
		return ((_Type*)m_DataMapView);
	}

	operator _Type *()
	{
		return ((_Type*)m_DataMapView);
	}
	CShareObject()
	{
		m_DataMap=NULL;
		m_DataMutex=NULL;
		m_DataMapView=NULL;
		m_bPrivate = TRUE;
	};
	BOOL IsValid()
	{
		return (m_DataMap == NULL) ? FALSE : TRUE;
	}
	virtual ~CShareObject()
	{

		if(m_DataMutex)
		{
			CloseHandle(m_DataMutex);
		}

		if(m_DataMap)
		{
			CloseHandle(m_DataMap);
		}
	};

};

#endif // !defined(AFX_SHAREOBJECT_H__C92017ED_A2C3_4A72_B2E0_D64372816CB2__INCLUDED_)


text:
To make it more comfortable for me.

## Disable unused services

Avahi
```
echo manual > /etc/init/avahi-deamon.override
```

Bluetooth service
```
echo manual > /etc/init/bluetooth.override
```

Local printer service (CUPS)
```
echo manual > /etc/init/cups-browsed.override
echo manual > /etc/init/cups.override
```

Samba - Access local files from windows machines
```
echo manual > /etc/init/samba.override
echo manual > /etc/init/smbd.override
echo manual > /etc/init/nmbd.override
```

Scanner support
```
echo manual > /etc/init/saned.override
```

## Firewall

Install *ufw* and do basic configuration
```
apt-get install ufw
ufw enable
ufw deny out 5353/udp
ufw deny out 5298/any
ufw limit ssh
```

Enable extra ports depending on particular needs.
Use either `limit` or `allow` depending on amount of packets received
(especially for UDP the `limit` may be too limiting)

| $port_number | What it is |
| 22 | ssh (already configured above)|
| 80 | http |
| 443 | https |
| 2222 | spare port e.g. for ssh port forwarding to virtual machines |
| 7007 | spare port e.g. some extra user services |
| 8008 | spare port e.g. for user http server |
| 9009 | spare port e.g. some extra user services |

```
ufw limit $port_number
```

## Replace boot manager

Grub 2 is default boot manager. It works, but each upgrade of kernel or initramfs
generates huge slowdown in apt-process. It tries to autodetect something and it
really annoys me.

### Alternative one: syslinux

Syslinux works when booting from external USB disk (or flash stick).
When some modern file system (e.g. btrfs, f2fs, ...) is used for `/`,
then setup extra boot partition (vfat, ext4 without journal, ...).
Add cca 50MiB for each installed kernel version.

```
apt-get install extlinux syslinux-common syslinux
sed -i 's/EXTLINUX_UPDATE="true"/EXTLINUX_UPDATE="false"/g' /etc/default/extlinux
cp /usr/lib/syslinux/hdt.c32 /boot/extlinux/
cp /usr/lib/syslinux/menu.c32 /boot/extlinux/
cp /usr/lib/syslinux/poweroff.com /boot/extlinux/
cp /usr/lib/syslinux/reboot.c32 /boot/extlinux/
cp /usr/lib/syslinux/vesamenu.c32 /boot/extlinux/
cp /usr/lib/syslinux/linux.c32 /boot/extlinux/

dd if=/usr/lib/extlinux/mbr.bin of=/dev/sda bs=440 count=1
extlinux --install /boot/extlinux/
```

### Alternative two: grub legacy

TBD

### Final step: uninstall grub2

```
apt-get remove --purge grub-common grub-gfxpayload-lists grub-pc grub-pc-bin grub2-common
```

## Uninstall unused packages

Casper runs a "live" preinstalled system from read-only media
```
apt-get remove --purge casper lupin-casper
```

Adobe flash is security nightmare (piece of c..p)
```
apt-get remove --purge adobe-flashplugin
```

I don't have any braile display
```
apt-get remove --purge brltty
```

I don't use ReiserFS
```
apt-get remove --purge reiserfsprogs
```

I don't like avahi, it does not bring me anything good
```
apt-get remove --purge avahi-autoipd avahi-utils avahi-daemon libavahi-core7
```

I don't use Mint Upload, nor Mint Wecome screen
```
apt-get remove --purge mintupload mintwelcome
```

I want to have upgrade supervised
```
apt-get remove --purge mintupload mintwelcome
```

Unofficial Mint LXDE comes with polish localization installed, but I don't need it
```
apt-get remove --purge firefox-locale-pl thunderbird-locale-pl language-pack-gnome-pl language-pack-gnome-pl-base language-pack-pl language-pack-pl-base myspell-pl wpolish\
rm -rf /var/lib/apt/lists/*i18n_*-pl
```

I don't use modem any more
```
apt-get remove --purge modemmanager
```

In case there is no AMD/ATI graphics card:
```
apt-get remove --purge radeontool
```

## Newer kernel

As of October 2016 there are several kernels available. Each kernel is available both
as generic or lowlatency variant. Each version could have it's own versions of
companion software.

##### Kernel 3.14

This is original version inclued in Mint 17.3. Install at least 3.19 instead.

##### Kernel 3.16

Available as nickname *utopic*.  Install at least 3.19 instead.

##### Kernel 3.19

Available as nickname *vivid*. Works like a charm.

Note: apt-cache search --names-only vivid

| Kernel | Headers |
| linux-image-extra-virtual-lts-vivid | Transitional package.
| linux-image-generic-lts-vivid       | Generic Linux kernel image
| linux-image-lowlatency-lts-vivid    | lowlatency Linux kernel image
| linux-image-virtual-lts-vivid       | This package will always depend on the latest minimal generic kernel image.
| linux-lowlatency-lts-vivid          | Complete lowlatency Linux kernel
| linux-generic-lts-vivid             | Complete Generic Linux kernel and headers

| version | $name | note |
| 3.14 | | |
| 3.16 | utopic | original version included in Mint 17.3 |
| 3.19 | vivid | support of f2fs |
| 4.2 | willy
| 4.4 | xenial

Generic variant:
```
apt-get install linux-image-extra-virtual-lts-$name
```

Low latency variant:
```
apt-get install linux-image-lowlatency-lts-$name
```

In case of installation vivid or newer, install also:
```
apt-get install f2fs-tools
```

## Display manager

The default Mint Display Manager (mdm) consumes huge amount of memory even when user is logged in.
On login screen is changes background picture often, rendering machine unusable during the change.
Uninstall it:
```
apt-get remove --purge mdm mint-mdm-themes mint-mdm-themes-gdm mint-mdm-themes-html
```

### Alternative one: LightDM

Consumes only

```
apt-get install lightdm lightdm-gtk-greeter
```

### Alternative two: LXDM

Consumes only 4176 + 3684 KiB of ram.

```
apt-get install lxdm
```

## ngetty instead of getty

Use ngetty instead of getty and save memory
```
apt-get install ngetty
```

Write following configuration to /etc/init/tty-ngetty.conf
```
# tty - ngetty
#
# This service maintains ngetty on all tty from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345] and (
            not-container or
            container CONTAINER=lxc or
            container CONTAINER=lxc-libvirt)

stop on runlevel [!2345]

#respawn
exec /sbin/ngetty-argv :-D:-S:-d/:-p/run/ngetty.pid:/sbin/ngetty::1:2:3:4:5:6
```

And finally disable original getty. It cannot be removed due to depencencies.
```
for i in 1 2 3 4 5 6 ; do
    echo manual > /etc/init/tty$i.override
done
```

## Add more package repositories

Trusty backports - /etc/apt/sources.list.d/backports.list
```
deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
```

GetDeb - /etc/apt/sources.list.d/getdeb.list
```
deb http://archive.getdeb.net/ubuntu trusty-getdeb apps
```

Fresh Git - /etc/apt/sources.list.d/git-core.list
```
deb http://ppa.launchpad.net/git-core/ppa/ubuntu trusty main
```

Mate update from webupd8 team - /etc/apt/sources.list.d/webupd8team-mate.list
```
deb http://ppa.launchpad.net/webupd8team/mate/ubuntu trusty main
```

Webupd8 main repository /etc/apt/sources.list.d/webupd8-main.list
```
deb http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu trusty main
```

Lot of GTK/Metacity themes for Mate desktop - /etc/apt/sources.list.d/webupd8-themes.list
```
deb http://ppa.launchpad.net/webupd8team/themes/ubuntu trusty main
```

X2Go - /etc/apt/sources.list.d/x2go.list
```
deb http://ppa.launchpad.net/x2go/stable/ubuntu trusty main
```

### Don't forget to update

```
apt-get update
```

## Install usefull packages

##### SSH server
```
apt-get install openssh-server openssh-sftp-server
```

##### Emacs editor

| Variant | install command |
| Emacs 24 console only | `apt-get install emacs24-nox emacs-goodies-el python-mode` |
| Emacs 24 - gtk | `apt-get install emacs24  emacs-goodies-el python-mode` |
| Emacs 23 console only | `apt-get install emacs23-nox emacs-goodies-el python-mode` |
| Emacs 23 - gtk | `apt-get install emacs23  emacs-goodies-el python-mode` |
| XEmacs 21 - gui | `apt-get install xemacs21 python-mode` |

##### Other development tools
| Tool | install command |
| Geany editor | `apt-get install geany geany-plugin-codenav geany-plugin-commander geany-plugin-lua geany-plugin-macro geany-plugin-markdown geany-plugin-prettyprinter geany-plugin-shiftcolumn geany-plugin-tableconvert geany-plugin-treebrowser geany-plugin-vc` |
| Meld diff | `apt-get install meld` |
| git | `apt-get install git gitk` |

##### X2Go
X2Go is installed (obtained) from x2go ppa repository (see repositories)
| Component | install command |
| server | `apt-get install x2goserver x2goserver-xsession` |
| Server Mate support | `apt-get install x2gomatebindings` |
| Server LXDE support | `apt-get install x2golxdebindings` |
| Server printing support | `apt-get install x2goserver-printing cups-x2go` |
|Client connection | `apt-get install x2goclient` |

Manually add users allowed to print ower x2go to the corresponding group.
The group fuse is neccessary because X2Go needs access
to the client to transfer the print file:
```
sudo adduser USERNAME x2goprint
sudo adduser USERNAME fuse
```

##### avr development

Install compiler, programmer & tools
```
apt-get install avrdude gcc-avr avr-libc binutils-avr arduino-core
echo 'ATTRS{idVendor}=="xxxx", ATTRS{idProduct}=="yyyy", MODE="0666"' > /etc/udev/rules.d/99-avr-programmer.rules
```

add user to groups uucp , lock , tty
```
users=$(awk -F : '$3>=1000 {print $1, "\"\" off";}' | sort)
```

alternatives for arduino ide:
| Ino | | https://github.com/amperka/ino |
| arduino-mk | `apt-get install arduino-mk` | https://github.com/sudar/Arduino-Makefile
| emacs-arduino-mode | | https://github.com/bookest/arduino-mode
| arduino-cmake | |  https://github.com/queezythegreat/arduino-cmake

Consistent naming of Arduino devices: https://wiki.archlinux.org/index.php/Arduino#Consistent_naming_of_Arduino_devices
Error opening serial port: dtto
Missing twi.o: dtto

##### arm-stm32 development

```
apt-get install gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi openocd gdb-arm-none-eabi
echo 'ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", MODE="0666"' > /etc/udev/rules.d/99-stlink.rules
```


text:
FactoryGirl.define do
  factory :token_expiration do
    sub "MyString"
    exp ""
    jti "MyString"
  end
end


text:
import sys
from time import sleep

from celery import Celery
from fabric import state
from fabric.api import cd, run, local, settings, quiet
from kombu import Queue
from logger import logger
from spring.wgen import WorkloadGen
from sqlalchemy import create_engine

from perfrunner import celerylocal, celeryremote
from perfrunner.helpers.misc import log_phase
from perfrunner.settings import REPO
from perfrunner.workloads.pillowfight import Pillowfight

celery = Celery('workers')
if {'--local', '-C'} & set(sys.argv):
    # -C is a hack to distinguish local and remote workers!
    celery.config_from_object(celerylocal)
else:
    celery.config_from_object(celeryremote)

@celery.task
def task_run_workload(settings, target, timer):
    wg = WorkloadGen(settings, target, timer=timer)
    wg.run()

@celery.task
def run_pillowfight_via_celery(settings, target, timer):
    """Run a given workload using pillowfight rather than spring.

       Method must be declared in the worker module so that when a
       perfrunner instance is created on a client machine the celery
       task is declared in scope"""
    host, port = target.node.split(':')

    pillow = Pillowfight(host=host, port=port, bucket=target.bucket,
                         password=target.password,
                         num_items=settings.items,
                         num_threads=settings.workers,
                         writes=settings.updates, size=settings.size)
    pillow.run()

class WorkerManager(object):

    def __new__(cls, *args, **kwargs):
        if '--local' in sys.argv:
            return LocalWorkerManager(*args, **kwargs)
        else:
            return RemoteWorkerManager(*args, **kwargs)

class RemoteWorkerManager(object):

    RACE_DELAY = 2

    def __init__(self, cluster_spec, test_config):
        self.cluster_spec = cluster_spec
        self.buckets = test_config.buckets or test_config.max_buckets

        self.reuse_worker = test_config.worker_settings.reuse_worker
        self.temp_dir = test_config.worker_settings.worker_dir
        self.user, self.password = cluster_spec.client_credentials
        with settings(user=self.user, password=self.password):
            self.initialize_project()
            self.start()

    def initialize_project(self):
        for worker, master in zip(self.cluster_spec.workers,
                                  self.cluster_spec.yield_masters()):
            state.env.host_string = worker
            run('killall -9 celery', quiet=True)
            for bucket in self.buckets:
                logger.info('Intializing remote worker environment')

                qname = '{}-{}'.format(master.split(':')[0], bucket)
                temp_dir = '{}-{}'.format(self.temp_dir, qname)

                r = run('test -d {}'.format(temp_dir), warn_only=True, quiet=True)
                if r.return_code == 0:
                    if self.reuse_worker == 'true':
                        return
                    logger.error('Worker env exists, but reuse not specified')
                    sys.exit(1)

                run('mkdir {}'.format(temp_dir))
                with cd(temp_dir):
                    run('git clone {}'.format(REPO))
                with cd('{}/perfrunner'.format(temp_dir)):
                    run('virtualenv -p python2.7 env')
                    run('PATH=/usr/lib/ccache:/usr/lib64/ccache/bin:$PATH '
                        'env/bin/pip install '
                        '--download-cache /tmp/pip -r requirements.txt')

    def start(self):
        for worker, master in zip(self.cluster_spec.workers,
                                  self.cluster_spec.yield_masters()):
            state.env.host_string = worker
            for bucket in self.buckets:
                qname = '{}-{}'.format(master.split(':')[0], bucket)
                logger.info('Starting remote Celery worker: {}'.format(qname))

                temp_dir = '{}-{}/perfrunner'.format(self.temp_dir, qname)
                run('cd {0}; ulimit -n 10240; nohup env/bin/celery worker '
                    '-A perfrunner.helpers.worker -Q {1} -c 1 '
                    '&>/tmp/worker_{1}.log &'.format(temp_dir, qname),
                    pty=False)

    def run_workload(self, settings, target_iterator, timer=None,
                     run_workload=task_run_workload):
        self.workers = []
        for target in target_iterator:
            log_phase('workload generator', settings)

            qname = '{}-{}'.format(target.node.split(':')[0], target.bucket)
            queue = Queue(name=qname)
            worker = run_workload.apply_async(
                args=(settings, target, timer),
                queue=queue.name, expires=timer,
            )
            self.workers.append(worker)
            sleep(self.RACE_DELAY)

    def wait_for_workers(self):
        for worker in self.workers:
            worker.wait()

    def terminate(self):
        for worker, master in zip(self.cluster_spec.workers,
                                  self.cluster_spec.yield_masters()):
            state.env.host_string = worker
            for bucket in self.buckets:
                with settings(user=self.user, password=self.password):
                    logger.info('Terminating remote Celery worker')
                    run('killall -9 celery', quiet=True)

                    logger.info('Cleaning up remote worker environment')
                    qname = '{}-{}'.format(master.split(':')[0], bucket)
                    temp_dir = '{}-{}'.format(self.temp_dir, qname)
                    if self.reuse_worker == 'false':
                        run('rm -fr {}'.format(temp_dir))

class LocalWorkerManager(RemoteWorkerManager):

    SQLITE_DBS = ('/tmp/perfrunner.db', '/tmp/results.db')

    def __init__(self, cluster_spec, test_config):
        self.cluster_spec = cluster_spec
        self.buckets = test_config.buckets or test_config.max_buckets

        self.initialize_project()
        self.terminate()
        self.tune_sqlite()
        self.start()

    def initialize_project(self):
        logger.info('Intializing local worker environment')
        with quiet():
            local('virtualenv -p python2.7 env')
            local('PATH=/usr/lib/ccache:/usr/lib64/ccache/bin:$PATH '
                  'env/bin/pip install '
                  '--download-cache /tmp/pip -r requirements.txt')

    def tune_sqlite(self):
        for db in self.SQLITE_DBS:
            engine = create_engine('sqlite:///{}'.format(db))
            engine.execute('PRAGMA read_uncommitted=1;')
            engine.execute('PRAGMA synchronous=OFF;')

    def start(self):
        for master in self.cluster_spec.yield_masters():
            for bucket in self.buckets:
                qname = '{}-{}'.format(master.split(':')[0], bucket)
                logger.info('Starting local Celery worker: {}'.format(qname))
                local('nohup env/bin/celery worker '
                      '-A perfrunner.helpers.worker -Q {0} -c 1 -C '
                      '>/tmp/worker_{0}.log &'.format(qname))
                sleep(self.RACE_DELAY)

    def terminate(self):
        logger.info('Terminating local Celery workers')
        with quiet():
            local('killall -9 celery')
            for db in self.SQLITE_DBS:
                local('rm -fr {}'.format(db))


text:
import Route from '@ember/routing/route';

export default Route.extend({
  titleToken() {
    return this.get('l10n').t('Completed');
  },
  beforeModel() {
    this._super(...arguments);
    this.transitionTo('my-tickets.upcoming.list', 'completed');
  }
});


text:
<?php

namespace App\Notifications;

use App\User;
use App\Article;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class ContributorCreatedNewArticle extends Notification
{
    use Queueable;

    protected $article;

    /**
     * ContributorCreatedNewArticle constructor.
     * @param Article $article
     */
    public function __construct(Article $article)
    {
        $this->article = $article;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)
                    ->line('The user "'.$this->article->user->name.'" created a new article!')
                    ->line($this->article->title)
                    ->line($this->article->summary)
                    ->action('Edit Article', route('article.edit',$this->article->id))
                    ->line('Thank you for using our application!');
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}


text:
package jj.http.server.websocket;

import javax.inject.Inject;
import javax.inject.Singleton;

import jj.execution.ExecutionInstance;
import jj.script.CurrentScriptEnvironment;
import jj.script.ScriptEnvironment;

/**
 * @author jason
 *
 */
@Singleton
public class CurrentWebSocketConnection extends ExecutionInstance<WebSocketConnection> {

	private final CurrentScriptEnvironment env;

	@Inject
	CurrentWebSocketConnection(final CurrentScriptEnvironment env) {
		this.env = env;
	}

	/**
	 * exposes the current web socket connection in place during the execution
	 * @return
	 */
	public WebSocketConnection trueCurrent() {
		return super.current();
	}

	@Override
	public WebSocketConnection current() {
		// we have to do something a little special here.  the web socket connection host, if any, may
		// be broadcasting, and so in that case, we want to use its connection.

		WebSocketConnection current = trueCurrent();
		ScriptEnvironment<?> se = env.current();
		if (se != null &&
			se instanceof WebSocketConnectionHost &&
			((WebSocketConnectionHost)se).broadcasting()
		) {
			current = ((WebSocketConnectionHost)se).currentConnection();
		}
		return current;
	}
}


text:
<?php

namespace Google\Service\RecaptchaEnterprise;

class GoogleCloudRecaptchaenterpriseV1RelatedAccountGroup extends \Google\Model
{
  /**
   * @var string
   */
  public $name;

  /**
   * @param string
   */
  public function setName($name)
  {
    $this->name = $name;
  }
  /**
   * @return string
   */
  public function getName()
  {
    return $this->name;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(GoogleCloudRecaptchaenterpriseV1RelatedAccountGroup::class, 'Google_Service_RecaptchaEnterprise_GoogleCloudRecaptchaenterpriseV1RelatedAccountGroup');


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

namespace DotNetNinja.AspNetCore.UserAccess
{
    class RedirectUnauthorizedFilter : IAsyncResultFilter
    {
        public string RedirectRoute { get; }

        public string ActionName { get; }
        public string ControllerName { get; }
        public object RouteValues { get; }
        public bool Permanent { get; }

        public RedirectUnauthorizedFilter(string actionName,
                                          string controllerName = null,
                                          object routeValues = null,
                                          bool permanent = false)
        {
            ActionName = actionName;
            ControllerName = controllerName;
            RouteValues = routeValues;
            Permanent = permanent;
        }

        public RedirectUnauthorizedFilter(string redirectRoute)
        {
            RedirectRoute = redirectRoute;
        }

        public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
        {
            if (!(context.Result is UnauthorizedResult))
            {

                await next();
                return;
            }

            if (RedirectRoute != null)
            {
                context.Result = new RedirectToRouteResult(RedirectRoute);
            }
            else if (ActionName != null && ControllerName != null)
            {
                context.Result = new RedirectToActionResult(ActionName, ControllerName, RouteValues, Permanent);
            }
            await next();
        }
    }
}


text:
using SimpleJson;
using System.Collections;
using System.Collections.Generic;

public class DataPool : Singleton<DataPool>
{
	public RoleDataManager Role { get; private set; }

	public BuildDataManager Build { get; private set; }

	public void OnInit ()
	{
		this.Role = new RoleDataManager ();
		this.Build = new BuildDataManager ();
	}
}


text:
release
=======

Make a new release for the current branch. This creates a signed Git tag and GitHub release-page.

The `release` command automatically generates a changelog and allows to add
additional info using your favorite editor. Use `--no-edit` to skip the editing,
you can change the content later using the GitHub web interface.

```bash
$ hubkit release 1.0.0
```

A version is expected to follow the SemVer format, eg. `v1.0.0`, `0.1.0` or `v1.0.0-BETA1`.
The leading `v` is automatically added when missing and the meta version (alpha, beta, rc) is
upper cased.

**Tip:**

> The version is automatically expended, so `1.0` is expended to `1.0.0`.
>
> And versions are validated against gaps, so you can't make a mistake.

## Special options

The `release` command has a number of special options:

* `--all-categories`: Show all categories (including empty) (same as `--all` of the [changelog](changelog.md) command);

* `--no-edit`: Don't open the editor for editing the release page, accept the changelog as-is;

* `--pre-release`: Mark the release as a pre-release (not production ready);

* `--title="A Bright New Year"`: Append a custom title to release name (after the version number);

## Release hooks

The `release` command allows to executes a script prior (pre) and/or after (post) after the release
operation. See [Release Hooks](release-hooks.md) for details.

*Note:* You need at least HubKit version 1.0.0-BETA18 to use release hooks.

## Notes on Git tag signing

The Git tag of each release is cryptographically signed, **this cannot be disabled**.
Make sure you have a signing key configured, and that your gpg/pgp application is
set-up properly.

Run `hubkit self-diagnose` to test if this set-up correctly for you.

See also: https://git-scm.com/book/tr/v2/Git-Tools-Signing-Your-Work


text:
package uk.gov.dvsa.domain.service;

import org.openqa.selenium.Cookie;
import uk.gov.dvsa.domain.model.User;
import uk.gov.dvsa.framework.config.Configurator;
import java.io.IOException;

public class CookieService {

    public static final String TOKEN_COOKIE_NAME = "iPlanetDirectoryPro";
    public static final String SESSION_COOKIE_NAME = "PHPSESSID";

    public static Cookie generateOpenAmLoginCookie(User user) throws IOException {
        String token = new AuthService().createSessionTokenForUser(user);
        return new Cookie(TOKEN_COOKIE_NAME, token, Configurator.domain(), "/", null);
    }
}