text:
package org.apache.camel.processor;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.support.processor.idempotent.MemoryIdempotentRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertFalse;

/**
 * Concurreny test for idempotent consumer
 */
public class IdempotentConsumerConcurrentTest extends ContextTestSupport {
    protected Endpoint startEndpoint;
    protected MockEndpoint resultEndpoint;

    @Override
    public boolean isUseRouteBuilder() {
        return false;
    }

    @Test
    public void testDuplicateMessagesAreFilteredOut() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                        .idempotentConsumer(header("messageId"), MemoryIdempotentRepository.memoryIdempotentRepository(200))
                        .to("mock:result");
            }
        });
        context.start();

        resultEndpoint.expectedBodiesReceived("one", "two", "three");

        sendMessage("1", "one");
        sendMessage("2", "two");
        sendMessage("1", "one");
        sendMessage("2", "two");
        sendMessage("1", "one");
        sendMessage("3", "three");

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testFailedExchangesNotAddedDeadLetterChannel() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                errorHandler(deadLetterChannel("mock:error").maximumRedeliveries(2).redeliveryDelay(0).logStackTrace(false));

                from("direct:start")
                        .idempotentConsumer(header("messageId"), MemoryIdempotentRepository.memoryIdempotentRepository(200))
                        .process(new Processor() {
                            public void process(Exchange exchange) throws Exception {
                                String id = exchange.getIn().getHeader("messageId", String.class);
                                if (id.equals("2")) {
                                    throw new IllegalArgumentException("Damm I cannot handle id 2");
                                }
                            }
                        }).to("mock:result");
            }
        });
        context.start();

        // we send in 2 messages with id 2 that fails
        getMockEndpoint("mock:error").expectedMessageCount(2);
        resultEndpoint.expectedBodiesReceived("one", "three");

        sendMessage("1", "one");
        sendMessage("2", "two");
        sendMessage("1", "one");
        sendMessage("2", "two");
        sendMessage("1", "one");
        sendMessage("3", "three");

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testFailedExchangesNotAdded() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                        .idempotentConsumer(header("messageId"), MemoryIdempotentRepository.memoryIdempotentRepository(200))
                        .process(new Processor() {
                            public void process(Exchange exchange) throws Exception {
                                String id = exchange.getIn().getHeader("messageId", String.class);
                                if (id.equals("2")) {
                                    throw new IllegalArgumentException("Damm I cannot handle id 2");
                                }
                            }
                        }).to("mock:result");
            }
        });
        context.start();

        resultEndpoint.expectedBodiesReceived("one", "three");

        sendMessage("1", "one");
        sendMessage("2", "two");
        sendMessage("1", "one");
        sendMessage("2", "two");
        sendMessage("1", "one");
        sendMessage("3", "three");

        assertMockEndpointsSatisfied();
    }

    /**
     * A multithreaded test for IdempotentConsumer filter
     */
    @Test
    public void testThreadedIdempotentConsumer() throws Exception {
        final int loopCount = 100;
        final int threadCount = 10;

        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                        .idempotentConsumer(header("messageId"), MemoryIdempotentRepository.memoryIdempotentRepository(200))
                        .delay(1).to("mock:result");
            }
        });
        context.start();

        resultEndpoint.reset();
        resultEndpoint.expectedMessageCount(loopCount);

        final boolean failedFlag[] = new boolean[1];
        failedFlag[0] = false;

        Thread[] threads = new Thread[threadCount];
        for (int i = 0; i < threadCount; i++) {
            final int threadIndex = i;
            threads[threadIndex] = new Thread() {
                @Override
                public void run() {
                    try {
                        for (int j = 0; j < loopCount; j++) {
                            sendMessage("" + j, "multithreadedTest" + j);
                        }
                    } catch (Throwable e) {
                        e.printStackTrace();
                        failedFlag[0] = true;
                    }
                }
            };
            threads[i].start();
        }
        for (int i = 0; i < threadCount; i++) {
            threads[i].join();
        }
        assertFalse(failedFlag[0], "At least one thread threw an exception");

        assertMockEndpointsSatisfied();
    }

    protected void sendMessage(final Object messageId, final Object body) {
        template.send(startEndpoint, new Processor() {
            public void process(Exchange exchange) {
                // now lets fire in a message
                Message in = exchange.getIn();
                in.setBody(body);
                in.setHeader("messageId", messageId);
            }
        });
    }

    @Override
    @BeforeEach
    public void setUp() throws Exception {
        super.setUp();

        startEndpoint = resolveMandatoryEndpoint("direct:start");
        resultEndpoint = getMockEndpoint("mock:result");
    }
}


text:
package com.jeffrey.pattern.singleton;

/**
 * 延迟加载,线程安全
 *
 * @author weij
 */
public class MysqlConnection {

    private static Object obj;

    public static Object getObj() {
        if (obj == null) {
            synchronized (MysqlConnection.class) {
                if (obj == null) {
                    obj = new Object();
                }
            }
        }
        return obj;
    }
}

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build cgo

package runtime_test

import (
	"runtime"
	"testing"
)

func TestCgoCrashHandler(t *testing.T) {
	testCrashHandler(t, true)
}

func TestCgoSignalDeadlock(t *testing.T) {
	if testing.Short() && runtime.GOOS == "windows" {
		t.Skip("Skipping in short mode") // takes up to 64 seconds
	}
	got := executeTest(t, cgoSignalDeadlockSource, nil)
	want := "OK\n"
	if got != want {
		t.Fatalf("expected %q, but got %q", want, got)
	}
}

func TestCgoTraceback(t *testing.T) {
	got := executeTest(t, cgoTracebackSource, nil)
	want := "OK\n"
	if got != want {
		t.Fatalf("expected %q, but got %q", want, got)
	}
}

const cgoSignalDeadlockSource = `
package main

import "C"

import (
	"fmt"
	"runtime"
	"time"
)

func main() {
	runtime.GOMAXPROCS(100)
	ping := make(chan bool)
	go func() {
		for i := 0; ; i++ {
			runtime.Gosched()
			select {
			case done := <-ping:
				if done {
					ping <- true
					return
				}
				ping <- true
			default:
			}
			func() {
				defer func() {
					recover()
				}()
				var s *string
				*s = ""
			}()
		}
	}()
	time.Sleep(time.Millisecond)
	for i := 0; i < 64; i++ {
		go func() {
			runtime.LockOSThread()
			select {}
		}()
		go func() {
			runtime.LockOSThread()
			select {}
		}()
		time.Sleep(time.Millisecond)
		ping <- false
		select {
		case <-ping:
		case <-time.After(time.Second):
			fmt.Printf("HANG\n")
			return
		}
	}
	ping <- true
	select {
	case <-ping:
	case <-time.After(time.Second):
		fmt.Printf("HANG\n")
		return
	}
	fmt.Printf("OK\n")
}
`

const cgoTracebackSource = `
package main

/* void foo(void) {} */
import "C"

import (
	"fmt"
	"runtime"
)

func main() {
	C.foo()
	buf := make([]byte, 1)
	runtime.Stack(buf, true)
	fmt.Printf("OK\n")
}
`


text:
namespace boost { namespace geometry
{

#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{

template
<
    typename Box1, typename Box2, bool Reverse
>
struct intersection
    <
        Box1, Box2,
        box_tag, box_tag,
        Reverse
    > : public detail::intersection::intersection_box_box
            <
                0, geometry::dimension<Box1>::value
            >
{};

} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH

}} // namespace boost::geometry

#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_HPP


text:
<?php

namespace Phpml\NeuralNetwork\Network;

use Phpml\NeuralNetwork\Layer;
use Phpml\NeuralNetwork\Network;
use Phpml\NeuralNetwork\Node\Input;
use Phpml\NeuralNetwork\Node\Neuron;
abstract class LayeredNetwork implements Network
{
    /**
     * @var Layer[]
     */
    protected $layers;
    /**
     * @param Layer $layer
     */
    public function addLayer(Layer $layer)
    {
        $this->layers[] = $layer;
    }
    /**
     * @return Layer[]
     */
    public function getLayers()
    {
        return $this->layers;
    }
    /**
     * @return void
     */
    public function removeLayers()
    {
        unset($this->layers);
    }
    /**
     * @return Layer
     */
    public function getOutputLayer()
    {
        return $this->layers[count($this->layers) - 1];
    }
    /**
     * @return array
     */
    public function getOutput()
    {
        $result = [];
        foreach ($this->getOutputLayer()->getNodes() as $neuron) {
            $result[] = $neuron->getOutput();
        }
        return $result;
    }
    /**
     * @param mixed $input
     *
     * @return $this
     */
    public function setInput($input)
    {
        $firstLayer = $this->layers[0];
        foreach ($firstLayer->getNodes() as $key => $neuron) {
            if ($neuron instanceof Input) {
                $neuron->setInput($input[$key]);
            }
        }
        foreach ($this->getLayers() as $layer) {
            foreach ($layer->getNodes() as $node) {
                if ($node instanceof Neuron) {
                    $node->reset();
                }
            }
        }
        return $this;
    }
}


text:
ALTER TABLE hydra_jwk RENAME pk TO pk_deprecated;
ALTER TABLE hydra_jwk ADD pk UUID NOT NULL DEFAULT gen_random_uuid();


text:
<?php
include ('class.qrcode.php');
$qr=new CodeQR('UTF-8');//Here are the available values: UTF-8 [Default] Shift_JIS  ISO-8859-1
$src=$qr->Draw("Hyper Solutions",100);  // Draw(TEXT,SIZE)
?>
<img src="<?=$src;?>" />


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

class AddPolynomials
{
	private static int[] GetCoefficent(int input)
	{
		Console.WriteLine("Please enter the coefficients for the polynom {0} separated by commas. All invalid input will be treated as 0.", input);
		string[] theInput = Console.ReadLine().Split(',');
		int[] theIntInput = new int[theInput.Length];
		for (int i = 0; i < theInput.Length; i++)
		{
			int tempNumber = 0;
			if (!int.TryParse(theInput[i], out tempNumber))
				tempNumber = 0;
			theIntInput[i] = tempNumber;
		}
		return theIntInput;
	}
	private static int[] AddPolynomial(int[] poly1, int[] poly2)
	{
		int maxLength = (poly1.Length > poly2.Length) ? poly1.Length : poly2.Length;
		int[] result = new int[maxLength];
		Array.Reverse(poly1);
		Array.Reverse(poly2);
		for (int i = 0; i < maxLength; i++)
		{
			if(i < poly1.Length)
				result[i] += poly1[i];
			if (i < poly2.Length)
				result[i] += poly2[i];
		}
		Array.Reverse(poly1);
		Array.Reverse(poly2);
		Array.Reverse(result);
		return result;
	}
	static void Print(int[] array)
	{
		for (int i = 0; i < array.Length; i++)
		{
			Console.Write("{0}",array[i]);
			if(i != array.Length - 1)
				Console.Write("x^{0} + ", array.Length - i - 1);
		}
		Console.WriteLine();
	}
	static void Main()
	{
		int[] firstPolynomial = GetCoefficent(1);
		int[] secondPolynomial = GetCoefficent(2);
		int[] sum = AddPolynomial(firstPolynomial, secondPolynomial);
		Print(sum);
	}
}


text:
jsx3.lang.Package.definePackage(
  "eg.wsdl3",                //the full name of the package to create
  function(wsdl3) {          //name the argument of this function

   /**
    * Executes the first service mapping and subscribes functions to events.
    * Call this method to begin the service call (eg.wsdl3.callGetHistoricalQuotes();)
    */
    //call this method to begin the service call (eg.service.callGetHistoricalQuotes();)
    wsdl3.callGetHistoricalQuotes = function() {
      var objService = eg.wsdl3.APP.loadResource("sampleGetHistoricalQuotes_xml");

      // set run mode with live data or static reponse
      objService.setMode(eg.wsdl3.APP.getJSXByName("radLive").getSelected());
      objService.setInboundURL('messages/sampleResponse.xml');

      objService.setOperation("GetHistoricalQuotes");
      objService.setEndpointURL(eg.wsdl3.proxy.convertURI(objService.getEndpointURL()));

      //subscribe and call
      objService.subscribe(jsx3.net.Service.ON_SUCCESS, wsdl3.onGetHistoricalQuotesSuccess);
      objService.subscribe(jsx3.net.Service.ON_ERROR, wsdl3.onGetHistoricalQuotesError);
      objService.subscribe(jsx3.net.Service.ON_INVALID, wsdl3.onGetHistoricalQuotesInvalid);

      objService.doCall();
    };

    /**
     * {String} stores the feedback from the web service.
     */
     wsdl3.wsOutcome = "Success";

    /**
     * {String} stores the message sent from the web service if an error occurs.
     */
     wsdl3.wsMessage = "Error";

    /**
     * Repaints the list control after successful web service call.
     *
     * @param objEvent {String} static field event type for successful response.
     */
    wsdl3.onGetHistoricalQuotesSuccess = function(objEvent) {
      //var responseXML = objEvent.target.getInboundDocument();

       if (wsdl3.wsOutcome == "Success") {
          wsdl3.APP.getJSXByName("mtxResultsList").repaint();
          wsdl3.APP.alert("Success","The service call was successful.");
       }
        else {
         // An error was sent from the web service.
          wsdl3.APP.alert("Web Service Error: " + wsdl3.wsOutcome, "The web service sent the following error message:

" + wsdl3.wsMessage, null, "Close", {width:350, height:200});

       }

    };

    /**
    * Calls an alert with HTTP status code on failed service call attempt.
    *
    * @param objEvent {String} static field event type for unsuccessful response.
    */

    wsdl3.onGetHistoricalQuotesError = function(objEvent) {
      var myStatus = objEvent.target.getRequest().getStatus();
      objEvent.target.getServer().alert("Error","The service call failed. The HTTP Status code is: " + myStatus);
    };

   /**
    * Creates an alert box if one or more restrictions fails during message generation.
    *
    * @param objEvent {String} static field event type for message generation.
    */
    wsdl3.onGetHistoricalQuotesInvalid = function(objEvent) {
      objEvent.target.getServer().alert("Invalid","The following message node just failed validation:\n\n" + objEvent.message);
    };

   /**
    * Executes the second service mapping and subscribes functions to events.
    */
    wsdl3.callGetLastClosingPrice = function() {
      var objService = eg.wsdl3.APP.loadResource("sampleGetLastClosingPrice_xml");
      objService.setOperation("GetLastClosingPrice");
      objService.setEndpointURL(eg.wsdl3.proxy.convertURI(objService.getEndpointURL()));

      // Support for Static mode
      objService.setMode(eg.wsdl3.APP.getJSXByName("radLive").getSelected());

      // moved out from onBeforeSend -- modified for 34sample
var dialog = eg.wsdl3.APP.getBodyBlock().load("components/dialogClosingPrice.xml",true);
dialog.setWidth(300,false);
dialog.setHeight(100,true);
dialog.getCaptionBar().setText(eg.wsdl3.getComplexValue(),true);

      //subscribe and call
      objService.subscribe(jsx3.net.Service.ON_SUCCESS, wsdl3.onGetLastClosingPriceSuccess);
      objService.subscribe(jsx3.net.Service.ON_ERROR, wsdl3.onGetLastClosingPriceError);
      objService.subscribe(jsx3.net.Service.ON_INVALID, wsdl3.onGetLastClosingPriceInvalid);
      objService.doCall();
    };

  /**
   * Does nothing after successful web service call.
   *
   * @param objEvent {String} static field event type for successful response.
   */
     wsdl3.onGetLastClosingPriceSuccess = function(objEvent) {
       // Nothing interesting happens in this code, the interesting bits are in the
       // onBeforeSend of the Input operation of the sampleGetLastClosingPrice mapping rule.
    };

  /**
   * Calls an alert with HTTP status code on failed service call attempt.
   *
   * @param objEvent {String} static field event type for unsuccessful response.
   */
    wsdl3.onGetLastClosingPriceError = function(objEvent) {
      var myStatus = objEvent.target.getRequest().getStatus();
      wsdl3.APP.alert("Error","The service call failed. The HTTP Status code is: " + myStatus);
    };

   /**
    * Creates an alert box if one or more restrictions fails during message generation.
    *
    * @param objEvent {String} static field event type for message generation.
    */
    wsdl3.onGetLastClosingPriceInvalid = function(objEvent) {
     wsdl3.APP.alert("Invalid","The following message node just failed validation:\n\n" + objEvent.message);
    };

  /**
   * Returns the ticker symbol of the selected security from the list object.
   *
   * @returns {String} the selected stock symbol.
   */
  wsdl3.getComplexValue = function() {
    var caption = "Today's closing price for: ";
    var objList = wsdl3.APP.getJSXByName("mtxResultsList");
    var objRecord = objList.getRecord(objList.getValue());
    var securityNode;
    if (objRecord.Security)
        securityNode = objRecord.Security;
    return  caption + securityNode;
  };

  }
);


text:
package com.flyco.dialogsamples.adapter;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.flyco.dialog.entity.DialogMenuItem;

import java.util.ArrayList;

public class TestAdapter extends BaseAdapter {
	private Context mContext;
	private ArrayList<DialogMenuItem> mMenuItems;
	private DisplayMetrics mDisplayMetrics;

	public TestAdapter(Context context, ArrayList<DialogMenuItem> customBaseItems) {
		this.mContext = context;
		this.mMenuItems = customBaseItems;

		mDisplayMetrics = new DisplayMetrics();
		((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(mDisplayMetrics);
	}

	@Override
	public int getCount() {
		return mMenuItems.size();
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		final DialogMenuItem item = mMenuItems.get(position);

		LinearLayout ll_item = new LinearLayout(mContext);
		ll_item.setOrientation(LinearLayout.HORIZONTAL);
		ll_item.setGravity(Gravity.CENTER_VERTICAL);

		ImageView iv_item = new ImageView(mContext);
		iv_item.setPadding(0, 0, (int) (15 * mDisplayMetrics.density), 0);
		ll_item.addView(iv_item);

		TextView tv_item = new TextView(mContext);
		tv_item.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
				LinearLayout.LayoutParams.WRAP_CONTENT));
		tv_item.setSingleLine(true);
		tv_item.setTextColor(Color.parseColor("#303030"));
		tv_item.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);

		ll_item.addView(tv_item);
		ll_item.setPadding(item.mResId == 0 ? (int) (18 * mDisplayMetrics.density) : (int) (16 * mDisplayMetrics.density), (int) (10 * mDisplayMetrics.density), 0,
				(int) (10 * mDisplayMetrics.density));

		iv_item.setImageResource(item.mResId);
		tv_item.setText(item.mOperName);
		iv_item.setVisibility(item.mResId == 0 ? View.GONE : View.VISIBLE);

		return ll_item;
	}
}


text:
'use babel';

import React from 'react';
import Profile from '../components/Profile';
import {connect} from 'react-redux';
import sidebarActions from '../actions/sidebar';

class AtomiesStatusBar extends React.Component {

  _setActive(avatar) {
    this.props.dispatch(sidebarActions.setActive(avatar));
  }

  render() {
    const avatars = [
      'https://avatars3.githubusercontent.com/u/238180?v=3&s=460',
      'https://avatars3.githubusercontent.com/u/238179?v=3&s=460',
      'https://avatars3.githubusercontent.com/u/238178?v=3&s=460',
    ];

    return (

         this._setActive(avatars[0]) }><Profile avatar={ avatars[0] } />
         this._setActive(avatars[1]) }><Profile avatar={ avatars[1] } />
         this._setActive(avatars[2]) }><Profile avatar={ avatars[2] } />

    );
  }
}

const selectSidebar = (state) => {
  return {
    sidebar: state.get('sidebar'),
  };
};

export default connect(selectSidebar)(AtomiesStatusBar);


text:
package org.apache.tika.parser.isatab;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Collections;
import java.util.Locale;
import java.util.Set;

import org.apache.tika.config.ServiceLoader;
import org.apache.tika.detect.AutoDetectReader;
import org.apache.tika.exception.TikaException;
import org.apache.tika.io.CloseShieldInputStream;
import org.apache.tika.io.IOUtils;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.mime.MediaType;
import org.apache.tika.parser.AbstractParser;
import org.apache.tika.parser.ParseContext;
import org.apache.tika.sax.XHTMLContentHandler;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;

/**
 * Format Specification:
 * http://isatab.sourceforge.net/docs/ISA-TAB_release-candidate
 * -1_v1.0_24nov08.pdf
 *
 */
public class ISATabInvestigationParser extends AbstractParser {

	/**
	 * Serial version UID
	 */
	private static final long serialVersionUID = -7682305811427263516L;

	private static final ServiceLoader LOADER = new ServiceLoader(
			ISATabInvestigationParser.class.getClassLoader());

	private final Set<MediaType> SUPPORTED_TYPES = Collections
			.singleton(MediaType.application("x-isatab-investigation"));

	// TODO This list includes only the investigation section.
	private String[] sections = {"INVESTIGATION", "INVESTIGATION PUBLICATIONS", "INVESTIGATION CONTACTS"};

	@Override
	public Set<MediaType> getSupportedTypes(ParseContext context) {
		return SUPPORTED_TYPES;
	}

	@Override
	public void parse(InputStream stream, ContentHandler handler,
			Metadata metadata, ParseContext context) throws IOException,
			SAXException, TikaException {

		// Automatically detect the character encoding
		AutoDetectReader reader = new AutoDetectReader(new CloseShieldInputStream(stream), metadata, context.get(ServiceLoader.class, LOADER));

		try {
			Charset charset = reader.getCharset();
			MediaType type = new MediaType(MediaType.application("x-isatab-investigation"), charset);
			metadata.set(Metadata.CONTENT_TYPE, type.toString());
			metadata.set(Metadata.CONTENT_ENCODING, charset.name());
			extractMetadata(reader, metadata);

			XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
			xhtml.startDocument();
			// TODO
			xhtml.endDocument();
		} finally {
			reader.close();
		}
	}

	private void extractMetadata(Reader reader, Metadata metadata) throws IOException {
		boolean section = false;

		BufferedReader bufReader = new BufferedReader(reader);

		String line = null;
		while ((line = bufReader.readLine()) != null) {
			String[] values = line.split("\t");
			// checks for "investigation" section headers; all uppercase and a single value.
			if (line.toUpperCase(Locale.ENGLISH).equals(line) && (values.length == 1)) {
				// investigation sections only!
				section = Arrays.asList(sections).contains(line);
			}
			else {
				if (section) {
					for (int i=1; i < values.length; i++) {
						metadata.add(values[0], values[i].replaceAll("(^\")|(\"$)",""));
					}
				}
			}
		}
	}
}


text:
package com.sun.xml.ws.transport.httpspi.servlet;

import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletContextAttributeEvent;
import jakarta.servlet.ServletContextAttributeListener;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import jakarta.xml.ws.WebServiceException;
import java.net.URL;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Parses {@code sun-jaxws.xml} and sets up
 * {@link com.sun.xml.ws.transport.httpspi.servlet.EndpointAdapter}s for all deployed endpoints.
 *
 *

 * This code is the entry point at the server side in the servlet deployment.
 * The user application writes this in their web.xml so that we can
 * start when the container starts the webapp.
 *
 * @author Jitendra Kotamraju
 */
public final class WSSPIContextListener
    implements ServletContextAttributeListener, ServletContextListener {

    private WSServletDelegate delegate;

    @Override
    public void attributeAdded(ServletContextAttributeEvent event) {
    }

    @Override
    public void attributeRemoved(ServletContextAttributeEvent event) {
    }

    @Override
    public void attributeReplaced(ServletContextAttributeEvent event) {
    }

    @Override
    public void contextDestroyed(ServletContextEvent event) {
        if (delegate != null) { // the deployment might have failed.
            delegate.destroy();
        }

        if (logger.isLoggable(Level.INFO)) {
            logger.info("JAX-WS context listener destroyed");
        }
    }

    @Override
    public void contextInitialized(ServletContextEvent event) {
        if (logger.isLoggable(Level.INFO)) {
            logger.info("JAX-WS context listener initializing");
        }
        ServletContext context = event.getServletContext();
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        if (classLoader == null) {
            classLoader = getClass().getClassLoader();
        }
        try {
            // Parse the descriptor file and build endpoint infos
            DeploymentDescriptorParser<EndpointAdapter> parser = new DeploymentDescriptorParser<>(
                    classLoader, new ServletResourceLoader(context), new EndpointAdapterFactory());
            URL sunJaxWsXml = context.getResource(JAXWS_RI_RUNTIME);
            if(sunJaxWsXml==null)
                throw new WebServiceException("Runtime descriptor "+JAXWS_RI_RUNTIME+" is mising");
            List<EndpointAdapter> adapters = parser.parse(sunJaxWsXml.toExternalForm(), sunJaxWsXml.openStream());
            for(EndpointAdapter adapter : adapters) {
                adapter.publish();
            }

            delegate = createDelegate(adapters, context);

            context.setAttribute(WSSPIServlet.JAXWS_RI_RUNTIME_INFO,delegate);

        } catch (Throwable e) {
            logger.log(Level.SEVERE, "failed to parse runtime descriptor", e);
            context.removeAttribute(WSSPIServlet.JAXWS_RI_RUNTIME_INFO);
            throw new WebServiceException("failed to parse runtime descriptor", e);
        }
    }

    /**
     * Creates {@link com.sun.xml.ws.transport.httpspi.servlet.WSServletDelegate} that does the real work.
     */
    protected WSServletDelegate createDelegate(List<EndpointAdapter> adapters, ServletContext context) {
        return new WSServletDelegate(adapters,context);
    }

    private static final String JAXWS_RI_RUNTIME = "/WEB-INF/sun-jaxws.xml";

    private static final Logger logger =
        Logger.getLogger(WSSPIContextListener.class.getName());

}


text:
<?php

namespace VideoGamesRecords\CoreBundle\Controller;

use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\NoResultException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use VideoGamesRecords\CoreBundle\Entity\Player;
use VideoGamesRecords\CoreBundle\Service\LostPositionManager;

/**
 * Class LostPositionController
 */
class LostPositionController extends AbstractController
{
    private LostPositionManager $lostPositionManager;

    public function __construct(LostPositionManager $lostPositionManager)
    {
        $this->lostPositionManager = $lostPositionManager;
    }

    /**
     * @param Player $player
     * @return int
     * @throws NoResultException
     * @throws NonUniqueResultException
     */
    public function getPlayerNbLostPosition(Player $player): int
    {
        return $this->lostPositionManager->getNbLostPosition($player);
    }

    /**
     * @param Player $player
     * @return int
     * @throws NoResultException
     * @throws NonUniqueResultException
     */
    public function getPlayerNbNewLostPosition(Player $player): int
    {
        return $this->lostPositionManager->getNbNewLostPosition($player);
    }
}


text:
app.controller('dashboardController', function($scope) {
    $scope.message = 'Dashboard controller';
});


text:
Drawio.strings['drawio_updating_page'] = 'Обновление страницы';
Drawio.strings['drawio_error_saving' ] = 'Ошибка при сохранении диаграммы:\n';
Drawio.strings['drawio_http_401'     ] = 'Не авторизован';
Drawio.strings['drawio_http_404'     ] = 'Убедитесь, что WebDAV для модуля DMSF включен';
Drawio.strings['drawio_http_409'     ] = 'Убедитесь, что DMSF папка существует и доступна';
Drawio.strings['drawio_http_422'     ] = 'Размер диаграммы слишком большой: увеличьте максимальный размер вложений в настройках Redmine';
Drawio.strings['drawio_http_502'     ] = 'Убедитесь, что WebDAV для модуля DMSF включен в режиме чтения/записи';
Drawio.strings['drawiosave_error'    ] = 'Error while saving the attachment';
// CKEditor plugin messages
Drawio.strings['drawio_cke_diagName'       ] = 'Название диаграммы';
Drawio.strings['drawio_cke_diagType'       ] = 'Формат диаграммы';
Drawio.strings['drawio_cke_size'           ] = 'Ширина (в пикселах)';
Drawio.strings['drawio_cke_attach_dlgtitle'] = 'Определить прикрепленную диаграмму';
Drawio.strings['drawio_cke_attach_btnlabel'] = 'Прикрепленная Drawio-диаграмма';
Drawio.strings['drawio_cke_dmsf_dlgtitle'  ] = 'Определить DMSF-диаграмму';
Drawio.strings['drawio_cke_dmsf_btnlabel'  ] = 'Drawio DMSF-диаграмма';

// Standard jstoolbar editor messages
Drawio.strings['drawio_btn_ok'      ] = 'Вставить макрос';
Drawio.strings['drawio_btn_cancel'  ] = 'Отмена';
Drawio.strings['drawio_attach_title'] = 'Прикрепить к Drawio-диаграмме';
Drawio.strings['drawio_dmsf_title'  ] = 'Использовать Drawio-диаграмму, сохраненную в DMSF-модуле';


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sitecore.Foundation.SitecoreExtensions.Tests.HtmlHelper
{
  using System.Web.Mvc;
  using System.Xml;
  using System.Xml.Linq;
  using FluentAssertions;
  using FluentAssertions.Xml;
  using Sitecore.Extensions;
  using Sitecore.Extensions.XElementExtensions;
  using Sitecore.Foundation.SitecoreExtensions.HtmlHelpers;
  using Sitecore.Foundation.SitecoreExtensions.Repositories;
  using Sitecore.Foundation.Testing.Attributes;
  using Sitecore.Mvc;
  using Sitecore.Mvc.Common;
  using Sitecore.Mvc.Extensions;
  using Sitecore.Mvc.Presentation;
  using Xunit;

  public class FormHelpersTests
  {
    [Theory]
    [AutoDbData]
    public void FormHandler_CurrentRenderingNull_ShouldReturnNull(HtmlHelper helper)
    {
      helper.FormHandler().Should().BeNull();
    }

    [Theory]
    [AutoDbData]
    public void FormHandler_CurrentRenderingNotNull_ShouldReturnHiddenInput(HtmlHelper helper)
    {
      var id = Guid.NewGuid();
      ContextService.Get().Push(new RenderingContext() {Rendering =  new Rendering() {UniqueId = id} });
      helper.Sitecore().CurrentRendering.Should().NotBeNull();
      var xml = XDocument.Parse(helper.FormHandler().ToString());
      xml.Root.Name.LocalName.Should().Be("input");
      xml.Root.GetAttributeValue("name").Should().Be("uid");
      Guid.Parse(xml.Root.GetAttributeValue("value")).Should().Be(id);
    }
  }
}


text:
## Curate your city's hidden gems for others to fall in love with or cure your wanderlust by exploring the city through a new perspective ##

## Summary ##
  > Ever eaten Ike's Daemon Bruce? Or bought a sword at the Mission pirate shop and challenged someone to a duel? Go on a solo adventure or invite your friends to explore scavenger hunts created by city veterans.

  > Love your city, and want to share your favorite spots with the world? Spread the love by creating a scavenger hunt for fellow urban explorers to enjoy.

## Problem ##
> Popular travel sites do not offer resources for fully immersing yourself and exploring a city. They focus on advertising commercial events and standard tourist attractions, while completely omitting many of the greatest secrets around town.

## Solution ##
> {Scavenger Hunt} distills local knowledge into tours and games that cost you nothing to explore. It's a great way to get to know a new city, or rediscover your home town, like having a few dozen locals show you around town whenever you're ready to go.

> Wanderlust is a beautiful feeling and we want to provide you with the right map for your journey. Share the joys of exploration and set up your own scavenger hunt for others to discover. Or take the plunge on an adventure of your own, laid out by a playful expert around town.

## Quote from You ##
  > This shit rocks

## How to Get Started ##
  > There are already amazing free tours waiting for you to discover. Just launch the app, and launch yourself out of that chair. Visit people and places you never knew about by taking a curated tour that matches your own interests.

## Customer Quote ##
  > "The San Francisco Mission scavenger hunt was an entire day's worth of adventure. I had no idea any of these places existed, and would have never been able to find them on Trip Advisor or Google. It was like I had a friend lead me around town the whole time. "

## Closing and Call to Action ##
  > Curate a trip. Go explore. Cure wanderlust.


text:
MathJax.Localization.addTranslation("lb","HTML-CSS",{
        version: "2.7.2",
        isLoaded: true,
        strings: {

        }
});

MathJax.Ajax.loadComplete("[MathJax]/localization/lb/HTML-CSS.js");


text:
<?php

namespace ANSI;

use ANSI\Color\ColorInterface;
use ANSI\Color\Mode;
use RuntimeException;

abstract class Terminal implements TerminalInterface
{

    /**
     * The current state of the terminal, bold, underscore, and colors
     * @var TerminalState
     */
    protected $currentState;

    /**
     * The desired state built during calls to set different styles of the terminal
     * The new styling is accumulated and sent out when a display is requested
     *
     * @var TerminalState
     */
    protected $desiredState;

    /**
     * The generator of escape sequencing based on the mode of the terminal
     * @var EscapeSequenceGenerator
     */
    protected $generator;

    /**
     * The prompt caret shown after the text of the prompt
     * @var string - the character
     */
    protected $promptCaret = ">";

    /**
     * Clio constructor.
     * @param Mode | int | string $mode
     *      Mode
     *          send in a Mode object built already
     *      integer -
     *          send in the desired number of colors to pick the closest mode (<16 for VT100, >16 and <256 for xterm and > 256 for RGB)
     *      string -
     *          send in one of the constants Mode::VT100, Mode::XTERM, or Mode::RGB
     *          send in one of the actual string values for the constants (case insensitive) "vt100", "RGB", "xterm"
     */
    public function __construct($mode = Mode::XTERM)
    {

        // initialize the current and desired state to empty (no styling)
        $this->currentState = new TerminalState();
        $this->desiredState = new TerminalState();

        // create a new generator
        $mode = new Mode($mode);
        $this->generator = new EscapeSequenceGenerator($mode);

    }

    /**
     * Set the state of the terminal directly
     *
     * @param TerminalStateInterface $state
     */
    public function setState(TerminalStateInterface $state) {

        // copy the state as now the desired state
        $this->desiredState = clone $state;

    }

    /**
     * Gets the desired state of the terminal, note that this is not related to the actual state
     * of the terminal, rather, the desired state that will happen the next time text is output
     *
     * @return TerminalStateInterface
     */
    public function getState() {

        // return the current desired state
        return $this->desiredState;
    }

    /////////////////////////////////////////////////////////////////////////////////////////
    //                                 Abstract Methods                                    //
    /////////////////////////////////////////////////////////////////////////////////////////

    /**
     *
     * All output goes to this function
     *
     * @param string $text
     */
    abstract public function output($text);

    /**
     * Anytime the cursor is returned to the leftmost column, this is fired
     */
    abstract public function carriageReturn();

    /////////////////////////////////////////////////////////////////////////////////////////
    //                                          Bold                                       //
    /////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Set bolding on or off
     *
     * @param boolean $on
     *
     * @return $this;
     */
    public function setBold($on = true) {

        // set the desired bold state
        $this->desiredState->setBold($on);

        // chaining
        return $this;
    }

    /**
     * Returns the current desired state of bolding, this may not represent what has
     * been commanded to the terminal, but rather the current intent.  Commanding only
     * happens with display
     *
     * @return bool
     */
    public function getBold() {

        // return the desired state of bold
        return $this->desiredState->isBold();
    }

    /////////////////////////////////////////////////////////////////////////////////////////
    //                                      Underscore                                     //
    /////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Set underscoring on or off
     *
     * @param boolean $on
     *
     * @return $this;
     */
    public function setUnderscore($on = true) {

        // set the desired underscoring state
        $this->desiredState->setUnderscore($on);

        // chaining
        return $this;
    }

    /**
     * Returns the current desired state of underscoring, this may not represent what has
     * been commanded to the terminal, but rather the current intent.  Commanding only
     * happens with display
     *
     * @return bool
     */
    public function getUnderscore() {

        // return the desired state of bold
        return $this->desiredState->isUnderscore();
    }

    /////////////////////////////////////////////////////////////////////////////////////////
    //                                       Colors                                        //
    /////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Set the text color
     *
     * @param ColorInterface | string | integer | array | null $color
     *      Color parameters can be:
     *          - Object adhering to the Color Interface
     *          - A color name "Antique White" or "antiquewhite"
     *          - Xterm integer from 0-255
     *          - [R,G,B]
     *          - null
     *
     * @return $this
     */
    public function setTextColor($color) {

        // set the desired text color
        $this->desiredState->setTextColor($color);

        // chaining
        return $this;

    }

    /**
     * Return the currently desired text color, keep in mind this may not be what has
     * been commanded to the terminal, the commanding only goes out the door with display
     *
     * @return ColorInterface
     */
    public function getTextColor() {

        // return the current desired text color
        return $this->desiredState->getTextColor();
    }

    /**
     * Set the fill color
     *
     * @param ColorInterface | string | integer | array | null $color
     *     Color parameters can be:
     *          - Object adhering to the Color Interface
     *          - A color name "Antique White" or "antiquewhite"
     *          - Xterm integer from 0-255
     *          - [R,G,B]
     *          - null
     *
     * @return $this
     */
    public function setFillColor($color) {

        // remember the desired fill color
        $this->desiredState->setFillColor($color);

        // chaining
        return $this;
    }

    /**
     * Return the currently desired fill color, keep in mind this may not be what has
     * been commanded to the terminal, the commanding only goes out the door with display
     *
     * @return ColorInterface
     */
    public function getFillColor() {

        // return the current desired text color
        return $this->desiredState->getFillColor();
    }

    /**
     * Set both the fill and text colors
     *
     * @param $textColor int|string|null $color - can be either a Color constant Color::Blue or a string with the same spelling "blue", "Red", "LIGHT CYAN", etc
     * @param $fillColor int|string|null $color - can be either a Color constant Color::Blue or a string with the same spelling "blue", "Red", "LIGHT CYAN", etc
     *
     * @return $this
     */
    public function setColors($textColor = null, $fillColor = null) {

        // set the desired text and fill
        $this->desiredState->setTextColor($textColor);
        $this->desiredState->setFillColor($fillColor);

        // chaining
        return $this;
    }

    /////////////////////////////////////////////////////////////////////////////////////////
    //                                       Display                                       //
    /////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Clear away all formatting - bold, underscore, text and fill color
     *
     * @param boolean $rightAway - whether to send out the escape sequence right away
     *          or allow the display to do it later
     * @return $this
     */
    public function clear($rightAway = false) {

        // clear the old settings
        $this->desiredState->clear();

        // if it desired to send out the clear sequence right away
        if ($rightAway) {

            // send it out
            $this->output(EscapeSequenceGenerator::generateClearSequence());

            // reset the two states to cleared
            $this->currentState = new TerminalState();
            $this->desiredState = new TerminalState();
        }

        // chaining
        return $this;
    }

    /**
     * Send out the escape sequence which will accomplish the desired state
     */
    public function outputEscapeSequence() {

        // send out any escaping to implement anything sitting in the desired state
        $this->output($this->generator->generate($this->currentState, $this->desiredState));

        // copy the current state to the now achieved desired state
        $this->currentState = clone $this->desiredState;
    }

    /**
     * Display the text.  This does not jump down to a new line.
     * If a temporary style is used, only the values that are not null will be used.
     *
     * @param $text
     *
     * @return $this
     */
    public function display($text) {

        // send out any escaping to implement anything sitting in the desired state
        $this->outputEscapeSequence();

        // Send out the text
        $this->output($text);

        // chaining
        return $this;
    }

    /**
     * Move the cursor to the next line
     * This is not an ANSI sequence, but rather the ASCII code 12 or \n
     *
     * @param int $count - the number of newlines to output
     * @return $this
     */
    public function newLine($count = 1) {

        // send out any escaping to implement anything sitting in the desired state
        $this->outputEscapeSequence();

        // if the $count is greater than one
        if (is_int($count) && $count > 1) {

            // send out the \n $count times
            for ($i=0; $i<$count; ++$i) {

                // echo the newline character
                $this->output("\n");
            }

        } else {
            // the parameter might be one or something crazy, just output one
            // echo the new line character
            $this->output("\n");
        }

        // fire the handler that indicates the cursor is sent to the left margin
        $this->carriageReturn();

        // chaining
        return $this;
    }

    /**
     * Clear the screen and move cursor to the top.
     *
     * @return $this
     */
    public function clearScreen() {

        // send out any escaping to implement anything sitting in the desired state
        $this->outputEscapeSequence();

        // escape sequences to clear screen and move it up
        $this->output(EscapeSequenceGenerator::generateClearScreenSequence());

        // fire the handler that indicates the cursor is sent to the left margin
        $this->carriageReturn();

        // chaining
        return $this;
    }

    /**
     * Produce a beep on the terminal, this is not part of ANSI, but rather and ASCII code
     * It may or may not work on other terminal emulators.
     */
    public function beep() {

        // sequence for beep
        $this->output("\007");

        // chaining
        return $this;
    }

    /**
     * Override the default of ">" as the prompt caret.  Do not add a space (that is done automatically)
     *
     * @param string | null $caret - send in null to reset to '>'
     * @return $this
     */
    public function caret($caret = null) {

        // if it is a string (even one with no length)
        if (is_string($caret)) {

            // save it
            $this->promptCaret = $caret;

        } else {

            // reset caret to the default
            $this->promptCaret = ">";
        }

        // chaining
        return $this;
    }

    /**
     * Prompt for a value.
     *
     * @param $text - the prompt string
     * @return string
     */
    public function prompt($text) {

        // send out any escaping to implement anything sitting in the desired state
        $this->outputEscapeSequence();

        // save off the prompt string
        $prompt = $text  . $this->promptCaret . " ";

        // prompt and return the answer
        return $this->readUserInput($prompt);

    }

    /**
     * Helper function to call the php function readline, just for stubbing out stdin
     * @param string $prompt
     * @return string - the answer typed by the user
     * @codeCoverageIgnore
     */
    public function readUserInput($prompt) {
        return readline($prompt);
    }

    /////////////////////////////////////////////////////////////////////////////////////////
    //                                 Property Getters                                    //
    /////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Error handler to catch errors when using the exec() function
     * @param int $errno
     * @param string $errstr
     * @throws RuntimeException
     */
    private static function errorHandler($errno, $errstr) {

        // generate the error (this has to be global to the class)
        // build the message
        $message = "The PHP CLI php.ini file has disable_function = exec, or an invalid \$TERM, it cannot determine screen attributes.\n";

        // add the error number if there is one
        if ($errno) {

            // append the error number to the string
            $message .= "[PHP #{$errno}] {$errstr}";
        }

        // throw the exception that can be caught
        throw new RuntimeException($message);

    }

    /**
     * Get the current screen terminal type
     *
     * @return string - the terminal type
     */
    public static function getTerminalType() {

        // return the value of the $TERM environment variable
        return getenv("TERM");

    }

    /**
     * Get the current screen height
     *
     * @uses errorHandler
     * @return int - the number of lines it holds
     * @throws RuntimeException
     */
    public static function getScreenHeight() {

        // set a simple error handler that indicates the exec function was disabled
        set_error_handler("self::errorHandler", E_WARNING);

        // initialize the array for the output of the execute
        $output = [];

        // execute the bash command tput cols to determine the screen width
        $height = exec("tput lines 2>&1", $output);

        // if the height is zero, then something went wrong
        if ($height == 0 || $height == "" || is_null($height)) {

            // use the error handler to raise the exception
            self::errorHandler(null,null );

        }

        // put back the error handler
        restore_error_handler();

        // return the width
        return intval($height);

    }

    /**
     * Get the current screen width
     *
     * @uses errorHandler
     * @return int - the number of characters that will fit across the screen
     * @throws RuntimeException
     */
    public static function getScreenWidth() {

        // set a simple error handler that indicates the exec function was disabled
        set_error_handler("self::errorHandler", E_WARNING);

        // initialize the array for the output of the execute
        $output = [];

        // execute the bash command tput cols to determine the screen width
        $width = exec("tput cols 2>&1", $output);

        // if the height is zero, then something went wrong
        if (count($output) == 0 ||$width == 0 || $width == "" || is_null($width)) {

            // use the error handler to raise the exception
            self::errorHandler(null,null);

        }

        // put back the error handler
        restore_error_handler();

        // return the height
        return intval($width);

    }

    /**
     * Get the current maximum colors
     *
     * @uses errorHandler
     * @return int - the maximum colors, so far, 8, 16 and 256 should be expected
     */
    public static function getScreenMaxColors() {

        // set a simple error handler that indicates the exec function was disabled
        set_error_handler("self::errorHandler", E_WARNING);

        // execute the bash command tput cols to determine the screen width
        $maxColors = exec('tput colors');

        // put back the error handler
        restore_error_handler();

        // return the max colors
        return intval($maxColors);

    }

}


text:
<?php

namespace Extraload\Transformer;

interface TransformerInterface
{
    public function transform($data);
}


text:
package Google::Ads::AdWords::v201402::AlertQuery;
use strict;
use warnings;

__PACKAGE__->_set_element_form_qualified(1);

sub get_xmlns { 'https://adwords.google.com/api/adwords/mcm/v201402' };

our $XML_ATTRIBUTE_CLASS;
undef $XML_ATTRIBUTE_CLASS;

sub __get_attr_class {
    return $XML_ATTRIBUTE_CLASS;
}

use Class::Std::Fast::Storable constructor => 'none';
use base qw(Google::Ads::SOAP::Typelib::ComplexType);

{ # BLOCK to scope variables

my %clientSpec_of :ATTR(:get<clientSpec>);
my %filterSpec_of :ATTR(:get<filterSpec>);
my %types_of :ATTR(:get<types>);
my %severities_of :ATTR(:get<severities>);
my %triggerTimeSpec_of :ATTR(:get<triggerTimeSpec>);
my %triggerTime_of :ATTR(:get<triggerTime>);
my %clientCustomerIds_of :ATTR(:get<clientCustomerIds>);

__PACKAGE__->_factory(
    [ qw(        clientSpec
        filterSpec
        types
        severities
        triggerTimeSpec
        triggerTime
        clientCustomerIds

    ) ],
    {
        'clientSpec' => \%clientSpec_of,
        'filterSpec' => \%filterSpec_of,
        'types' => \%types_of,
        'severities' => \%severities_of,
        'triggerTimeSpec' => \%triggerTimeSpec_of,
        'triggerTime' => \%triggerTime_of,
        'clientCustomerIds' => \%clientCustomerIds_of,
    },
    {
        'clientSpec' => 'Google::Ads::AdWords::v201402::ClientSpec',
        'filterSpec' => 'Google::Ads::AdWords::v201402::FilterSpec',
        'types' => 'Google::Ads::AdWords::v201402::AlertType',
        'severities' => 'Google::Ads::AdWords::v201402::AlertSeverity',
        'triggerTimeSpec' => 'Google::Ads::AdWords::v201402::TriggerTimeSpec',
        'triggerTime' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
        'clientCustomerIds' => 'SOAP::WSDL::XSD::Typelib::Builtin::long',
    },
    {

        'clientSpec' => 'clientSpec',
        'filterSpec' => 'filterSpec',
        'types' => 'types',
        'severities' => 'severities',
        'triggerTimeSpec' => 'triggerTimeSpec',
        'triggerTime' => 'triggerTime',
        'clientCustomerIds' => 'clientCustomerIds',
    }
);

} # end BLOCK

1;

=pod

=head1 NAME

Google::Ads::AdWords::v201402::AlertQuery

=head1 DESCRIPTION

Perl data type class for the XML Schema defined complexType
AlertQuery from the namespace https://adwords.google.com/api/adwords/mcm/v201402.

Querying criteria for getting alerts.

=head2 PROPERTIES

The following properties may be accessed using get_PROPERTY / set_PROPERTY
methods:

=over

=item * clientSpec

=item * filterSpec

=item * types

=item * severities

=item * triggerTimeSpec

=item * triggerTime

=item * clientCustomerIds

=back

=head1 METHODS

=head2 new

Constructor. The following data structure may be passed to new():

=head1 AUTHOR

Generated by SOAP::WSDL

=cut


text:
define([
    "dojo/_base/declare",
    "dojo/_base/lang",
    "dojo/dom-class",
    "dijit/_WidgetBase",
    "dojo/dom",
    "dojo/on",
    "esri/arcgis/utils",
    "esri/arcgis/Portal",
    "dojo/Deferred",
    "dojo/cookie",
    "dojo/i18n!application/nls/resources"
],
  function (declare, lang, domClass, _WidgetBase, dom, on, arcgisUtils, portal, Deferred, cookie, nls) {
    var Widget = declare([_WidgetBase], {
      declaredClass: "application.signInHelper",
      _portal: null,
      cred: "esri_jsapi_id_manager_data",
      constructor: function () {
        this._portal = new portal.Portal(this._getPortalURL());
      },

      createPortal: function () {
        // create portal
        var deferred = new Deferred();
        // portal loaded
        this.own(on(this._portal, "Load", lang.hitch(this, function () {
          this._portal.signIn().then(function (loggedInUser) {
            deferred.resolve(loggedInUser);
          }, function (err) {
            deferred.reject(err);
          });
        })));

        return deferred.promise;
      },

      _getPortalURL: function () {
        return arcgisUtils.arcgisUrl.split('/sharing/')[0];
      },

      getPortal: function () {
        return this._portal;
      },

      reportError: function (error) {
        // remove loading class from body
        domClass.remove(document.body, "app-loading");
        domClass.add(document.body, "app-error");
        // an error occurred - notify the user. In this example we pull the string from the
        // resource.js file located in the nls folder because we've set the application up
        // for localization. If you don't need to support multiple languages you can hardcode the
        // strings here and comment out the call in index.html to get the localization strings.
        // set message
        var node = dom.byId("loading_message");
        if (node) {
          if (this.config && this.config.i18n) {
            node.innerHTML = this.config.i18n.map.error + ": " + error.message;
          } else {
            node.innerHTML = "Unable to create map: " + error.message;
          }
        }
      }

    });
    return Widget;
  });


text:
<?php
include_once '_start.php';

use Bootstrapper\Helpers;

class HelpersTest extends BootstrapperWrapper
{

    public function testOutputCorrectCSSLinks()
    {
        $css = Helpers::get_CSS();

        $this->assertEquals(
            "<link rel='stylesheet' href='//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css'><link rel='stylesheet' href='//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css'>",
            $css
        );
    }

    public function testOutputCorrectJSLinks()
    {
        $js = Helpers::get_JS();

        $this->assertEquals(
            "<script src='http://code.jquery.com/jquery-2.1.0.min.js'></script><script src='//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js'></script>",
            $js
        );
    }

}

?>


text:
Some Togglz sample applications.

Hint: The samples have been moved to the togglz project itself: https://github.com/togglz/togglz/tree/master/samples


text:
package com.example.elliottross23.androidcomponents.utils;

import android.app.Activity;
import android.view.inputmethod.InputMethodManager;

/**
 * Created by elliottross on 8/17/15.
 */
public class SystemUtils {

    public static void hideKeyboard(Activity activity) {
        InputMethodManager imm = (InputMethodManager) activity.getSystemService(activity.INPUT_METHOD_SERVICE);

        if(imm.isAcceptingText()) { // verify if the soft keyboard is open
            imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
        }
    }
}


text:
class CreateProductsDigidownloads < ActiveRecord::Migration

  def up
    create_table :refinery_digidownloads do |t|
      t.references :product
      t.string    :download_token, :unique => true, :null => false
      t.integer   :download_completed, :default => 0
      t.integer   :download_remaining, :default => 0
      t.integer   :download_count,     :default => 0
      t.integer   :restrict_count
      t.integer   :restrict_days
      t.boolean   :is_defunct,         :default => false

      t.has_attached_file :doc
      t.has_attached_file :preview

      t.integer :position

      t.timestamps
    end

    add_index :refinery_digidownloads, :product_id
    add_index :refinery_digidownloads, :download_token

  end

  def down

    drop_table :refinery_digidownloads

  end

end


text:
<!DOCTYPE html>

<meta name="viewport" content="width=800">

    This text should be autosized to 80px computed font-size (16 * 800/320 * 2, where 2 is the fontScaleFactor).

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sapien sapien, tempus id egestas a, consectetur et felis. Ut pharetra mi eget lectus laoreet rutrum. Mauris tellus odio, egestas vitae sodales in, vehicula eget ante. Pellentesque id egestas arcu. Quisque tellus quam, rhoncus ac elementum vel, volutpat vel felis. Aliquam ut leo dolor, eget egestas tellus. Nunc ut velit gravida nisl fringilla rutrum eget at arcu. Vivamus et pretium mauris.


text:
<html>
<head>
<meta http-equiv="refresh" content="0; url=https://developers.liveperson.com/consumer-experience-ios-sdk-handlepush.html" />
</head>
</html>


text:
// Copyright (C) 2011 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.package com.google.gerrit.server.git;

package com.google.gerrit.server.project;

import com.google.common.cache.Cache;
import com.google.gerrit.common.data.AccessSection;
import com.google.gerrit.server.cache.CacheModule;
import com.google.gerrit.server.util.MostSpecificComparator;
import com.google.inject.Inject;
import com.google.inject.Module;
import com.google.inject.Singleton;
import com.google.inject.name.Named;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.List;

/** Caches the order AccessSections should be sorted for evaluation. */
@Singleton
public class SectionSortCache {
  private static final Logger log =
      LoggerFactory.getLogger(SectionSortCache.class);

  private static final String CACHE_NAME = "permission_sort";

  public static Module module() {
    return new CacheModule() {
      @Override
      protected void configure() {
        cache(CACHE_NAME, EntryKey.class, EntryVal.class);
        bind(SectionSortCache.class);
      }
    };
  }

  private final Cache<EntryKey, EntryVal> cache;

  @Inject
  SectionSortCache(@Named(CACHE_NAME) Cache<EntryKey, EntryVal> cache) {
    this.cache = cache;
  }

  void sort(String ref, List<AccessSection> sections) {
    final int cnt = sections.size();
    if (cnt <= 1) {
      return;
    }

    EntryKey key = new EntryKey(ref, sections);
    EntryVal val = cache.getIfPresent(key);
    if (val != null) {
      int[] srcIdx = val.order;
      if (srcIdx != null) {
        AccessSection[] srcList = copy(sections);
        for (int i = 0; i < cnt; i++) {
          sections.set(i, srcList[srcIdx[i]]);
        }
      } else {
        // Identity transform. No sorting is required.
      }

    } else {
      boolean poison = false;
      IdentityHashMap<AccessSection, Integer> srcMap =
          new IdentityHashMap<AccessSection, Integer>();
      for (int i = 0; i < cnt; i++) {
        poison |= srcMap.put(sections.get(i), i) != null;
      }

      Collections.sort(sections, new MostSpecificComparator(ref));

      int srcIdx[];
      if (isIdentityTransform(sections, srcMap)) {
        srcIdx = null;
      } else {
        srcIdx = new int[cnt];
        for (int i = 0; i < cnt; i++) {
          srcIdx[i] = srcMap.get(sections.get(i));
        }
      }

      if (poison) {
        log.error("Received duplicate AccessSection instances, not caching sort");
      } else {
        cache.put(key, new EntryVal(srcIdx));
      }
    }
  }

  private static AccessSection[] copy(List<AccessSection> sections) {
    return sections.toArray(new AccessSection[sections.size()]);
  }

  private static boolean isIdentityTransform(List<AccessSection> sections,
      IdentityHashMap<AccessSection, Integer> srcMap) {
    for (int i = 0; i < sections.size(); i++) {
      if (i != srcMap.get(sections.get(i))) {
        return false;
      }
    }
    return true;
  }

  static final class EntryKey {
    private final String ref;
    private final String[] patterns;
    private final int hashCode;

    EntryKey(String refName, List<AccessSection> sections) {
      int hc = refName.hashCode();
      ref = refName;
      patterns = new String[sections.size()];
      for (int i = 0; i < patterns.length; i++) {
        String n = sections.get(i).getName();
        patterns[i] = n;
        hc = hc * 31 + n.hashCode();
      }
      hashCode = hc;
    }

    @Override
    public int hashCode() {
      return hashCode;
    }

    @Override
    public boolean equals(Object other) {
      if (other instanceof EntryKey) {
        EntryKey b = (EntryKey) other;
        return ref.equals(b.ref) && Arrays.equals(patterns, b.patterns);
      }
      return false;
    }
  }

  static final class EntryVal {
    /**
     * Maps the input index to the output index.
     * <p>
     * For {@code x == order[y]} the expression means move the item at
     * source position {@code x} to the output position {@code y}.
     */
    final int[] order;

    EntryVal(int[] order) {
      this.order = order;
    }
  }

}


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

<title>NaturalLogSeriesElement</title>
<meta name="date" content="2017-01-04">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.drip.function.r1tor1

Class NaturalLogSeriesElement

java.lang.Object

org.drip.function.definition.R1ToR1

org.drip.function.r1tor1.NaturalLogSeriesElement

public class NaturalLogSeriesElement
extends R1ToR1

NaturalLogSeriesElement implements an element in the natural log series expansion.

Author:

Lakshmi Krishnamurthy

Constructor Summary

Constructors

Constructor and Description

NaturalLogSeriesElement(int iExponent)

NaturalLogSeriesElement constructor

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

double
derivative(double dblVariate,
          int iOrder)

Calculate the derivative as a double

double
evaluate(double dblVariate)

Evaluate for the given variate

int
getExponent()

Retrieve the exponent in the natural log series

double
integrate(double dblBegin,
         double dblEnd)

Integrate over the given range

Methods inherited from class org.drip.function.definition.R1ToR1

differential, differential, maxima, maxima, minima, minima

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

NaturalLogSeriesElement

public NaturalLogSeriesElement(int iExponent)
                        throws java.lang.Exception

NaturalLogSeriesElement constructor

Parameters:

iExponent - The series exponent

Throws:

java.lang.Exception - Thrown if the inputs are invalid

Method Detail

evaluate

public double evaluate(double dblVariate)
                throws java.lang.Exception

Description copied from class: R1ToR1

Evaluate for the given variate

Specified by:

evaluate in class R1ToR1

Parameters:

dblVariate - Variate

Returns:

Returns the calculated value

Throws:

java.lang.Exception - Thrown if evaluation cannot be done

derivative

public double derivative(double dblVariate,
                         int iOrder)
                  throws java.lang.Exception

Description copied from class: R1ToR1

Calculate the derivative as a double

Overrides:

derivative in class R1ToR1

Parameters:

dblVariate - Variate at which the derivative is to be calculated

iOrder - Order of the derivative to be computed

Returns:

The Derivative

Throws:

java.lang.Exception - Thrown if Inputs are Invalid

integrate

public double integrate(double dblBegin,
                        double dblEnd)
                 throws java.lang.Exception

Description copied from class: R1ToR1

Integrate over the given range

Overrides:

integrate in class R1ToR1

Parameters:

dblBegin - Range Begin

dblEnd - Range End

Returns:

The Integrated Value

Throws:

java.lang.Exception - Thrown if evaluation cannot be done

getExponent

public int getExponent()

Retrieve the exponent in the natural log series

Returns:

Exponent in the natural log series

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
#include "config.h"
#include "platform/fonts/Font.h"

#include "platform/fonts/TestFontSelector.h"
#include "platform/fonts/TypesettingFeatures.h"
#include "public/platform/WebUnitTestSupport.h"

#include <gtest/gtest.h>

namespace blink {

static inline String fontPath(String relativePath)
{
    return Platform::current()->unitTestSupport()->webKitRootDir()
        + String("/Source/platform/testing/data/")
        + relativePath;
}

TEST(FontPlatformDataTest, AhemHasNoSpaceInLigaturesOrKerning)
{
    Font font = createTestFont("Ahem", fontPath("Ahem.woff"));
    const FontPlatformData& platformData = font.primaryFont()->platformData();
    TypesettingFeatures features = Kerning | Ligatures;

    EXPECT_FALSE(platformData.hasSpaceInLigaturesOrKerning(features));
}

TEST(FontPlatformDataTest, AhemSpaceLigatureHasSpaceInLigaturesOrKerning)
{
    Font font = createTestFont("AhemSpaceLigature", fontPath("AhemSpaceLigature.woff"));
    const FontPlatformData& platformData = font.primaryFont()->platformData();
    TypesettingFeatures features = Kerning | Ligatures;

    EXPECT_TRUE(platformData.hasSpaceInLigaturesOrKerning(features));
}

TEST(FontPlatformDataTest, AhemSpaceLigatureHasNoSpaceWithoutFontFeatures)
{
    Font font = createTestFont("AhemSpaceLigature", fontPath("AhemSpaceLigature.woff"));
    const FontPlatformData& platformData = font.primaryFont()->platformData();
    TypesettingFeatures features = 0;

    EXPECT_FALSE(platformData.hasSpaceInLigaturesOrKerning(features));
}

} // namespace blink


text:
#import "S3AccessControlListUnmarshaller.h"

@implementation S3AccessControlListUnmarshaller

#pragma mark NSXMLParserDelegate implementation

-(void) parser:(NSXMLParser *)parser
didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qualifiedName
attributes:(NSDictionary *)attributeDict
{
    [super parser:parser didStartElement:elementName namespaceURI:namespaceURI qualifiedName:qualifiedName attributes:attributeDict];

    if ([elementName isEqualToString:@"Owner"]) {
        [parser setDelegate:[[[S3OwnerUnmarshaller alloc] initWithCaller:self withParentObject:self.accessControlList withSetter:@selector(setOwner:)] autorelease]];
    }

    if ([elementName isEqualToString:@"Grant"]) {
        [parser setDelegate:[[[S3GrantUnmarshaller alloc] initWithCaller:self withParentObject:self.accessControlList withSetter:@selector(addGrant:)] autorelease]];
    }
}

-(void) parser:(NSXMLParser *)parser
didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName
{
    [super parser:parser didEndElement:elementName namespaceURI:namespaceURI qualifiedName:qName];

    if ([elementName isEqualToString:@"AccessControlPolicy"]) {
        if (caller != nil) {
            [parser setDelegate:caller];
        }

        if (parentObject != nil && [parentObject respondsToSelector:parentSetter]) {
            [parentObject performSelector:parentSetter withObject:self.accessControlList];
        }

        return;
    }
}

#pragma mark Unmarshalled object property

-(S3AccessControlList *)accessControlList
{
    if (nil == accessControlList)
    {
        accessControlList = [[S3AccessControlList alloc] init];
    }
    return accessControlList;
}

-(void)dealloc
{
    [accessControlList release];
    [super dealloc];
}

@end


text:
module CreatesCommit
  extend ActiveSupport::Concern

  def create_commit(service, success_path:, failure_path:, failure_view: nil, success_notice: nil)
    set_commit_variables

    commit_params = @commit_params.merge(
      source_project: @project,
      source_branch: @ref,
      target_branch: @target_branch
    )

    result = service.new(@tree_edit_project, current_user, commit_params).execute

    if result[:status] == :success
      update_flash_notice(success_notice)

      respond_to do |format|
        format.html { redirect_to final_success_path(success_path) }
        format.json { render json: { message: "success", filePath: final_success_path(success_path) } }
      end
    else
      flash[:alert] = result[:message]
      respond_to do |format|
        format.html do
          if failure_view
            render failure_view
          else
            redirect_to failure_path
          end
        end
        format.json { render json: { message: "failed", filePath: failure_path } }
      end
    end
  end

  def authorize_edit_tree!
    return if can_collaborate_with_project?

    access_denied!
  end

  private

  def update_flash_notice(success_notice)
    flash[:notice] = success_notice || "Your changes have been successfully committed."

    if create_merge_request?
      if merge_request_exists?
        flash[:notice] = nil
      else
        target = different_project? ? "project" : "branch"
        flash[:notice] << " You can now submit a merge request to get this change into the original #{target}."
      end
    end
  end

  def final_success_path(success_path)
    return success_path unless create_merge_request?

    merge_request_exists? ? existing_merge_request_path : new_merge_request_path
  end

  def new_merge_request_path
    new_namespace_project_merge_request_path(
      @mr_source_project.namespace,
      @mr_source_project,
      merge_request: {
        source_project_id: @mr_source_project.id,
        target_project_id: @mr_target_project.id,
        source_branch: @mr_source_branch,
        target_branch: @mr_target_branch
      }
    )
  end

  def existing_merge_request_path
    namespace_project_merge_request_path(@mr_target_project.namespace, @mr_target_project, @merge_request)
  end

  def merge_request_exists?
    return @merge_request if defined?(@merge_request)

    @merge_request = @mr_target_project.merge_requests.opened.find_by(
      source_branch: @mr_source_branch,
      target_branch: @mr_target_branch
    )
  end

  def different_project?
    @mr_source_project != @mr_target_project
  end

  def different_branch?
    @mr_source_branch != @mr_target_branch || different_project?
  end

  def create_merge_request?
    params[:create_merge_request].present? && different_branch?
  end

  def set_commit_variables
    @mr_source_branch ||= @target_branch

    if can?(current_user, :push_code, @project)
      # Edit file in this project
      @tree_edit_project = @project
      @mr_source_project = @project

      if @project.forked?
        # Merge request from this project to fork origin
        @mr_target_project = @project.forked_from_project
        @mr_target_branch = @mr_target_project.repository.root_ref
      else
        # Merge request to this project
        @mr_target_project = @project
        @mr_target_branch ||= @ref
      end
    else
      # Edit file in fork
      @tree_edit_project = current_user.fork_of(@project)
      # Merge request from fork to this project
      @mr_source_project = @tree_edit_project
      @mr_target_project = @project
      @mr_target_branch ||= @ref
    end
  end
end


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
in Ainsworth, Sparrow & Susmann, The Fungi (London) 4A: 154 (1973)

#### Original name
Aulographaceae Luttr.

### Remarks
null


text:
<?php

namespace Resty\Loggy;

// Logger
use Resty\Loggy\LogLevelTrait;
use Resty\Loggy\LoggerTrait;
// PSR
use Psr\Log\LoggerInterface;

/**
 * Logger
 *
 * @category  Loggy
 * @package   Loggy
 * @author    Federico Lozada Mosto <mosto.federico@gmail.com>
 * @copyright 2016 Federico Lozada Mosto <mosto.federico@gmail.com>
 * @license   MIT License (http://www.opensource.org/licenses/mit-license.php)
 * @link      http://www.mostofreddy.com.ar
 */
class Logger implements LoggerInterface
{
    use LogLevelTrait;
    use LoggerTrait;

    const EMERGENCY = 1;
    const ALERT = 2;
    const CRITICAL = 4;
    const ERROR = 8;
    const WARNING = 16;
    const NOTICE = 32;
    const INFO = 64;
    const DEBUG = 128;

    protected $uid = '';
    protected $handlers = [];

    /********************************************************************************
     * Constructor
     *******************************************************************************/

    /**
     * Construye un logger
     *
     * @param string $channel  [description]
     * @param [type] $handlers [description]
     *
     * @return [type]           [description]
     */
    public static function get(string $channel, array $handlers)
    {
        $logger = new static();
        return $logger->setUid(static::generateUid())
            ->setHandlers($handlers)
            ->setChannel($channel);
    }

    /**
     * Genera un identificador único para todos los logs de un request
     *
     * @return string
     */
    public static function generateUid():string
    {
        static $uid = null;
        if ($uid === null) {
            $now = \DateTime::createFromFormat('U.u', microtime(true), static::timezone());
            $uid = md5($now->format("Y-m-d\TH:i:s.uO"));
        }
        return $uid;
    }

    /**
     * Devuelve el timezone
     *
     * @return \DateTimeZone
     */
    protected static function timezone()
    {
        static $timezone = null;
        if ($timezone == null) {
            $timezone = new \DateTimeZone('UTC');
        }
        return $timezone;
    }

    /********************************************************************************
     * Setters
     *******************************************************************************/
    /**
     * Setea el uid
     *
     * @param string $uid UID
     *
     * @return self
     */
    public function setUid(string $uid)
    {
        $this->uid = $uid;
        return $this;
    }
    /**
     * Setea el nombre del canal, nombre del logger
     *
     * @param string $channel Nombre
     *
     * @return self
     */
    public function setChannel(string $channel)
    {
        $this->channel = $channel;
        return $this;
    }
    /**
     * Setea los distintos handlers para el logger
     *
     * @param array $handlers Array de handlers
     *
     * @return self
     */
    public function setHandlers(array $handlers)
    {
        $this->handlers = $handlers;
        return $this;
    }

    /********************************************************************************
     * Handler
     *******************************************************************************/

    /**
     * Publica un mensaje
     *
     * @param int    $level   Log Level
     * @param string $message Mensaje
     * @param array  $context Contexto
     *
     * @return Logger
     */
    public function log($level, $message, array $context = array()):Logger
    {
        $msg = $this->formatMessage($level, $message, $context);
        foreach ($this->handlers as $handler) {
            $handler($level, $msg);
        }
        return $this;
    }

    /**
     * Renderiza el formato del mensaje
     *
     * @param int    $level   Log Level
     * @param string $message Mensaje
     * @param array  $context Contecto
     *
     * @return string
     */
    public function formatMessage($level, string $message, array $context = array()):string
    {

        $dateTime = new \DateTime();
        $dateTime->setTimezone(static::timezone());
        return $dateTime->format('[c]')
            ." ".$this->getLogLevelName($level)
            ." @".$this->channel
            ." uid:".$this->uid
            ." - "
            .$message
            ." - "
            .json_encode($context);
    }
}


text:
package com.raizlabs.android.dbflow.structure;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import com.raizlabs.android.dbflow.annotation.ConflictAction;
import com.raizlabs.android.dbflow.annotation.PrimaryKey;
import com.raizlabs.android.dbflow.config.FlowManager;
import com.raizlabs.android.dbflow.sql.SqlUtils;
import com.raizlabs.android.dbflow.sql.builder.ConditionQueryBuilder;

/**
 * Author: andrewgrosner
 * Description: Internal adapter that gets extended when a {@link com.raizlabs.android.dbflow.annotation.Table} gets used.
 */
public abstract class ModelAdapter<ModelClass extends Model>
        implements InternalAdapter<ModelClass, ModelClass>, InstanceAdapter<ModelClass, ModelClass> {

    private ConditionQueryBuilder<ModelClass> mPrimaryWhere;

    private SQLiteStatement mInsertStatement;

    /**
     * @return The precompiled insert statement for this table model adapter
     */
    public SQLiteStatement getInsertStatement() {
        if (mInsertStatement == null) {
            mInsertStatement = FlowManager.getDatabaseForTable(getModelClass())
                    .getWritableDatabase().compileStatement(getInsertStatementQuery());
        }

        return mInsertStatement;
    }

    /**
     * Creates a new {@link ModelClass} and Loads the cursor into a the object.
     *
     * @param cursor The cursor to load
     * @return A new {@link ModelClass}
     */
    public ModelClass loadFromCursor(Cursor cursor) {
        ModelClass model = newInstance();
        loadFromCursor(cursor, model);
        return model;
    }

    /**
     * Saves the specified model to the DB using the specified saveMode in {@link com.raizlabs.android.dbflow.sql.SqlUtils}.
     *
     * @param model The model to save/insert/update
     */
    @Override
    public void save(ModelClass model) {
        SqlUtils.save(model, this, this);
    }

    /**
     * Inserts the specified model into the DB.
     *
     * @param model The model to insert.
     */
    @Override
    public void insert(ModelClass model) {
        SqlUtils.insert(model, this, this);
    }

    /**
     * Updates the specified model into the DB.
     *
     * @param model The model to update.
     */
    @Override
    public void update(ModelClass model) {
        SqlUtils.update(model, this, this);
    }

    /**
     * Deletes the model from the DB
     *
     * @param model The model to delete
     */
    @Override
    public void delete(ModelClass model) {
        SqlUtils.delete(model, this, this);
    }

    /**
     * If a {@link com.raizlabs.android.dbflow.structure.Model} has an autoincrementing primary key, then
     * this method will be overridden.
     *
     * @param model The model object to store the key
     * @param id    The key to store
     */
    @Override
    public void updateAutoIncrement(ModelClass model, long id) {

    }

    /**
     * @return The value for the {@link PrimaryKey#autoincrement()}
     * if it has the field. This method is overridden when its specified for the {@link ModelClass}
     */
    @Override
    public long getAutoIncrementingId(ModelClass model) {
        throw new InvalidDBConfiguration(
                String.format("This method may have been called in error. The model class %1s must contain" +
                              "a single primary key (if used in a ModelCache, this method may be called)",
                              getModelClass()));
    }

    /**
     * @return The autoincrement column name for the {@link PrimaryKey#autoincrement()}
     * if it has the field. This method is overridden when its specified for the {@link ModelClass}
     */
    public String getAutoIncrementingColumnName() {
        throw new InvalidDBConfiguration(
                String.format("This method may have been called in error. The model class %1s must contain" +
                              "an autoincrementing or single int/long primary key (if used in a ModelCache, this method may be called)",
                              getModelClass()));
    }

    /**
     * @param model The model to retrieve the caching id from.
     * @return The id that comes from the model. This is generated by subclasses of this adapter.
     */
    @Override
    public Object getCachingId(ModelClass model) {
        return getAutoIncrementingId(model);
    }

    /**
     * @return The name of the column used in caching. By default it uses the auto increment column,
     * when specified in the {@link com.raizlabs.android.dbflow.annotation.Table}, it is overridden.
     */
    public String getCachingColumnName() {
        return getAutoIncrementingColumnName();
    }

    /**
     * @param cursor      The cursor to retrieve data from.
     * @param columnIndex The column index to retrieve data from.
     * @return The cache id value from the {@link Cursor}. This is generated since not all
     * columns have the same value.
     */
    public Object getCachingIdFromCursorIndex(Cursor cursor, int columnIndex) {
        return cursor.getLong(columnIndex);
    }

    @Override
    public boolean hasCachingId() {
        return false;
    }

    /**
     * @return Only created once if doesn't exist, the extended class will return the builder to use.
     */
    protected abstract ConditionQueryBuilder<ModelClass> createPrimaryModelWhere();

    /**
     * Will create the where query only once that is used to check for existence in the DB.
     *
     * @return The WHERE query containing all primary key fields
     */
    public ConditionQueryBuilder<ModelClass> getPrimaryModelWhere() {
        if (mPrimaryWhere == null) {
            mPrimaryWhere = createPrimaryModelWhere();
        }
        mPrimaryWhere.setUseEmptyParams(true);
        return mPrimaryWhere;
    }

    /**
     * @return The query used to create this table.
     */
    public abstract String getCreationQuery();

    /**
     * @return The query used to insert a model using a {@link android.database.sqlite.SQLiteStatement}
     */
    protected abstract String getInsertStatementQuery();

    /**
     * @return The conflict algorithm to use when updating a row in this table.
     */
    public ConflictAction getUpdateOnConflictAction() {
        return ConflictAction.ABORT;
    }

    /**
     * @return The conflict algorithm to use when inserting a row in this table.
     */
    public ConflictAction getInsertOnConflictAction() {
        return ConflictAction.ABORT;
    }
}


text:
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.tenant;

import com.yahoo.config.model.api.TenantSecretStore;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.TenantName;
import com.yahoo.container.jdisc.secretstore.SecretStore;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author olaa
 */
public class SecretStoreExternalIdRetriever {

    private static final String SECRET_NAME_FORMAT = "%s.external.id.%s.%s";

    public static List<TenantSecretStore> populateExternalId(SecretStore secretStore, TenantName tenant, SystemName system, List<TenantSecretStore> tenantSecretStores) {
        return tenantSecretStores.stream()
                .map(tenantSecretStore -> {
                    var secretName = secretName(tenant, system, tenantSecretStore.getName());
                    String secret = secretStore.getSecret(secretName);
                    if (secret == null)
                     throw new RuntimeException("No secret found in secret store for " + secretName);
                    return tenantSecretStore.withExternalId(secret);
                })
                .collect(Collectors.toList());
    }

    public static String secretName(TenantName tenant, SystemName system, String storeName) {
        return String.format(SECRET_NAME_FORMAT, tenantSecretGroup(system), tenant.value(), storeName);
    }

    private static String tenantSecretGroup(SystemName system) {
        switch (system) {
            case Public:
                return "vespa.external.tenant.secrets";
            case PublicCd:
                return "vespa.external.cd.tenant.secrets";
            default:
                throw new IllegalArgumentException("No tenant secret store key group defined for system " + system);
        }
    }

}