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

namespace System.Linq.Expressions.Tests
{
    public class Assign
    {
        private class PropertyAndFields
        {
#pragma warning disable 649 // Assigned through expressions.
            public string StringProperty { get; set; }
            public string StringField;
            public readonly string ReadonlyStringField;
            public string ReadonlyStringProperty { get { return ""; } }
            public static string StaticStringProperty { get; set; }
            public static string StaticStringField;
            public static readonly string ReadonlyStaticStringField;
            public static string ReadonlyStaticStringProperty { get { return ""; } }
            public const string ConstantString = "Constant";
            public string WriteOnlyString { set { } }
            public static string WriteOnlyStaticString { set { } }

            public int Int32Property { get; set; }
            public int Int32Field;
            public readonly int ReadonlyInt32Field;
            public int ReadonlyInt32Property { get { return 42; } }
            public static int StaticInt32Property { get; set; }
            public static int StaticInt32Field;
            public static readonly int ReadonlyStaticInt32Field;
            public static int ReadonlyStaticInt32Property { get { return 321; } }
            public const int ConstantInt32 = 12;
            public int WriteOnlyInt32 { set { } }
            public static int WriteOnlyStaticInt32 { set { } }
#pragma warning restore 649
        }

        private static IEnumerable<object[]> ReadOnlyExpressions()
        {
            Expression obj = Expression.Constant(new PropertyAndFields());
            yield return new object[] { Expression.Field(obj, typeof(PropertyAndFields), nameof(PropertyAndFields.ReadonlyInt32Field)) };
            yield return new object[] { Expression.Property(obj, typeof(PropertyAndFields), nameof(PropertyAndFields.ReadonlyInt32Property)) };
            yield return new object[] { Expression.Field(obj, typeof(PropertyAndFields), nameof(PropertyAndFields.ReadonlyStringField)) };
            yield return new object[] { Expression.Property(obj, typeof(PropertyAndFields), nameof(PropertyAndFields.ReadonlyStringProperty)) };
            yield return new object[] { Expression.Field(null, typeof(PropertyAndFields), nameof(PropertyAndFields.ConstantInt32)) };
            yield return new object[] { Expression.Field(null, typeof(PropertyAndFields), nameof(PropertyAndFields.ConstantString)) };
            yield return new object[] { Expression.Field(null, typeof(PropertyAndFields), nameof(PropertyAndFields.ReadonlyStaticInt32Field)) };
            yield return new object[] { Expression.Property(null, typeof(PropertyAndFields), nameof(PropertyAndFields.ReadonlyStaticInt32Property)) };
            yield return new object[] { Expression.Field(null, typeof(PropertyAndFields), nameof(PropertyAndFields.ReadonlyStaticStringField)) };
            yield return new object[] { Expression.Property(null, typeof(PropertyAndFields), nameof(PropertyAndFields.ReadonlyStaticStringProperty)) };
            yield return new object[] { Expression.Default(typeof(int)) };
            yield return new object[] { Expression.Default(typeof(string)) };
            yield return new object[] { Expression.Default(typeof(DateTime)) };
        }

        private static IEnumerable<object> WriteOnlyExpressions()
        {
            Expression obj = Expression.Constant(new PropertyAndFields());
            yield return new object[] { Expression.Property(obj, typeof(PropertyAndFields), nameof(PropertyAndFields.WriteOnlyInt32)) };
            yield return new object[] { Expression.Property(obj, typeof(PropertyAndFields), nameof(PropertyAndFields.WriteOnlyString)) };
            yield return new object[] { Expression.Property(null, typeof(PropertyAndFields), nameof(PropertyAndFields.WriteOnlyStaticInt32)) };
            yield return new object[] { Expression.Property(null, typeof(PropertyAndFields), nameof(PropertyAndFields.WriteOnlyStaticString)) };
        }

        private static IEnumerable<object> MemberAssignments()
        {
            Expression obj = Expression.Constant(new PropertyAndFields());
            yield return new object[] { Expression.Field(null, typeof(PropertyAndFields), nameof(PropertyAndFields.StaticInt32Field)), 1 };
            yield return new object[] { Expression.Property(null, typeof(PropertyAndFields), nameof(PropertyAndFields.StaticInt32Property)), 2 };
            yield return new object[] { Expression.Field(obj, typeof(PropertyAndFields), nameof(PropertyAndFields.Int32Field)), 3 };
            yield return new object[] { Expression.Property(obj, typeof(PropertyAndFields), nameof(PropertyAndFields.Int32Property)), 4 };
            yield return new object[] { Expression.Field(null, typeof(PropertyAndFields), nameof(PropertyAndFields.StaticStringField)), "a" };
            yield return new object[] { Expression.Property(null, typeof(PropertyAndFields), nameof(PropertyAndFields.StaticStringProperty)), "b" };
            yield return new object[] { Expression.Field(obj, typeof(PropertyAndFields), nameof(PropertyAndFields.StringField)), "c" };
            yield return new object[] { Expression.Property(obj, typeof(PropertyAndFields), nameof(PropertyAndFields.StringProperty)), "d" };
        }

        [Theory, ClassData(typeof(CompilationTypes))]
        public void SimpleAssignment(bool useInterpreter)
        {
            ParameterExpression variable = Expression.Variable(typeof(int));
            LabelTarget target = Expression.Label(typeof(int));
            Expression exp = Expression.Block(
                new ParameterExpression[] { variable },
                Expression.Assign(variable, Expression.Constant(42)),
                Expression.Return(target, variable),
                Expression.Label(target, Expression.Default(typeof(int)))
                );
            Assert.Equal(42, Expression.Lambda<Func<int>>(exp).Compile(useInterpreter)());
        }

        [Theory, ClassData(typeof(CompilationTypes))]
        public void AssignmentHasValueItself(bool useInterpreter)
        {
            ParameterExpression variable = Expression.Variable(typeof(int));
            Expression exp = Expression.Block(
                new ParameterExpression[] { variable },
                Expression.Assign(variable, Expression.Constant(42))
                );
            Assert.Equal(42, Expression.Lambda<Func<int>>(exp).Compile(useInterpreter)());
        }

        [Theory, PerCompilationType(nameof(MemberAssignments))]
        public void AssignToMember(Expression memberExp, object value, bool useInterpreter)
        {
            Func<bool> func = Expression.Lambda<Func<bool>>(
                Expression.Block(
                    Expression.Assign(memberExp, Expression.Constant(value)),
                    Expression.Equal(memberExp, Expression.Constant(value))
                    )
                ).Compile(useInterpreter);
            Assert.True(func());
        }

        [Fact]
        public void CannotReduce()
        {
            Expression exp = Expression.Assign(Expression.Variable(typeof(int)), Expression.Constant(0));
            Assert.False(exp.CanReduce);
            Assert.Same(exp, exp.Reduce());
            Assert.Throws<ArgumentException>(null, () => exp.ReduceAndCheck());
        }

        [Fact]
        public void ThrowsOnLeftNull()
        {
            Assert.Throws<ArgumentNullException>("left", () => Expression.Assign(null, Expression.Constant("")));
        }

        [Fact]
        public void ThrowsOnRightNull()
        {
            Assert.Throws<ArgumentNullException>("right", () => Expression.Assign(Expression.Variable(typeof(int)), null));
        }

        [Fact]
        public void LeftMustBeWritable()
        {
            Assert.Throws<ArgumentException>(() => Expression.Assign(Expression.Constant(0), Expression.Constant(1)));
        }

        [Fact]
        public void MismatchTypes()
        {
            Assert.Throws<ArgumentException>(() => Expression.Assign(Expression.Variable(typeof(int)), Expression.Constant("Hello")));
        }

        [Fact]
        public void AssignableButOnlyWithConversion()
        {
            Assert.Throws<ArgumentException>(() => Expression.Assign(Expression.Variable(typeof(long)), Expression.Constant(1)));
        }

        [Theory, ClassData(typeof(CompilationTypes))]
        public void ReferenceAssignable(bool useInterpreter)
        {
            ParameterExpression variable = Expression.Variable(typeof(object));
            LabelTarget target = Expression.Label(typeof(object));
            Expression exp = Expression.Block(
                new ParameterExpression[] { variable },
                Expression.Assign(variable, Expression.Constant("Hello")),
                Expression.Return(target, variable),
                Expression.Label(target, Expression.Default(typeof(object)))
                );
            Assert.Equal("Hello", Expression.Lambda<Func<object>>(exp).Compile(useInterpreter)());
        }

        [Theory, MemberData(nameof(ReadOnlyExpressions))]
        public void AttemptToAssignToNonWritable(Expression readonlyExp)
        {
            Assert.Throws<ArgumentException>(() => Expression.Assign(readonlyExp, Expression.Default(readonlyExp.Type)));
        }

        [Theory, MemberData(nameof(WriteOnlyExpressions))]
        public static void AttemptToAssignFromNonReadable(Expression writeOnlyExp)
        {
            ParameterExpression variable = Expression.Variable(writeOnlyExp.Type);
            Assert.Throws<ArgumentException>("right", () => Expression.Assign(variable, writeOnlyExp));
        }
    }
}


text:
package iperf3

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	appsv1 "k8s.io/api/apps/v1"
	batchv1 "k8s.io/api/batch/v1"
	corev1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/resource"

	ksapi "github.com/xridge/kubestone/api/v1alpha1"
)

var _ = Describe("Pod Annotations", func() {
	Describe("created from CR", func() {
		var cr ksapi.Iperf3
		var serverDeployment *appsv1.Deployment
		var clientService *corev1.Service
		var jobSpec *batchv1.Job

		BeforeEach(func() {
			tolerationSeconds := int64(17)
			cr = ksapi.Iperf3{
				Spec: ksapi.Iperf3Spec{
					Image: ksapi.ImageSpec{
						Name:       "foo",
						PullPolicy: "Always",
						PullSecret: "pull-secret",
					},
					ServerConfiguration: ksapi.Iperf3ConfigurationSpec{
						CmdLineArgs: "--testing --things",
						HostNetwork: true,
						PodConfigurationSpec: ksapi.PodConfigurationSpec{
							Annotations: map[string]string{"anno_two": "exists"},
							PodLabels:   map[string]string{"labels": "are", "really": "useful"},
							PodScheduling: ksapi.PodSchedulingSpec{
								Affinity: &corev1.Affinity{
									NodeAffinity: &corev1.NodeAffinity{
										RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{
											NodeSelectorTerms: []corev1.NodeSelectorTerm{
												{
													MatchExpressions: []corev1.NodeSelectorRequirement{
														{
															Key:      "mutated",
															Operator: corev1.NodeSelectorOperator(corev1.NodeSelectorOpIn),
															Values:   []string{"nano-virus"},
														},
													},
												},
											},
										},
									},
								},
								Tolerations: []corev1.Toleration{
									{
										Key:               "genetic-code",
										Operator:          corev1.TolerationOperator(corev1.TolerationOpExists),
										Value:             "distressed",
										Effect:            corev1.TaintEffect(corev1.TaintEffectNoExecute),
										TolerationSeconds: &tolerationSeconds,
									},
								},
								NodeSelector: map[string]string{
									"atomized": "spiral",
								},
								NodeName: "energy-spike-07",
							},
							Resources: corev1.ResourceRequirements{
								Requests: corev1.ResourceList{
									corev1.ResourceCPU:    resource.MustParse("500m"),
									corev1.ResourceMemory: resource.MustParse("5Gi"),
								},
								Limits: corev1.ResourceList{
									corev1.ResourceCPU:    resource.MustParse("1G"),
									corev1.ResourceMemory: resource.MustParse("10Gi"),
								},
							},
						},
					},
					ClientConfiguration: ksapi.Iperf3ConfigurationSpec{
						CmdLineArgs: "--testing --things",
						HostNetwork: true,
						PodConfigurationSpec: ksapi.PodConfigurationSpec{
							Annotations: map[string]string{
								"anno_one": "value_two",
							},
						},
					},
				},
			}

			jobSpec = NewClientJob(&cr)
			serverDeployment = NewServerDeployment(&cr)
			clientService = NewServerService(&cr)

		})

		Context("job configuration", func() {
			It("has client annotations", func() {
				Expect(jobSpec.Annotations).To(HaveKey("anno_one"))
			})

			It("doesnt have server annotations", func() {
				Expect(jobSpec.Annotations).ToNot(HaveKey("anno_two"))
			})

			Context("template", func() {
				It("has client annotations", func() {
					Expect(jobSpec.Spec.Template.Annotations).To(HaveKey("anno_one"))
				})

				It("doesnt have server annotations", func() {
					Expect(jobSpec.Spec.Template.Annotations).ToNot(HaveKey("anno_two"))
				})
			})
		})

		Context("client configuration", func() {
			It("has client annotations", func() {
				Expect(clientService.Annotations).To(HaveKey("anno_one"))
			})

			It("doesnt have server annotations", func() {
				Expect(clientService.Annotations).ToNot(HaveKey("anno_two"))
			})
		})

		Context("server configuration", func() {
			Context("spec", func() {
				It("has server annotations", func() {
					Expect(serverDeployment.Annotations).To(HaveKey("anno_two"))
				})

				It("doesnt have client annotations", func() {
					Expect(serverDeployment.Annotations).ToNot(HaveKey("anno_one"))
				})
			})
			Context("template", func() {
				It("has server annotations", func() {
					Expect(serverDeployment.Spec.Template.ObjectMeta.Annotations).To(HaveKey("anno_two"))
				})

				It("doesnt have client annotations", func() {
					Expect(serverDeployment.Spec.Template.ObjectMeta.Annotations).ToNot(HaveKey("anno_one"))
				})
			})
		})
	})
})

redpajama_set_name: RedPajamaGithub


text:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="history" name="save" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>Dispose Method</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />

            OpenPop.NET POP3 Library Documentation

Pop3Client.Dispose Method

 Disposes the Pop3Client.
 This is the implementation of the IDisposable interface.
 Sends the QUIT command to the server before closing the streams.

Overload List

Inherited from Disposable.

        public void Dispose()

 Disposes the Pop3Client.
 This is the implementation of the IDisposable interface.
 Sends the QUIT command to the server before closing the streams.

        protected override void Dispose(bool)

See Also

        Pop3Client Class | OpenPop.Pop3 Namespace

          Send comments on this topic.

          Public Domain Dedication

Generated from assembly OpenPop [2.0.4.369] by NDoc3


text:
<?php

abstract class PhabricatorFact extends Phobject {

  private $key;

  public static function getAllFacts() {
    $engines = PhabricatorFactEngine::loadAllEngines();

    $map = array();
    foreach ($engines as $engine) {
      $facts = $engine->newFacts();
      $facts = mpull($facts, null, 'getKey');
      $map += $facts;
    }

    return $map;
  }

  final public function setKey($key) {
    $this->key = $key;
    return $this;
  }

  final public function getKey() {
    return $this->key;
  }

  final public function getName() {
    return pht('Fact "%s"', $this->getKey());
  }

  final public function newDatapoint() {
    return $this->newTemplateDatapoint()
      ->setKey($this->getKey());
  }

  abstract protected function newTemplateDatapoint();

  final public function getFunctionArguments() {
    $key = $this->getKey();

    $argv = array();

    if (preg_match('/\.project\z/', $key)) {
      $argv[] = id(new PhabricatorChartFunctionArgument())
        ->setName('phid')
        ->setType('phid');
    }

    if (preg_match('/\.owner\z/', $key)) {
      $argv[] = id(new PhabricatorChartFunctionArgument())
        ->setName('phid')
        ->setType('phid');
    }

    return $argv;
  }

  final public function buildWhereClauseParts(
    AphrontDatabaseConnection $conn,
    PhabricatorChartFunctionArgumentParser $arguments) {
    $where = array();

    $has_phid = $this->getFunctionArguments();

    if ($has_phid) {
      $phid = $arguments->getArgumentValue('phid');

      $dimension_id = id(new PhabricatorFactObjectDimension())
        ->newDimensionID($phid);

      $where[] = qsprintf(
        $conn,
        'dimensionID = %d',
        $dimension_id);
    }

    return $where;
  }

}


text:
package com.qinxiandiqi.electrocardiogram;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Environment;

public class SettingUtil {

	static final String PREFERENCES = "preferences";
	static final String SENSITIVITY = "sensitivity";
	static final String TABLESIZE = "tableSize";
	static final String FOLDERPATH = "folderPath";

	public static int getSensitivity(Activity activity){
		SharedPreferences preferences = activity.getSharedPreferences(PREFERENCES, Activity.MODE_PRIVATE);
		return preferences.getInt(SENSITIVITY, 50);
	}

	public static boolean setSensitivity(Activity activity, int sensitivity){
		SharedPreferences preferences = activity.getSharedPreferences(PREFERENCES, Activity.MODE_PRIVATE);
		return preferences.edit().putInt(SENSITIVITY, sensitivity).commit();
	}

	public static int getTableSize(Activity activity){
		SharedPreferences preferences = activity.getSharedPreferences(PREFERENCES, Activity.MODE_PRIVATE);
		return preferences.getInt(TABLESIZE, 50);
	}

	public static boolean setTableSize(Activity activity, int tableSize){
		SharedPreferences preferences = activity.getSharedPreferences(PREFERENCES, Activity.MODE_PRIVATE);
		return preferences.edit().putInt(TABLESIZE, tableSize).commit();
	}

	public static String getFolderPath(Activity activity){
		SharedPreferences preferences = activity.getSharedPreferences(PREFERENCES, Activity.MODE_PRIVATE);
		String path = preferences.getString(FOLDERPATH, null);
		if(path == null || path.length() == 0){
			return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).toString()+"/Electrocardiogram";
		}else return path;
	}

	public static boolean setFolderPath(Activity activity, String path){
		SharedPreferences preferences = activity.getSharedPreferences(PREFERENCES, Activity.MODE_PRIVATE);
		return preferences.edit().putString(FOLDERPATH, path).commit();
	}
}


text:
;var theSummernote;
var Summernote = {

    /**
     * element
     */
    element: null,

    /**
     * options
     */
    options: {},

    /**
     * init function
     *
     * @param options
     */
    init: function(options)
    {
        // object
        theSummernote = this;

        // default settings
        this.options = $.extend(true, this.getDefaultOptions(), options);

        // element
        this.element = $(this.options.src);

        // summernote init
        this.element.summernote(this.options.summernote);

    },

    /**
     * get default options
     */
    getDefaultOptions: function()
    {
        return {
            src: '.summernote',
            summernote: {
                placeholder: LMCApp.lang.admin.ops.write_here,
                height: 500,
                lang: 'tr-TR',
                dialogsInBody: true,
                toolbar: [
                    ['font', ['fontname','fontsize']],
                    ['font-style', ['bold','italic','underline']],
                    ['font-style', ['superscript','subscript','strikethrough','clear','height']],
                    ['color', ['color']],
                    ['style', ['style']],
                    ['para', ['paragraph','ul','ol']],
                    ['insert', ['addclass','table','link','picture','video','map','hr']],
                    ['misc', ['print']],
                    ['ops', ['undo','redo']],
                    ['view', ['fullscreen','codeview']],
                    ['help', ['help']]
                ],
                popover: {
                    image: [
                        ['imagesize', ['imageSize100', 'imageSize50', 'imageSize25']],
                        ['floatBS', ['floatBSLeft', 'floatBSNone', 'floatBSRight']],
                        ['custom', ['imageAttributes']],
                        ['remove', ['removeMedia']]
                    ]
                },
                map: {
                    apiKey: 'AIzaSyDt_BTC7JZ0TPkjSi0gRNmeTOdkbcqgRdo',
                    center: {
                        lat: 44,
                        lng: 23
                    },
                    zoom: 5
                },
                addclass: {
                    debug: false,
                    classTags: [
                        {tag: 'div', title:'Uyarı (Bilgi)',value:'alert alert-info'},
                        {tag: 'div', title:'Uyarı (Başarılı)',value:'alert alert-success'},
                        {tag: 'div', title:'Uyarı (Uyarı)',value:'alert alert-warning'},
                        {tag: 'div', title:'Uyarı (Tehlike)',value:'alert alert-danger'},
                        {tag: 'div', title:'Not (Bilgi)',value:'note note-info'},
                        {tag: 'div', title:'Not (Başarılı)',value:'note note-success'},
                        {tag: 'div', title:'Not (Uyarı)',value:'note note-warning'},
                        {tag: 'div', title:'Not (Tehlike)',value:'note note-danger'},
                        {tag: 'div', title:'Kaynak',value:'well'},
                        {title:'Öne Çıkar',value:'lead'},
                        {title:'Kenarları Yuvarlanmış fotoğraf',value:'img-rounded'},
                        {title:'Daire Fotoğraf',value:'img-circle'},
                        {title:'Uyumlu Fotoğraf',value:'img-responsive'},
                        {title:'Sönük Metin',value:'text-muted'},
                        {title:'Birincil Metin',value:'text-primary'},
                        {title:'Uyarı Metni',value:'text-warning'},
                        {title:'Tehlike Metni',value:'text-danger'},
                        {title:'Başarı Metni',value:'text-success'},
                    ]
                }
            } // end of summernote
        };
    }

};


text:
/* This source file is distributed under the MIT license
 * (see attached LICENSE.txt file for details)
 */

#pragma once

#include "TcpServer.h"

class NullTcpServer : public TcpServer
{
public:
    NullTcpServer(QObject *parent = 0) : TcpServer(parent) { /* Do nothing */ }

    virtual void startServer(const QHostAddress &, quint16 ) { /* Do nothing */ }
    virtual void stopServer() { /* Do nothing */ }
};


text:
<?php

namespace nabu\provider\base;
use nabu\data\CNabuDataObject;
use nabu\provider\exceptions\ENabuProviderException;
use nabu\provider\interfaces\INabuProviderManager;

/**
 * @author Rafael Gutierrez <rgutierrez@nabu-3.com>
 * @since 3.0.0 Surface
 * @version 3.0.9 Surface
 * @package \nabu\http\managers\base
 */
abstract class CNabuProviderModuleManagerAdapter extends CNabuDataObject implements INabuProviderManager
{
    /** @var string Vendor Key field name */
    const VENDOR_KEY = 'vendor_key';
    /** @var string Module Key field name */
    const MODULE_KEY = 'module_key';
    /** @var string Complex Key field name */
    const COMPLEX_KEY = 'complex_key';

    public function __construct(string $vendor_key, string $module_key)
    {
        parent::__construct();

        $this->setVendorKey($vendor_key);
        $this->setModuleKey($module_key);
    }

    public function getVendorKey()
    {
        return $this->getValue(self::VENDOR_KEY);
    }

    /**
     * Sets the vendor key
     * @param string $vendor_key New vendor key.
     * @return INabuProviderManager Returns manager instance to grant cascade calls.
     * @throws ENabuProviderException Raises an exception if $vendor_key have an invalid value.
     */
     public function setVendorKey(string $vendor_key)
     {
         if (!nb_isValidKey($vendor_key)) {
             throw new ENabuProviderException(ENabuProviderException::ERROR_VENDOR_KEY_NOT_VALID, array($vendor_key));
         }
         $this->setValue(self::VENDOR_KEY, $vendor_key);

         try {
             $this->getComplexKey();
         } catch (ENabuProviderException $ex) {

         }

         return $this;
     }

    public function getModuleKey()
    {
        return $this->getValue(self::MODULE_KEY);
    }

    /**
     * Sets the module key
     * @param string $module_key New module key.
     * @return INabuProviderManager Returns the manager instance to grant cascade calls.
     * @throws ENabuProviderException Raises an exception if $module_key have an invalid value.
     */
    public function setModuleKey(string $module_key)
    {
        if (!nb_isValidKey($module_key)) {
            throw new ENabuProviderException(ENabuProviderException::ERROR_MODULE_KEY_NOT_VALID, array($module_key));
        }
        $this->setValue(self::MODULE_KEY, $module_key);

        try {
            $this->getComplexKey();
        } catch (ENabuProviderException $ex) {

        }

        return $this;
    }

    public function getComplexKey()
    {
        if (!$this->hasValue(self::COMPLEX_KEY)) {
            $vendor_key = $this->getVendorKey();
            $module_key = $this->getModuleKey();

            if (nb_isValidKey($vendor_key) && nb_isValidKey($module_key)) {
                $this->setValue(self::COMPLEX_KEY, "$vendor_key:$module_key");
            } else {
                throw new ENabuProviderException(ENabuProviderException::ERROR_INVALID_KEYS);
            }
        }

        return $this->getValue(self::COMPLEX_KEY);
    }
}


text:
.class public Lcom/htc/preference/HtcSwitchPreference;
.super Lcom/htc/preference/HtcTwoStatePreference;
.source "HtcSwitchPreference.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/htc/preference/HtcSwitchPreference$1;,
        Lcom/htc/preference/HtcSwitchPreference$Listener;
    }
.end annotation

# instance fields
.field private final mListener:Lcom/htc/preference/HtcSwitchPreference$Listener;

.field private mSwitchOff:Ljava/lang/CharSequence;

.field private mSwitchOn:Ljava/lang/CharSequence;

# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 102
    const/4 v0, 0x0

    invoke-direct {p0, p1, v0}, Lcom/htc/preference/HtcSwitchPreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 103
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 93
    const v0, 0x101036d

    invoke-direct {p0, p1, p2, v0}, Lcom/htc/preference/HtcSwitchPreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 94
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 4
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    const/4 v3, 0x0

    .line 71
    invoke-direct {p0, p1, p2, p3}, Lcom/htc/preference/HtcTwoStatePreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 43
    new-instance v1, Lcom/htc/preference/HtcSwitchPreference$Listener;

    const/4 v2, 0x0

    invoke-direct {v1, p0, v2}, Lcom/htc/preference/HtcSwitchPreference$Listener;-><init>(Lcom/htc/preference/HtcSwitchPreference;Lcom/htc/preference/HtcSwitchPreference$1;)V

    iput-object v1, p0, Lcom/htc/preference/HtcSwitchPreference;->mListener:Lcom/htc/preference/HtcSwitchPreference$Listener;

    .line 73
    sget-object v1, Lcom/android/internal/R$styleable;->SwitchPreference:[I

    invoke-virtual {p1, p2, v1, p3, v3}, Landroid/content/Context;->obtainStyledAttributes(Landroid/util/AttributeSet;[III)Landroid/content/res/TypedArray;

    move-result-object v0

    .line 75
    .local v0, a:Landroid/content/res/TypedArray;
    invoke-virtual {v0, v3}, Landroid/content/res/TypedArray;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Lcom/htc/preference/HtcSwitchPreference;->setSummaryOn(Ljava/lang/CharSequence;)V

    .line 76
    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/content/res/TypedArray;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Lcom/htc/preference/HtcSwitchPreference;->setSummaryOff(Ljava/lang/CharSequence;)V

    .line 77
    const/4 v1, 0x3

    invoke-virtual {v0, v1}, Landroid/content/res/TypedArray;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Lcom/htc/preference/HtcSwitchPreference;->setSwitchTextOn(Ljava/lang/CharSequence;)V

    .line 79
    const/4 v1, 0x4

    invoke-virtual {v0, v1}, Landroid/content/res/TypedArray;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Lcom/htc/preference/HtcSwitchPreference;->setSwitchTextOff(Ljava/lang/CharSequence;)V

    .line 81
    const/4 v1, 0x2

    invoke-virtual {v0, v1, v3}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z

    move-result v1

    invoke-virtual {p0, v1}, Lcom/htc/preference/HtcSwitchPreference;->setDisableDependentsState(Z)V

    .line 83
    invoke-virtual {v0}, Landroid/content/res/TypedArray;->recycle()V

    .line 84
    return-void
.end method

# virtual methods
.method public getSwitchTextOff()Ljava/lang/CharSequence;
    .locals 1

    .prologue
    .line 207
    iget-object v0, p0, Lcom/htc/preference/HtcSwitchPreference;->mSwitchOff:Ljava/lang/CharSequence;

    return-object v0
.end method

.method public getSwitchTextOn()Ljava/lang/CharSequence;
    .locals 1

    .prologue
    .line 196
    iget-object v0, p0, Lcom/htc/preference/HtcSwitchPreference;->mSwitchOn:Ljava/lang/CharSequence;

    return-object v0
.end method

.method protected onBindView(Landroid/view/View;)V
    .locals 3
    .parameter "view"

    .prologue
    .line 111
    invoke-super {p0, p1}, Lcom/htc/preference/HtcTwoStatePreference;->onBindView(Landroid/view/View;)V

    .line 113
    const v1, 0x10202da

    invoke-virtual {p1, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    .line 114
    .local v0, checkableView:Landroid/view/View;
    if-eqz v0, :cond_0

    instance-of v1, v0, Lcom/htc/widget/HtcToggleButton;

    if-eqz v1, :cond_0

    move-object v1, v0

    .line 115
    check-cast v1, Lcom/htc/widget/HtcToggleButton;

    iget-boolean v2, p0, Lcom/htc/preference/HtcTwoStatePreference;->mChecked:Z

    invoke-virtual {v1, v2}, Lcom/htc/widget/HtcToggleButton;->setChecked(Z)V

    .line 117
    invoke-virtual {p0, v0}, Lcom/htc/preference/HtcSwitchPreference;->sendAccessibilityEvent(Landroid/view/View;)V

    .line 119
    instance-of v1, v0, Lcom/htc/widget/HtcToggleButton;

    if-eqz v1, :cond_0

    .line 120
    check-cast v0, Lcom/htc/widget/HtcToggleButton;

    .line 127
    .end local v0           #checkableView:Landroid/view/View;
    :cond_0
    invoke-virtual {p0, p1}, Lcom/htc/preference/HtcSwitchPreference;->syncSummaryView(Landroid/view/View;)V

    .line 128
    return-void
.end method

.method public setSwitchTextOff(I)V
    .locals 1
    .parameter "resId"

    .prologue
    .line 185
    invoke-virtual {p0}, Lcom/htc/preference/HtcSwitchPreference;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0, p1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/htc/preference/HtcSwitchPreference;->setSwitchTextOff(Ljava/lang/CharSequence;)V

    .line 186
    return-void
.end method

.method public setSwitchTextOff(Ljava/lang/CharSequence;)V
    .locals 0
    .parameter "offText"

    .prologue
    .line 156
    iput-object p1, p0, Lcom/htc/preference/HtcSwitchPreference;->mSwitchOff:Ljava/lang/CharSequence;

    .line 157
    invoke-virtual {p0}, Lcom/htc/preference/HtcSwitchPreference;->notifyChanged()V

    .line 158
    return-void
.end method

.method public setSwitchTextOn(I)V
    .locals 1
    .parameter "resId"

    .prologue
    .line 171
    invoke-virtual {p0}, Lcom/htc/preference/HtcSwitchPreference;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0, p1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/htc/preference/HtcSwitchPreference;->setSwitchTextOn(Ljava/lang/CharSequence;)V

    .line 172
    return-void
.end method

.method public setSwitchTextOn(Ljava/lang/CharSequence;)V
    .locals 0
    .parameter "onText"

    .prologue
    .line 141
    iput-object p1, p0, Lcom/htc/preference/HtcSwitchPreference;->mSwitchOn:Ljava/lang/CharSequence;

    .line 142
    invoke-virtual {p0}, Lcom/htc/preference/HtcSwitchPreference;->notifyChanged()V

    .line 143
    return-void
.end method


text:
require "tti_spec_helper"
require "net/tti/message"
require "net/tti/connection"

shared_examples_for "a ProtocolNegotiationResponse that reads properly" do
  subject {Net::TTI::ConnectionParameters.new}

  before :each do
    response = Net::TTI::ProtocolNegotiationResponse.read( binary_string )
    response.populate_connection_parameters( subject )
  end

  its(:proSvrVer) {should == version}
  its(:architecture) {should == architecture}
  its(:platform) {should == platform}
end

module Net::TTI
  describe ProtocolNegotiationResponse do
    context "with a response from a Windows 10g server" do
      it_should_behave_like "a ProtocolNegotiationResponse that reads properly" do
        let(:binary_string) {TtiSpecHelper.read_message("protocol_negotiation_response_windows_10g.raw")}
        let(:version) {6}
        let(:architecture) {:x86}
        let(:platform) {:windows}
      end
    end

    context "with a response from a Windows 11g server" do
      it_should_behave_like "a ProtocolNegotiationResponse that reads properly" do
        let(:binary_string) {TtiSpecHelper.read_message("protocol_negotiation_response_windows_11g.raw")}
        let(:version) {6}
        let(:architecture) {:x86}
        let(:platform) {:windows}
      end
    end

    context "with a response from a Linux 10g server" do
      it_should_behave_like "a ProtocolNegotiationResponse that reads properly" do
        let(:binary_string) {TtiSpecHelper.read_message("protocol_negotiation_response_linux_10g.raw")}
        let(:version) {6}
        let(:architecture) {:x86}
        let(:platform) {:linux}
      end
    end

    context "with a response from a Linux 11g server" do
      it_should_behave_like "a ProtocolNegotiationResponse that reads properly" do
        let(:binary_string) {TtiSpecHelper.read_message("protocol_negotiation_response_linux_11g.raw")}
        let(:version) {6}
        let(:architecture) {:x64}
        let(:platform) {:linux}
      end
    end
  end
end


text:
<!DOCTYPE html>

        <link rel="stylesheet" href="https://obertguo.ml/bootstrap/bootstrap.css"/>

        <link rel="icon" href="https://obertguo.ml/logo/logo.ico">

        <title>Categories | Obert Guo</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta property="og:title" content="Categories | Obert Guo"/>
        <meta property="og:image" content="https://obertguo.ml/logo/logo.png"/>
        <meta property="og:url" content="https://obertguo.ml/categories/"/>
        <meta name="theme-color" content="#007bff"/>

        <link rel="stylesheet" href="https://obertguo.ml/katex/katex.min.css">

        <link rel="stylesheet" href="https://obertguo.ml/highlightjs/github-dark.min.css">

        <link rel="stylesheet" href="https://obertguo.ml/style.css"/>

        <button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#navbarText">

        </button>

                    Home

                    Posts

                    Contact

            <input type="checkbox" id="themeToggleCheckBox" onclick="themeToggle()"/>

Recent Posts


text:
package com.bigchange.concurrent.blockingqueue.producer;

import java.util.concurrent.BlockingQueue;

/**
 * 数据生产者线程
 */
public class Producer implements Runnable {
    BlockingQueue<String> queue;
    public Producer(BlockingQueue<String> queue) {
        this.queue = queue;
    }
    @Override
    public void run() {
        try {

            System.out.println("I have made a product:"
                    + Thread.currentThread().getName());
            String temp = "A Product, 生产线程:"
                    + Thread.currentThread().getName();
            queue.put(temp);//如果队列是满的话,会阻塞当前线程
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}


text:
TODO
============================

contact
---------------

celphone (unique)
export

unlimited photos
unlimited attachments

Option
---------------
language
theme
defaultpage


text:
'use strict';

require('configureForRelayOSS');

jest
  .dontMock('RelayMutation')
  .dontMock('buildRQL');

const Relay = require('Relay');
const RelayTestUtils = require('RelayTestUtils');

const buildRQL = require('buildRQL');
const fromGraphQL = require('fromGraphQL');

describe('RelayMutation', function() {
  var MockMutation;
  var mockBarPointer;
  var mockFooPointer;

  var {getNode, getPointer} = RelayTestUtils;

  beforeEach(function() {
    jest.resetModuleRegistry();

    var makeMockMutation = () => {
      class MockMutationClass extends Relay.Mutation {}
      MockMutationClass.fragments = {
        bar: () => Relay.QL`
          fragment on Node {
            id,
          }
        `,
        foo: () => Relay.QL`
          fragment on Node {
            id,
          }
        `,
      };
      return MockMutationClass;
    };
    MockMutation = makeMockMutation();

    var mockBarRequiredFragment =
      MockMutation.getFragment('bar').getFragment({});
    var mockFooRequiredFragment =
      MockMutation.getFragment('foo').getFragment({});
    mockBarPointer = getPointer('bar', getNode(mockBarRequiredFragment));
    mockFooPointer = getPointer('foo', getNode(mockFooRequiredFragment));

    jasmine.addMatchers(RelayTestUtils.matchers);
  });

  it('resolves props', () => {
    /* eslint-disable no-new */
    new MockMutation({
      bar: mockBarPointer,
      foo: mockFooPointer,
    });
    /* eslint-enable no-new */
    expect(Relay.Store.read.mock.calls.length).toBe(2);

    var mockBarRequiredFragment = fromGraphQL.Fragment(buildRQL.Fragment(
      MockMutation.fragments.bar, []
    ));
    expect(Relay.Store.read.mock.calls[0]).toEqual(
      [mockBarRequiredFragment, 'bar']
    );
  });

  it('throws if mutation defines invalid `Relay.QL` fragment', () => {
    class BadMutation extends Relay.Mutation {}
    BadMutation.fragments = {
      foo: () => Relay.QL`query{node(id:"123"){id}}`,
    };
    var badFragmentReference = BadMutation.getFragment('foo');
    expect(() => {
      badFragmentReference.getFragment();
    }).toFailInvariant(
      'Relay.QL defined on mutation `BadMutation` named `foo` is not a valid ' +
      'fragment. A typical fragment is defined using: ' +
      'Relay.QL`fragment on Type {...}`'
    );
  });
});


text:
package main

import (
	"go/ast"

	"github.com/golang/mock/mockgen/model"
)

func getTypeSpecTypeParams(ts *ast.TypeSpec) []*ast.Field {
	return nil
}

func (p *fileParser) parseGenericType(pkg string, typ ast.Expr, tps map[string]bool) (model.Type, error) {
	return nil, nil
}

func getIdentTypeParams(decl interface{}) string {
	return ""
}


text:
![Akka.NET logo](documentation/icons/AkkaNetLogo.Normal.png)

[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/akkadotnet/akka.net?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Issue Stats](http://www.issuestats.com/github/akkadotnet/akka.net/badge/pr)](http://www.issuestats.com/github/akkadotnet/akka.net)
[![Issue Stats](http://www.issuestats.com/github/akkadotnet/akka.net/badge/issue)](http://www.issuestats.com/github/akkadotnet/akka.net)

**Akka.NET** is a community-driven port of the popular Java/Scala framework [Akka](http://akka.io) to .NET.

* Subscribe to the Akka.NET dev feed: https://twitter.com/AkkaDotNet  (@AkkaDotNet)
* Support forum: https://groups.google.com/forum/#!forum/akkadotnet-user-list
* Mail: hi@getakka.net
* Stack Overflow: http://stackoverflow.com/questions/tagged/akka.net

### Documentation and resources

#### [Akka.NET Community Site](http://getakka.net)

### Install Akka.NET via NuGet

If you want to include Akka.NET in your project, you can [install it directly from NuGet](https://www.nuget.org/packages/Akka)

To install Akka.NET Distributed Actor Framework, run the following command in the Package Manager Console

```
PM> Install-Package Akka
PM> Install-Package Akka.Remote
```

And if you need F# support:

```
PM> Install-Package Akka.FSharp
```

### Contribute
If you are interested in helping porting Akka to .NET please take a look at [Contributing to Akka.NET](http://akkadotnet.github.io/wiki/Contributing to Akka.NET).

Also, please see [Building Akka.NET](http://getakka.net/docs/Building%20and%20Distributing%20Akka).


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.blobcity</groupId>
    <artifactId>db-java-adapter</artifactId>
    <version>1.2.11</version>
    <packaging>jar</packaging>

    <name>BlobCity DB Java Adapter</name>
    <description>Java adapter for connecting your Java applications to the BlobCity DB. Contains a full feature
        implementation of the BlobCity DB web service interface, to use BlobCity DB on-cloud or on-premise seamlessly
        from your Java applications.</description>
    <url>https://github.com/blobcity/db-java-adapter</url>
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>BlobCity</name>
            <email>support@blobcity.com</email>
            <organization>BlobCity iSolutions Pvt. Ltd.</organization>
            <organizationUrl>http://www.blobcity.com</organizationUrl>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:git://github.com/blobcity/db-java-adapter.git</connection>
        <developerConnection>scm:git:git://github.com/blobcity/db-java-adapter.git</developerConnection>
        <url>https://github.com/blobcity/db-java-adapter</url>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spring.version>4.0.3.RELEASE</spring.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.2.4</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
            <type>jar</type>
        </dependency>
        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20141113</version>
            <type>jar</type>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.3.1</version>
                <configuration>
                    <rules>
                        <DependencyConvergence/>
                    </rules>
                </configuration>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <check>
                        <branchRate>100</branchRate>
                        <lineRate>100</lineRate>
                        <haltOnFailure>false</haltOnFailure>
                    </check>
                    <instrumentation>
                        <excludes>
                        </excludes>
                    </instrumentation>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>clean</goal>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.7</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org</nexusUrl>
                    <autoReleaseAfterClose>false</autoReleaseAfterClose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!--<plugin>-->
                <!--<groupId>org.apache.maven.plugins</groupId>-->
                <!--<artifactId>maven-gpg-plugin</artifactId>-->
                <!--<version>1.5</version>-->
                <!--<!– <executions>-->
                    <!--<execution>-->
                        <!--<id>sign-artifacts</id>-->
                        <!--<phase>verify</phase>-->
                        <!--<goals>-->
                            <!--<goal>sign</goal>-->
                        <!--</goals>-->
                    <!--</execution>-->
                <!--</executions> –>-->
            <!--</plugin>-->
            <!--<plugin>-->
                <!--<groupId>org.apache.maven.plugins</groupId>-->
                <!--<artifactId>maven-failsafe-plugin</artifactId>-->
                <!--<version>2.13</version>-->
                <!--<executions>-->
                    <!--<execution>-->
                        <!--<id>integration-test</id>-->
                        <!--<goals>-->
                            <!--<goal>integration-test</goal>-->
                        <!--</goals>-->
                    <!--</execution>-->
                    <!--<execution>-->
                        <!--<id>verify</id>-->
                        <!--<goals>-->
                            <!--<goal>verify</goal>-->
                        <!--</goals>-->
                    <!--</execution>-->
                <!--</executions>-->
            <!--</plugin>-->
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <check>
                        <branchRate>100</branchRate>
                        <lineRate>100</lineRate>
                        <haltOnFailure>false</haltOnFailure>
                    </check>
                    <instrumentation>
                        <excludes>
                        </excludes>
                    </instrumentation>
                    <formats>
                        <format>html</format>
                    </formats>
                </configuration>
            </plugin>
        </plugins>
    </reporting>
</project>


text:
angular.module('chatty')
    .directive('embedContent', function($sce) {
        return {
            restrict: 'E',
            templateUrl: 'embedContent/embedContent.html',
            scope: {
                url: '@',
                type: '@'
            },
            controller: function($scope) {
                $scope.toggleVisibility = function() {
                    $scope.visible = !$scope.visible
                }

                $scope.fixUrl = function(regex, fixed) {
                    var rex = new RegExp(regex)
                    var url = $scope.url.replace(rex, fixed)
                    return $sce.trustAsResourceUrl(url)
                }

                $scope.testFixUrl = function(tests) {
                    var result = _.find(tests, function(test) {
                        var rex = new RegExp(test.test)
                        return rex.test($scope.url)
                    })

                    if (result) {
                        return $scope.fixUrl(result.regex, result.replace)
                    } else {
                        return $scope.url
                    }
                }
            }
        }
    })


text:
import {Logger} from './logger';

const CONFIG_ERROR_CODE = 105;
const BROWSER_CONNECT_ERROR_CODE = 135;
const KITCHEN_SINK_CODE = 199;

export class IError extends Error {
  code?: number;
  stack?: string;
}

export class ProtractorError extends IError {
  static ERR_MSGS: string[];
  static CODE = KITCHEN_SINK_CODE;
  static SUPRESS_EXIT_CODE = false;

  message: string;  // a one line message

  /**
   * Captures the stack trace to this.stack from the Error.captureStackTrace.
   * this allows us to capture the error of this error object. Note:
   * called with Error set to any to quiet typescript warnings.
   */
  captureStackTrace() {
    (Error as any).captureStackTrace(this, this.constructor);
  }

  constructor(logger: Logger, message: string, code: number, error?: Error) {
    super(message);
    this.message = message;
    this.code = code;
    this.captureStackTrace();

    // replacing the stack trace with the thrown error stack trace.
    if (error) {
      let protractorError = error as ProtractorError;
      this.stack = protractorError.stack;
    }
    this.logError(logger);

    if (!ProtractorError.SUPRESS_EXIT_CODE) {
      process.exit(this.code);
    }
  }

  logError(logger: Logger) {
    ProtractorError.log(logger, this.code, this.message, this.stack);
  }

  static log(logger: Logger, code: number, message: string, stack: string) {
    let messages = message.split('\n');
    if (messages.length > 1) {
      message = messages[0];
    }
    logger.error('Error code: ' + code);
    logger.error('Error message: ' + message);
    logger.error(stack);
  }
}

/**
 * Configuration file error
 */
export class ConfigError extends ProtractorError {
  static CODE = CONFIG_ERROR_CODE;
  constructor(logger: Logger, message: string, error?: Error) {
    super(logger, message, ConfigError.CODE, error);
  }
}

/**
 * Browser errors including getting a driver session, direct connect, etc.
 */
export class BrowserError extends ProtractorError {
  static CODE = BROWSER_CONNECT_ERROR_CODE;
  static ERR_MSGS = [
    'ECONNREFUSED connect ECONNREFUSED', 'Sauce Labs Authentication Error',
    'Invalid username or password'
  ];
  constructor(logger: Logger, message: string) {
    super(logger, message, BrowserError.CODE);
  }
}

export class ErrorHandler {
  static isError(errMsgs: string[], e: Error): boolean {
    if (errMsgs && errMsgs.length > 0) {
      for (let errPos in errMsgs) {
        let errMsg = errMsgs[errPos];
        if (e.message && e.message.indexOf(errMsg) !== -1) {
          return true;
        }
      }
    }
    return false;
  }

  static parseError(e: Error): number {
    if (ErrorHandler.isError(ConfigError.ERR_MSGS, e)) {
      return ConfigError.CODE;
    }
    if (ErrorHandler.isError(BrowserError.ERR_MSGS, e)) {
      return BrowserError.CODE;
    }
    return null;
  }
}


text:
package dart.common.util;

import static javax.lang.model.element.Modifier.PRIVATE;
import static javax.lang.model.element.Modifier.STATIC;

import dart.DartModel;
import dart.common.NavigationModelBindingTarget;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map;
import java.util.Set;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.util.ElementFilter;

public class NavigationModelFieldUtil {

  private final LoggingUtil loggingUtil;
  private final NavigationModelBindingTargetUtil navigationModelBindingTargetUtil;

  private RoundEnvironment roundEnv;

  public NavigationModelFieldUtil(
      LoggingUtil loggingUtil, NavigationModelBindingTargetUtil navigationModelBindingTargetUtil) {
    this.loggingUtil = loggingUtil;
    this.navigationModelBindingTargetUtil = navigationModelBindingTargetUtil;
  }

  public void setRoundEnvironment(RoundEnvironment roundEnv) {
    this.roundEnv = roundEnv;
  }

  public void parseDartModelAnnotatedFields(
      Map<TypeElement, NavigationModelBindingTarget> targetClassMap) {
    for (VariableElement element :
        ElementFilter.fieldsIn(roundEnv.getElementsAnnotatedWith(DartModel.class))) {
      try {
        parseNavigationModelField(element, targetClassMap);
      } catch (Exception e) {
        StringWriter stackTrace = new StringWriter();
        e.printStackTrace(new PrintWriter(stackTrace));
        loggingUtil.error(
            element,
            "Unable to generate extra binder when parsing @DartModel.\n\n%s",
            stackTrace.toString());
      }
    }
  }

  private void parseNavigationModelField(
      VariableElement element, Map<TypeElement, NavigationModelBindingTarget> targetClassMap) {
    final TypeElement enclosingElement = (TypeElement) element.getEnclosingElement();
    if (targetClassMap.containsKey(enclosingElement)) {
      loggingUtil.error(
          enclosingElement,
          "Component %s cannot bind more than one NavigationModel.",
          enclosingElement.getSimpleName());
      return;
    }

    // Verify common generated code restrictions.
    if (!isValidUsageOfNavigationModelField(element)) {
      return;
    }

    // Assemble information on the binding point.
    final NavigationModelBindingTarget navigationModelBindingTarget =
        navigationModelBindingTargetUtil.createTargetClass(enclosingElement, element);
    targetClassMap.put(enclosingElement, navigationModelBindingTarget);
  }

  private boolean isValidUsageOfNavigationModelField(VariableElement element) {
    final TypeElement enclosingElement = (TypeElement) element.getEnclosingElement();
    boolean valid = true;

    // Verify modifiers.
    Set<Modifier> modifiers = element.getModifiers();
    if (modifiers.contains(PRIVATE) || modifiers.contains(STATIC)) {
      loggingUtil.error(
          element,
          "@DartModel field must not be private or static. (%s.%s)",
          enclosingElement.getQualifiedName(),
          element.getSimpleName());
      valid = false;
    }

    return valid;
  }
}


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

namespace Room11\Jeeves;

const GITHUB_PROJECT_URL = 'https://github.com/Room-11/Jeeves';
const APP_BASE = __DIR__;
const DATA_BASE_DIR = APP_BASE . '/data';

define(__NAMESPACE__ . '\\PROCESS_START_TIME', time());
define(__NAMESPACE__ . '\\IS_WINDOWS', stripos(PHP_OS, 'win') === 0);

require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/version.php';


text:
var mongoose = require('mongoose'),
    Schema = mongoose.Schema; // Each schema maps to a MongoDB collection

// For any user
var userSchema = new Schema({
  created_at: {
    // auto added user registration timestamp
    type: Date,
    default: Date.now
  },
  username: {
    type: String,
    unique: true
  },
  email: {
    type: String,
    unique: true,
    lowercase: true // force email lowercase
  },
  accessToken: {
    type: String
  },
  name: {
    type: String
  },
  fb_id: String,
  friends: [],  // list of id's and names of friends
  photo: {
    type: String
  },
  movie_likes: [{   // from fb and liked within the app
    tmdb_id: String,
    imdb_id: String,
    genres: [String],
    title: String,
    directors: [String],
    actors: [String],
    trailer: String,
    overview: String,
    poster: String,
    url: String,
    release_date: String,
    tagline: String,
    recommended_by: {  // "us" if we recommended or friend's name
      type: String,
      default: "us"
    }
  }],
  queue: [{   // all recommendations
    tmdb_id: String,
    imdb_id: String,
    genres: [String],
    title: String,
    directors: [String],
    actors: [String],
    trailer: String,
    overview: String,
    poster: String,
    url: String,
    release_date: String,
    tagline: String,
    recommended_by: {  // "us" if we recommended or friend's name
      type: String,
      default: "us"
    },
    event_link: String  // has a value if it has a link
  }],
  seen: [Object]
});

module.exports = mongoose.model('User', userSchema);


text:
layout: post
comments: true
title: Ačiū kad skaitėte, metas atsisveikinti!
excerpt_separator:
---

Mano nuomone, kažkokia veikla reikia užsiimti tol, kol ji suteikia malonumą. Kai tas užsiėmimas tampa našta, metas ją nutraukti.
Taip nutiko ir man, todėl nusprendžiau, jog laikas atsisveikinti su blogo rašymu.

Tik nepagalvokite, jog metu programavimą - tikrai ne! Panašu, jog pagaliau atradau savo vietą puikiame lietuviškame startuolyje, kuriame tikiuosi
užsilikti bent jau keleriems metams.

Rašydama šį blogą išmokau daug dalykų - pagerinau (tikiuosi) sklandesnį minčių dėstymą, pati lengviau suvokiau techninius dalykus apie juos
rašydama. Sužinojau, kas aktualu ir kitiems į IT besiorientuojantiems žmonėms.

Tačiau vis dažniau pradėjau jausti, jog blogo rašymas - o pastaruoju metu tiesiog galvojimas, jog turiu kažką parašyti - tapo našta, neteikianti
džiaugsmo.

Vis sunkiau darosi sugalvoti straipsnių temų, kurios būtų aktualios besimokantiems programuoti, nes būtent tokia ir buvo pirminė šio blogo idėja -
savo pavyzdžiu parodyti, jog visiškai įmanoma savarankiškai išmokti programuoti ir persikvalifikuoti, net kai tau virš 30.

Šiais metais atradau dar vieną itin mėgstamą hobį - sodininkavimą ir daržininkavimą, todėl visas mano laisvalaikis yra nukreiptas į būtent
šią veiklą. Tai labai atpalaiduoja, tikrai rekomenduoju. O ir nugaros skausmas nuo sėdimo darbo greitai išgaravo.

Tad nenustebkite, jei ateityje mane pamatysite kokiame youtube kanale darančią įrašus apie gamtinę žemdirbystę ar kalbančią apie skaniausias
išbandytas pomidorų rūšis.

Turiu dar vieną žinutę visiems besimokantiems ir siekiantiems pakeisti karjerą. Apie šią žinutę pagalvojau gavusi laišką iš
kodinu.lt blogo
autoriaus.

Jame Eligijus kalba apie tai, jog kai kurie besimokantys taip niekada ir netampa programuotojais. Aš irgi pažįstu žmonių, kurie pradėjo mokytis programuoti, bet net ir praėjus porai metų, jie vis dar mokosi ir vis dar nesijaučia
pasiruošę pirmajam darbui.

Jei esi vienas iš tokių žmonių, galbūt laikas susimąstyti, ar programavimas tikrai yra tai, ką tu nori daryti. Nes jei tai yra tavo svajonių
profesija, tu turi dirbti kasdien. Kasdien programuoti, kasdien parašyti nors kelias eilutes kodo, paskaityti nors vieną techninį straipsnį,
išspręsti nors vieną algoritmą. Kitaip tavo įgūdžiai tiesiog nestiprės.

Besimokančių programuoti ir lankančių įvairius kursus už kosmines sumas yra daug, tačiau tik maža dalis jų įveiks tą barjerą. Būk vienas
iš tų žmonių!

Tačiau, jei po kurio laiko pradedi jausti, jog programavimas tau neteikia džiaugsmo, nežadina vidinio smalsumo, kuris tave stumtų į priekį,
nebesikankink. Tai nėra veikla, kuri tinka visiems - nes jei taip būtų, neturėtume IT specialistų trūkumo.

Šį blogą paliksiu kaip archyvą ateityje čia galbūt užklysiantiems žmonėms. Kas žino, gal po kurio laiko aš vėl turėsiu įkvėpimo tęsti
rašymą, galbūt rasiu temų, aktualių ne tik pradedantiesiems, bet ir pažengusiems.

Jei turėtumėte klausimų, visada galite su manimi susisiekti, pavyzdžiui, per LinkedIn.

Sėkmės kelyje į vieną perspektyviausių karjeros sričių!

![atsisveikinimas](/assets/see-you-soon.gif)


text:
create or replace function users.test_update() returns void as $$
    declare
        _user_id int;
    begin

        _user_id = users.add('login', 'password', 'Elephant Sam', 'samelephant82@gmail.com', true);

        IF assert.not_null(_user_id) THEN

            PERFORM users.update(
                _user_id,
                'Up_Elephant Sam',
                'Up_samelephant82@gmail.com',
                false
            );

            IF assert.false((SELECT is_superuser FROM postgres_ci.users WHERE user_id = _user_id)) THEN

                PERFORM
                    assert.equal('login', user_login),
                    assert.equal('Up_Elephant Sam', user_name),
                    assert.equal('Up_samelephant82@gmail.com', user_email)
                FROM postgres_ci.users WHERE user_id = _user_id;

            END IF;

        END IF;
    end;
$$ language plpgsql security definer;


text:
#include <assert.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sched.h>
#include <sys/wait.h>

#include "utest.h"

static int nothing_to_report(pid_t pid) {
  return (waitpid(pid, NULL, WCONTINUED | WUNTRACED | WNOHANG) == 0);
}

/* ======= wait_basic ======= */
static volatile int sigcont_handled = 0;
static volatile int ppid;
static void sigcont_handler(int signo) {
  sigcont_handled = 1;
}

int test_wait_basic(void) {
  ppid = getpid();
  signal(SIGCONT, sigcont_handler);
  int pid = fork();
  if (pid == 0) {
    while (!sigcont_handled)
      sched_yield();
    sigcont_handled = 0;
    kill(ppid, SIGCONT);
    while (!sigcont_handled)
      sched_yield();
    return 0;
  }

  int status;
  /* Nothing has happened yet, so waitpid shouldn't report anything. */
  assert(nothing_to_report(pid));

  kill(pid, SIGSTOP);
  assert(waitpid(pid, &status, WUNTRACED) == pid);
  assert(WIFSTOPPED(status));

  assert(nothing_to_report(pid));

  kill(pid, SIGCONT);
  assert(waitpid(pid, &status, WCONTINUED) == pid);
  assert(WIFCONTINUED(status));

  assert(nothing_to_report(pid));

  /* Wait until the child is ready to accept the second SIGCONT. */
  while (!sigcont_handled)
    sched_yield();

  kill(pid, SIGCONT);
  assert(waitpid(pid, &status, 0) == pid);
  assert(WIFEXITED(status));
  assert(WEXITSTATUS(status) == 0);
  return 0;
}

/* ======= wait_nohang ======= */
int test_wait_nohang(void) {
  ppid = getpid();
  signal(SIGCONT, sigcont_handler);
  int pid = fork();
  if (pid == 0) {
    while (!sigcont_handled)
      sched_yield();
    sigcont_handled = 0;
    kill(ppid, SIGCONT);
    while (!sigcont_handled)
      sched_yield();
    return 0;
  }

  int status, rv;
  /* Nothing has happened yet, so waitpid shouldn't report anything. */
  assert(nothing_to_report(pid));

  kill(pid, SIGSTOP);
  while ((rv = waitpid(pid, &status, WUNTRACED | WNOHANG)) != pid) {
    assert(rv == 0);
    sched_yield();
  }
  assert(WIFSTOPPED(status));

  assert(nothing_to_report(pid));

  kill(pid, SIGCONT);
  while ((rv = waitpid(pid, &status, WCONTINUED | WNOHANG)) != pid) {
    assert(rv == 0);
    sched_yield();
  }
  assert(WIFCONTINUED(status));

  assert(nothing_to_report(pid));

  /* Wait until the child is ready to accept the second SIGCONT. */
  while (!sigcont_handled)
    sched_yield();

  kill(pid, SIGCONT);
  while ((rv = waitpid(pid, &status, WNOHANG)) != pid) {
    assert(rv == 0);
    sched_yield();
  }
  assert(WIFEXITED(status));
  assert(WEXITSTATUS(status) == 0);
  return 0;
}


text:
package ro.satrapu.churchmanagement.ui;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.faces.application.ProjectStage;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.text.MessageFormat;

/**
 * Contains application-wide settings.
 *
 * @author satrapu
 */
@Named
@ApplicationScoped
public class ApplicationSettings implements Serializable {
    private static final long serialVersionUID = 1L;
    private FacesContext facesContext;
    private String titleSuffix;

    @Inject
    @Valid
    public ApplicationSettings(@NotNull FacesContext facesContext) {
        this.facesContext = facesContext;
    }

    @PostConstruct
    public void initialize() {
        initializeTitleSuffix();
    }

    private void initializeTitleSuffix() {
        ProjectStage projectStage = facesContext.getApplication().getProjectStage();

        switch (projectStage) {
            case Production:
                titleSuffix = "";
                break;
            default:
                titleSuffix = MessageFormat.format(" :: {0}", projectStage.toString());
                break;
        }
    }

    public String getTitleSuffix() {
        return titleSuffix;
    }
}


text:
<?php

namespace Jivoo\Routing;

class HttpTest extends \Jivoo\TestCase {

  protected function _before() {}

  protected function _after() {}

  public function testEncodeQuery() {
    $this->assertEquals('', Http::encodeQuery(array()));
    $this->assertEquals('', Http::encodeQuery(array(''), false));
    $this->assertEquals('', Http::encodeQuery(array('' => '')));
    $this->assertEquals('', Http::encodeQuery(array('' => 'foo')));
    $this->assertEquals('foo=bar', Http::encodeQuery(array('foo' => 'bar')));
    $this->assertEquals('foo', Http::encodeQuery(array('foo' => '')));
    $this->assertEquals('0=foo', Http::encodeQuery(array('foo')));
    $this->assertEquals('0=foo&1=bar', Http::encodeQuery(array('foo', 'bar')));
    $this->assertEquals('foo=bar&0=baz', Http::encodeQuery(array('foo' => 'bar', 'baz')));

    $this->assertEquals('', Http::encodeQuery(array(), false));
    $this->assertEquals('', Http::encodeQuery(array(''), false));
    $this->assertEquals('', Http::encodeQuery(array('', ''), false));
    $this->assertEquals('bar', Http::encodeQuery(array('foo' => 'bar'), false));
    $this->assertEquals('foo', Http::encodeQuery(array('foo'), false));
    $this->assertEquals('foo&bar', Http::encodeQuery(array('foo', 'bar'), false));
    $this->assertEquals('bar&baz', Http::encodeQuery(array('foo' => 'bar', 'baz'), false));

    $this->assertEquals('foo+bar=baz%26%3Dfoobar', Http::encodeQuery(array('foo bar' => 'baz&=foobar')));
  }

  public function testDecodeQuery() {
    $this->assertEquals(array(), Http::decodeQuery(''));
    $this->assertEquals(array(), Http::decodeQuery('?'));
    $this->assertEquals(array(), Http::decodeQuery('?&'));
    $this->assertEquals(array(), Http::decodeQuery('?&&&'));
    $this->assertEquals(array('??????' => ''), Http::decodeQuery('???????'));

    $this->assertEquals(array('foo' => ''), Http::decodeQuery('foo'));
    $this->assertEquals(array('foo' => ''), Http::decodeQuery('foo='));
    $this->assertEquals(array('foo' => ''), Http::decodeQuery('foo=&'));
    $this->assertEquals(array('foo' => 'bar'), Http::decodeQuery('foo=bar'));
    $this->assertEquals(array('foo' => 'bar', 'baz' => 'foobar'), Http::decodeQuery('foo=bar&baz=foobar'));
    $this->assertEquals(array('foo' => 'bar', 'foobar'), Http::decodeQuery('foo=bar&0=foobar'));
//     $this->assertEquals(array('foo' => array('bar', 'foobar')), Http::decodeQuery('foo[]=bar&foo[]=foobar'));
    $this->assertEquals(array('bar'), Http::decodeQuery('0=bar'));

    $this->assertEquals(array(), Http::decodeQuery('', false));
    $this->assertEquals(array(), Http::decodeQuery('&', false));
    $this->assertEquals(array('foo'), Http::decodeQuery('foo', false));
    $this->assertEquals(array('bar'), Http::decodeQuery('foo=bar', false));
    $this->assertEquals(array('bar', 'foobar'), Http::decodeQuery('foo=bar&baz=foobar', false));
    $this->assertEquals(array('bar', 'foobar', 'baz'), Http::decodeQuery('foo=bar&0=foobar&baz', false));
    $this->assertEquals(array('bar'), Http::decodeQuery('0=bar', false));

    $this->assertEquals(array('foo bar' => 'baz&=foobar'), Http::decodeQuery('foo+bar=baz%26%3Dfoobar'));
  }
}


text:
import { Component, OnInit } from '@angular/core';
import * as json from './editordemo-dataproperties.json';
import * as jsonEvents from './editordemo-dataevents.json';

@Component({
  selector: 'app-editordemo',
  templateUrl: './editordemo.component.html',
  styleUrls: ['./editordemo.component.scss']
})
export class EditorDemoComponent implements OnInit {

  public dataTableProperties;

  public dataEvents;

  public config = {

    font: {
      family: { show: true, tooltipText: 'Font family' }
    }

  };

  constructor() {
    this.dataTableProperties = json.dataProperties;
    this.dataEvents = jsonEvents.dataProperties;
  }

  ngOnInit() {}

}


text:
package br.eti.hmagalhaes.rh.model.repository.hibernate;

import br.eti.hmagalhaes.rh.model.entity.Departamento;
import br.eti.hmagalhaes.rh.model.repository.DepartamentoRepository;
import java.util.Collection;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

/**
 *
 * @author Hudson P. Magalhães <hudson@hmagalhaes.eti.br>
 * @since 28-Feb-2014
 */
@Repository
public class DepartamentoHibernateRepository
		extends HibernateCRUDRepository<Departamento, Long>
		implements DepartamentoRepository {

	public DepartamentoHibernateRepository() {
		super(Departamento.class);
	}

	@Override
	public int qtdDepartamentosVazios() {
		return (Integer) getSession().
				createQuery("select count(*) from Departamento as d left join d.colaboradoress as c where c = null").
				uniqueResult();
	}

	@Override
	public int qtdColaboradoresPorDepto(long id) {
		Query q = getSession().createQuery("select count(*) from Departamento as d inner join d.colaboradores where d.id = :id");
		q.setParameter("id", id);
		return ((Number) q.uniqueResult()).intValue();
	}

	@Override
	public Collection<Departamento> departamentosVazios() {
		Query q = getSession().createQuery("select d from Departamento as d left join d.colaboradores as c where c = null");
		return q.list();
	}
}


text:
package org.apache.ode.bpel.engine.fc;

import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;

import javax.imageio.ImageIO;
import javax.xml.namespace.QName;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.mail.util.Base64Encoder;
import org.apache.ode.bpel.common.ProcessState;
import org.apache.ode.bpel.dao.ProcessInstanceDAO;
import org.apache.ode.bpel.engine.BpelProcess;
import org.apache.ode.bpel.engine.FragmentCompositionEventBroker;
import org.apache.ode.bpel.engine.FragmentCompositionResponse;
import org.apache.ode.bpel.engine.fc.excp.FragmentCompositionException;
import org.apache.ode.bpel.engine.fc.excp.InstanceNotFoundException;
import org.apache.ode.bpel.fcapi.ActivityListDocument;
import org.apache.ode.bpel.fcapi.MappingListDocument;
import org.apache.ode.bpel.fcapi.StringListDocument;
import org.apache.ode.bpel.fcapi.TActivityInfo;
import org.apache.ode.bpel.fcapi.TActivityInfoList;
import org.apache.ode.bpel.fcapi.TMappingInfo;
import org.apache.ode.bpel.fcapi.TMappingInfoList;
import org.apache.ode.bpel.fcapi.TStringList;
import org.apache.ode.bpel.fcapi.TVariableInfo;
import org.apache.ode.bpel.fcapi.TVariableInfoList;
import org.apache.ode.bpel.fcapi.VariableInfoListDocument;
import org.apache.ode.bpel.o.OActivity;
import org.apache.ode.bpel.o.OBase;
import org.apache.ode.bpel.o.OConstantVarType;
import org.apache.ode.bpel.o.OElementVarType;
import org.apache.ode.bpel.o.OFragmentEntry;
import org.apache.ode.bpel.o.OFragmentExit;
import org.apache.ode.bpel.o.OFragmentRegion;
import org.apache.ode.bpel.o.OMessageVarType;
import org.apache.ode.bpel.o.OPartnerLink;
import org.apache.ode.bpel.o.OScope;
import org.apache.ode.bpel.o.OXsdTypeVarType;
import org.apache.ode.bpel.o.OScope.CorrelationSet;
import org.apache.ode.bpel.o.OScope.Variable;
import org.apache.ode.bpel.runtime.BpelRuntimeContext;
import org.apache.ode.bpel.runtime.channels.FragmentCompositionChannel;
import org.apache.ode.bpel.util.fc.FragmentCompositionUtil;
import org.apache.ode.fc.dao.FCManagementDAO;
import org.apache.ode.fcanalyzer.CorrelationSetNameComparator;
import org.apache.ode.fcanalyzer.FragmentEntryExitFinder;
import org.apache.ode.fcanalyzer.PartnerLinkNameComparator;
import org.apache.ode.fcanalyzer.ProcessElementFinder;
import org.apache.ode.fcanalyzer.VariableNameComparator;
import org.apache.ode.jacob.JacobRunnable;
import org.apache.ode.jacob.vpu.JacobVPU;
import org.apache.ode.renderer.ProcessRenderer;
import org.apache.ode.utils.fc.Mapping;

/**
 *
 * @author Alex Hummel
 *
 */
public class FragmentCompositionAPIImpl implements FragmentCompositionAPI {
	private static final Log __log = LogFactory
			.getLog(FragmentCompositionAPIImpl.class);
	private BpelProcess process;
	private final ProcessInstanceDAO procInstance;
	private FragmentCompositionEventBroker broker;
	private FragmentCompositionResponse response;

	public FragmentCompositionAPIImpl(BpelProcess process,
			final ProcessInstanceDAO procInstance) {
		broker = process.getEngine().getFragmentCompositionEventBroker();
		this.process = process;
		this.procInstance = procInstance;
	}

	private VariableInfoListDocument variablesToDocument(List<Variable> vars) {
		VariableInfoListDocument doc = VariableInfoListDocument.Factory
				.newInstance();
		TVariableInfoList list = doc.addNewVariableInfoList();
		for (Variable var : vars) {
			QName type = null;
			if (var.type instanceof OElementVarType) {
				type = ((OElementVarType) var.type).elementType;
			} else if (var.type instanceof OMessageVarType) {
				type = ((OMessageVarType) var.type).messageType;
			} else if (var.type instanceof OXsdTypeVarType) {
				type = ((OXsdTypeVarType) var.type).xsdType;
			} else if (var.type instanceof OConstantVarType) {
				type = new QName("http://www.w3.org/2001/XMLSchema", "string");
			}

			if (type != null) {
				TVariableInfo info = list.addNewVariableInfo();
				info.setName(var.name);
				info.setType(type);
			}
		}
		return doc;
	}

	public VariableInfoListDocument getAvailableVariables(Long instanceId,
			int elementId) throws FragmentCompositionException,
			InstanceNotFoundException {
		__log.debug("getAvailableVariables(instanceId: " + instanceId
				+ ", elementId: " + elementId + ")");
		OBase temp = process.getOProcess().getChild(elementId);
		if (temp != null
				&& (temp instanceof OFragmentEntry
						|| temp instanceof OFragmentExit || temp instanceof OFragmentRegion)) {
			OActivity act = (OActivity) temp;

			if (act != null) {
				List<Variable> vars = ProcessElementFinder
						.getVisibleVariables(act);
				Collections.sort(vars, new VariableNameComparator());
				VariableInfoListDocument doc = variablesToDocument(vars);

				response.returnValue(doc);
			} else {
				StringBuffer buffer = new StringBuffer();
				buffer.append("No FragmentExit no FragmentEntry and no FragmentRegion with the id \"");
				buffer.append(elementId);
				buffer.append("\" found!");
				response.throwException(new FragmentCompositionException(buffer
						.toString()));
			}
		}

		return null;
	}

	private void fillActivityList(TActivityInfoList list, List<Integer> ids) {
		for (Integer id : ids) {
			OBase element = process.getOProcess().getChild(id);
			if (element != null && element instanceof OActivity) {
				TActivityInfo info = list.addNewActivityInfo();
				info.setId(id);
				info.setName(((OActivity) element).name);
			}
		}
	}

	public ActivityListDocument getDanglingEntries(Long instanceId)
			throws InstanceNotFoundException {
		__log.debug("getDanglingEntries(instanceId: " + instanceId + ")");
		List<Integer> entries = FragmentEntryExitFinder
				.findDanglingEntries(process.getOProcess());
		List<Integer> regions = FragmentEntryExitFinder
				.findRegionsToMapBack(process.getOProcess());
		entries.addAll(regions);

		ActivityListDocument ret = ActivityListDocument.Factory.newInstance();
		TActivityInfoList list = ret.addNewActivityList();
		fillActivityList(list, entries);

		response.returnValue(ret);
		return null;
	}

	public ActivityListDocument getDanglingExits(Long instanceId)
			throws InstanceNotFoundException {
		__log.debug("getDanglingExits(instanceId: " + instanceId + ")");
		// List<Integer> exits =
		// FragmentEntryExitFinder.findDanglingExits(process.getOProcess());
		ArrayList<Integer> result = new ArrayList<Integer>();
		List<Integer> regions = FragmentEntryExitFinder
				.findRegionsToMapForward(process.getOProcess());
		List<Integer> exits = process.getEngine().getFCManagementDAO()
				.getActiveFragmentExits(instanceId);
		result.addAll(exits);
		result.addAll(regions);

		ActivityListDocument ret = ActivityListDocument.Factory.newInstance();
		TActivityInfoList list = ret.addNewActivityList();
		fillActivityList(list, result);

		response.returnValue(ret);
		return null;
	}

	public ActivityListDocument getIgnorableExits(Long instanceId)
			throws InstanceNotFoundException {
		__log.debug("getIgnorableExits(instanceId: " + instanceId + ")");
		List<Integer> exits = process.getEngine().getFCManagementDAO()
				.getActiveFragmentExits(instanceId);

		ActivityListDocument ret = ActivityListDocument.Factory.newInstance();
		TActivityInfoList list = ret.addNewActivityList();
		fillActivityList(list, exits);

		response.returnValue(ret);
		return null;

	}

	public ActivityListDocument getFragmentContainers(Long instanceId)
			throws InstanceNotFoundException {
		__log.debug("getFragmentContainers(instanceId: " + instanceId + ")");
		ActivityListDocument ret = ActivityListDocument.Factory.newInstance();
		TActivityInfoList list = ret.addNewActivityList();

		if (FragmentCompositionUtil.isGlueAllowed(process.getOProcess())) {
			List<Integer> activeFlows = process.getEngine()
					.getFCManagementDAO()
					.getActiveFragmentContainers(instanceId);
			List<Integer> flows = FragmentEntryExitFinder
					.findElementsToGlue(process.getOProcess());

			// intersect the activeFlows and flows
			HashSet<Integer> activeSet = new HashSet<Integer>(activeFlows);
			ArrayList<Integer> result = new ArrayList<Integer>();
			for (Integer current : flows) {
				if (activeSet.contains(current)) {
					result.add(current);
				}
			}

			fillActivityList(list, result);
		}
		response.returnValue(ret);
		return null;
	}

	public byte[] getProcessImage(Long instanceId)
			throws InstanceNotFoundException {
		__log.debug("getProcessImage(instanceId: " + instanceId + ")");
		ProcessRenderer renderer = new ProcessRenderer(process.getOProcess());
		BufferedImage image = renderer.render();
		try {

			ByteArrayOutputStream out = new ByteArrayOutputStream();

			ImageIO.write(image, "png", out);

			byte[] notEncoded = out.toByteArray();

			ByteArrayOutputStream encoded = new ByteArrayOutputStream();
			Base64Encoder encoder = new Base64Encoder();
			encoder.encode(notEncoded, 0, notEncoded.length, encoded);
			response.returnValue(encoded.toByteArray());
		} catch (IOException e) {
			__log.error(e);
		}
		return null;
	}

	public boolean glue(Long instanceId, int containerId, String newFragmentName)
			throws FragmentCompositionException, InstanceNotFoundException {
		__log.debug("glue(instanceId: " + instanceId + ", containerId: "
				+ containerId + ", fragmentName" + newFragmentName + ")");
		if (procInstance.getState() == ProcessState.STATE_ACTIVE) {
			final QName newFragment = QName.valueOf(newFragmentName);
			final int tmpContainerId = containerId;
			final Long tempInstanceId = instanceId;
			JacobRunnable runnable = new JacobRunnable() {
				private BpelRuntimeContext getRuntimeContext() {
					return (BpelRuntimeContext) JacobVPU.activeJacobThread()
							.getExtension(BpelRuntimeContext.class);
				}

				@Override
				public void run() {

					BpelProcess process = getRuntimeContext().getBpelProcess();
					short instanceState = process.getProcessDAO()
							.getInstance(tempInstanceId).getState();
					if (instanceState == ProcessState.STATE_ACTIVE) {
						FCManagementDAO dao = process.getEngine()
								.getFCManagementDAO();
						String channel = dao.getChannel(tempInstanceId,
								tmpContainerId);
						if (channel != null) {
							FragmentCompositionChannel imported = importChannel(
									channel, FragmentCompositionChannel.class);
							if (imported != null) {
								imported.glue(newFragment, response);
							} else {
								response.throwException(new FragmentCompositionException(
										"Could not import FragmentCompositionChannel"));
							}
						} else {
							response.throwException(new FragmentCompositionException(
									"Could not find FragmentCompositionChannel"));
						}
					}
				}

			};

			broker.continueExecution(process, procInstance, runnable);
		} else {
			response.throwException(new FragmentCompositionException(
					"Process instance is not active!"));
		}
		return true;
	}

	private Mapping[] extractMappings(MappingListDocument doc) {
		TMappingInfoList list = doc.getMappingList();
		Mapping mappings[] = new Mapping[list.sizeOfMappingInfoArray()];
		for (int i = 0; i < list.sizeOfMappingInfoArray(); i++) {
			TMappingInfo info = list.getMappingInfoArray(i);
			TMappingInfo.ElementType.Enum type = info.getElementType();
			Mapping.ElementType eType;
			switch (type.intValue()) {
			case TMappingInfo.ElementType.INT_PARTNERLINK:
				eType = Mapping.ElementType.PARTNER_LINK;
				break;
			case TMappingInfo.ElementType.INT_CORRELATIONSET:
				eType = Mapping.ElementType.CORRELATION_SET;
				break;
			default:
				eType = Mapping.ElementType.VARIABLE;
			}

			mappings[i] = new Mapping(eType, info.getFromElementName(),
					info.getToElementName());
		}
		return mappings;
	}

	public boolean wireAndMap(Long instanceId, int fragmentExitId,
			int fragmentEntryId, MappingListDocument mappings)
			throws FragmentCompositionException, InstanceNotFoundException {
		__log.debug("wireAndMap(instanceId: " + instanceId
				+ ", fragmentExitId: " + fragmentExitId + ", fragmentEntryId: "
				+ fragmentEntryId + ")");
		if (procInstance.getState() == ProcessState.STATE_ACTIVE) {
			final int containerId = FragmentCompositionUtil
					.findEnclosingFragmentContainer(process.getOProcess(),
							fragmentExitId, fragmentEntryId);
			if (containerId != -1) {

				final int tempExit = fragmentExitId;
				final int tempEntry = fragmentEntryId;
				final Mapping[] tempMappings = extractMappings(mappings);
				final Long tempInstanceId = instanceId;

				// Runnable onSuccess = new
				// CleanUpChannelsTask(process.getOProcess(),
				// process.getEngine(), procInstance.getInstanceId());
				// response.setOnSuccessAction(onSuccess);

				JacobRunnable runnable = new JacobRunnable() {

					private BpelRuntimeContext getRuntimeContext() {
						return (BpelRuntimeContext) JacobVPU
								.activeJacobThread().getExtension(
										BpelRuntimeContext.class);
					}

					@Override
					public void run() {

						BpelProcess process = getRuntimeContext()
								.getBpelProcess();
						short instanceState = process.getProcessDAO()
								.getInstance(tempInstanceId).getState();
						if (instanceState == ProcessState.STATE_ACTIVE) {
							FCManagementDAO dao = process.getEngine()
									.getFCManagementDAO();
							String channel = dao.getChannel(tempInstanceId,
									containerId);
							if (channel != null) {
								FragmentCompositionChannel imported = importChannel(
										channel,
										FragmentCompositionChannel.class);
								if (imported != null) {
									imported.wireAndMap(tempExit, tempEntry,
											tempMappings, response);
								} else {
									response.throwException(new FragmentCompositionException(
											"Could not import FragmentCompositionChannel"));
								}
							} else {
								response.throwException(new FragmentCompositionException(
										"Could not find FragmentCompositionChannel"));
							}
						}
					}
				};

				broker.continueExecution(process, procInstance, runnable);
			} else {
				throw new FragmentCompositionException(
						"Could not find the FragmentFlowCompositionChannel");
			}
		} else {
			response.throwException(new FragmentCompositionException(
					"Process instance is not active!"));
		}
		return true;
	}

	public void setFCResponseObject(FragmentCompositionResponse response) {
		this.response = response;
	}

	public VariableInfoListDocument getVariablesToMap(Long instanceId,
			int elementId) throws InstanceNotFoundException {
		__log.debug("getVariablesToMap(instanceId: " + instanceId
				+ ", elementId: " + elementId + ")");
		List<OScope.Variable> vars = ProcessElementFinder.getVariablesToMap(
				process.getOProcess(), elementId);

		VariableInfoListDocument doc = variablesToDocument(vars);

		response.returnValue(doc);
		return null;
	}

	public boolean ignoreFragmentExit(Long instanceId, int fragmentExitId)
			throws InstanceNotFoundException, FragmentCompositionException {
		__log.debug("ignoreFragmentExit(instanceId: " + instanceId
				+ ", fragmentExitId: " + fragmentExitId + ")");
		if (procInstance.getState() == ProcessState.STATE_ACTIVE) {
			final int containerId = FragmentCompositionUtil
					.findEnclosingFragmentContainer(process.getOProcess(),
							fragmentExitId);
			if (containerId != -1) {
				final int tempExit = fragmentExitId;
				final Long tempInstanceId = instanceId;
				// Runnable onSuccess = new
				// CleanUpChannelsTask(process.getOProcess(),
				// process.getEngine(), procInstance.getInstanceId());
				// response.setOnSuccessAction(onSuccess);

				JacobRunnable runnable = new JacobRunnable() {
					private BpelRuntimeContext getRuntimeContext() {
						return (BpelRuntimeContext) JacobVPU
								.activeJacobThread().getExtension(
										BpelRuntimeContext.class);
					}

					@Override
					public void run() {

						BpelProcess process = getRuntimeContext()
								.getBpelProcess();
						short instanceState = process.getProcessDAO()
								.getInstance(tempInstanceId).getState();
						if (instanceState == ProcessState.STATE_ACTIVE) {
							FCManagementDAO dao = process.getEngine()
									.getFCManagementDAO();
							String channel = dao.getChannel(tempInstanceId,
									containerId);
							if (channel != null) {
								FragmentCompositionChannel imported = importChannel(
										channel,
										FragmentCompositionChannel.class);
								if (imported != null) {
									imported.ignoreFragmentExit(tempExit,
											response);
								} else {
									response.throwException(new FragmentCompositionException(
											"Could not import FragmentCompositionChannel"));
								}
							} else {
								response.throwException(new FragmentCompositionException(
										"Could not find FragmentCompositionChannel"));
							}
						}
					}

				};

				broker.continueExecution(process, procInstance, runnable);
			} else {
				throw new FragmentCompositionException(
						"Could not find the FragmentFlowCompositionChannel");
			}
		} else {
			response.throwException(new FragmentCompositionException(
					"Process instance is not active!"));
		}
		return true;

	}

	public StringListDocument getAvailableCorrelationSets(Long instanceId,
			int elementId) throws FragmentCompositionException,
			InstanceNotFoundException {
		__log.debug("getAvailableCorrelationSets(instanceId: " + instanceId
				+ ", elementId: " + elementId + ")");
		OBase temp = process.getOProcess().getChild(elementId);
		if (temp != null
				&& (temp instanceof OFragmentEntry
						|| temp instanceof OFragmentExit || temp instanceof OFragmentRegion)) {
			OActivity act = (OActivity) temp;

			if (act != null) {
				List<CorrelationSet> sets = ProcessElementFinder
						.getVisibleCorrelationSets(act);
				Collections.sort(sets, new CorrelationSetNameComparator());
				StringListDocument ret = StringListDocument.Factory
						.newInstance();
				TStringList list = ret.addNewStringList();
				for (CorrelationSet set : sets) {
					list.addElement(set.name);
				}
				response.returnValue(ret);
			} else {
				StringBuffer buffer = new StringBuffer();
				buffer.append("No FragmentExit no FragmentEntry and no FragmentRegion with the id \"");
				buffer.append(elementId);
				buffer.append("\" found!");
				response.throwException(new FragmentCompositionException(buffer
						.toString()));
			}
		}
		return null;
	}

	public StringListDocument getAvailablePartnerLinks(Long instanceId,
			int elementId) throws FragmentCompositionException,
			InstanceNotFoundException {
		__log.debug("getAvailablePartnerLinks(instanceId: " + instanceId
				+ ", elementId: " + elementId + ")");
		OBase temp = process.getOProcess().getChild(elementId);
		if (temp != null
				&& (temp instanceof OFragmentEntry
						|| temp instanceof OFragmentExit || temp instanceof OFragmentRegion)) {
			OActivity act = (OActivity) temp;

			if (act != null) {
				List<OPartnerLink> links = ProcessElementFinder
						.getVisiblePartnerLinks(act);
				Collections.sort(links, new PartnerLinkNameComparator());
				StringListDocument ret = StringListDocument.Factory
						.newInstance();
				TStringList list = ret.addNewStringList();
				for (OPartnerLink link : links) {
					list.addElement(link.name);
				}
				response.returnValue(ret);
			} else {
				StringBuffer buffer = new StringBuffer();
				buffer.append("No FragmentExit no FragmentEntry and no FragmentRegion with the id \"");
				buffer.append(elementId);
				buffer.append("\" found!");
				response.throwException(new FragmentCompositionException(buffer
						.toString()));
			}
		}

		return null;
	}

	public StringListDocument getCorrelationSetsToMap(Long instanceId,
			int elementId) throws InstanceNotFoundException {
		__log.debug("getCorrelationSetsToMap(instanceId: " + instanceId
				+ ", elementId: " + elementId + ")");
		List<CorrelationSet> sets = ProcessElementFinder
				.getCorrelationSetsToMap(process.getOProcess(), elementId);

		StringListDocument ret = StringListDocument.Factory.newInstance();
		TStringList list = ret.addNewStringList();
		for (CorrelationSet set : sets) {
			list.addElement(set.name);
		}

		response.returnValue(list);
		return null;
	}

	public StringListDocument getPartnerLinksToMap(Long instanceId,
			int elementId) throws InstanceNotFoundException {
		__log.debug("getPartnerLinksToMap(instanceId: " + instanceId
				+ ", elementId: " + elementId + ")");
		List<OPartnerLink> links = ProcessElementFinder.getPartnerLinksToMap(
				process.getOProcess(), elementId);

		StringListDocument ret = StringListDocument.Factory.newInstance();
		TStringList list = ret.addNewStringList();
		for (OPartnerLink link : links) {
			list.addElement(link.name);
		}

		response.returnValue(list);
		return null;
	}

	public ActivityListDocument getIgnorableEntries(Long instanceId)
			throws InstanceNotFoundException {
		__log.debug("getIgnorableEntries(instanceId: " + instanceId + ")");
		List<Integer> entries = process.getEngine().getFCManagementDAO()
				.getActiveFragmentEntries(instanceId);

		ActivityListDocument ret = ActivityListDocument.Factory.newInstance();
		TActivityInfoList list = ret.addNewActivityList();
		fillActivityList(list, entries);

		response.returnValue(ret);
		return null;
	}

	public boolean ignoreFragmentEntry(Long instanceId, int fragmentEntryId)
			throws FragmentCompositionException, InstanceNotFoundException {
		__log.debug("ignoreFragmentEntry(instanceId: " + instanceId
				+ ", fragmentEntryId: " + fragmentEntryId + ")");
		if (procInstance.getState() == ProcessState.STATE_ACTIVE) {
			final int containerId = FragmentCompositionUtil
					.findEnclosingFragmentContainer(process.getOProcess(),
							fragmentEntryId);
			if (containerId != -1) {
				final int tempEntry = fragmentEntryId;
				final Long tempInstanceId = instanceId;
				// Runnable onSuccess = new
				// CleanUpChannelsTask(process.getOProcess(),
				// process.getEngine(), procInstance.getInstanceId());
				// response.setOnSuccessAction(onSuccess);

				JacobRunnable runnable = new JacobRunnable() {
					private BpelRuntimeContext getRuntimeContext() {
						return (BpelRuntimeContext) JacobVPU
								.activeJacobThread().getExtension(
										BpelRuntimeContext.class);
					}

					@Override
					public void run() {

						BpelProcess process = getRuntimeContext()
								.getBpelProcess();
						short instanceState = process.getProcessDAO()
								.getInstance(tempInstanceId).getState();
						if (instanceState == ProcessState.STATE_ACTIVE) {
							FCManagementDAO dao = process.getEngine()
									.getFCManagementDAO();
							String channel = dao.getChannel(tempInstanceId,
									containerId);
							if (channel != null) {
								FragmentCompositionChannel imported = importChannel(
										channel,
										FragmentCompositionChannel.class);
								if (imported != null) {
									imported.ignoreFragmentEntry(tempEntry,
											response);
								} else {
									response.throwException(new FragmentCompositionException(
											"Could not import FragmentCompositionChannel"));
								}
							} else {
								response.throwException(new FragmentCompositionException(
										"Could not find FragmentCompositionChannel"));
							}
						}
					}

				};

				broker.continueExecution(process, procInstance, runnable);
			} else {
				throw new FragmentCompositionException(
						"Could not find the FragmentFlowCompositionChannel");
			}
		} else {
			response.throwException(new FragmentCompositionException(
					"Process instance is not active!"));
		}
		return true;
	}

}


text:
namespace Warden.Manager.Commands
{
    public class StartWarden : IWardenCommand
    {
    }
}


text:
package com.example.compute.errorreporting;

import org.fluentd.logger.FluentLogger;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;

// [START example]
public class ExceptionUtil {
    private static FluentLogger ERRORS = FluentLogger.getLogger("myapp");

    public static void main(String[] args) {
      try {
        throw new Exception("Generic exception for testing Stackdriver");
      } catch (Exception e) {
        report(e);
      }
    }

    public static void report(Throwable ex) {
        StringWriter exceptionWriter = new StringWriter();
        ex.printStackTrace(new PrintWriter(exceptionWriter));
        Map<String, Object> data = new HashMap<>();
        data.put("message", exceptionWriter.toString());
        Map<String,String> serviceContextData = new HashMap<>();
        serviceContextData.put("service", "myapp");
        data.put("serviceContext", serviceContextData);
        // ... add more metadata
        ERRORS.log("errors", data);
    }
}
// [END example]