text:
## Storage Account key 가져오기

Storage account에는 두 개의 보안키가 있으며, 다음과 같은 방법으로 키 값을 반환할 수 있습니다.

#### Azure Service Management(Classic)

ASM에서는 Get-AzureStorageKey라는 cmdlet을 사용합니다.

```PowerShell
$subscriptionName = "your subscription name"

Select-AzureRmSubscription -SubscriptionName $subscriptionName

$storageAccountName = "your storage account name"

(Get-AzureStorageKey -StorageAccountName $storageAccountName).Primary
(Get-AzureStorageKey -StorageAccountName $storageAccountName).Secondary
```

마지막 두 줄은 Primary와 Secondary만 다릅니다.
Primary는 Primary Access Key를, Secondary는 Secondary Key를 의미합니다.

![](https://jyseongfileshare.blob.core.windows.net/images/storage_account-10.png)

#### Azure Resource Manager(ARM)

ARM에서는 Get-AzureRmStorageAccountKey cmdlet을 사용합니다.

```PowerShell
$resourceGroupName = "your resource group name"
$storageAccountName = "your storage account"

(Get-AzureRmStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageAccountName).Value[0]
(Get-AzureRmStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageAccountName).Value[1]
```

Get-AzureStorageKey cmdlet과는 달리, Primary/Secondary 대신 Value[0]/Value[1]을 사용합니다.
여기서 Value[0]은 포털의 key1을,  Value[1]은 key2를 의미합니다.

![](https://jyseongfileshare.blob.core.windows.net/images/storage_account-11.png)

## Storage Account key 다시 생성하기

Storage Account key는 다양한 이유(보안 규정, 관리 목적 등)로 인해서, 주기적으로 변경을 권고하고 있습니다.
Web 응용 프로그램에서 storage account를 사용하고 있다면, 다음과 같은 순서에 따라서 Storage account key의 변경 절차를 고려해야 합니다.

0. Web 응용 프로그램의 구성 파일에서는 Primary key를 사용하는 것으로 간주합니다.
1. 사용하는 Storage account의 Secondary key를 새로운 key로 다시 생성합니다.
2. Web 응용 프로그램의 구성 파일의 Key 값을 1단계에서 새로 생성한 Key로 변경합니다.
3. Storage account의 Primary key를 새로운 key로 다시 생성합니다.

Storage account의 key를 다시 생성하는 방법은 다음과 같습니다.

#### Azure Service Management(Classic)

```PowerShell
$subscriptionName = "your subscription name"

Select-AzureRmSubscription -SubscriptionName $subscriptionName

$storageAccountName = "your storage account name"

New-AzureStorageKey -StorageAccountName $storageAccountName -KeyType Primary
New-AzureStorageKey -StorageAccountName $storageAccountName -KeyType Secondary
```

#### Azure Resource Manager(ARM)

```PowerShell
$resourceGroupName = "your resource group name"
$storageAccountName = "your storage account"

New-AzureRmStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageAccountName -KeyName key1
New-AzureRmStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageAccountName -KeyName key2
```

참고 자료
- [Get-AzureStorageKey](https://msdn.microsoft.com/en-us/library/azure/dn495235.aspx)
- [Get-AzureRmStorageAccountKey](https://msdn.microsoft.com/en-us/library/mt607145.aspx)
- [New-AzureStorageKey](https://msdn.microsoft.com/en-us/library/azure/dn495112.aspx)
- [New-AzureRmStorageAccountKey](https://msdn.microsoft.com/en-us/library/mt607143.aspx)


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

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

MsetCommand: Contents
  MSET _key1_ _value1_ _key2_ _value2_ ... _keyN_ _valueN_ (Redis >
  MSETNX _key1_ _value1_ _key2_ _value2_ ... _keyN_ _valueN_ (Redis >
    MSET Return value
    MSETNX Return value

MsetCommand

                    ï»¿#sidebar StringCommandsSidebar
MSET _key1_ _value1_ _key2_ _value2_ ... _keyN_ _valueN_ (Redis >
 1.1) =

MSETNX _key1_ _value1_ _key2_ _value2_ ... _keyN_ _valueN_ (Redis >
 1.1) =
Time complexity: O(1) to set every key
Set the the respective keys to the respective values. MSET will replace oldvalues with new values, while MSETNX will not perform any operation at alleven if just a single key already exists.

Because of this semantic MSETNX can be used in order to set different keysrepresenting different fields of an unique logic object in a way thatensures that either all the fields or none at all are set.

Both MSET and MSETNX are atomic operations. This means that for instanceif the keys A and B are modified, another client talking to Redis can eithersee the changes to both A and B at once, or no modification at all.

MSET Return value
Status code reply Basically +OK as MSET can't fail
MSETNX Return value
Integer reply, specifically:

1 if the all the keys were set
0 if no key was set (at least one key already existed)

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

  <title>SWARMOPS</title>
  <link rel="icon" href="data:,">
  <meta name="application-name" content="swarwopm">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">

SWARMOPS

DOCKER SWARM REAL-TIME MONITORING

    Your browser doesn't support iframes.

      Designed by cdelaitre / Running on  / Powered by


text:
package rhttpc.echo

import org.scalatest.matchers.should.Matchers
import org.scalatest.flatspec.AnyFlatSpec

class FailNTimesThanReplyWithMessageSpec extends AnyFlatSpec with Matchers {

  it should "recognize pattern" in {
    val FailNTimesThanReplyWithMessage(count, message) = "fail-3-times-than-reply-with-foo"
    count shouldEqual 3
    message shouldEqual "foo"
  }

}


text:
package tiamat.compiler;

import org.apache.commons.io.IOUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

class AssetsUtils {

    static String readString(String fileName) {
        try {
            FileInputStream fis = new FileInputStream(new File("src/test/assets", fileName));
            return IOUtils.toString(fis, "UTF-8");
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        }
    }
}


text:
package org.kaazing.gateway.transport.http.security.auth.token;

import static org.kaazing.gateway.transport.http.HttpHeaders.HEADER_AUTHORIZATION;

import java.io.UnsupportedEncodingException;
import java.util.Set;

import org.kaazing.gateway.resource.address.http.HttpRealmInfo;
import org.kaazing.gateway.security.auth.token.DefaultAuthenticationToken;
import org.kaazing.gateway.server.spi.security.AuthenticationToken;
import org.kaazing.gateway.transport.http.HttpCookie;
import org.kaazing.gateway.transport.http.bridge.HttpRequestMessage;

public class AbstractAuthenticationTokenExtractor implements AuthenticationTokenExtractor {

    @Override
    public AuthenticationToken extract(HttpRequestMessage httpRequest, HttpRealmInfo realm) throws UnsupportedEncodingException {
        DefaultAuthenticationToken result = new DefaultAuthenticationToken();

        extractAuthorizationHeader(httpRequest, result);

        final String[] httpHeaders = realm.getHeaderNames();
        final String[] httpQueryParameters = realm.getParameterNames();
        final String[] httpCookieNames = realm.getAuthenticationCookieNames();

        if ( httpHeaders != null && httpHeaders.length > 0 ) {
            extractHttpHeaders(httpRequest, httpHeaders, result);
        }

        if ( httpQueryParameters != null && httpQueryParameters.length > 0 ) {
            extractQueryParameters(httpRequest, httpQueryParameters, result);
        }

        if ( httpCookieNames != null && httpCookieNames.length > 0 ) {
            extractCookies(httpRequest, httpCookieNames, result);
        }

        return result;
    }

    protected void extractHttpHeaders(HttpRequestMessage httpRequest, String[] httpHeaders, DefaultAuthenticationToken result) {
        for ( String headerName: httpHeaders ) {
            //TODO: support multiple values for headers
            String value = httpRequest.getHeader(headerName);
            if ( value != null ) {
                if ( result.get(headerName) != null ) {
                    throw new IllegalStateException("Cannot authenticate with multiple http header values for header name \""+headerName+"\"");
                }
                result.add(headerName, value);
            }
        }
    }

    protected void extractQueryParameters(HttpRequestMessage httpRequest, String[] httpQueryParameters, DefaultAuthenticationToken result) {
        for ( String parameterName: httpQueryParameters ) {
            //TODO: support multiple values for parameters
            String value = httpRequest.getParameter(parameterName);
            if ( value != null ) {
                if ( result.get(parameterName) != null ) {
                    throw new IllegalStateException("Cannot authenticate with multiple http parameter values for parameter name \""+parameterName+"\"");
                }
                result.add(parameterName, value);
            }
        }
    }

     protected void extractCookies(HttpRequestMessage httpRequest, String[] httpCookieNames, DefaultAuthenticationToken result) {
        for ( String cookieName: httpCookieNames ) {
            Set<HttpCookie> cookies =  httpRequest.getCookies();
            if ( cookies != null ) {
                for (HttpCookie cookie: cookies) {
                    if ( cookieName != null && cookieName.equals(cookie.getName()) ) {
                        String value = cookie.getValue();
                        if ( value != null ) {
                            if ( result.get(cookieName) != null ) {
                                throw new IllegalStateException("Cannot authenticate with multiple http cookie values for cookie name \""+cookieName+"\"");
                            }
                            result.add(cookieName, value);
                        }
                    }
                }
            }
        }
    }

    private void extractAuthorizationHeader(HttpRequestMessage httpRequest, DefaultAuthenticationToken result) {
        if (httpRequest.hasHeader(HEADER_AUTHORIZATION) ) {
            String authorization = httpRequest.getHeader(HEADER_AUTHORIZATION).trim();

            // We have to be careful when handling any client-supplied data.  In
            // this particular case, we need to extract the challenge scheme from
            // the Authorization: header -- and it may not be there, or may not be
            // there in the form we expect.

            int idx = -1;

            for (int i = 0; i < authorization.length(); i++) {
                if (Character.isWhitespace(authorization.charAt(i))) {
                    idx = i;
                    break;
                }
            }

            if (idx == -1) {
                // The client sent a badly formed Authorization: header value,
                // where only the scheme was provided.  The login modules will
                // be the judge of how to handle this.
                result.setScheme(authorization);

            } else {
                String scheme = authorization.substring(0, idx);
                authorization = authorization.substring(idx+1);

                result.setScheme(scheme);
                if (authorization.length() > 0) {
                    result.add(authorization);
                }
            }
        }
    }
}


text:
package LeetCodePerformancePractice;

public class _383RansomNote {
	public static void main(String[] args) {
		System.out.println(canConstruct("a", "z"));
		System.out.println(canConstruct("aa", "ab"));
		System.out.println(canConstruct("aa", "aab"));
	}
	public static boolean canConstruct(String ransomNote, String magazine) {
		char c[]=new char[26];
		for (int i = 0; i < magazine.length(); i++) {
			c[magazine.charAt(i)-97]++;
		}
		for (int i = 0; i < ransomNote.length(); i++) {
			if(c[ransomNote.charAt(i)-97]<=0)
				return false;
			else
				c[ransomNote.charAt(i)-97]--;
		}
		return true;
	}
}


text:
title: Connect Apps to QuickBooks Online
connection: QuickBooks Online
image: /media/connections/quickbooks.png
seo_alias: quickbooks-online
description: Learn how to add login functionality to your app with QuickBooks Online. You will need to obtain a Client ID and Client Secret for QuickBooks Online.
toc: true
public: true
index: 6
topics:
  - connections
  - social
  - quickbooks-online
contentType: how-to
useCase:
    - customize-connections
    - add-idp
---
<%= include('../../../snippets/social/quickbooks-online/0') %>
<%= include('../../../snippets/social/quickbooks-online/1') %>
<%= include('../../../snippets/social/quickbooks-online/2') %>
<%= include('../../../snippets/social/quickbooks-online/3') %>
<%= include('../../../snippets/social/quickbooks-online/4') %>
<%= include('../../../snippets/social/quickbooks-online/5') %>
<%= include('../_quickstart-links.md') %>


text:
<?php

declare(strict_types=1);

namespace Facile\MongoDbBundle\Services\Loggers;

use Facile\MongoDbBundle\Models\Query;

class MongoQueryLogger implements DataCollectorLoggerInterface
{
    /** @var \SplQueue|Query[] */
    private $logs;

    /** @var array|string[] */
    private $connections;

    /**
     * MongoQueryLogger constructor.
     */
    public function __construct()
    {
        $this->logs = new \SplQueue();
        $this->connections = [];
    }

    /**
     * @param string $connection
     */
    public function addConnection(string $connection)
    {
        $this->connections[] = $connection;
    }

    /**
     * @return array|\string[]
     */
    public function getConnections(): array
    {
        return $this->connections;
    }

    /**
     * @param Query $event
     */
    public function logQuery(Query $event)
    {
        $this->logs->enqueue($event);
    }

    /**
     * @return Query
     */
    public function getLoggedEvent(): Query
    {
        if (! $this->hasLoggedEvents()) {
            throw new \LogicException('No more events logged!');
        }

        return $this->logs->dequeue();
    }

    /**
     * @return bool
     */
    public function hasLoggedEvents(): bool
    {
        return ! $this->logs->isEmpty();
    }
}


text:
Router.configure({
  layoutTemplate:"layout"
});

Router.map(function(){
  this.route('home',{
    path:"/",
    template:"home"
  });
  this.route('projects',{
    path:'/projects',
    template:'work'
  });
  this.route('contact',{
    path:'/contact',
    template:'contact'
  });
  this.route('about',{
    path:'/about',
    template:'about'
  });

  this.route('login',{
    path:'/admin',
    template:'login'
  });

  //List Clients
  this.route('list_clients',{
    path:'/admin/clients',
    template:'list_clients',
    data:function(){
      templateData={
        clients: function(){
          return Clients.find();
        }
      }
    }
  });
  //Add a Client
  this.route('add_client',{
    path:'/admin/clients/add',
    template:'add_client'
  });

  //Edit a Client
  this.route('edit_client',{
    path:'/admin/clients/:_id/edit',
    template:'edit_client',
    data: function(){
      return Clients.findOne(this.params._id);
    }
  });

  //Timeline for a Client
  this.route('timeline',{
    path:'admin/clients/timeline',
    template: 'timeline'
  });

  //Events Routes begin here.
  this.route('list_events',{
    path:'/admin/events',
    template:'list_events'
  });
  this.route('add_event',{
    path:'/admin/events/add',
    template:'add_event'
  });
  this.route('edit_event',{
    path:'/admin/events/:_id/edit',
    template:'edit_event',
    data: function(){
      return Events.findOne(this.params._id);
    }
  });
});


text:
API Reference

Accelerometer

            Tap into the device's motion sensor.

Camera

            Capture a photo using the device's camera.

Capture

            Capture media files using device's media capture applications.

Compass

            Obtain the direction that the device is pointing.

Connection

            Quickly check the network state, and cellular network information.

Contacts

            Work with the devices contact database.

Device

            Gather device specific information.

Events

            Hook into native events through JavaScript.

File

            Hook into native file system through JavaScript.

Geolocation

            Make your application location aware.

Media

            Record and play back audio files.

Notification

            Visual, audible, and tactile device notifications.

Storage

            Hook into the devices native storage options.

Guides

Keyword Index

            Full index of the PhoneGap Documentation.


text:
namespace LiskovSubstitutionSquareBefore.Abstract
{
    public abstract class Shape
    {
        public abstract decimal Area { get; }
    }
}


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

<TITLE>
AspectQueryContext
</TITLE>

<META NAME="date" CONTENT="2014-09-10">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      ¸ÅÊö
      Èí¼þ°ü
    Àà
      ʹÓÃ
      Ê÷
      Òѹýʱ
      Ë÷Òý
      °ïÖú

 ÉÏÒ»¸öÀà
 ÏÂÒ»¸öÀà

  ¿ò¼Ü
 ÎÞ¿ò¼Ü

  ËùÓÐÀà

  ÕªÒª£º ǶÌ× | ×Ö¶Î | ¹¹Ôì·½·¨ | ·½·¨

ÏêϸÐÅÏ¢£º ×Ö¶Î | ¹¹Ôì·½·¨ | ·½·¨

darks.orm.core.aspect

Àà AspectQueryContext

java.lang.Object
  darks.orm.core.aspect.AspectQueryContext

ËùÓÐÒÑʵÏֵĽӿڣº
QueryAspect

public class AspectQueryContext
extends java.lang.Object
implements QueryAspect

¹¹Ôì·½·¨ÕªÒª

AspectQueryContext(AspectData aspectData)

·½·¨ÕªÒª

 boolean
afterInvoke(SqlSession dao,
            AspectData aspectData,
            QueryAspectWrapper queryWrapper,
            QueryEnumType queryEnumType)

 boolean
beforeInvoke(SqlSession dao,
             AspectData aspectData,
             QueryAspectWrapper queryWrapper,
             QueryEnumType queryEnumType)

 QueryAspectAdapter
createQueryAspect(AspectData aspectData)

          ¸ù¾ÝA

 AspectData
getAspectData()

 QueryAspectAdapter
getQueryAspect()

 void
setAspectData(AspectData aspectData)

 void
setQueryAspect(QueryAspectAdapter queryAspect)

´ÓÀà java.lang.Object ¼Ì³ÐµÄ·½·¨

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

¹¹Ôì·½·¨ÏêϸÐÅÏ¢

AspectQueryContext

public AspectQueryContext(AspectData aspectData)

·½·¨ÏêϸÐÅÏ¢

createQueryAspect

public QueryAspectAdapter createQueryAspect(AspectData aspectData)

¸ù¾ÝA

²ÎÊý£º
aspectData -

·µ»Ø£º

beforeInvoke

public boolean beforeInvoke(SqlSession dao,
                            AspectData aspectData,
                            QueryAspectWrapper queryWrapper,
                            QueryEnumType queryEnumType)
                     throws AspectException

Ö¸¶¨Õߣº
½Ó¿Ú QueryAspect ÖÐµÄ beforeInvoke

Å׳ö£º

AspectException

afterInvoke

public boolean afterInvoke(SqlSession dao,
                           AspectData aspectData,
                           QueryAspectWrapper queryWrapper,
                           QueryEnumType queryEnumType)
                    throws AspectException

Ö¸¶¨Õߣº
½Ó¿Ú QueryAspect ÖÐµÄ afterInvoke

Å׳ö£º

AspectException

getQueryAspect

public QueryAspectAdapter getQueryAspect()

setQueryAspect

public void setQueryAspect(QueryAspectAdapter queryAspect)

getAspectData

public AspectData getAspectData()

setAspectData

public void setAspectData(AspectData aspectData)

      ¸ÅÊö
      Èí¼þ°ü
    Àà
      ʹÓÃ
      Ê÷
      Òѹýʱ
      Ë÷Òý
      °ïÖú

 ÉÏÒ»¸öÀà
 ÏÂÒ»¸öÀà

  ¿ò¼Ü
 ÎÞ¿ò¼Ü

  ËùÓÐÀà

  ÕªÒª£º ǶÌ× | ×Ö¶Î | ¹¹Ôì·½·¨ | ·½·¨

ÏêϸÐÅÏ¢£º ×Ö¶Î | ¹¹Ôì·½·¨ | ·½·¨


text:
FROM alpine:3.5
MAINTAINER Reiji Sakao <reiji.sakao@gmail.com>

RUN apk update
RUN apk add bash gcc musl-dev alpine-sdk vim emacs

CMD ["bash"]


text:
#ifndef BMX_RDD9_PCM_TRACK_H_
#define BMX_RDD9_PCM_TRACK_H_

#include <bmx/rdd9_mxf/RDD9Track.h>
#include <bmx/mxf_helper/WaveMXFDescriptorHelper.h>

namespace bmx
{

class RDD9PCMTrack : public RDD9Track
{
public:
    RDD9PCMTrack(RDD9File *file, uint32_t track_index, uint32_t track_id, uint8_t track_type_number,
                 Rational frame_rate, EssenceType essence_type);
    virtual ~RDD9PCMTrack();

    void SetSamplingRate(Rational sampling_rate);       // default 48000/1
    void SetQuantizationBits(uint32_t bits);            // default 16
    void SetChannelCount(uint32_t count);               // default and required 1
    void SetLocked(bool locked);                        // default not set
    void SetAudioRefLevel(int8_t level);                // default not set
    void SetDialNorm(int8_t dial_norm);                 // default not set
    void SetSequenceOffset(uint8_t offset);             // default not set

public:
    const std::vector<uint32_t>& GetSampleSequence() const  { return mSampleSequence; }
    uint8_t GetSequenceOffset() const                       { return mWaveDescriptorHelper->GetSequenceOffset(); }
    std::vector<uint32_t> GetShiftedSampleSequence() const;

protected:
    virtual void PrepareWrite(uint8_t picture_track_count, uint8_t sound_track_count);
    virtual void CompleteWrite();

private:
    void SetSampleSequence();

private:
    WaveMXFDescriptorHelper *mWaveDescriptorHelper;
    std::vector<uint32_t> mSampleSequence;
};

};

#endif


text:
/*
 * Hash Chain match finder with 2-, 3-, and 4-byte hashing
 *
 * Authors: Lasse Collin <lasse.collin@tukaani.org>
 *          Igor Pavlov <http://7-zip.org/>
 *
 * This file has been put into the public domain.
 * You can do whatever you want with this file.
 */

package org.tukaani.xz.lz;

final class HC4 extends LZEncoder {
    private final Hash234 hash;
    private final int[] chain;
    private final Matches matches;
    private final int depthLimit;

    private final int cyclicSize;
    private int cyclicPos = -1;
    private int lzPos;

    /**
     * Gets approximate memory usage of the match finder as kibibytes.
     */
    static int getMemoryUsage(int dictSize) {
        return Hash234.getMemoryUsage(dictSize) + dictSize / (1024 / 4) + 10;
    }

    /**
     * Creates a new LZEncoder with the HC4 match finder.
     * See LZEncoder.getInstance for parameter descriptions.
     */
    HC4(int dictSize, int beforeSizeMin, int readAheadMax,
            int niceLen, int matchLenMax, int depthLimit) {
        super(dictSize, beforeSizeMin, readAheadMax, niceLen, matchLenMax);

        hash = new Hash234(dictSize);

        // +1 because we need dictSize bytes of history + the current byte.
        cyclicSize = dictSize + 1;
        chain = new int[cyclicSize];
        lzPos = cyclicSize;

        // Substracting 1 because the shortest match that this match
        // finder can find is 2 bytes, so there's no need to reserve
        // space for one-byte matches.
        matches = new Matches(niceLen - 1);

        // Use a default depth limit if no other value was specified.
        // The default is just something based on experimentation;
        // it's nothing magic.
        this.depthLimit = (depthLimit > 0) ? depthLimit : 4 + niceLen / 4;
    }

    /**
     * Moves to the next byte, checks that there is enough available space,
     * and possibly normalizes the hash tables and the hash chain.
     *
     * @return      number of bytes available, including the current byte
     */
    private int movePos() {
        int avail = movePos(4, 4);

        if (avail != 0) {
            if (++lzPos == Integer.MAX_VALUE) {
                int normalizationOffset = Integer.MAX_VALUE - cyclicSize;
                hash.normalize(normalizationOffset);
                normalize(chain, normalizationOffset);
                lzPos -= normalizationOffset;
            }

            if (++cyclicPos == cyclicSize)
                cyclicPos = 0;
        }

        return avail;
    }

    public Matches getMatches() {
        matches.count = 0;
        int matchLenLimit = matchLenMax;
        int niceLenLimit = niceLen;
        int avail = movePos();

        if (avail < matchLenLimit) {
            if (avail == 0)
                return matches;

            matchLenLimit = avail;
            if (niceLenLimit > avail)
                niceLenLimit = avail;
        }

        hash.calcHashes(buf, readPos);
        int delta2 = lzPos - hash.getHash2Pos();
        int delta3 = lzPos - hash.getHash3Pos();
        int currentMatch = hash.getHash4Pos();
        hash.updateTables(lzPos);

        chain[cyclicPos] = currentMatch;

        int lenBest = 0;

        // See if the hash from the first two bytes found a match.
        // The hashing algorithm guarantees that if the first byte
        // matches, also the second byte does, so there's no need to
        // test the second byte.
        if (delta2 < cyclicSize && buf[readPos - delta2] == buf[readPos]) {
            lenBest = 2;
            matches.len[0] = 2;
            matches.dist[0] = delta2 - 1;
            matches.count = 1;
        }

        // See if the hash from the first three bytes found a match that
        // is different from the match possibly found by the two-byte hash.
        // Also here the hashing algorithm guarantees that if the first byte
        // matches, also the next two bytes do.
        if (delta2 != delta3 && delta3 < cyclicSize
                && buf[readPos - delta3] == buf[readPos]) {
            lenBest = 3;
            matches.dist[matches.count++] = delta3 - 1;
            delta2 = delta3;
        }

        // If a match was found, see how long it is.
        if (matches.count > 0) {
            while (lenBest < matchLenLimit && buf[readPos + lenBest - delta2]
                                              == buf[readPos + lenBest])
                ++lenBest;

            matches.len[matches.count - 1] = lenBest;

            // Return if it is long enough (niceLen or reached the end of
            // the dictionary).
            if (lenBest >= niceLenLimit)
                return matches;
        }

        // Long enough match wasn't found so easily. Look for better matches
        // from the hash chain.
        if (lenBest < 3)
            lenBest = 3;

        int depth = depthLimit;

        while (true) {
            int delta = lzPos - currentMatch;

            // Return if the search depth limit has been reached or
            // if the distance of the potential match exceeds the
            // dictionary size.
            if (depth-- == 0 || delta >= cyclicSize)
                return matches;

            currentMatch = chain[cyclicPos - delta
                                 + (delta > cyclicPos ? cyclicSize : 0)];

            // Test the first byte and the first new byte that would give us
            // a match that is at least one byte longer than lenBest. This
            // too short matches get quickly skipped.
            if (buf[readPos + lenBest - delta] == buf[readPos + lenBest]
                    && buf[readPos - delta] == buf[readPos]) {
                // Calculate the length of the match.
                int len = 0;
                while (++len < matchLenLimit)
                    if (buf[readPos + len - delta] != buf[readPos + len])
                        break;

                // Use the match if and only if it is better than the longest
                // match found so far.
                if (len > lenBest) {
                    lenBest = len;
                    matches.len[matches.count] = len;
                    matches.dist[matches.count] = delta - 1;
                    ++matches.count;

                    // Return if it is long enough (niceLen or reached the
                    // end of the dictionary).
                    if (len >= niceLenLimit)
                        return matches;
                }
            }
        }
    }

    public void skip(int len) {
        assert len >= 0;

        while (len-- > 0) {
            if (movePos() != 0) {
                // Update the hash chain and hash tables.
                hash.calcHashes(buf, readPos);
                chain[cyclicPos] = hash.getHash4Pos();
                hash.updateTables(lzPos);
            }
        }
    }
}


text:
using System.Text.Json;
using Azure.Core;

namespace Azure.ResourceManager.Resources.Models
{
    public partial class UserAssignedResourceIdentity : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WriteEndObject();
        }

        internal static UserAssignedResourceIdentity DeserializeUserAssignedResourceIdentity(JsonElement element)
        {
            Optional<string> principalId = default;
            Optional<string> tenantId = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("principalId"))
                {
                    principalId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tenantId"))
                {
                    tenantId = property.Value.GetString();
                    continue;
                }
            }
            return new UserAssignedResourceIdentity(principalId.Value, tenantId.Value);
        }
    }
}


text:
<?xml version="1.0"?>
<!--

    Copyright (C) 2014-2018 LinkedIn Corp. (pinot-core@linkedin.com)

    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.

-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>pinot</artifactId>
    <groupId>com.linkedin.pinot</groupId>
    <version>0.016</version>
  </parent>
  <groupId>com.linkedin.pinot</groupId>
  <artifactId>pinot-transport</artifactId>
  <version>0.016</version>
  <name>pinot-transport</name>
  <url>http://maven.apache.org</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.linkedin.pinot</groupId>
      <artifactId>pinot-common</artifactId>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-all</artifactId>
    </dependency>
    <dependency>
      <groupId>com.yammer.metrics</groupId>
      <artifactId>metrics-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-mapper-asl</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-validator</groupId>
      <artifactId>commons-validator</artifactId>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
    </dependency>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <scope>test</scope>
    </dependency>
     <dependency>
       <groupId>commons-cli</groupId>
       <artifactId>commons-cli</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.helix</groupId>
      <artifactId>helix-core</artifactId>
      <exclusions>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty</artifactId>
    </dependency>
    <dependency>
      <groupId>com.linkedin.pinot</groupId>
      <artifactId>pinot-common</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>appassembler-maven-plugin</artifactId>
        <configuration>
          <programs>
            <program>
              <mainClass>com.linkedin.pinot.transport.perf.ScatterGatherPerfTester</mainClass>
              <name>perf-tester</name>
            </program>
          </programs>
          <repositoryLayout>flat</repositoryLayout>
          <repositoryName>lib</repositoryName>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
</project>


text:
// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!

#ifndef V8ScreenOrientation_h
#define V8ScreenOrientation_h

#include "bindings/core/v8/ScriptWrappable.h"
#include "bindings/core/v8/ToV8.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8DOMWrapper.h"
#include "bindings/core/v8/V8EventTarget.h"
#include "bindings/core/v8/WrapperTypeInfo.h"
#include "modules/ModulesExport.h"
#include "modules/screen_orientation/ScreenOrientation.h"
#include "platform/heap/Handle.h"

namespace blink {

class V8ScreenOrientation {
public:
    MODULES_EXPORT static bool hasInstance(v8::Local<v8::Value>, v8::Isolate*);
    static v8::Local<v8::Object> findInstanceInPrototypeChain(v8::Local<v8::Value>, v8::Isolate*);
    MODULES_EXPORT static v8::Local<v8::FunctionTemplate> domTemplate(v8::Isolate*);
    static ScreenOrientation* toImpl(v8::Local<v8::Object> object)
    {
        return toScriptWrappable(object)->toImpl<ScreenOrientation>();
    }
    MODULES_EXPORT static ScreenOrientation* toImplWithTypeCheck(v8::Isolate*, v8::Local<v8::Value>);
    MODULES_EXPORT static const WrapperTypeInfo wrapperTypeInfo;
    static void refObject(ScriptWrappable*);
    static void derefObject(ScriptWrappable*);
    template<typename VisitorDispatcher>
    static void trace(VisitorDispatcher visitor, ScriptWrappable* scriptWrappable)
    {
        visitor->trace(scriptWrappable->toImpl<ScreenOrientation>());
    }
    static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCount + 0;
    static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1;
    static void installConditionallyEnabledProperties(v8::Local<v8::Object>, v8::Isolate*) { }
    static void preparePrototypeObject(v8::Isolate*, v8::Local<v8::Object> prototypeObject, v8::Local<v8::FunctionTemplate> interfaceTemplate) { }
};

template <>
struct V8TypeOf<ScreenOrientation> {
    typedef V8ScreenOrientation Type;
};

} // namespace blink

#endif // V8ScreenOrientation_h


text:
package org.keycloak.authentication;

import org.jboss.logging.Logger;
import org.keycloak.OAuth2Constants;
import org.keycloak.authentication.authenticators.conditional.ConditionalAuthenticator;
import org.keycloak.credential.CredentialModel;
import org.keycloak.models.AuthenticationExecutionModel;
import org.keycloak.models.AuthenticationFlowModel;
import org.keycloak.models.Constants;
import org.keycloak.models.RealmModel;
import org.keycloak.models.UserModel;
import org.keycloak.services.ServicesLogger;
import org.keycloak.services.util.AuthenticationFlowHistoryHelper;
import org.keycloak.services.util.AuthenticationFlowURLHelper;
import org.keycloak.sessions.AuthenticationSessionModel;

import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;

/**
 * @author Bill Burke
 * @version $Revision: 1 $
 */
public class DefaultAuthenticationFlow implements AuthenticationFlow {
    private static final Logger logger = Logger.getLogger(DefaultAuthenticationFlow.class);
    private final List<AuthenticationExecutionModel> executions;
    private final AuthenticationProcessor processor;
    private final AuthenticationFlowModel flow;
    private boolean successful;
    private List<AuthenticationFlowException> afeList = new ArrayList<>();

    public DefaultAuthenticationFlow(AuthenticationProcessor processor, AuthenticationFlowModel flow) {
        this.processor = processor;
        this.flow = flow;
        this.executions = processor.getRealm().getAuthenticationExecutions(flow.getId());
    }

    protected boolean isProcessed(AuthenticationExecutionModel model) {
        if (model.isDisabled()) return true;
        AuthenticationSessionModel.ExecutionStatus status = processor.getAuthenticationSession().getExecutionStatus().get(model.getId());
        if (status == null) return false;
        return status == AuthenticationSessionModel.ExecutionStatus.SUCCESS || status == AuthenticationSessionModel.ExecutionStatus.SKIPPED
                || status == AuthenticationSessionModel.ExecutionStatus.ATTEMPTED
                || status == AuthenticationSessionModel.ExecutionStatus.SETUP_REQUIRED;
    }

    protected Authenticator createAuthenticator(AuthenticatorFactory factory) {
        String display = processor.getAuthenticationSession().getAuthNote(OAuth2Constants.DISPLAY);
        if (display == null) return factory.create(processor.getSession());

        if (factory instanceof DisplayTypeAuthenticatorFactory) {
            Authenticator authenticator = ((DisplayTypeAuthenticatorFactory) factory).createDisplay(processor.getSession(), display);
            if (authenticator != null) return authenticator;
        }
        // todo create a provider for handling lack of display support
        if (OAuth2Constants.DISPLAY_CONSOLE.equalsIgnoreCase(display)) {
            processor.getAuthenticationSession().removeAuthNote(OAuth2Constants.DISPLAY);
            throw new AuthenticationFlowException(AuthenticationFlowError.DISPLAY_NOT_SUPPORTED,
                    ConsoleDisplayMode.browserContinue(processor.getSession(), processor.getRefreshUrl(true).toString()));
        } else {
            return factory.create(processor.getSession());
        }
    }

    @Override
    public Response processAction(String actionExecution) {
        logger.debugv("processAction: {0}", actionExecution);

        if (actionExecution == null || actionExecution.isEmpty()) {
            throw new AuthenticationFlowException("action is not in current execution", AuthenticationFlowError.INTERNAL_ERROR);
        }
        AuthenticationExecutionModel model = processor.getRealm().getAuthenticationExecutionById(actionExecution);
        if (model == null) {
            throw new AuthenticationFlowException("action is not in current execution", AuthenticationFlowError.INTERNAL_ERROR);
        }

        MultivaluedMap<String, String> inputData = processor.getRequest().getDecodedFormParameters();
        String authExecId = inputData.getFirst(Constants.AUTHENTICATION_EXECUTION);
        String selectedCredentialId = inputData.getFirst(Constants.CREDENTIAL_ID);

        //check if the user has selected the "back" option
        if (inputData.containsKey("back")) {
            AuthenticationSessionModel authSession = processor.getAuthenticationSession();

            AuthenticationFlowHistoryHelper history = new AuthenticationFlowHistoryHelper(processor);
            if (history.hasAnyExecution()) {

                String executionId = history.pullExecution();
                AuthenticationExecutionModel lastActionExecution = processor.getRealm().getAuthenticationExecutionById(executionId);

                logger.debugf("Moving back to authentication execution '%s'", lastActionExecution.getAuthenticator());

                recursiveClearExecutionStatusOfAllExecutionsAfterOurExecutionInclusive(lastActionExecution);

                Response response = processSingleFlowExecutionModel(lastActionExecution, null, false);
                if (response == null) {
                    processor.getAuthenticationSession().removeAuthNote(AuthenticationProcessor.CURRENT_AUTHENTICATION_EXECUTION);
                    return processFlow();
                } else return response;
            } else {
                // This normally shouldn't happen as "back" button shouldn't be available on the form. If it is still triggered, we show "pageExpired" page
                new AuthenticationFlowURLHelper(processor.getSession(), processor.getRealm(), processor.getUriInfo())
                        .showPageExpired(authSession);
            }
        }

        // check if the user has switched to a new authentication execution, and if so switch to it.
        if (authExecId != null && !authExecId.isEmpty()) {

            List<AuthenticationSelectionOption> selectionOptions = createAuthenticationSelectionList(model);

            // Check if switch to the requested authentication execution is allowed
            selectionOptions.stream()
                    .filter(authSelectionOption -> authExecId.equals(authSelectionOption.getAuthExecId()))
                    .findFirst()
                    .orElseThrow(() -> new AuthenticationFlowException("Requested authentication execution is not allowed", AuthenticationFlowError.INTERNAL_ERROR)
            );

            model = processor.getRealm().getAuthenticationExecutionById(authExecId);

            // In case that new execution is a flow, we will add the 1st item from the selection (preferred credential) to the history, so when later click "back", we will return to it.
            if (model.isAuthenticatorFlow()) {
                new AuthenticationFlowHistoryHelper(processor).pushExecution(selectionOptions.get(0).getAuthExecId());
            }

            Response response = processSingleFlowExecutionModel(model, selectedCredentialId, false);
            if (response == null) {
                processor.getAuthenticationSession().removeAuthNote(AuthenticationProcessor.CURRENT_AUTHENTICATION_EXECUTION);
                checkAndValidateParentFlow(model);
                return processFlow();
            } else return response;
        }
        //handle case where execution is a flow
        if (model.isAuthenticatorFlow()) {
            logger.debug("execution is flow");
            AuthenticationFlow authenticationFlow = processor.createFlowExecution(model.getFlowId(), model);
            Response flowChallenge = authenticationFlow.processAction(actionExecution);
            if (flowChallenge == null) {
                checkAndValidateParentFlow(model);
                return processFlow();
            } else {
                processor.getAuthenticationSession().setExecutionStatus(model.getId(), AuthenticationSessionModel.ExecutionStatus.CHALLENGED);
                return flowChallenge;
            }
        }
        //handle normal execution case
        AuthenticatorFactory factory = getAuthenticatorFactory(model);
        Authenticator authenticator = createAuthenticator(factory);
        AuthenticationProcessor.Result result = processor.createAuthenticatorContext(model, authenticator, executions);
        result.setAuthenticationSelections(createAuthenticationSelectionList(model));

        result.setSelectedCredentialId(selectedCredentialId);

        logger.debugv("action: {0}", model.getAuthenticator());
        authenticator.action(result);
        Response response = processResult(result, true);
        if (response == null) {
            processor.getAuthenticationSession().removeAuthNote(AuthenticationProcessor.CURRENT_AUTHENTICATION_EXECUTION);
            checkAndValidateParentFlow(model);
            return processFlow();
        } else return response;
    }

    /**
     * Clear execution status of targetExecution and also clear execution status of all the executions, which were triggered after this execution.
     * This covers also "flow" executions and executions, which were set automatically
     *
     * @param targetExecution
     */
    private void recursiveClearExecutionStatusOfAllExecutionsAfterOurExecutionInclusive(AuthenticationExecutionModel targetExecution) {
        RealmModel realm = processor.getRealm();
        AuthenticationSessionModel authSession = processor.getAuthenticationSession();

        // Clear execution status of our execution
        authSession.getExecutionStatus().remove(targetExecution.getId());

        // Find all the "sibling" executions after target execution including target execution. For those, we can recursively remove execution status
        recursiveClearExecutionStatusOfAllSiblings(targetExecution);

        // Find the parent flow. If corresponding execution of this parent flow already has "executionStatus" set, we should clear it and also clear
        // the status for all the siblings after that execution
        while (true) {
            AuthenticationFlowModel parentFlow = realm.getAuthenticationFlowById(targetExecution.getParentFlow());
            if (parentFlow.isTopLevel()) {
                return;
            }

            AuthenticationExecutionModel flowExecution = realm.getAuthenticationExecutionByFlowId(parentFlow.getId());
            if (authSession.getExecutionStatus().containsKey(flowExecution.getId())) {
                authSession.getExecutionStatus().remove(flowExecution.getId());
                recursiveClearExecutionStatusOfAllSiblings(flowExecution);
                targetExecution = flowExecution;
            } else {
                return;
            }

        }
    }

    /**
     * Recursively removes the execution status of all "sibling" executions after targetExecution.
     *
     * @param targetExecution
     */
    private void recursiveClearExecutionStatusOfAllSiblings(AuthenticationExecutionModel targetExecution) {
        RealmModel realm = processor.getRealm();
        AuthenticationFlowModel parentFlow = realm.getAuthenticationFlowById(targetExecution.getParentFlow());

        logger.debugf("Recursively clearing executions in flow '%s', which are after execution '%s'", parentFlow.getAlias(), targetExecution.getId());

        List<AuthenticationExecutionModel> siblingExecutions = realm.getAuthenticationExecutions(parentFlow.getId());
        int index = siblingExecutions.indexOf(targetExecution);
        siblingExecutions = siblingExecutions.subList(index + 1, siblingExecutions.size());

        for (AuthenticationExecutionModel authExec : siblingExecutions) {
            recursiveClearExecutionStatus(authExec);
        }
    }

    /**
     * Removes the execution status for an execution. If it is a flow, do the same for all sub-executions.
     *
     * @param execution the execution for which the status must be cleared
     */
    private void recursiveClearExecutionStatus(AuthenticationExecutionModel execution) {
        processor.getAuthenticationSession().getExecutionStatus().remove(execution.getId());
        if (execution.isAuthenticatorFlow()) {
            processor.getRealm().getAuthenticationExecutions(execution.getFlowId()).forEach(this::recursiveClearExecutionStatus);
        }
    }

    /**
     * This method makes sure that the parent flow's corresponding execution is considered successful if its contained
     * executions are successful.
     * The purpose is for when an execution is validated through an action, to make sure its parent flow can be successful
     * when re-evaluation the flow tree.
     *
     * @param model An execution model.
     */
    private void checkAndValidateParentFlow(AuthenticationExecutionModel model) {
        List<AuthenticationExecutionModel> localExecutions = processor.getRealm().getAuthenticationExecutions(model.getParentFlow());
        AuthenticationExecutionModel parentFlowModel = processor.getRealm().getAuthenticationExecutionByFlowId(model.getParentFlow());
        if (parentFlowModel != null &&
                ((model.isRequired() && localExecutions.stream().allMatch(processor::isSuccessful)) ||
                        (model.isAlternative() && localExecutions.stream().anyMatch(processor::isSuccessful)))) {
            processor.getAuthenticationSession().setExecutionStatus(parentFlowModel.getId(), AuthenticationSessionModel.ExecutionStatus.SUCCESS);
        }
    }

    @Override
    public Response processFlow() {
        logger.debug("processFlow");

        //separate flow elements into required and alternative elements
        List<AuthenticationExecutionModel> requiredList = new ArrayList<>();
        List<AuthenticationExecutionModel> alternativeList = new ArrayList<>();

        for (AuthenticationExecutionModel execution : executions) {
            if (isConditionalAuthenticator(execution)) {
                continue;
            } else if (execution.isRequired() || execution.isConditional()) {
                requiredList.add(execution);
            } else if (execution.isAlternative()) {
                alternativeList.add(execution);
            }
        }

        //handle required elements : all required elements need to be executed
        boolean requiredElementsSuccessful = true;
        Iterator<AuthenticationExecutionModel> requiredIListIterator = requiredList.listIterator();
        while (requiredIListIterator.hasNext()) {
            AuthenticationExecutionModel required = requiredIListIterator.next();
            //Conditional flows must be considered disabled (non-existent) if their condition evaluates to false.
            if (required.isConditional() && isConditionalSubflowDisabled(required)) {
                requiredIListIterator.remove();
                continue;
            }
            Response response = processSingleFlowExecutionModel(required, null, true);
            requiredElementsSuccessful &= processor.isSuccessful(required) || isSetupRequired(required);
            if (response != null) {
                return response;
            }
        }

        //Evaluate alternative elements only if there are no required elements. This may also occur if there was only condition elements
        if (requiredList.isEmpty()) {
            //check if an alternative is already successful, in case we are returning in the flow after an action
            if (alternativeList.stream().anyMatch(alternative -> processor.isSuccessful(alternative) || isSetupRequired(alternative))) {
                successful = true;
                return null;
            }

            //handle alternative elements: the first alternative element to be satisfied is enough
            for (AuthenticationExecutionModel alternative : alternativeList) {
                try {
                    Response response = processSingleFlowExecutionModel(alternative, null, true);
                    if (response != null) {
                        return response;
                    }
                    if (processor.isSuccessful(alternative) || isSetupRequired(alternative)) {
                        successful = true;
                        return null;
                    }
                } catch (AuthenticationFlowException afe) {
                    //consuming the error is not good here from an administrative point of view, but the user, since he has alternatives, should be able to go to another alternative and continue
                    afeList.add(afe);
                    processor.getAuthenticationSession().setExecutionStatus(alternative.getId(), AuthenticationSessionModel.ExecutionStatus.ATTEMPTED);
                }
            }
        } else {
            successful = requiredElementsSuccessful;
        }
        return null;
    }

    /**
     * Checks if the conditional subflow passed in parameter is disabled.
     * @param model
     * @return
     */
    private boolean isConditionalSubflowDisabled(AuthenticationExecutionModel model) {
        if (model == null || !model.isAuthenticatorFlow() || !model.isConditional()) {
            return false;
        };
        List<AuthenticationExecutionModel> modelList = processor.getRealm().getAuthenticationExecutions(model.getFlowId());
        List<AuthenticationExecutionModel> conditionalAuthenticatorList = modelList.stream()
                .filter(this::isConditionalAuthenticator)
                .filter(s -> s.isEnabled())
                .collect(Collectors.toList());
        return conditionalAuthenticatorList.isEmpty() || conditionalAuthenticatorList.stream().anyMatch(m-> conditionalNotMatched(m, modelList));
    }

    private boolean isConditionalAuthenticator(AuthenticationExecutionModel model) {
        return !model.isAuthenticatorFlow() && model.getAuthenticator() != null && createAuthenticator(getAuthenticatorFactory(model)) instanceof ConditionalAuthenticator;
    }

    private AuthenticatorFactory getAuthenticatorFactory(AuthenticationExecutionModel model) {
        AuthenticatorFactory factory = (AuthenticatorFactory) processor.getSession().getKeycloakSessionFactory().getProviderFactory(Authenticator.class, model.getAuthenticator());
        if (factory == null) {
            throw new RuntimeException("Unable to find factory for AuthenticatorFactory: " + model.getAuthenticator() + " did you forget to declare it in a META-INF/services file?");
        }
        return factory;
    }

    private boolean conditionalNotMatched(AuthenticationExecutionModel model, List<AuthenticationExecutionModel> executionList) {
        AuthenticatorFactory factory = getAuthenticatorFactory(model);
        ConditionalAuthenticator authenticator = (ConditionalAuthenticator) createAuthenticator(factory);
        AuthenticationProcessor.Result context = processor.createAuthenticatorContext(model, authenticator, executionList);

        return !authenticator.matchCondition(context);
    }

    private boolean isSetupRequired(AuthenticationExecutionModel model) {
        return AuthenticationSessionModel.ExecutionStatus.SETUP_REQUIRED.equals(processor.getAuthenticationSession().getExecutionStatus().get(model.getId()));
    }

    private Response processSingleFlowExecutionModel(AuthenticationExecutionModel model, String selectedCredentialId, boolean calledFromFlow) {
        logger.debugv("check execution: {0} requirement: {1}", model.getAuthenticator(), model.getRequirement());

        if (isProcessed(model)) {
            logger.debug("execution is processed");
            return null;
        }
        //handle case where execution is a flow
        if (model.isAuthenticatorFlow()) {
            logger.debug("execution is flow");
            AuthenticationFlow authenticationFlow = processor.createFlowExecution(model.getFlowId(), model);
            Response flowChallenge = authenticationFlow.processFlow();
            if (flowChallenge == null) {
                if (authenticationFlow.isSuccessful()) {
                    processor.getAuthenticationSession().setExecutionStatus(model.getId(), AuthenticationSessionModel.ExecutionStatus.SUCCESS);
                } else {
                    processor.getAuthenticationSession().setExecutionStatus(model.getId(), AuthenticationSessionModel.ExecutionStatus.FAILED);
                }
                return null;
            } else {
                processor.getAuthenticationSession().setExecutionStatus(model.getId(), AuthenticationSessionModel.ExecutionStatus.CHALLENGED);
                return flowChallenge;
            }
        }

        //handle normal execution case
        AuthenticatorFactory factory = getAuthenticatorFactory(model);
        Authenticator authenticator = createAuthenticator(factory);
        logger.debugv("authenticator: {0}", factory.getId());
        UserModel authUser = processor.getAuthenticationSession().getAuthenticatedUser();

        //If executions are alternative, get the actual execution to show based on user preference
        List<AuthenticationSelectionOption> selectionOptions = createAuthenticationSelectionList(model);
        if (!selectionOptions.isEmpty() && calledFromFlow) {
            List<AuthenticationSelectionOption> finalSelectionOptions = selectionOptions.stream().filter(aso -> !aso.getAuthenticationExecution().isAuthenticatorFlow() && !isProcessed(aso.getAuthenticationExecution())).collect(Collectors.toList());;
            if (finalSelectionOptions.isEmpty()) {
                //move to next
                return null;
            }
            model = finalSelectionOptions.get(0).getAuthenticationExecution();
            factory = (AuthenticatorFactory) processor.getSession().getKeycloakSessionFactory().getProviderFactory(Authenticator.class, model.getAuthenticator());
            if (factory == null) {
                throw new RuntimeException("Unable to find factory for AuthenticatorFactory: " + model.getAuthenticator() + " did you forget to declare it in a META-INF/services file?");
            }
            authenticator = createAuthenticator(factory);
        }
        AuthenticationProcessor.Result context = processor.createAuthenticatorContext(model, authenticator, executions);
        context.setAuthenticationSelections(selectionOptions);
        if (selectedCredentialId != null) {
            context.setSelectedCredentialId(selectedCredentialId);
        } else if (!selectionOptions.isEmpty()) {
            context.setSelectedCredentialId(selectionOptions.get(0).getCredentialId());
        }
        if (authenticator.requiresUser()) {
            if (authUser == null) {
                throw new AuthenticationFlowException("authenticator: " + factory.getId(), AuthenticationFlowError.UNKNOWN_USER);
            }
            if (!authenticator.configuredFor(processor.getSession(), processor.getRealm(), authUser)) {
                if (factory.isUserSetupAllowed() && model.isRequired() && authenticator.areRequiredActionsEnabled(processor.getSession(), processor.getRealm())) {
                    //This means that having even though the user didn't validate the
                    logger.debugv("authenticator SETUP_REQUIRED: {0}", factory.getId());
                    processor.getAuthenticationSession().setExecutionStatus(model.getId(), AuthenticationSessionModel.ExecutionStatus.SETUP_REQUIRED);
                    authenticator.setRequiredActions(processor.getSession(), processor.getRealm(), processor.getAuthenticationSession().getAuthenticatedUser());
                    return null;
                } else {
                    throw new AuthenticationFlowException("authenticator: " + factory.getId(), AuthenticationFlowError.CREDENTIAL_SETUP_REQUIRED);
                }
            }
        }
        logger.debugv("invoke authenticator.authenticate: {0}", factory.getId());
        authenticator.authenticate(context);

        return processResult(context, false);
    }

    /**
     * This method creates the list of authenticators that is presented to the user. For a required execution, this is
     * only the credentials associated to the authenticator, and for an alternative execution, this is all other alternative
     * executions in the flow, including the credentials.
     *

     * In both cases, the credentials take precedence, with the order selected by the user (or his administrator).
     *
     * @param model The current execution model
     * @return an ordered list of the authentication selection options to present the user.
     */
    private List<AuthenticationSelectionOption> createAuthenticationSelectionList(AuthenticationExecutionModel model) {
        List<AuthenticationSelectionOption> authenticationSelectionList = new ArrayList<>();
        if (processor.getAuthenticationSession() != null) {
            Map<String, AuthenticationExecutionModel> typeAuthExecMap = new HashMap<>();
            List<AuthenticationExecutionModel> nonCredentialExecutions = new ArrayList<>();
            if (model.isAlternative()) {
                //get all alternative executions to be able to list their credentials
                List<AuthenticationExecutionModel> alternativeExecutions = processor.getRealm().getAuthenticationExecutions(model.getParentFlow())
                        .stream().filter(AuthenticationExecutionModel::isAlternative).collect(Collectors.toList());
                for (AuthenticationExecutionModel execution : alternativeExecutions) {
                    if (!execution.isAuthenticatorFlow()) {
                        Authenticator localAuthenticator = processor.getSession().getProvider(Authenticator.class, execution.getAuthenticator());
                        if (!(localAuthenticator instanceof CredentialValidator)) {
                            nonCredentialExecutions.add(execution);
                            continue;
                        }
                        CredentialValidator<?> cv = (CredentialValidator<?>) localAuthenticator;
                        typeAuthExecMap.put(cv.getType(processor.getSession()), execution);
                    } else {
                        nonCredentialExecutions.add(execution);
                    }
                }
            } else if (model.isRequired() && !model.isAuthenticatorFlow()) {
                //only get current credentials
                Authenticator authenticator = processor.getSession().getProvider(Authenticator.class, model.getAuthenticator());
                if (authenticator instanceof CredentialValidator) {
                    typeAuthExecMap.put(((CredentialValidator<?>) authenticator).getType(processor.getSession()), model);
                }
            }
            //add credential authenticators in order
            if (processor.getAuthenticationSession().getAuthenticatedUser() != null) {
                List<CredentialModel> credentials = processor.getSession().userCredentialManager()
                        .getStoredCredentials(processor.getRealm(), processor.getAuthenticationSession().getAuthenticatedUser())
                        .stream()
                        .filter(credential -> typeAuthExecMap.containsKey(credential.getType()))
                        .collect(Collectors.toList());

                MultivaluedMap<String, AuthenticationSelectionOption> countAuthSelections = new MultivaluedHashMap<>();

                for (CredentialModel credential : credentials) {
                    AuthenticationSelectionOption authSel = new AuthenticationSelectionOption(typeAuthExecMap.get(credential.getType()), credential);
                    authenticationSelectionList.add(authSel);
                    countAuthSelections.add(credential.getType(), authSel);
                }
                for (Entry<String, List<AuthenticationSelectionOption>> entry : countAuthSelections.entrySet()) {
                    if (entry.getValue().size() == 1) {
                        entry.getValue().get(0).setShowCredentialName(false);
                    }
                }
                //don't show credential type if there's only a single type in the list
                if (countAuthSelections.keySet().size() == 1 && nonCredentialExecutions.isEmpty()) {
                    for (AuthenticationSelectionOption so : authenticationSelectionList) {
                        so.setShowCredentialType(false);
                    }
                }
            }
            //add all other authenticators (including flows)
            for (AuthenticationExecutionModel exec : nonCredentialExecutions) {
                if (exec.isAuthenticatorFlow()) {
                    authenticationSelectionList.add(new AuthenticationSelectionOption(exec,
                            processor.getRealm().getAuthenticationFlowById(exec.getFlowId())));
                } else {
                    authenticationSelectionList.add(new AuthenticationSelectionOption(exec));
                }
            }
        }
        return authenticationSelectionList;
    }

    public Response processResult(AuthenticationProcessor.Result result, boolean isAction) {
        AuthenticationExecutionModel execution = result.getExecution();
        FlowStatus status = result.getStatus();
        switch (status) {
            case SUCCESS:
                logger.debugv("authenticator SUCCESS: {0}", execution.getAuthenticator());
                if (isAction) {
                    new AuthenticationFlowHistoryHelper(processor).pushExecution(execution.getId());
                }

                processor.getAuthenticationSession().setExecutionStatus(execution.getId(), AuthenticationSessionModel.ExecutionStatus.SUCCESS);
                return null;
            case FAILED:
                logger.debugv("authenticator FAILED: {0}", execution.getAuthenticator());
                processor.logFailure();
                processor.getAuthenticationSession().setExecutionStatus(execution.getId(), AuthenticationSessionModel.ExecutionStatus.FAILED);
                if (result.getChallenge() != null) {
                    return sendChallenge(result, execution);
                }
                throw new AuthenticationFlowException(result.getError());
            case FORK:
                logger.debugv("reset browser login from authenticator: {0}", execution.getAuthenticator());
                processor.getAuthenticationSession().setAuthNote(AuthenticationProcessor.CURRENT_AUTHENTICATION_EXECUTION, execution.getId());
                throw new ForkFlowException(result.getSuccessMessage(), result.getErrorMessage());
            case FORCE_CHALLENGE:
            case CHALLENGE:
                processor.getAuthenticationSession().setExecutionStatus(execution.getId(), AuthenticationSessionModel.ExecutionStatus.CHALLENGED);
                return sendChallenge(result, execution);
            case FAILURE_CHALLENGE:
                logger.debugv("authenticator FAILURE_CHALLENGE: {0}", execution.getAuthenticator());
                processor.logFailure();
                processor.getAuthenticationSession().setExecutionStatus(execution.getId(), AuthenticationSessionModel.ExecutionStatus.CHALLENGED);
                return sendChallenge(result, execution);
            case ATTEMPTED:
                logger.debugv("authenticator ATTEMPTED: {0}", execution.getAuthenticator());
                if (execution.isRequired()) {
                    throw new AuthenticationFlowException(AuthenticationFlowError.INVALID_CREDENTIALS);
                }
                processor.getAuthenticationSession().setExecutionStatus(execution.getId(), AuthenticationSessionModel.ExecutionStatus.ATTEMPTED);
                return null;
            case FLOW_RESET:
                processor.resetFlow();
                return processor.authenticate();
            default:
                logger.debugv("authenticator INTERNAL_ERROR: {0}", execution.getAuthenticator());
                ServicesLogger.LOGGER.unknownResultStatus();
                throw new AuthenticationFlowException(AuthenticationFlowError.INTERNAL_ERROR);
        }
    }

    public Response sendChallenge(AuthenticationProcessor.Result result, AuthenticationExecutionModel execution) {
        processor.getAuthenticationSession().setAuthNote(AuthenticationProcessor.CURRENT_AUTHENTICATION_EXECUTION, execution.getId());
        return result.getChallenge();
    }

    @Override
    public boolean isSuccessful() {
        return successful;
    }

    @Override
    public List<AuthenticationFlowException> getFlowExceptions(){
        return afeList;
    }
}


text:
module GarrettsRps

  class Player

    def initialize(name)
      @name = name
    end

    def name
      @name
    end

    def get_input #checks with get_input
      print "#{self.name}>>"
      input = gets.strip
      until valid_input? (input)
        puts "Please choose: rock, paper, or scissors."
        print ">>"
        input = gets.chomp
      end
      input
    end

    def valid_input? (input)#if not, get_input again
      choices = ["rock", "paper", "scissors"]
      if choices.include? input
        true
      else
        false
      end
    end

  end

end


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

using SDNUOJ.Caching;
using SDNUOJ.Controllers.Exception;
using SDNUOJ.Data;
using SDNUOJ.Entity;
using SDNUOJ.Utilities;

namespace SDNUOJ.Controllers.Core
{
    /// <summary>
    /// 题目类型种类数据管理类
    /// </summary>
    internal static class ProblemCategoryManager
    {
        #region 用户方法
        ///// <summary>
        ///// 根据ID得到一个题目类型种类实体
        ///// </summary>
        ///// <param name="id">题目类型种类ID</param>
        ///// <returns>题目类型种类实体</returns>
        //public static ProblemCategoryEntity GetProblemCategory(Int32 id)
        //{
        //    if (id <= 0)
        //    {
        //        throw new InvalidRequstException(RequestType.ProblemCategory);
        //    }

        //    List<ProblemCategoryEntity> list = ProblemCategoryManager.GetProblemCategoryList();

        //    if (list != null && list.Count > 0)
        //    {
        //        for (Int32 i = 0; i < list.Count; i++)
        //        {
        //            if (list[i].TypeID == id) return list[i];
        //        }
        //    }

        //    throw new NullResponseException(RequestType.ProblemCategory);
        //}

        /// <summary>
        /// 获取所有题目类型种类
        /// </summary>
        /// <returns>所有题目类型种类</returns>
        public static List<ProblemCategoryEntity> GetProblemCategoryList()
        {
            List<ProblemCategoryEntity> list = ProblemCategoryCache.GetProblemCategoryListCache();//获取缓存

            if (list == null)
            {
                list = ProblemCategoryRepository.Instance.GetAllEntities();
                ProblemCategoryCache.SetProblemCategoryListCache(list);//设置缓存
            }

            return list;
        }
        #endregion

        #region 管理方法
        /// <summary>
        /// 增加一条题目类型种类
        /// </summary>
        /// <param name="entity">题目类型种类实体</param>
        /// <returns>是否成功增加</returns>
        public static IMethodResult AdminInsertProblemCategory(ProblemCategoryEntity entity)
        {
            if (!AdminManager.HasPermission(PermissionType.ProblemManage))
            {
                throw new NoPermissionException();
            }

            if (String.IsNullOrEmpty(entity.Title))
            {
                return MethodResult.FailedAndLog("Problem category title cannot be NULL!");
            }

            Boolean success = ProblemCategoryRepository.Instance.InsertEntity(entity) > 0;

            if (!success)
            {
                return MethodResult.FailedAndLog("No problem category was added!");
            }

            ProblemCategoryCache.RemoveProblemCategoryListCache();//删除缓存

            return MethodResult.SuccessAndLog("Admin add problem category, title = {0}", entity.Title);
        }

        /// <summary>
        /// 更新一条题目类型种类
        /// </summary>
        /// <param name="entity">题目类型种类实体</param>
        /// <returns>是否成功更新</returns>
        public static IMethodResult AdminUpdateProblemCategory(ProblemCategoryEntity entity)
        {
            if (!AdminManager.HasPermission(PermissionType.ProblemManage))
            {
                throw new NoPermissionException();
            }

            if (entity.TypeID <= 0)
            {
                return MethodResult.InvalidRequest(RequestType.ProblemCategory);
            }

            if (String.IsNullOrEmpty(entity.Title))
            {
                return MethodResult.FailedAndLog("Problem category title cannot be NULL!");
            }

            Boolean success = ProblemCategoryRepository.Instance.UpdateEntity(entity) > 0;

            if (!success)
            {
                return MethodResult.FailedAndLog("No problem category was updated!");
            }

            ProblemCategoryCache.RemoveProblemCategoryListCache();//删除缓存

            return MethodResult.SuccessAndLog("Admin update problem category, id = {0}", entity.TypeID.ToString());
        }

        /// <summary>
        /// 删除指定ID的题目类型种类
        /// </summary>
        /// <param name="id">题目类型种类ID</param>
        /// <returns>是否成功删除</returns>
        public static IMethodResult AdminDeleteProblemCategory(Int32 id)
        {
            if (!AdminManager.HasPermission(PermissionType.ProblemManage))
            {
                throw new NoPermissionException();
            }

            if (id <= 0)
            {
                return MethodResult.InvalidRequest(RequestType.ProblemCategory);
            }

            if (ProblemCategoryItemRepository.Instance.CountEntities(id) > 0)
            {
                return MethodResult.FailedAndLog("This category still has some problems, please remove these problem from this category first!");
            }

            Boolean success = ProblemCategoryRepository.Instance.DeleteEntity(id) > 0;

            if (!success)
            {
                return MethodResult.FailedAndLog("No problem category was deleted!");
            }

            ProblemCategoryCache.RemoveProblemCategoryListCache();//删除缓存

            return MethodResult.SuccessAndLog("Admin delete problem category, id = {0}", id.ToString());
        }

        /// <summary>
        /// 根据ID得到题目类型种类实体
        /// </summary>
        /// <param name="id">题目类型种类ID</param>
        /// <returns>题目类型种类实体</returns>
        public static IMethodResult AdminGetProblemCategory(Int32 id)
        {
            if (!AdminManager.HasPermission(PermissionType.ProblemManage))
            {
                throw new NoPermissionException();
            }

            if (id <= 0)
            {
                return MethodResult.InvalidRequest(RequestType.ProblemCategory);
            }

            ProblemCategoryEntity entity = ProblemCategoryRepository.Instance.GetEntity(id);

            if (entity == null)
            {
                return MethodResult.NotExist(RequestType.ProblemCategory);
            }

            return MethodResult.Success(entity);
        }

        /// <summary>
        /// 获取题目类型种类列表
        /// </summary>
        /// <param name="pageIndex">页面索引</param>
        /// <returns>题目类型种类列表</returns>
        public static PagedList<ProblemCategoryEntity> AdminGetProblemCategoryList(Int32 pageIndex)
        {
            if (!AdminManager.HasPermission(PermissionType.ProblemManage))
            {
                throw new NoPermissionException();
            }

            Int32 pageSize = AdminManager.ADMIN_LIST_PAGE_SIZE;
            Int32 recordCount = ProblemCategoryManager.AdminCountProblemCategoryList();

            return ProblemCategoryRepository.Instance
                .GetEntities(pageIndex, pageSize, recordCount)
                .ToPagedList(pageSize, recordCount);
        }

        /// <summary>
        /// 获取题目类型种类总数
        /// </summary>
        /// <returns>题目类型种类总数</returns>
        private static Int32 AdminCountProblemCategoryList()
        {
            return ProblemCategoryRepository.Instance.CountEntities();
        }
        #endregion
    }
}


text:
Template.intel.rendered = function() {
Session.set("intelFilters", {});
Session.set("intelLoaded", false);
Meteor.subscribe("intel", function onReady() {
  Session.set("intelLoaded", true);
});
}

Template.intel.helpers({
  settings: function() {
    return {
      position: "bottom",
      limit: 20,
      rules: [
        {
          token: '',
          collection: "mapRegions",
          subscription: "mapRegions",
          template: Template.regionSelectTemplate,
          field: "regionName"
        }
      ]
    };
  },
  loadingIntel: function() {
    return !Session.get("intelLoaded");
  },
  intel: function() {
    return Intel.find(Session.get("intelFilters"), {sort: {killTime:-1}});
  }
});

Template.intel.events({
  "autocompleteselect #area": function(event, template, doc) {
    console.log(doc, doc.regionID);
    Session.set("intelFilters", {regionID: doc.regionID});
    Session.set("intelLoaded", false);
    Meteor.subscribe("intel", doc.regionID, function onReady() {
      Session.set("intelLoaded", true);
    });
  }
});


text:
<?php

namespace Sylius\Bundle\LocaleBundle\DependencyInjection;

use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;

/**
 * @author Paweł Jędrzejewski <pawel@sylius.org>
 */
class SyliusLocaleExtension extends AbstractResourceExtension
{
    /**
     * {@inheritdoc}
     */
    public function load(array $config, ContainerBuilder $container)
    {
        $config = $this->processConfiguration($this->getConfiguration($config, $container), $config);
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

        $this->registerResources('sylius', $config['driver'], $config['resources'], $container);

        $configFiles = [
            'services.xml',
            'templating.xml',
            'twig.xml',
        ];

        foreach ($configFiles as $configFile) {
            $loader->load($configFile);
        }

        $definition = $container->findDefinition('sylius.context.locale');
        $definition->replaceArgument(0, new Reference($config['storage']));

        $container
            ->getDefinition('sylius.form.type.locale_choice')
            ->setArguments([new Reference('sylius.repository.locale')])
        ;
    }
}


text:
package com.qubole.qds.sdk.java.examples;

import com.qubole.qds.sdk.java.client.DefaultQdsConfiguration;
import com.qubole.qds.sdk.java.client.QdsClient;
import com.qubole.qds.sdk.java.client.QdsClientFactory;
import com.qubole.qds.sdk.java.client.QdsConfiguration;
import com.qubole.qds.sdk.java.client.ResultLatch;
import com.qubole.qds.sdk.java.entities.CommandResponse;
import com.qubole.qds.sdk.java.entities.ResultValue;

public class HiveCommandExample
{
    public static void main(String[] args) throws Exception
    {
        String endpoint = System.getProperty("API_ENDPOINT", DefaultQdsConfiguration.API_ENDPOINT);
        QdsConfiguration configuration = new DefaultQdsConfiguration(endpoint, System.getProperty("API_KEY"));
        QdsClient client = QdsClientFactory.newClient(configuration);
        try
        {
            CommandResponse commandResponse = client.command().hive().query("show tables;").invoke().get();
            ResultLatch resultLatch = new ResultLatch(client, commandResponse.getId());
            ResultValue resultValue = resultLatch.awaitResult();
            System.out.println(resultValue.getResults());

            String s = client.command().logs("" + commandResponse.getId()).invoke().get();
            System.err.println(s);
        }
        finally
        {
            client.close();
        }
    }
}


text:
require 'spec_helper'

describe Rss::ImportJob, dbscope: :example do
  before do
    WebMock.reset!

    chain = stub_request(:get, url)
    chain = chain.to_return(status: 200, body: ::File.read(Rails.root.join("spec", "fixtures", "rss", path)), headers: {})
    if respond_to?(:path2)
      chain = chain.to_return(status: 200, body: ::File.read(Rails.root.join("spec", "fixtures", "rss", path2)), headers: {})
    end
    chain.to_return(status: 404)
  end

  after { WebMock.reset! }

  context "when importing rdf" do
    let(:path) { "sample-rdf.xml" }
    let(:url) { "http://#{unique_domain}/#{path}" }
    let(:site) { cms_site }
    let(:node) { create :rss_node_page, site: site, rss_url: url }
    let(:user) { cms_user }
    let(:bindings) { { site_id: site.id, node_id: node.id, user_id: user.id } }

    it do
      expect { described_class.bind(bindings).perform_now }.to change { Rss::Page.count }.from(0).to(5)
      expect(Rss::Page.where(rss_link: "http://example.jp/rdf/1.html").first).not_to be_nil
    end
  end

  context "when importing rss" do
    let(:path) { "sample-rss.xml" }
    let(:url) { "http://#{unique_domain}/#{path}" }
    let(:site) { cms_site }
    let(:node) { create :rss_node_page, site: site, rss_url: url }
    let(:user) { cms_user }
    let(:bindings) { { site_id: site.id, node_id: node.id, user_id: user.id } }

    it do
      expect { described_class.bind(bindings).perform_now }.to change { Rss::Page.count }.from(0).to(5)
      expect(Rss::Page.where(rss_link: "http://example.jp/rss/1.html").first).not_to be_nil
    end
  end

  context "when importing atom" do
    let(:path) { "sample-atom.xml" }
    let(:url) { "http://#{unique_domain}/#{path}" }
    let(:site) { cms_site }
    let(:node) { create :rss_node_page, site: site, rss_url: url }
    let(:user) { cms_user }
    let(:bindings) { { site_id: site.id, node_id: node.id, user_id: user.id } }

    it do
      expect { described_class.bind(bindings).perform_now }.to change { Rss::Page.count }.from(0).to(5)
      expect(Rss::Page.where(rss_link: "http://example.jp/atom/1.html").first).not_to be_nil
    end
  end

  describe ".import_jobs" do
    context "rss_refresh_method is auto" do
      let(:path) { "sample-rdf.xml" }
      let(:url) { "http://#{unique_domain}/#{path}" }
      let(:site) { cms_site }
      let(:user) { cms_user }
      let(:refresh_method) { Rss::Node::Page::RSS_REFRESH_METHOD_AUTO }
      let!(:node) { create :rss_node_page, site: site, rss_url: url, rss_refresh_method: refresh_method }

      it do
        described_class.perform_jobs(site, user)

        expect(Job::Log.count).to eq 1
        Job::Log.first.tap do |log|
          expect(log.logs).to include(/INFO -- : .* Started Job/)
          expect(log.logs).to include(/INFO -- : .* Completed Job/)
        end
      end
    end

    context "rss_refresh_method is manual" do
      let(:path) { "sample-rdf.xml" }
      let(:url) { "http://#{unique_domain}/#{path}" }
      let(:site) { cms_site }
      let(:user) { cms_user }
      let(:refresh_method) { Rss::Node::Page::RSS_REFRESH_METHOD_MANUAL }
      let!(:node) { create :rss_node_page, site: site, rss_url: url, rss_refresh_method: refresh_method }

      it do
        described_class.perform_jobs(site, user)
        expect(Job::Log.count).to eq 0
      end
    end
  end

  context "when rss_max_docs is 3" do
    let(:path) { "sample-rdf.xml" }
    let(:url) { "http://#{unique_domain}/#{path}" }
    let(:site) { cms_site }
    let(:node) { create :rss_node_page, site: site, rss_url: url, rss_max_docs: 3 }
    let(:user) { cms_user }
    let(:bindings) { { site_id: site.id, node_id: node.id, user_id: user.id } }

    it do
      expect { described_class.bind(bindings).perform_now }.to change { Rss::Page.count }.from(0).to(3)
      expect(History::Trash.all.count).to eq 0
    end
  end

  context "when rss is not changed" do
    let(:path) { "sample-rdf.xml" }
    let(:url) { "http://#{unique_domain}/#{path}" }
    let(:site) { cms_site }
    let(:node) { create :rss_node_page, site: site, rss_url: url }
    let(:user) { cms_user }
    let(:bindings) { { site_id: site.id, node_id: node.id, user_id: user.id } }

    it do
      described_class.bind(bindings).perform_now
      expect(Rss::Page.count).to eq 5

      described_class.bind(bindings).perform_now
      # expected count is 5.
      expect(Rss::Page.count).to eq 5

      # doc1 is not changed.
      doc1 = Rss::Page.where(rss_link: "http://example.jp/rdf/1.html").first
      expect(doc1).not_to be_nil
      expect(doc1.name).to eq '記事1'
      expect(doc1.released).to eq Time.zone.parse('2015-06-12T19:00:00+09:00')
      # doc2 is not changed.
      doc2 = Rss::Page.where(rss_link: "http://example.jp/rdf/2.html").first
      expect(doc2).not_to be_nil
      expect(doc2.name).to eq '記事2'
      expect(doc2.released).to eq Time.zone.parse('2015-06-11T14:00:00+09:00')
      # doc3 is not changed.
      doc3 = Rss::Page.where(rss_link: "http://example.jp/rdf/3.html").first
      expect(doc3).not_to be_nil
      expect(doc3.name).to eq '記事3'
      expect(doc3.released).to eq Time.zone.parse('2015-06-10T09:00:00+09:00')
      # doc4 is not changed.
      doc4 = Rss::Page.where(rss_link: "http://example.jp/rdf/4.html").first
      expect(doc4).not_to be_nil
      expect(doc4.name).to eq '記事4'
      expect(doc4.released).to eq Time.zone.parse('2015-06-09T15:00:00+09:00')
      # doc5 is not changed.
      doc5 = Rss::Page.where(rss_link: "http://example.jp/rdf/5.html").first
      expect(doc5).not_to be_nil
      expect(doc5.name).to eq '記事5'
      expect(doc5.released).to eq Time.zone.parse('2015-06-08T10:00:00+09:00')

      expect(History::Trash.all.count).to eq 0
    end
  end

  context "when rss is updated" do
    let(:path) { "sample-rdf.xml" }
    let(:path2) { "sample-rdf-2.xml" }
    let(:url) { "http://#{unique_domain}/#{path}" }
    let(:site) { cms_site }
    let(:node) { create :rss_node_page, site: site, rss_url: url }
    let(:user) { cms_user }
    let(:bindings) { { site_id: site.id, node_id: node.id, user_id: user.id } }

    it do
      described_class.bind(bindings).perform_now
      expect(Rss::Page.count).to eq 5
      expect(History::Trash.all.count).to eq 0

      described_class.bind(bindings).perform_now
      # expected count is 3, 1 added, 3 deleted, 1 updated.
      expect(Rss::Page.count).to eq 3
      expect(History::Trash.all.count).to eq 0

      # doc1 is updated.
      doc1 = Rss::Page.where(rss_link: "http://example.jp/rdf/1.html").first
      expect(doc1).not_to be_nil
      expect(doc1.name).to eq '【更新】記事1'
      expect(doc1.released).to eq Time.zone.parse('2015-06-13T11:00:00+09:00')
      # doc2 is deleted.
      doc2 = Rss::Page.where(rss_link: "http://example.jp/rdf/2.html").first
      expect(doc2).to be_nil
      # doc3 is not changed.
      doc3 = Rss::Page.where(rss_link: "http://example.jp/rdf/3.html").first
      expect(doc3).not_to be_nil
      expect(doc3.name).to eq '記事3'
      expect(doc3.released).to eq Time.zone.parse('2015-06-10T09:00:00+09:00')
      # doc4 is deleted.
      doc4 = Rss::Page.where(rss_link: "http://example.jp/rdf/4.html").first
      expect(doc4).to be_nil
      # doc5 is deleted.
      doc5 = Rss::Page.where(rss_link: "http://example.jp/rdf/5.html").first
      expect(doc5).to be_nil
      # doc6 is added.
      doc6 = Rss::Page.where(rss_link: "http://example.jp/rdf/6.html").first
      expect(doc6).not_to be_nil
    end
  end

  context "when first rss and last rss was deleted" do
    let(:path) { "sample-rdf.xml" }
    let(:path2) { "sample-rdf-3.xml" }
    let(:url) { "http://#{unique_domain}/#{path}" }
    let(:site) { cms_site }
    let(:node) { create :rss_node_page, site: site, rss_url: url }
    let(:user) { cms_user }
    let(:bindings) { { site_id: site.host, node_id: node.id, user_id: user.id } }

    it do
      described_class.bind(bindings).perform_now
      expect(Rss::Page.count).to eq 5
      expect(History::Trash.all.count).to eq 0

      # http.options real_path: "/sample-rdf-3.xml"

      described_class.bind(bindings).perform_now
      # expected count is 3, 2 deleted.
      expect(Rss::Page.count).to eq 3
      expect(History::Trash.all.count).to eq 0

      # doc1 is deleted.
      doc1 = Rss::Page.where(rss_link: "http://example.jp/rdf/1.html").first
      expect(doc1).to be_nil
      # doc2 is not changed.
      doc3 = Rss::Page.where(rss_link: "http://example.jp/rdf/2.html").first
      expect(doc3).not_to be_nil
      expect(doc3.name).to eq '記事2'
      expect(doc3.released).to eq Time.zone.parse('2015-06-11T14:00:00+09:00')
      # doc3 is not changed.
      doc3 = Rss::Page.where(rss_link: "http://example.jp/rdf/3.html").first
      expect(doc3).not_to be_nil
      expect(doc3.name).to eq '記事3'
      expect(doc3.released).to eq Time.zone.parse('2015-06-10T09:00:00+09:00')
      # doc4 is not changed.
      doc3 = Rss::Page.where(rss_link: "http://example.jp/rdf/4.html").first
      expect(doc3).not_to be_nil
      expect(doc3.name).to eq '記事4'
      expect(doc3.released).to eq Time.zone.parse('2015-06-09T15:00:00+09:00')
      # doc5 is deleted.
      doc5 = Rss::Page.where(rss_link: "http://example.jp/rdf/5.html").first
      expect(doc5).to be_nil
    end
  end
end


text:
/*
 * Basic example for hardware accelerated ray tracing using VK_KHR_ray_tracing_pipeline and VK_KHR_acceleration_structure
 */

#pragma once

#include "api_vulkan_sample.h"
#include "glsl_compiler.h"

// Holds data for a scratch buffer used as a temporary storage during acceleration structure builds
struct ScratchBuffer
{
	uint64_t       device_address;
	VkBuffer       handle;
	VkDeviceMemory memory;
};

// Wraps all data required for an acceleration structure
struct AccelerationStructure
{
	VkAccelerationStructureKHR         handle;
	uint64_t                           device_address;
	std::unique_ptr<vkb::core::Buffer> buffer;
};

class RaytracingBasic : public ApiVulkanSample
{
  public:
	VkPhysicalDeviceRayTracingPipelinePropertiesKHR  ray_tracing_pipeline_properties{};
	VkPhysicalDeviceAccelerationStructureFeaturesKHR acceleration_structure_features{};

	AccelerationStructure bottom_level_acceleration_structure;
	AccelerationStructure top_level_acceleration_structure;

	std::unique_ptr<vkb::core::Buffer>                vertex_buffer;
	std::unique_ptr<vkb::core::Buffer>                index_buffer;
	uint32_t                                          index_count;
	std::vector<VkRayTracingShaderGroupCreateInfoKHR> shader_groups{};

	std::unique_ptr<vkb::core::Buffer> raygen_shader_binding_table;
	std::unique_ptr<vkb::core::Buffer> miss_shader_binding_table;
	std::unique_ptr<vkb::core::Buffer> hit_shader_binding_table;

	struct StorageImage
	{
		VkDeviceMemory memory;
		VkImage        image = VK_NULL_HANDLE;
		VkImageView    view;
		VkFormat       format;
		uint32_t       width;
		uint32_t       height;
	} storage_image;

	struct UniformData
	{
		glm::mat4 view_inverse;
		glm::mat4 proj_inverse;
	} uniform_data;
	std::unique_ptr<vkb::core::Buffer> ubo;

	VkPipeline            pipeline;
	VkPipelineLayout      pipeline_layout;
	VkDescriptorSet       descriptor_set;
	VkDescriptorSetLayout descriptor_set_layout;

	RaytracingBasic();
	~RaytracingBasic();

	void          request_gpu_features(vkb::PhysicalDevice &gpu) override;
	uint64_t      get_buffer_device_address(VkBuffer buffer);
	ScratchBuffer create_scratch_buffer(VkDeviceSize size);
	void          delete_scratch_buffer(ScratchBuffer &scratch_buffer);
	void          create_storage_image();
	void          create_bottom_level_acceleration_structure();
	void          create_top_level_acceleration_structure();
	void          delete_acceleration_structure(AccelerationStructure &acceleration_structure);
	void          create_scene();
	void          create_shader_binding_tables();
	void          create_descriptor_sets();
	void          create_ray_tracing_pipeline();
	void          create_uniform_buffer();
	void          build_command_buffers() override;
	void          update_uniform_buffers();
	void          draw();
	bool          prepare(vkb::Platform &platform) override;
	virtual void  render(float delta_time) override;
};

std::unique_ptr<vkb::VulkanSample> create_raytracing_basic();


text:
<?php

$installer = $this;
/* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */

$installer->startSetup();

$installer->run("
    ALTER TABLE `{$this->getTable('catalog/product_option_type_value')}` ADD `sort_order` int(10) unsigned NOT NULL default '0';
");

$installer->endSetup();


text:
using namespace std;

void sort_list(vector<int> list) {
	map<int, int> count_occurences;

	// Counting occurences of each element in the input list
	for(int i = 0; i < list.size(); i++) {
		count_occurences[list[i]]++;
	}

	vector<int> sorted_list;

	// Generating sorted list based on the occurences of each element in the input
	for (auto it = count_occurences.begin(); it != count_occurences.end(); it++) {
		for(int i = 0; i < (*it).second; i++) {
			sorted_list.push_back((*it).first);
		}
	}

	vector<int> first_sorted_list;
	vector<int> second_sorted_list;

	vector<int> combined_sorted_list;

	// Splitting the sorted list in two
	for (int i = 0; i < sorted_list.size(); i++) {
		if (i % 2 == 0) {
			first_sorted_list.push_back(sorted_list[i]);
		} else {
			second_sorted_list.push_back(sorted_list[i]);
		}
	}

	// Creating a sored list from the above generated two lists
	for(int i = 0; i < sorted_list.size() / 2; i++) {
		combined_sorted_list.push_back(first_sorted_list[i]);
		combined_sorted_list.push_back(second_sorted_list[i]);
	}

	// Comparing the sorted lists - on the left side is the combination between the split lists,
	// And on the right is the initial sorted list based on the occurences of elements in the input
	for (int i = 0; i < combined_sorted_list.size(); i++) {
		cout << combined_sorted_list[i] << " - " << sorted_list[i] << endl;
	}
}

vector<int>& random_list_sort() {
	random_device rd;
	mt19937 mt(rd());
	uniform_int_distribution<int> range(1, 10000); // 1: 10-000

	vector<int> output(100);

	for(int i = 0; i < 100; i++) {
		output[i] = (range(mt));
	}

	sort_list(output);

	return output;
}
// Uncomment for awesomeness
//int main() {
//	vector<int> test = random_list_sort();
//
//	cin.get();
//}


text:
'use strict';

var React = require('react-native');
var {
  Animation,
  StyleSheet,
  View,
  Text,
  TouchableOpacity,
} = React;

var merge = require('merge');

var Modal = React.createClass({
  componentDidUpdate(prevProps, prevState) {
    if (!prevProps.isVisible && this.props.isVisible == true) {
      Animation.startAnimation(this.refs['this'], 300, 0, 'easeInOutQuad', {opacity: 1});
    }
  },

  render() {
    var closeButton;

    if (this.props.hideCloseButton !== true) {
      closeButton = (
        <View style={modalStyles.closeButton}>
          <TouchableOpacity onPress={this.props.onClose}>
            <Text style={modalStyles.closeButtonText}>Close</Text>
          </TouchableOpacity>
        </View>
      )
    }

    if (this.props.isVisible) {
      return (
        <View ref="this" style={modalStyles.container}>
          <View style={modalStyles.backdrop} />
          {closeButton}

          <View style={modalStyles.modal}>
            {this.props.children}
          </View>
        </View>
      );
    } else {
      return <View />;
    }
  },
});

var modalStyles = StyleSheet.create({
  container: {
    position: 'absolute',
    top: 0,
    bottom: 0,
    left: 0,
    right: 0,
    backgroundColor: 'transparent',
    alignItems: 'center',
    justifyContent: 'center',
  },
  backdrop: {
    position: 'absolute',
    top: 0,
    bottom: 0,
    left: 0,
    right: 0,
    backgroundColor: '#000000',
    opacity: 0.5,
  },
  closeButton: {
    position: 'absolute',
    borderColor: '#ffffff',
    borderRadius: 2,
    borderWidth: 1,
    right: 20,
    top: 20,
    paddingLeft: 10,
    paddingRight: 10,
    paddingTop: 5,
    paddingBottom: 5,
  },
  closeButtonText: {
    color: '#ffffff',
  },
  modal: {
    margin: 20,
    backgroundColor: '#ffffff',
    borderRadius: 3,
    padding: 20,
    alignSelf: 'stretch',
  }
});

module.exports = Modal;


text:
<?xml version="1.0" encoding="UTF-8"?>
<window>
  <include>OpenClose</include>
  <controls>
    <control type="image" id="901" description="Muted">
      <top>-42</top>
      <left>1672</left>
      <width>318</width>
      <height>306</height>
      <bordersize>75</bordersize>
	  <texture aligny="top" align="right">HUD/VolumeMuted.png</texture>
	  <colordiffuse>HL</colordiffuse>
    </control>
  </controls>
</window>


text:
local props={rx=50,ry=25,dx=150,dy=100,style="fill:none;"}

set_flowchart_props=function(P)
	for k,v in pairs(P) do
		props[k]=v
	end
	return props
end

local default_taget={cx=0,cy=0}

require "utils/str2things"
local str2xya=str2xya

local cal_pos=function(str,target)
	local x,y=str2xya(str,props.dx,props.dy)
	target=target or default_taget
	return target.cx+x,target.cy+y
end

unit=function(tp,label,pos_str,target)
	local x,y=cal_pos(pos_str,target)
	return node{TYPE=tp or "rect",STYLE=props.STYLE,cx=x,cy=y,rx=props.rx,ry=props.ry,LABEL=label,LPOS="D8M"}
end

process=function(label,pos_str,target)
	return unit("rect",label,pos_str,target)
end

condition=function(label,pos_str,target)
	return unit("diamond",label,pos_str,target)
end

state=function(label,pos_str,target)
	return unit("ellipse",label,pos_str,target)
end

point_to=function(from,to,label,lpos,shape,reverse,smooth)
	local offset= shape=="C" and (reverse and -dw or dw) or shape=="U" and (reverse and -dh or dh)
	return edge{from,to;   LABEL=label,LPOS=label and (lpos or ""),SHAPE=shape,OFFSET=offset,SMOOTH=smooth,HEAD="url(#arrow)"}
end

------------------------------------------------------------
-- usage
------------------------------------------------------------

--~ require "flowchart"

--~ local start=state("start","DR3")
--~ local p1=process("p1","D",start)
--~ local p2=process("p2","D",p1)
--~ local c=condition("c?","D",p2)
--~ local p3=process("p3","D",c)
--~ local p4=process("p4","R",p3)
--~ local _end=state("end","D",p3)

--~ point_to(start,p1)
--~ point_to(p1,p2)
--~ point_to(p2,c)
--~ point_to(c,p3,"no","R5S","-")
--~ point_to(c,p4,"yes","U5M","7")
--~ point_to(p3,_end)
--~ point_to(p4,_end,"","","N")

--~ export("test-flowchart.svg")