text:
namespace history {

namespace {

// Validates the consistency of the given history result. We just make sure
// that the URL rows match the indices structure. The unit tests themselves
// test the index structure to verify things are in the right order, so we
// don't need to.
void CheckHistoryResultConsistency(const QueryResults& result) {
  for (size_t i = 0; i < result.size(); i++) {
    size_t match_count;
    const size_t* matches = result.MatchesForURL(result[i].url(), &match_count);

    bool found = false;
    for (size_t match = 0; match < match_count; match++) {
      if (matches[match] == i) {
        found = true;
        break;
      }
    }

    EXPECT_TRUE(found) << "The URL had no index referring to it.";
  }
}

const char kURL1[] = "http://www.google.com/";
const char kURL2[] = "http://news.google.com/";

// Adds kURL1 twice and kURL2 once.
void AddSimpleData(QueryResults* results) {
  GURL url1(kURL1);
  GURL url2(kURL2);
  std::vector<URLResult> test_vector;

  test_vector.push_back(URLResult(url1, base::Time::Now()));
  test_vector.push_back(URLResult(url1, base::Time::Now()));
  test_vector.push_back(URLResult(url2, base::Time::Now()));

  // The URLResults are invalid after being inserted.
  results->SetURLResults(std::move(test_vector));
  CheckHistoryResultConsistency(*results);
}

}  // namespace

// Tests insertion and deletion by range.
TEST(HistoryQueryResult, DeleteRange) {
  GURL url1(kURL1);
  GURL url2(kURL2);
  QueryResults results;
  AddSimpleData(&results);

  // Make sure the first URL is in there twice. The indices can be in either
  // order.
  size_t match_count;
  const size_t* matches = results.MatchesForURL(url1, &match_count);
  ASSERT_EQ(2U, match_count);
  EXPECT_TRUE((matches[0] == 0 && matches[1] == 1) ||
              (matches[0] == 1 && matches[1] == 0));

  // Check the second one.
  matches = results.MatchesForURL(url2, &match_count);
  ASSERT_EQ(1U, match_count);
  EXPECT_TRUE(matches[0] == 2);

  // Delete the first instance of the first URL.
  results.DeleteRange(0, 0);
  CheckHistoryResultConsistency(results);

  // Check the two URLs.
  matches = results.MatchesForURL(url1, &match_count);
  ASSERT_EQ(1U, match_count);
  EXPECT_TRUE(matches[0] == 0);
  matches = results.MatchesForURL(url2, &match_count);
  ASSERT_EQ(1U, match_count);
  EXPECT_TRUE(matches[0] == 1);

  // Now delete everything and make sure it's deleted.
  results.DeleteRange(0, 1);
  EXPECT_EQ(0U, results.size());
  EXPECT_FALSE(results.MatchesForURL(url1, nullptr));
  EXPECT_FALSE(results.MatchesForURL(url2, nullptr));
}

// Tests insertion and deletion by URL.
TEST(HistoryQueryResult, ResultDeleteURL) {
  GURL url1(kURL1);
  GURL url2(kURL2);
  QueryResults results;
  AddSimpleData(&results);

  // Delete the first URL.
  results.DeleteURL(url1);
  CheckHistoryResultConsistency(results);
  EXPECT_EQ(1U, results.size());

  // The first one should be gone, and the second one should be at [0].
  size_t match_count;
  EXPECT_FALSE(results.MatchesForURL(url1, nullptr));
  const size_t* matches = results.MatchesForURL(url2, &match_count);
  ASSERT_EQ(1U, match_count);
  EXPECT_TRUE(matches[0] == 0);

  // Delete the second URL, there should be nothing left.
  results.DeleteURL(url2);
  EXPECT_EQ(0U, results.size());
  EXPECT_FALSE(results.MatchesForURL(url2, nullptr));
}

// Tests time ranges.
TEST(HistoryTypes, DeletionTimeRange) {
  auto invalid = DeletionTimeRange::Invalid();
  EXPECT_FALSE(invalid.IsValid());
  EXPECT_FALSE(invalid.IsAllTime());

  auto some_hours = DeletionTimeRange(
      base::Time::Now() - base::TimeDelta::FromHours(1), base::Time::Now());
  EXPECT_TRUE(some_hours.IsValid());
  EXPECT_FALSE(some_hours.IsAllTime());

  auto all_time = DeletionTimeRange::AllTime();
  EXPECT_TRUE(all_time.IsValid());
  EXPECT_TRUE(all_time.IsAllTime());

  auto another_all_time = DeletionTimeRange(base::Time(), base::Time());
  EXPECT_TRUE(another_all_time.IsValid());
  EXPECT_TRUE(another_all_time.IsAllTime());
}

}  // namespace history

redpajama_set_name: RedPajamaGithub


text:
<?php

/*
 * This file is part of vaibhavpandeyvpz/chokidar package.
 *
 * (c) Vaibhav Pandey <contact@vaibhavpandey.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.md.
 */

namespace Chokidar;

/**
 * Interface RepositoryInterface
 * @package Chokidar
 */
interface RepositoryInterface
{
    /**
     * @param string $username
     * @return UserInterface|false
     */
    public function find($username);
}


text:
ACCEPTED

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

#### Published in
Lichenologist 25(3): 249 (1993)

#### Original name
Lecanactis patellarioides var. convexa B. de Lesd.

### Remarks
null


text:
layout: null
sitemap:
  exclude: 'yes'
---

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="text" xml:lang="en">{{ site.title }} by Pavel Dmytrenko</title>
  <link type="application/atom+xml" href="{{ site.url }}/atom.xml" rel="self"/>
  <link href="{{ site.url }}/"/>
  <id>{{ site.url }}/</id>
  <updated>{{ site.time | date: "%Y-%m-%dT%H:%M:%SZ" }}</updated>
  <rights type="text">Copyright © {{ site.time | date: "%Y" }} {{ site.author.name }}. All rights reserved.</rights>
  {% for post in site.posts limit:10 %}
    <entry>
      <author>
        <name>{{ site.author.name }}</name>
        <email>{{ site.author.email }}</email>
      </author>
      <title type="text">{{ post.title | xml_escape }}</title>
      {% for tag in post.tags %}
        <category term="{{ tag }}"/>
      {% endfor %}
      <link rel="alternate" type="text/html" href="{{ site.url }}{{ post.url }}"/>
      <id>{{ site.url }}{{ post.id }}</id>
      <published>{{ post.date | date: "%Y-%m-%dT%H:%M:%SZ" }}</published>
      <updated>{{ post.date | date: "%Y-%m-%dT%H:%M:%SZ" }}</updated>
      <content type="html">{{ post.content | xml_escape }}</content>
    </entry>
  {% endfor %}
</feed>


text:
import RightPanelStore from "../../stores/right-panel/RightPanelStore";
import { RightPanelPhases } from "../../stores/right-panel/RightPanelStorePhases";

export const showThreadPanel = () => {
    RightPanelStore.instance.setCard({ phase: RightPanelPhases.ThreadPanel });
};


text:
@class NSArray, NSDate, NSMutableArray, NSString, XCSDevice, XCSIntegration;

@interface XCSTest : XCSObject
{
    BOOL _passed;
    XCSIntegration *_integration;
    XCSDevice *_testedDevice;
    NSString *_keyPath;
    NSDate *_date;
    double _startTime;
    double _endTime;
    NSArray *_failureSummaries;
    NSString *_deviceIdentifier;
    NSMutableArray *_somePerfMetrics;
}

+ (id)gregorianCalendar;
@property(retain, nonatomic) NSMutableArray *somePerfMetrics; // @synthesize somePerfMetrics=_somePerfMetrics;
@property(retain, nonatomic) NSString *deviceIdentifier; // @synthesize deviceIdentifier=_deviceIdentifier;
@property(retain, nonatomic) NSArray *failureSummaries; // @synthesize failureSummaries=_failureSummaries;
@property(nonatomic) BOOL passed; // @synthesize passed=_passed;
@property(nonatomic) double endTime; // @synthesize endTime=_endTime;
@property(nonatomic) double startTime; // @synthesize startTime=_startTime;
@property(retain, nonatomic) NSDate *date; // @synthesize date=_date;
@property(copy, nonatomic) NSString *keyPath; // @synthesize keyPath=_keyPath;
@property(retain, nonatomic) XCSDevice *testedDevice; // @synthesize testedDevice=_testedDevice;
@property(retain, nonatomic) XCSIntegration *integration; // @synthesize integration=_integration;
- (void).cxx_destruct;
- (BOOL)_validateWithPerfMetrics:(struct NSArray *)arg1 errors:(id *)arg2;
- (BOOL)_validateWithIntegration:(id)arg1 device:(id)arg2 keyPath:(id)arg3 date:(id)arg4 startTime:(double)arg5 endTime:(double)arg6 passed:(BOOL)arg7 failureSummaries:(id)arg8;
- (id)saveRepresentationHumanReadable:(BOOL)arg1;
- (id)saveRepresentation;
- (id)dictionaryRepresentation;
- (id)description;
- (id)initWithContents:(id)arg1 service:(id)arg2 validationErrors:(id *)arg3;
- (id)initWithIntegration:(id)arg1 device:(id)arg2 keyPath:(id)arg3 date:(id)arg4 startTime:(double)arg5 endTime:(double)arg6 passed:(BOOL)arg7 failureSummaries:(id)arg8;
- (BOOL)setTestPerfMetrics:(struct NSArray *)arg1 errors:(id *)arg2;
@property(readonly, copy, nonatomic) NSString *name;
@property(readonly, nonatomic) NSArray *perfMetrics;

@end


text:
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateNotificationsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('notifications', function($table) {
			$table->increments('id');
			$table->string('notification');
			$table->string('type');
			$table->integer('type_id')->unsigned()->nullable();
			$table->boolean('is_read')->default(0);

			$table->integer('sent_id')->unsigned()->nullable();
			$table->integer('user_id')->unsigned();
			$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');

			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('notifications');
	}
}


text:
package boa.test.datagen.php;

import java.io.IOException;

import org.junit.Test;

public class TestPHPReference extends PHPBaseTest {

	@Test
	public void testReference() throws IOException, Exception{
		nodeTest(load("test/datagen/PHP/Reference.boa"),
				load("test/datagen/PHP/Reference.php"));
	}

}


text:
	<TITLE>802.11 to PRISM2 RID Mapping List</TITLE>

doc/prism2/ridlist-mib.html
Copyright (C) 2000 AbsoluteValue Systems, Inc. All Rights Reserved.

API - The document source for this RID is the API Enhancements Document

PRO - The document source for this RID is the CW10 Programmer's Manual

[1] - read mode is implemented internally within the driver

[2] - This RID is implemented internally in the driver during implementation of the Group Addresses RID (0xFC80)

[3] - This RID is implemented internally in the driver

		PRISM2
RID
VALUE
		PRISM2
RID
NAME
		STA
		AP
		802.11 MibItem Name
		Doc
Src
		Implemented?

		F200
		LinkStatus

		API

		F201
		AssociationStatus

		API

		F202
		AuthenticationRequest

		API

		F203
		PowerSaveUserCount

		API

		FC29
		cnfWEPKeyMappingTable

		API

		FC2A
		cnfAuthentication

		API

		FC2B
		cnfMaxAssociatedStations

		API

		FC2C
		cnfTxControl

		API

		FC2D
		cnfRoamingMode

		API

		FC2E
		cnfHostAuthentication

		API

		FC30
		cnfRcvCrcError

		API

		FC31
		cnfMMLife

		API

		FC32
		cnfAltRetryCnt

		API

		FC33
		cnfBeaconInterval

		API

		FC34
		cnfAPPCFInfo

		API

		FC35
		cnfSTAPCFInfo

		API

		FC9E
		TxRateControl0

		API

		FC9F
		TxRateControl1

		API

		FCA0
		TxRateControl2

		API

		FCA1
		TxRateControl3

		API

		FCA2
		TxRateControl4

		API

		FCA3
		TxRateControl5

		API

		FCA4
		TxRateControl6

		API

		FCB0
		cnfShortPreamble

		API

		FCB1
		cnfExcludeLongPreamble

		API

		FCB3
		cnfBasicRates

		API

		FCE1
		ScanRequest

		API

		FCE2
		JoinRequest

		API

		FCE3
		authenticateStation

		API

		FCE4
		ChannelInfoRequest

		API

		F101
		ScanResults

		PRO

		F102
		ChannelInfoResults

		PRO

		FC00
		cnfPortType

		PRO

		FC03
		cnfOwnChannel

		PRO

		FC04
		cnfOwnSSID IBSS

		PRO

		FC05
		cnfOwnATIMWindow

		PRO

		FC06
		cnfSystemScale

		PRO

		FC07
		cnfMaxDataLength

		PRO

		FC08
		cnfWDSAddress

		PRO

		FC0A
		cnfPMEPS

		PRO

		FC0B
		cnfMulticastReceive

		PRO

		FC0C
		cnfMaxSleepDuration

		PRO

		FC0D
		cnfPMHoldoverDuration

		PRO

		FC0E
		cnfOwnName

		PRO

		FC11
		cnfWDSAddress1

		PRO

		FC12
		cnfWDSAddress2

		PRO

		FC13
		cnfWDSAddress3

		PRO

		FC14
		cnfWDSAddress4

		PRO

		FC15
		cnfWDSAddress5

		PRO

		FC16
		cnfWDSAddress6

		PRO

		FC17
		cnfMulticastPMBuffering

		PRO

		FC81
		CreateIBSS

		PRO

		FC90
		FragmentationThreshold0

		PRO

		FC91
		FragmentationThreshold1

		PRO

		FC92
		FragmentationThreshold2

		PRO

		FC93
		FragmentationThreshold3

		PRO

		FC94
		FragmentationThreshold4

		PRO

		FC95
		FragmentationThreshold5

		PRO

		FC96
		FragmentationThreshold6

		PRO

		FC97
		RTSThreshold0

		PRO

		FC98
		RTSThreshold1

		PRO

		FC99
		RTSThreshold2

		PRO

		FC9A
		RTSThreshold3

		PRO

		FC9B
		RTSThreshold4

		PRO

		FC9C
		RTSThreshold5

		PRO

		FC9D
		RTSThreshold6

		PRO

		FCB4
		cnfSupportedRates

		PRO

		FCE0
		TickTime

		PRO

		FD00
		MaxLoadTime

		PRO

		FD01
		DownloadBuffer

		PRO

		FD02
		PRIIdentity

		PRO

		FD03
		PRISupRange

		PRO

		FD04
		CFIActRanges

		PRO

		FD0A
		NICSerialNumber

		PRO

		FD0B
		NICIdentity

		PRO

		FD0C
		MFISupRange

		PRO

		FD0D
		CFISupRange

		PRO

		FD10
		ChannelList

		PRO

		FD11
		RegulatoryDomains

		PRO

		FD13
		CIS

		PRO

		FD20
		STAIdentity

		PRO

		FD21
		STASupRange

		PRO

		FD22
		MFIActRanges

		PRO

		FD23
		CFIActRanges

		PRO

		FD40
		PortStatus

		PRO

		FD41
		CurrentSSID

		PRO

		FD42
		CurrentBSSID

		PRO

		FD43
		CommsQuality

		PRO

		FD44
		CurrentTxRate

		PRO

		FD46
		CurrentScaleThresholds

		PRO

		FD80
		CurrentTxRate1

		PRO

		FD81
		CurrentTxRate2

		PRO

		FD82
		CurrentTxRate3

		PRO

		FD83
		CurrentTxRate4

		PRO

		FD84
		CurrentTxRate5

		PRO

		FD85
		CurrentTxRate6

		PRO

		FDC2
		CurrentPowerState

		PRO

		FDC6
		SupportedDataRates

		PRO

		dot11ACKFailureCount
		PRO

		FC85
		PromiscuousMode
		X

		dot11Address1-32
		PRO
		R/W [2]

		FC80
		GroupAddresses
		X

		dot11Address10
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address11
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address12
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address13
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address14
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address15
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address16
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address17
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address18
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address19
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address1
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address20
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address21
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address22
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address23
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address24
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address25
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address26
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address27
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address28
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address29
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address2
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address30
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address31
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address32
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address3
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address4
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address5
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address6
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address7
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address8
		PRO
		R/W [1]

		FC80
		GroupAddresses
		X

		dot11Address9
		PRO
		R/W [1]

		dot11AntennaListIndex
		PRO

		FD47
		ProtocolRspTime
		X
		X
		dot11AssociationResponseTimeOut
		PRO
		R

		dot11AuthenticateFailStation
		PRO
		R [3]

		dot11AuthenticateFailStatus
		PRO
		R [3]

		FD4D
		AuthenticationAlgorithms
		X
		X
		dot11AuthenticationAlgorithm1
		PRO
		R/W

		dot11AuthenticationAlgorithm2
		PRO

		dot11AuthenticationAlgorithm3
		PRO

		dot11AuthenticationAlgorithm4
		PRO

		dot11AuthenticationAlgorithm5
		PRO

		dot11AuthenticationAlgorithm6
		PRO

		FD4D
		AuthenticationAlgorithms
		X
		X
		dot11AuthenticationAlgorithmsEnable1
		PRO
		R/W

		dot11AuthenticationAlgorithmsEnable2
		PRO

		dot11AuthenticationAlgorithmsEnable3
		PRO

		dot11AuthenticationAlgorithmsEnable4
		PRO

		dot11AuthenticationAlgorithmsEnable5
		PRO

		dot11AuthenticationAlgorithmsEnable6
		PRO

		FCB2
		cnfAuthenticationRspTO
		X

		dot11AuthenticationResponseTimeOut
		API
		R

		FD45
		CurrentBeaconInterval
		X
		X
		dot11BeaconPeriod
		PRO
		R/W

		dot11CCAModeSupported
		PRO

		dot11CCAWatchdogCountMax
		PRO

		dot11CCAWatchdogCountMin
		PRO

		dot11CCAWatchdogTimerMax
		PRO

		dot11CCAWatchdogTimerMin
		PRO

		FD87
		PCFInfo

		X
		dot11CFPMaxDuration
		PRO
		R

		FD87
		PCFInfo

		X
		dot11CFPPeriod
		PRO
		R

		FD4C
		CFPollable
		X

		dot11CFPollable
		PRO
		R

		dot11ChannelAgilityEnabled
		PRO

		dot11ChannelAgilityPresent
		PRO

		FDC3
		CCAMode
		X
		X
		dot11CurrentCCAMode
		PRO
		R

		FDC1
		CurrentChannel
		X
		X
		dot11CurrentChannel
		PRO
		R

		dot11CurrentChannelNumber
		PRO

		dot11CurrentDwellTime
		PRO

		dot11CurrentIndex
		PRO

		dot11CurrentPattern
		PRO

		dot11CurrentRegDomain
		PRO

		dot11CurrentRxAntenna
		PRO

		dot11CurrentSet
		PRO

		dot11CurrentTxAntenna
		PRO

		dot11CurrentTxPowerLevel
		PRO

		FC10
		cnfOwnDTIMPeriod

		X
		dot11DTIMPeriod
		API
		R/W

		dot11DeauthenticateReason
		PRO
		R [3]

		dot11DeauthenticateStation
		PRO
		R [3]

		dot11DesiredBSSType
		PRO
		R/W [3]

		FC02
		cnfDesiredSSID
		X

		dot11DesiredSSID
		PRO
		R/W

		dot11DisassociateReason
		PRO
		R [3]

		dot11DisassociateStation
		PRO
		R [3]

		dot11DiversitySelectionRx
		PRO

		dot11DiversitySupport
		PRO

		dot11EDThreshold
		PRO

		FC28
		cnfWEPFlags
		X
		X
		dot11ExcludeUnencrypted
		API
		R/W

		dot11FCSErrorCount
		PRO

		dot11FailedCount
		PRO

		FC82
		FragmentationThreshold
		X

		dot11FragmentationThreshold
		PRO
		R/W

		dot11FrameDuplicateCount
		PRO

		dot11HopTime
		PRO

		FD49
		LongRetryLimit
		X
		X
		dot11LongRetryLimit
		PRO
		R

		FD86
		OwnMACAddress

		X
		dot11MACAddress
		PRO
		R/W

		dot11ManufacturerID
		PRO

		dot11MaxDwellTime
		PRO

		FD4B
		MaxReceiveLifetime

		dot11MaxReceiveLifetime
		PRO
		R

		FD4A
		MaxTransmitLifetime

		dot11MaxTransmitMSDULifetime
		PRO
		R

		FD87
		PCFInfo

		X
		dot11MediumOccupancyLimit
		PRO
		R

		dot11MulticastReceivedFrameCount
		PRO

		dot11MulticastTransmittedFrameCount
		PRO

		dot11MultipleRetryCount
		PRO

		dot11NumberSupportedPowerLevels
		PRO

		FC84
		TxRateControl
		X

		dot11OperationalRateSet
		API
		R/W

		dot11PBCCOptionImplemented
		PRO

		FDC0
		PHYType
		X
		X
		dot11PHYType
		PRO
		R

		FC09
		cnfPMEnabled
		X

		dot11PowerManagementMode
		PRO
		R/W

		FC28
		cnfWEPFlags
		X
		X
		dot11PrivacyInvoked
		API
		R/W

		FD4F
		PrivacyOptionImplemented

		dot11PrivacyOptionImplemented
		PRO
		R

		dot11ProductID
		PRO

		dot11RTSFailureCount
		PRO

		dot11RTSSuccessCount
		PRO

		FC83
		RTSThreshold
		X

		dot11RTSThreshold
		PRO
		R/W

		dot11ReceivedFragmentCount
		PRO

		dot11RegDomainsSupportIndex
		PRO

		dot11RegDomainsSupportValue
		PRO

		dot11RetryCount
		PRO

		dot11ShortPreambleOptionImplemented
		PRO

		FD48
		ShortRetryLimit
		X
		X
		dot11ShortRetryLimit
		PRO
		R

		FC01
		cnfOwnMACAddress
		X

		dot11StationID
		PRO
		R/W

		dot11SupportedDataRatesRxIndex
		PRO

		dot11SupportedDataRatesRxValue
		PRO

		dot11SupportedDataRatesTxIndex
		PRO

		dot11SupportedDataRatesTxValue
		PRO

		dot11SupportedRxAntenna
		PRO

		dot11SupportedTxAntenna
		PRO

		FD12
		TempType
		X
		X
		dot11TempType
		PRO
		R

		dot11TransmittedFragmentCount
		PRO

		dot11TransmittedFrameCount
		PRO

		dot11TxPowerLevel1
		PRO

		dot11TxPowerLevel2
		PRO

		dot11TxPowerLevel3
		PRO

		dot11TxPowerLevel4
		PRO

		dot11TxPowerLevel5
		PRO

		dot11TxPowerLevel6
		PRO

		dot11TxPowerLevel7
		PRO

		dot11TxPowerLevel8
		PRO

		FC24
		cnfDefaultKey0
		X
		X
		dot11WEPDefaultKey0
		API
		R/W

		FC25
		cnfDefaultKey1
		X
		X
		dot11WEPDefaultKey1
		API
		R/W

		FC26
		cnfDefaultKey2
		X
		X
		dot11WEPDefaultKey2
		API
		R/W

		FC27
		cnfDefaultKey3
		X
		X
		dot11WEPDefaultKey3
		API
		R/W

		FC23
		cnfWEPDefaultKeyID
		X
		X
		dot11WEPDefaultKeyID
		API
		R/W

		dot11WEPExcludedCount
		PRO

		dot11WEPICVErrorCount
		PRO

		dot11WEPKeyMappingAddress
		PRO

		dot11WEPKeyMappingIndex
		PRO

		dot11WEPKeyMappingLength
		PRO

		dot11WEPKeyMappingValue
		PRO

		dot11WEPKeyMappingWEPOn
		PRO

		dot11WEPUndecryptableCount
		PRO


text:
<?php

namespace BruntTest\Testobjects;

use Brunt\Injectable;

class NonInjectableWrapper extends Injectable
{
    /**
     * @var NonInjectable
     */
    public $nonInjectable;

    /**
     * NonInjectableWrapper constructor.
     * @param NonInjectable $nonInjectable
     */
    public function __construct(NonInjectable $nonInjectable)
    {
        $this->nonInjectable = $nonInjectable;
    }
}


text:
/*
 * orion_spi.h
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2. This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */

#ifndef __LINUX_SPI_ORION_SPI_H
#define __LINUX_SPI_ORION_SPI_H

struct orion_spi_info {
	u32	tclk;		/* no <linux/clk.h> support yet */
};

#endif


text: DROP TABLE locality_early_vote_sites;


text:
title: 'Lost treasures  - Buildings removed as Contributing Structures of the Taos National Register Historic District'
date: 2012-07-05T08:20:00.000-07:00
draft: false
slug: lost-treasures-buildings-removed-as
tags: [Taos' Urban Environment]
---

During a project redocumenting the Taos Historic District in 2011, several buildings were removed from listing as Contributing Structures to the historic district by the NM State Historic Preservation Office because of renovations that rendered their historic facades no longer  authentic. It is worth sharing here to help our readers avoid having their own buildings delisted.

![](/images/blog/legacy/NM_Taos+County_110+Teresina_0001-e+%28Small%29.jpg)

The buildings no longer considered "authentically historic" include:

- Twirl Toystore at Teresina and Scheurich off the Plaza, removed because of its massive second story and extensive obscuring of the old structures with Asian wood details, which has a merit of curiosity that _might_ allow it to be relisted in 30 years.
- 146 Paseo Norte completed a construction that covered a facade with unique stone details with a Craftsman-style entrance. There are no other examples of Craftsman style in Taos. This is completely fabricated and inappropriate.
- The Taos Territorial compound at Padre Martinez and Don Fernando, for renovations that exaggerated the details of the old compound's true Territorial design.
- Enos Garcia Elementary.  Changing the windows changed this buildings status, and it will just about every time.
- The "Antonio's building" at Dona Luz and Don Fernando. Despite the attention to detail of changing material, size, and shape of details on the additions, the new shape of the building (second story especially) and new portions obscuring the actual historic building is what made this building considered no-longer contributing.

These are posted because they represent a hard lesson in what happens when the Taos Town Planning office isn't allowed to do its job. Each of these buildings' owners would have been eligible for $25k in tax credits for restoration work on these buildings. Now they are no longer eligible. As a preservationist, I know how hard cash is to come up with for preservation projects which can easily cost more than new work. I think that's a terrible shame.

A second lesson in this is be careful which architect you select. Make sure they have a track record in preservation that does not include having their buildings de-listed.


text:
Spree.config do |config|
  Spree::PermittedAttributes.address_attributes.concat [:street, :housenumber]
end


text:
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
  license agreements. See the NOTICE file distributed with this work for additional
  information regarding copyright ownership. The ASF licenses this file to
  you 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>cloud-developer</artifactId>
  <name>Apache CloudStack Developer Mode</name>
  <packaging>pom</packaging>
  <parent>
    <groupId>org.apache.cloudstack</groupId>
    <artifactId>cloudstack</artifactId>
    <version>4.10.0.0-SNAPSHOT</version>
  </parent>
  <dependencies>
    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-pool</groupId>
      <artifactId>commons-pool</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jasypt</groupId>
      <artifactId>jasypt</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cloudstack</groupId>
      <artifactId>cloud-utils</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cloudstack</groupId>
      <artifactId>cloud-server</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>properties-maven-plugin</artifactId>
        <version>1.0-alpha-2</version>
        <executions>
          <execution>
            <phase>initialize</phase>
            <goals>
              <goal>read-project-properties</goal>
            </goals>
            <configuration>
              <files>
                <file>${basedir}/../utils/conf/db.properties</file>
                <file>${basedir}/../utils/conf/db.properties.override</file>
              </files>
              <quiet>true</quiet>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <filter token="VERSION" value="${project.version}"/>
                <copy todir="${basedir}/target/db" filtering="true">
                  <fileset dir="${basedir}/../setup/db/"/>
                </copy>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <!-- default deploydb property -->
      <id>deploydb</id>
      <activation>
        <property>
          <name>deploydb</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
             <dependencies>
              <!-- specify the dependent jdbc driver here -->
              <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${cs.mysql.version}</version>
              </dependency>
            </dependencies>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <id>create-schema</id>
                <goals>
                  <goal>java</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
              <includePluginDependencies>true</includePluginDependencies>
              <arguments>
                <!-- db properties file -->
                <argument>${basedir}/../utils/conf/db.properties</argument>
                <argument>${basedir}/../utils/conf/db.properties.override</argument>
                <!-- Create default schema and db table views -->
                <argument>${basedir}/target/db/create-schema.sql</argument>
                <argument>${basedir}/target/db/create-schema-premium.sql</argument>
                <!-- Seed templates -->
                <argument>${basedir}/target/db/templates.sql</argument>
                <!-- Seed the database -->
                <argument>${basedir}/developer-prefill.sql</argument>
                <argument>${basedir}/developer-prefill.sql.override</argument>
                <!-- Do database upgrade-->
                <argument>com.cloud.upgrade.DatabaseUpgradeChecker</argument>
                <argument>--database=cloud,usage</argument>
                <argument>--rootpassword=${db.root.password}</argument>
                <!-- Print help using -h or dash-dash-help -->
                <!-- Do dry run using -d or dash-dash-dry -->
                <!-- Enable verbosity by -v or dash-dash-verbose -->
              </arguments>
              <systemProperties>
                <systemProperty>
                  <key>catalina.home</key>
                  <value>${basedir}/../utils</value>
                </systemProperty>
                <systemProperty>
                  <key>paths.script</key>
                  <value>${basedir}/target/db</value>
                </systemProperty>
              </systemProperties>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!-- saml deploydb property -->
      <id>deploydb-saml</id>
      <activation>
        <property>
          <name>deploydb-saml</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <dependencies>
              <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${cs.mysql.version}</version>
              </dependency>
            </dependencies>
            <version>1.2.1</version>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <id>create-schema-simulator</id>
                <goals>
                  <goal>java</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
              <includePluginDependencies>true</includePluginDependencies>
              <arguments>
                <!-- db properties file -->
                <argument>${basedir}/../utils/conf/db.properties</argument>
                <argument>${basedir}/../utils/conf/db.properties.override</argument>
                <!-- simulator sql files -->
                <argument>${basedir}/developer-saml.sql</argument>
                <!-- upgrade -->
                <argument>com.cloud.upgrade.DatabaseUpgradeChecker</argument>
                <argument>--rootpassword=${db.root.password}</argument>
              </arguments>
              <systemProperties>
                <systemProperty>
                  <key>catalina.home</key>
                  <value>${basedir}/../utils</value>
                </systemProperty>
                <systemProperty>
                  <key>paths.script</key>
                  <value>${basedir}/target/db</value>
                </systemProperty>
              </systemProperties>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!-- simulator deploydb property -->
      <id>deploydb-simulator</id>
      <activation>
        <property>
          <name>deploydb-simulator</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <dependencies>
              <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${cs.mysql.version}</version>
              </dependency>
	    </dependencies>
            <version>1.2.1</version>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <id>create-schema-simulator</id>
                <goals>
                  <goal>java</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
              <includePluginDependencies>true</includePluginDependencies>
              <arguments>
                <!-- db properties file -->
                <argument>${basedir}/../utils/conf/db.properties</argument>
                <argument>${basedir}/../utils/conf/db.properties.override</argument>
                <!-- simulator sql files -->
                <argument>${basedir}/target/db/create-schema-simulator.sql</argument>
                <argument>${basedir}/target/db/templates.simulator.sql</argument>
                <argument>${basedir}/target/db/hypervisor_capabilities.simulator.sql</argument>
                <!-- upgrade -->
                <argument>com.cloud.upgrade.DatabaseUpgradeChecker</argument>
                <argument>--database=simulator</argument>
                <argument>--rootpassword=${db.root.password}</argument>
              </arguments>
              <systemProperties>
                <systemProperty>
                  <key>catalina.home</key>
                  <value>${basedir}/../utils</value>
                </systemProperty>
                <systemProperty>
                  <key>paths.script</key>
                  <value>${basedir}/target/db</value>
                </systemProperty>
              </systemProperties>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>


text:
/* http://meyerweb.com/eric/tools/css/reset/
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/*
    Small Player Middle
*/
div#small-player-middle{
    width: 100%;
    height: 100%;
    margin-left: auto;
    margin-right: auto;
    top: 50%;
}

/*
    Play Pause
*/
div.amplitude-play-pause{
    height: 500px;
    width: 500px;
    cursor: pointer;
    padding: 5px;
}
div.amplitude-paused{
    background-image: url('/static/play-blue.png');
    background-repeat: no-repeat;
    background-size: 100%;
}
div.amplitude-playing{
    background-image: url('/static/pause-blue.png');
    background-repeat: no-repeat;
    background-size: 100%;
}
/*
    Current song time
*/
div#current-time{
    font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    font-weight: 500;
    font-size: 50px;
    margin-left: 22%;
    color: #024F99;
}


text:
This package and its sub-packages contain a [mounttable server] implementation
that uses Google's [Cloud Bigtable] service for storage. It is fast and scalable
to millions of nodes and, with enough replicas, millions of requests per second.

## Schema

Bigtable is not a relational database. Each table has only one key, and all
operations are atomic only at the row level. There is no way to mutate multiple
rows together atomically.

See the [Overview of Cloud Bigtable] for more information.

Our table has one row per node. The row key is a hash of the node name followed
by the name itself. This spreads rows evenly across all tablet servers with no
risk of name collision.

The table has three column families:

   * Metadata `m`: used to store information about the row:
      * ID `i`: A 4-byte ID for the node. Doesn't have to be globally unique.
      * Version `v`: The version changes every time the row is mutated. It is
        used to detect conflicts related to concurrent access.
      * Creator `c`: The cell's value is the name of its creator and its
        timestamp is the node creation time.
      * Sticky `s`: When this column is present, the node is not automatically
        garbage collected.
      * Permissions `p`: The [access.Permissions] of the node.
   * Servers `s`: Each mounted server has its own column. The column name is the
     server's address. The value contains the [mount flags]. The timestamp is
     the mount deadline.
   * Children `c`: Each child has its own column. The column name is the name of
     the child, without the path. The timestamp is the child creation time.

Example:

| Key              | ID  | Version | Creator | Sticky | Permissions  | Mounted Server...           | Child... |
| ---              | --- | ---     | ---     | ---    | ---          | ---                         | ---      |
| 540f1a56/        | id1 | 54321   | user    | 1      | {"Admin":... |                             | (id2)foo |
| 1234abcd/foo     | id2 | 123     | user    |        | {"Admin":... |                             | (id3)bar |
| 46d523e3/foo/bar | id3 | 5436    | user    |        | {"Admin":... | /example.com:123 (deadline) |          |

Counters are stored in another table, one row with one column per counter.

## Mutations

All operations use optimistic concurrency control. If a conflicting
change happens during a mutation, the whole operation is restarted.

  * Mutation on N
    * Get Node N
    * Check caller's permissions
    * Apply mutation on N if node version hasn't changed

If the node version changed, it means that another mutation was applied between
the time when we retrieved the node and when we tried to apply our mutation.
When that happens, we restart to whole operation, starting with retrieving the
node again.

### Mounting / Unmounting a server

Mounting a server consists of adding a new cell to the node's row. The column
family is `s`, the column name is the address of the server, the timestamp is
the mount deadline, and the value contains the [mount flags].

Unmounting a server consists of deleting the server's column.

### Adding / Removing a child node

Adding or removing a node requires two mutations: one on the parent, one on the
child.

When adding a node, we first add it to the parent, and then create a new row
with the same timestamp.

When deleting a node, we first delete the row, and then delete the child column
on the parent.

If the server process dies between the two mutations, it will leave the parent
with a reference to a child row that doesn't exist. As a consequence, the parent
will never be seen as "empty" and will not be automatically garbage collected.
This will be corrected when:

  * the child is re-created, or
  * the parent is forcibly deleted.

## Hot rows & caching

Some nodes are expected to be accessed significantly more than others, e.g. the
root node and its immediate children are traversed more often than nodes that
are further down the tree. The bigtable rows associated with these nodes are
"hotter" which can lead to traffic imbalance and poor performance.

This problem is alleviated with a small cache in the bigtable client. High
frequency or concurrent requests for the same rows can be bundled together to
reduce both latency and bigtable load at the same time.

## Opportunistic garbage collection

A node can be garbage-collected when it has no children, no mounted servers, and
hasn't been marked as _sticky_. A node is _sticky_ when someone explicitly
called [SetPermissions] on it.

The garbage collection happens opportunistically. When a mounttable server
accessed a node that is eligible for garbage collection while processing a
request, this node is removed before the ongoing request completes.

[Cloud Bigtable]: https://cloud.google.com/bigtable/docs/
[Overview of Cloud Bigtable]: https://cloud.google.com/bigtable/docs/api-overview
[mounttable server]: https://github.com/vanadium/go.v23/blob/master/services/mounttable/service.vdl
[SetPermissions]: https://github.com/vanadium/go.v23/blob/master/services/permissions/service.vdl#L58
[access.Permissions]: https://github.com/vanadium/go.v23/blob/master/security/access/types.vdl#L130
[mount flags]: https://github.com/vanadium/go.v23/blob/master/naming/types.vdl#L9


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
    <solid android:color="#ffffff"/>
    <corners android:radius="8dip"/>
    <stroke android:width="0.5dip" android:color="#000000"/>

</shape>


text:
DECLARE_WINDOW_PROPERTY_TYPE(bool)

namespace ash {

namespace {

const aura::WindowProperty<bool> kWindowTrackedByWorkspaceSplitProp = {true};

}  // namespace

void SetRestoreBounds(aura::Window* window, const gfx::Rect& bounds) {
  window->SetProperty(aura::client::kRestoreBoundsKey, new gfx::Rect(bounds));
}

void SetRestoreBoundsIfNotSet(aura::Window* window) {
  if (!GetRestoreBounds(window))
    SetRestoreBounds(window, window->bounds());
}

const gfx::Rect* GetRestoreBounds(aura::Window* window) {
  return window->GetProperty(aura::client::kRestoreBoundsKey);
}

void ClearRestoreBounds(aura::Window* window) {
  window->ClearProperty(aura::client::kRestoreBoundsKey);
}

void ToggleMaximizedState(aura::Window* window) {
  window->SetProperty(aura::client::kShowStateKey,
                      wm::IsWindowMaximized(window) ? ui::SHOW_STATE_NORMAL
                                                    : ui::SHOW_STATE_MAXIMIZED);
}

const aura::WindowProperty<bool>* const
    kWindowTrackedByWorkspaceSplitPropKey = &kWindowTrackedByWorkspaceSplitProp;

void SetTrackedByWorkspace(aura::Window* window, bool value) {
  window->SetProperty(kWindowTrackedByWorkspaceSplitPropKey, value);
}

bool GetTrackedByWorkspace(aura::Window* window) {
  return window->GetProperty(kWindowTrackedByWorkspaceSplitPropKey);
}

}


text:
<?xml version='1.0' encoding='UTF-8'?>
<Document>
  <Header>
    <SchemaName>Location</SchemaName>
    <Identifier>location_geonames_2756207</Identifier>
    <DocumentState>public</DocumentState>
    <TimeStamp>1390753462775</TimeStamp>
    <SummaryFields>
      <Title>NL > North Brabant > Elisabethpolder</Title>
    </SummaryFields>
  </Header>
  <Body>
    <Location>
      <GeopoliticalHierarchy>NL,North Brabant,Elisabethpolder</GeopoliticalHierarchy>
      <LocationName>
        <Appelation>Elisabethpolder</Appelation>
        <LocationNameType>polder</LocationNameType>
        <Comments></Comments>
      </LocationName>
      <Coordinates>
        <Longitude>4.4284099999999995</Longitude>
        <Latitude>51.64355</Latitude>
      </Coordinates>
      <GeonamesURI>http://www.geonames.org/2756207</GeonamesURI>
      <WikipediaLink/>
      <DbpediaLink/>
    </Location>
  </Body>
</Document>


text:
<?php

namespace Concrete\Tests\Validator\String;

use Concrete\TestHelpers\Database\ConcreteDatabaseTestCase;

class UniqueUserNameValidatorTest extends ConcreteDatabaseTestCase
{
    protected $fixtures = [
        'UniqueUserData',
    ];

    public function __construct($name = null, array $data = [], $dataName = '')
    {
        parent::__construct($name, $data, $dataName);
        $this->metadatas[] = \Concrete\Core\Entity\User\User::class;
    }

    public function testIsValid()
    {
        $validator = \Core::make(\Concrete\Core\Validator\String\UniqueUserNameValidator::class);

        $this->assertNotEmpty($validator->getRequirementStrings());

        $this->assertTrue($validator->isValidFor('new_user'));
        $this->assertFalse($validator->isValid('admin'));
        $this->assertFalse($validator->isValidFor('admin'));
        $this->assertTrue($validator->isValidFor('admin', 1));
        $this->assertFalse($validator->isValidFor('admin', 2));
    }

    public function testErrorAdded()
    {
        $validator = \Core::make(\Concrete\Core\Validator\String\UniqueUserNameValidator::class);

        $this->assertFalse($validator->isValid('admin', $error = new \ArrayObject()));
        $this->assertNotEmpty($error);
    }

    public function testInvalidInput()
    {
        $validator = \Core::make(\Concrete\Core\Validator\String\UniqueUserNameValidator::class);

        $this->setExpectedException('Exception');
        $validator->isValid($validator);
    }
}


text:
package com.myframe.dao.util;

/**
 * 排序枚举对象。
 *
 * @author wyzfzu (wyzfzu@qq.com)
 */
public enum OrderBy {
    asc("asc"),
    desc("desc");

    private String value;

    public String getValue() {
        return value;
    }

    OrderBy(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return getValue();
    }

}


text:
SELECT
  date,
  ZIP,
  max(MaxTemperatureF)
FROM
  weather

--1.b. Find station/s with zip code 94063 in trips

SELECT
  start_station,
  zip_code
FROM
  trips
WHERE
  zip_code = 94063

--1.c. Find city in which the one of the stations is

SELECT
 name,
 city
FROM
 stations
WHERE
 name LIKE 'San Francisco Caltrain 2 (330 Townsend)'

 --How many trips started at each station?
SELECT
  start_station,
  COUNT(*) trip_count
FROM
  trips
Group by start_station

--What's the shortest trip that happened?
SELECT
  trip_id,
  start_station,
  end_station,
  min(duration)
FROM
  trips

  --What is the average trip duration, by end station?
SELECT
  end_station,
  AVG(duration)
FROM
  trips
GROUP BY 1


text:
require 'spec_helper'

describe 'dlrn::worker' do
  let :facts do
  {  :os                        => {
          'family' => 'RedHat',
          'release' => {
              'major' => '7',
              'minor' => '1',
              'full'  => '7.6.1810',
           },
          'selinux' => {
              'enabled' => true,
          }
      },
      :osfamily                  => 'RedHat',
      :operatingsystem           => 'Fedora',
      :operatingsystemrelease    => '24',
      :operatingsystemmajrelease => '24',
      :concat_basedir            => '/tmp',
      :puppetversion             => '3.7.0',
      :selinux                   => true,
      :sudoversion               => '1.8.15',
      :processorcount            => 2 }
  end

  let :params do {
    :distro           => 'centos7',
    :target           => 'centos',
    :distgit_branch   => 'rpm-master',
    :distro_branch    => 'master',
    :disable_email    => true,
    :enable_cron      => false,
    :server_type      => 'primary',
    }
  end

  let(:pre_condition) { [
      'include ::apache',
      'include ::dlrn::common',
  ] }

  context 'with default parameters' do
    ['fedora-master', 'centos-master', 'centos-rocky'].each do |user|
      describe "when user is #{user}" do
        let :title do
          user
        end

        it 'creates user' do
          is_expected.to contain_user("#{user}").with(
            :groups     => ['users','mock'],
            :uid        => nil,
            :managehome => 'true',
          )
        end

        it 'sets owner on home directory' do
          is_expected.to contain_file("/home/#{user}").with(
            :ensure => 'directory',
            :mode   => '0755',
            :owner  => "#{user}",
          ).with_before(/Exec\[ensure home contents belong to #{user}\]/)
        end

        it 'creates the data directory' do
          is_expected.to contain_file("/home/#{user}/data").with(
            :ensure  => 'directory',
            :mode    => '0755',
            :owner   => "#{user}",
          ).with_before(/File\[\/home\/#{user}\/data\/repos\]/)
        end

        it 'creates the data/repos directory' do
          is_expected.to contain_file("/home/#{user}/data/repos").with(
            :ensure  => 'directory',
            :mode => '0755',
            :owner   => "#{user}",
          ).with_before(/File\[\/home\/#{user}\/data\/repos\/dlrn-deps.repo\]/)
        end

        it 'creates the dlrn-deps.repo file' do
          is_expected.to contain_file("/home/#{user}/data/repos/dlrn-deps.repo").with(
            :source => "puppet:///modules/dlrn/#{user}-dlrn-deps.repo",
            :mode   => '0644',
            :owner  => "#{user}",
            :group  => "#{user}",
          )
        end

        it 'creates the delorean-deps.repo compat symlink' do
          is_expected.to contain_file("/home/#{user}/data/repos/delorean-deps.repo").with(
            :ensure => 'link',
            :target => "/home/#{user}/data/repos/dlrn-deps.repo",
          )
        end

        it 'creates the sudo entry' do
          is_expected.to contain_sudo__conf("#{user}").with(
            :priority => '10',
            :content  => "#{user} ALL=(ALL) NOPASSWD: /bin/rm",
          )
        end

        it 'creates a log removal cron job' do
          is_expected.to contain_cron("#{user}-logrotate").with(
            :command => "/usr/bin/find /home/#{user}/dlrn-logs/*.log -mtime +2 -exec rm {} \\;",
            :user    => "#{user}",
            :hour    => '4',
            :minute  => '0',
          )
        end

        it 'configures the venv' do
          is_expected.to contain_file("/home/#{user}/setup_dlrn.sh").with(
            :ensure  => 'present',
            :mode    => '0755',
          )
          is_expected.to contain_exec("pip-install-#{user}").with(
            :command => "/home/#{user}/setup_dlrn.sh",
            :cwd     => "/home/#{user}/dlrn",
            :creates => "/home/#{user}/.venv/bin/dlrn",
          )
        end

        it { is_expected.to contain_cron("#{user}").with(
            :ensure => 'absent',
          )
        }
        it 'does not set smtpserver in projects.ini' do
          is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
          .with_content(/smtpserver=$/)
        end

        it 'sets the default release in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/tags=rocky$/)
        end

        it 'does not set a gerrit user in projects.ini' do
            is_expected.not_to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/gerrit=$/)
        end

        it 'does not set rsyncdest in projects.ini' do
            is_expected.not_to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/rsyncdest=/)
        end

        it 'does set rsyncport to 22 in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/rsyncport=22$/)
        end

        it 'sets the rdoinfo driver in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/pkginfo_driver=dlrn.drivers.rdoinfo.RdoInfoDriver$/)
        end

        it 'sets the mock build driver in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/build_driver=dlrn.drivers.mockdriver.MockBuildDriver$/)
        end

        it 'configures 1 worker in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/workers=1$/)
        end

        it 'configures the default db connection string' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/database_connection=sqlite:\/\/\/commits.sqlite$/)
        end

        it 'sets fallback_to_master to true' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/fallback_to_master=true$/)
        end

        it 'sets include_srpm_in_repo to true' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/include_srpm_in_repo=true$/)
        end

        it 'configures the default release numbering scheme' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/release_numbering=0.date.hash$/)
        end

        it 'creates the API directory' do
            is_expected.to contain_file("/home/#{title}/api").with(
              :ensure  => 'directory',
              :mode    => '0755',
              :owner   => "root",
              :group   => "root",
              :require => "File[/home/#{title}]",
            )
        end

        it 'creates the WSGI config file' do
          is_expected.to contain_file("/home/#{title}/api/dlrn-api-#{title}.cfg")
            .with_content(/DB_PATH = \'sqlite:\/\/\/\/home\/#{title}\/dlrn\/commits.sqlite\'$/)
        end

        it 'sets a config file path in the WSGI config file' do
          is_expected.to contain_file("/home/#{title}/api/dlrn-api-#{title}.cfg")
            .with_content(/CONFIG_FILE = \'\/usr\/local\/share\/dlrn\/#{title}\/projects.ini'$/)
        end

        it 'does not create a cronjob for deps sync' do
          is_expected.not_to contain_cron("#{user}-deps").with(
            :command => '/usr/local/bin/update-deps.sh',
            :user    => "#{user}",
            :hour    => '*',
            :minute  => '10,40',
          )
        end

        it 'does not create a cronjob for build deps sync' do
          is_expected.not_to contain_cron("#{user}-deps").with(
            :command => 'TAG_PHASE="build" DEPS_DIR="${HOME}/data/repos/build-deps/" /usr/local/bin/update-deps.sh > $HOME/dlrn-logs/update-build-deps-$(date +\%Y\%m\%d\%H\%M).log 2>&1',
            :user    => "#{user}",
            :hour    => '*',
            :minute  => '25,55',
          )
        end
      end

      context 'with a custom db connection string' do
        before :each do
          params.merge!(:db_connection => 'mysql+pymysql://user:password@serverIP/dlrn')
        end

        let :title do
          user
        end

        it 'configures the custom db connection string' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/database_connection=mysql\+pymysql:\/\/user:password@serverIP\/dlrn$/)
        end

        it 'creates the WSGI config file' do
          is_expected.to contain_file("/home/#{title}/api/dlrn-api-#{title}.cfg")
          .with_content(/DB_PATH = \'mysql\+pymysql:\/\/user:password@serverIP\/dlrn\'$/)
        end
      end

      context 'with the newer release numbering scheme' do
        before :each do
          params.merge!(:release_numbering => '0.1.date.hash')
        end

        let :title do
          user
        end

        it 'configures the custom release numbering scheme' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/release_numbering=0.1.date.hash$/)
        end
      end

      context 'with the minor.date.hash release numbering scheme' do
        before :each do
          params.merge!(:release_numbering => 'minor.date.hash')
          params.merge!(:release_minor => '1')
        end

        let :title do
          user
        end

        it 'configures the custom release numbering scheme' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/release_numbering=minor.date.hash$/)
        end

        it 'sets the right release_minor value' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/release_minor=1$/)
        end
      end

      context 'with an invalid release numbering scheme' do
        before :each do
          params.merge!(:release_numbering => 'foo')
        end

        let :title do
          user
        end

        it 'will fail' do
            is_expected.to raise_error(Puppet::Error, /Invalid release numbering scheme specified/)
        end
      end

      context 'with a specific number of workers' do
        before :each do
          params.merge!(:worker_processes => '4')
        end

        let :title do
          user
        end

        it 'configures 4 workers in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/workers=4$/)
        end
      end

      context 'when not allowing fallback to master' do
        before :each do
          params.merge!(:fallback_to_master => 'false')
        end

        let :title do
          user
        end

        it 'configures fallback_to_master=false' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/fallback_to_master=false$/)
        end
      end

      context 'when not including srpms in repos' do
        before :each do
          params.merge!(:include_srpm_in_repo => 'false')
        end

        let :title do
          user
        end

        it 'configures include_srpm_in_repo=false' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/include_srpm_in_repo=false$/)
        end
      end

      context 'with specific uid' do
        before :each do
          params.merge!(:uid => '1001')
        end

        let :title do
          user
        end

        it 'creates user with defined uid' do
          is_expected.to contain_user("#{user}").with(
            :uid => '1001'
          )
        end
      end

      context 'with enabled cron job and default cron params' do
        before :each do
          params.merge!(:enable_cron => true)
        end

        let :title do
          user
        end

        it 'creates cron job' do
          is_expected.to contain_cron("#{user}").with(
            :command => 'DLRN_ENV= /usr/local/bin/run-dlrn.sh',
            :user    => "#{user}",
            :hour    => '*',
            :minute  => '*/5',
          )
        end
      end

      context 'with enabled cron job and a command-line param' do
        before :each do
          params.merge!(:enable_cron => true)
          params.merge!(:cron_env => '--head-only')
        end

        let :title do
          user
        end

        it 'creates cron job' do
          is_expected.to contain_cron("#{user}").with(
            :command => 'DLRN_ENV=--head-only /usr/local/bin/run-dlrn.sh',
            :user    => "#{user}",
            :hour    => '*',
            :minute  => '*/5',
          )
        end
      end

      context 'with enabled cron job and a specific schedule' do
        before :each do
          params.merge!(:enable_cron => true)
          params.merge!(:cron_hour => '*/12')
          params.merge!(:cron_minute => '30')
        end

        let :title do
          user
        end

        it 'creates cron job' do
          is_expected.to contain_cron("#{user}").with(
            :command => 'DLRN_ENV= /usr/local/bin/run-dlrn.sh',
            :user    => "#{user}",
            :hour    => '*/12',
            :minute  => '30',
          )
        end
      end

      context 'with enabled purge job and default params' do
        before :each do
          params.merge!(:enable_purge => true)
        end

        let :title do
          user
        end

        it 'creates cron job' do
          is_expected.to contain_cron("#{user}-purge").with(
            :command => '/usr/local/bin/run-purge.sh',
            :user    => "#{user}",
            :hour    => '1',
            :minute  => '7',
          )
        end
      end

      context 'with enabled purge job and a specific schedule' do
        before :each do
          params.merge!(:enable_purge => true)
          params.merge!(:purge_hour => '5')
          params.merge!(:purge_minute => '35')
        end

        let :title do
          user
        end

        it 'creates cron job' do
          is_expected.to contain_cron("#{user}-purge").with(
            :command => '/usr/local/bin/run-purge.sh',
            :user    => "#{user}",
            :hour    => '5',
            :minute  => '35',
          )
        end
      end

      context 'with enabled emails' do
        before :each do
          params.merge!(:disable_email => false)
        end

        let :title do
          user
        end

        it 'sets smtpserver in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/smtpserver=localhost$/)
        end
      end

      context 'with symlinks' do
        before :each do
          params.merge!(:symlinks => ['/var/www/html/f24','/var/www/html/fedora24'])
        end

        let :title do
          user
        end

        it 'creates symlinks' do
          is_expected.to contain_file('/var/www/html/f24').with(
            :ensure  => 'link',
            :target  => "/home/#{user}/data/repos",
            :require => 'Package[httpd]',
          )
        end
      end

      context 'when specifying release' do
        before :each do
          params.merge!(:release => 'stein')
        end

        let :title do
          user
        end

        it 'sets tags in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/tags=stein$/)
        end
      end

      context 'when setting a gerrit user' do
        before :each do
          params.merge!(:gerrit_user => 'foo')
          params.merge!(:gerrit_email => 'foo@rdoproject.org')
        end

        let :title do
          user
        end

        it 'sets a gerrit user in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/gerrit=yes$/)
        end

        it 'configures the gerrit user' do
          is_expected.to contain_exec("Set gerrit user for #{user}").with(
            :command => "git config --global --add gitreview.username foo",
            :require => "File[/home/#{user}]",
          )

          is_expected.to contain_exec("Set git user for #{user}").with(
            :command => "git config --global user.name foo",
            :require => "File[/home/#{user}]",
          )

          is_expected.to contain_exec("Set git email for #{user}").with(
            :command => "git config --global user.email foo@rdoproject.org",
            :require => "File[/home/#{user}]",
          )
        end

        it 'sets the default Gerrit topic' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/gerrit_topic=rdo-FTBFS$/)
        end

        it 'sets up the required SSH keys' do
          is_expected.to contain_sshkey('review.rdoproject.org').with(
            :ensure => 'present',
            :name   => '[review.rdoproject.org]:29418',
          )
        end
      end

      context 'when setting a specific gerrit topic' do
        before :each do
          params.merge!(:gerrit_user => 'foo')
          params.merge!(:gerrit_email => 'foo@rdoproject.org')
          params.merge!(:gerrit_topic => 'rdo-FTBFS-anotherbranch')
        end

        let :title do
          user
        end

        it 'sets the right Gerrit topic' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/gerrit_topic=rdo-FTBFS-anotherbranch$/)
        end
      end

      context 'when setting the gitrepo driver' do
        before :each do
          params.merge!(:pkginfo_driver => 'dlrn.drivers.gitrepo.GitRepoDriver')
          params.merge!(:gitrepo_skip   => ['pkg1', 'pkg2'])
        end

        let :title do
          user
        end

        it 'sets the proper driver in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/pkginfo_driver=dlrn.drivers.gitrepo.GitRepoDriver$/)
        end

        it 'sets the proper skip in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/skip=pkg1,pkg2$/)
        end

        it 'sets use_version_from_spec to true in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/use_version_from_spec=true$/)
        end
      end

      context 'when setting the Koji build driver' do
        before :each do
          params.merge!(:build_driver           => 'dlrn.drivers.kojidriver.KojiBuildDriver')
          params.merge!(:koji_exe               => 'brew')
          params.merge!(:koji_krb_principal     => 'test@example.com')
          params.merge!(:koji_krb_keytab        => '/home/test/test.keytab')
          params.merge!(:koji_build_target      => 'testtarget')
          params.merge!(:koji_arch              => 'aarch64')
          params.merge!(:koji_fetch_mock_config => true)
        end

        let :title do
          user
        end

        it 'sets the proper driver in projects.ini' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/build_driver=dlrn.drivers.kojidriver.KojiBuildDriver$/)
        end

        it 'sets the default value for scratch_builds and use_rhpkg' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/scratch_build=true$/)
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/use_rhpkg=false$/)
        end

        it 'sets the proper value for koji_exe' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/koji_exe=brew$/)
        end

        it 'sets the proper value for koji_arch' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/arch=aarch64$/)
        end

        it 'sets the proper value for koji_fetch_mock_config' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/fetch_mock_config=true$/)
        end

        it 'sets the default value for koji_krb_principal' do
            is_expected.to contain_file("/usr/local/share/dlrn/#{user}/projects.ini")
            .with_content(/krb_principal=test@example.com$/)
        end
      end

      context 'when setting a gerrit user but not an email' do
        before :each do
          params.merge!(:gerrit_user => 'foo')
        end

        let :title do
          user
        end

        it 'should fail' do
          is_expected.to raise_error(Puppet::Error,/gerrit_email not set, but gerrit_user is set/)
        end
      end
    end
  end

  context 'when running on master' do
    let :title do
      'centos-master'
    end

    it 'sets default baseurl in projects.ini' do
        is_expected.to contain_file("/usr/local/share/dlrn/centos-master/projects.ini")
        .with_content(/baseurl=http:\/\/localhost$/)
    end

    it 'creates mock config file with disabled mock_tmpfs' do
      is_expected.to contain_file("/home/centos-master/dlrn/scripts/centos.cfg")
      .with_content(/config_opts\[\'plugin_conf\'\]\[\'tmpfs\_enable\'\] = False/)
    end

    context 'when enabling mock_tmpfs' do
      before :each do
        params.merge!(:mock_tmpfs_enable => true)
      end

      it 'creates mock config file with enabled mock_tmpfs' do
        is_expected.to contain_file("/home/centos-master/dlrn/scripts/centos.cfg")
        .with_content(/config_opts\[\'plugin_conf\'\]\[\'tmpfs\_enable\'\] = True/)
      end
    end
  end

  context 'with special case for centos-train' do
    before :each do
      params.merge!(:release             => 'train')
      params.merge!(:target              => 'centos-train')
      params.merge!(:distro_branch       => 'stable/train')
      params.merge!(:baseurl             => 'https://trunk.rdoproject.org/centos7-foo')
      params.merge!(:enable_public_rsync => true)
    end

    let :title do
      'centos-train'
    end

    it 'creates specific mock config file for centos-train' do
      is_expected.to contain_file('/home/centos-train/dlrn/scripts/centos-train.cfg')
      .with_content(/config_opts\[\'root\'\] = \'dlrn-centos-train-x86_64\'/)
    end

    it 'creates directory under /var/www/html' do
      is_expected.to contain_file('/var/www/html/train').with(
        :ensure  => 'directory',
        :mode    => '0755',
        :path    => '/var/www/html/train',
        :require => 'Package[httpd]',
      )
    end

    it 'sets a custom baseurl in projects.ini' do
        is_expected.to contain_file("/usr/local/share/dlrn/centos-train/projects.ini")
        .with_content(/baseurl=https:\/\/trunk.rdoproject.org\/centos7-foo$/)
    end

    it 'configures rsync module' do
        is_expected.to contain_rsync__server__module('centos-train').with(
            :path        => '/home/centos-train/data/repos',
            :hosts_allow => nil,
        )
    end
  end

  context 'when enabling public rsync for centos-master-uc, and setting specific allowed hosts' do
    before :each do
      params.merge!(:release                  => 'train-uc')
      params.merge!(:target                   => 'centos-master-uc')
      params.merge!(:distro_branch            => 'master')
      params.merge!(:baseurl                  => 'https://trunk.rdoproject.org/centos7')
      params.merge!(:enable_public_rsync      => true)
      params.merge!(:public_rsync_hosts_allow => ['foo.example.com'])
    end

    let :title do
      'centos-master-uc'
    end

    it 'configures rsync module with the proper name and allowed hosts' do
        is_expected.to contain_rsync__server__module('centos7').with(
            :path        => '/home/centos-master-uc/data/repos',
            :hosts_allow => ['foo.example.com'],
        )
    end
  end

  context 'with rsyncdest parameter parameter' do
    before :each do
      params.merge!(:rsyncdest       => 'centos-stein@backupserver.example.com:/home/centos-stein/data/repos')
      params.merge!(:rsyncport       => 1022)
    end

    let :title do
      'centos-stein'
    end

    it 'sets rsyncdest in projects.ini' do
        is_expected.to contain_file("/usr/local/share/dlrn/centos-stein/projects.ini")
        .with_content(/rsyncdest=centos-stein@backupserver.example.com:\/home\/centos-stein\/data\/repos$/)
    end

    it 'does set rsyncport to 1022 in projects.ini' do
        is_expected.to contain_file("/usr/local/share/dlrn/centos-stein/projects.ini")
        .with_content(/rsyncport=1022$/)
    end
  end

  context 'with :enable_deps_sync parameter set to true' do
    before :each do
      params.merge!(:enable_deps_sync => true)
      params.merge!(:enable_purge => false)
    end

    let :title do
      'centos-queens'
    end

    it 'does create a cronjob for deps sync' do
      is_expected.to contain_cron('centos-queens-deps').with(
        :command => '/usr/local/bin/update-deps.sh > $HOME/dlrn-logs/update-deps-$(date +\%Y\%m\%d\%H\%M).log 2>&1',
        :user    => 'centos-queens',
        :hour    => '*',
        :minute  => [10, 40],
      )
    end

    it 'does creates a deps directory' do
      is_expected.to contain_file("/home/#{title}/data/repos/deps").with(
        :ensure  => 'directory',
        :mode    => '0755',
        :owner   => 'centos-queens',
        :group   => 'centos-queens',
      )
    end

    it 'does creates a deps/latest directory' do
      is_expected.to contain_file("/home/#{title}/data/repos/deps/latest").with(
        :ensure  => 'directory',
        :mode    => '0755',
        :owner   => 'centos-queens',
        :group   => 'centos-queens',
      )
    end

    it 'does creates a deps/latest/noarch directory' do
      is_expected.to contain_file("/home/#{title}/data/repos/deps/latest/noarch").with(
        :ensure  => 'directory',
        :mode    => '0755',
        :owner   => 'centos-queens',
        :group   => 'centos-queens',
      )
    end

    it 'does not create a cron job to purge dependencies' do
        is_expected.not_to contain_cron("#{title}-deps-purge")
    end
  end

  context 'with :enable_brs_sync parameter set to true' do
    before :each do
      params.merge!(:enable_brs_sync => true)
      params.merge!(:enable_purge => true)
    end

    let :title do
      'centos-queens'
    end

    it 'does create a cronjob for build deps sync' do
      is_expected.to contain_cron('centos-queens-build-deps').with(
        :command => 'TAG_PHASE="build" DEPS_DIR="${HOME}/data/repos/build-deps/" /usr/local/bin/update-deps.sh > $HOME/dlrn-logs/update-build-deps-$(date +\%Y\%m\%d\%H\%M).log 2>&1',
        :user    => 'centos-queens',
        :hour    => '*',
        :minute  => [25, 55],
      )
    end

    it 'does creates a build-deps directory' do
      is_expected.to contain_file("/home/#{title}/data/repos/build-deps").with(
        :ensure  => 'directory',
        :mode    => '0755',
        :owner   => 'centos-queens',
        :group   => 'centos-queens',
      )
    end

    it 'does creates a build-deps/latest directory' do
      is_expected.to contain_file("/home/#{title}/data/repos/build-deps/latest").with(
        :ensure  => 'directory',
        :mode    => '0755',
        :owner   => 'centos-queens',
        :group   => 'centos-queens',
      )
    end

    it 'does creates a build-deps/latest/noarch directory' do
      is_expected.to contain_file("/home/#{title}/data/repos/build-deps/latest/noarch").with(
        :ensure  => 'directory',
        :mode    => '0755',
        :owner   => 'centos-queens',
        :group   => 'centos-queens',
      )
    end

    it 'creates the rdo-trunk-runtime-deps.repo file' do
      is_expected.to contain_file("/home/centos-queens/data/repos/rdo-trunk-runtime-deps.repo").with(
        :ensure => 'present',
        :source => 'puppet:///modules/dlrn/centos-queens-rdo-trunk-runtime-deps.repo',
        :mode   => '0644',
        :owner  => 'centos-queens',
        :group  => 'centos-queens',)
    end

    it 'does create a cronjob for deps purge' do
      is_expected.to contain_cron('centos-queens-deps-purge').with(
        :command => '/usr/local/bin/purge-deps.sh',
        :user    => 'centos-queens',
        :hour    => '3',
        :minute  => '0',
      )
    end
  end

  context 'with parameter server_type = passive' do
    before :each do
      params.merge!(:server_type    => 'passive')
    end

    context 'with centos-stein name' do
      before :each do
        params.merge!(:distro_branch   => 'stable/stein')
        params.merge!(:release         => 'stein')
        params.merge!(:enable_cron     => true)
        params.merge!(:gerrit_user     => 'foo')
        params.merge!(:gerrit_email    => 'foo@rdoproject.org')
        params.merge!(:disable_email   => false)
      end

      let :title do
        'centos-stein'
      end

      it { is_expected.not_to contain_cron("#{title}") }

      it 'does not set a gerrit user in projects.ini' do
        is_expected.not_to contain_file("/usr/local/share/dlrn/#{title}/projects.ini")
        .with_content(/gerrit=yes$/)
      end

      it 'sets empty smtpserver in projects.ini' do
        is_expected.to contain_file("/usr/local/share/dlrn/#{title}/projects.ini")
        .with_content(/smtpserver=$/)
      end
    end

    context 'with fedora-stein name' do
      before :each do
        params.merge!(:distro_branch   => 'stable/stein')
        params.merge!(:release         => 'stein')
      end

      let :title do
        'fedora-stein'
      end

      it { is_expected.not_to contain_cron("#{title}") }
    end

    context 'with centos-master name' do
      before :each do
        params.merge!(:distro_branch   => 'master')
        params.merge!(:release         => 'rocky')
        params.merge!(:enable_cron     => true)
        params.merge!(:rsyncdest       => 'centos-master@backupserver.example.com:/home/centos-master/data/repos')
        params.merge!(:rsyncport       => 1022)
      end

      let :title do
        'centos-master'
      end

      it { is_expected.not_to contain_cron("#{title}") }

      it 'does not set rsyncdest in projects.ini' do
        is_expected.not_to contain_file("/usr/local/share/dlrn/#{title}/projects.ini")
        .with_content(/rsyncdest=/)
      end

      it 'does not set rsyncport in projects.ini' do
        is_expected.not_to contain_file("/usr/local/share/dlrn/#{title}/projects.ini")
        .with_content(/rsyncport=/)
      end
    end

    context 'with centos-queens name' do
      before :each do
        params.merge!(:enable_deps_sync => true)
      end

      let :title do
        'centos-queens'
      end

      it 'does not create a cronjob for deps sync' do
        is_expected.not_to contain_cron('centos-queens-deps').with(
          :command => '/usr/local/bin/update-deps.sh > $HOME/dlrn-logs/update-deps-$(date +\%Y\%m\%d\%H\%M).log 2>&1',
          :user    => 'centos-queens',
          :hour    => '*',
          :minute  => '10,40',
        )
      end

    end
  end
end


text:
package org.apache.druid.indexing.common;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.jaxrs.smile.SmileMediaTypes;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Throwables;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import org.apache.druid.indexer.TaskLocation;
import org.apache.druid.indexer.TaskStatus;
import org.apache.druid.java.util.common.IAE;
import org.apache.druid.java.util.common.IOE;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.concurrent.Execs;
import org.apache.druid.java.util.emitter.EmittingLogger;
import org.apache.druid.java.util.http.client.HttpClient;
import org.apache.druid.java.util.http.client.Request;
import org.apache.druid.java.util.http.client.response.StringFullResponseHandler;
import org.apache.druid.java.util.http.client.response.StringFullResponseHolder;
import org.apache.druid.segment.realtime.firehose.ChatHandlerResource;
import org.jboss.netty.channel.ChannelException;
import org.jboss.netty.handler.codec.http.HttpMethod;
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
import org.joda.time.Duration;
import org.joda.time.Period;

import javax.annotation.Nullable;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.Socket;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;

/**
 * Abstract class to communicate with index tasks via HTTP. This class provides interfaces to serialize/deserialize
 * data and send an HTTP request.
 */
public abstract class IndexTaskClient implements AutoCloseable
{
  public static class NoTaskLocationException extends RuntimeException
  {
    public NoTaskLocationException(String message)
    {
      super(message);
    }
  }

  public static class TaskNotRunnableException extends RuntimeException
  {
    public TaskNotRunnableException(String message)
    {
      super(message);
    }
  }

  public static final int MAX_RETRY_WAIT_SECONDS = 10;

  private static final EmittingLogger log = new EmittingLogger(IndexTaskClient.class);
  private static final String BASE_PATH = "/druid/worker/v1/chat";
  private static final int MIN_RETRY_WAIT_SECONDS = 2;
  private static final int TASK_MISMATCH_RETRY_DELAY_SECONDS = 5;

  private final HttpClient httpClient;
  private final ObjectMapper objectMapper;
  private final TaskInfoProvider taskInfoProvider;
  private final Duration httpTimeout;
  private final RetryPolicyFactory retryPolicyFactory;
  private final ListeningExecutorService executorService;

  public IndexTaskClient(
      HttpClient httpClient,
      ObjectMapper objectMapper,
      TaskInfoProvider taskInfoProvider,
      Duration httpTimeout,
      String callerId,
      int numThreads,
      long numRetries
  )
  {
    this.httpClient = httpClient;
    this.objectMapper = objectMapper;
    this.taskInfoProvider = taskInfoProvider;
    this.httpTimeout = httpTimeout;
    this.retryPolicyFactory = initializeRetryPolicyFactory(numRetries);
    this.executorService = MoreExecutors.listeningDecorator(
        Execs.multiThreaded(
            numThreads,
            StringUtils.format(
                "IndexTaskClient-%s-%%d",
                StringUtils.encodeForFormat(callerId)
            )
        )
    );
  }

  private static RetryPolicyFactory initializeRetryPolicyFactory(long numRetries)
  {
    // Retries [numRetries] times before giving up; this should be set long enough to handle any temporary
    // unresponsiveness such as network issues, if a task is still in the process of starting up, or if the task is in
    // the middle of persisting to disk and doesn't respond immediately.
    return new RetryPolicyFactory(
        new RetryPolicyConfig()
            .setMinWait(Period.seconds(MIN_RETRY_WAIT_SECONDS))
            .setMaxWait(Period.seconds(MAX_RETRY_WAIT_SECONDS))
            .setMaxRetryCount(numRetries)
    );
  }

  protected HttpClient getHttpClient()
  {
    return httpClient;
  }

  protected RetryPolicy newRetryPolicy()
  {
    return retryPolicyFactory.makeRetryPolicy();
  }

  protected <T> T deserialize(String content, JavaType type) throws IOException
  {
    return objectMapper.readValue(content, type);
  }

  protected <T> T deserialize(String content, TypeReference<T> typeReference) throws IOException
  {
    return objectMapper.readValue(content, typeReference);
  }

  protected <T> T deserialize(String content, Class<T> typeReference) throws IOException
  {
    return objectMapper.readValue(content, typeReference);
  }

  protected <T> T deserializeMap(String content, Class<? extends Map> mapClass, Class<?> keyClass, Class<?> valueClass)
      throws IOException
  {
    return deserialize(content, objectMapper.getTypeFactory().constructMapType(mapClass, keyClass, valueClass));
  }

  protected <T> T deserializeNestedValueMap(
      String content,
      Class<? extends Map> mapClass,
      Class<?> keyClass,
      Class<? extends Map> valueMapClass,
      Class<?> valueMapClassKey,
      Class<?> valueMapClassValue
  )
      throws IOException
  {
    TypeFactory factory = objectMapper.getTypeFactory();
    return deserialize(
        content,
        factory.constructMapType(
            mapClass,
            factory.constructType(keyClass),
            factory.constructMapType(valueMapClass, valueMapClassKey, valueMapClassValue)
        )
    );
  }

  protected byte[] serialize(Object value) throws JsonProcessingException
  {
    return objectMapper.writeValueAsBytes(value);
  }

  protected <T> ListenableFuture<T> doAsync(Callable<T> callable)
  {
    return executorService.submit(callable);
  }

  protected boolean isSuccess(StringFullResponseHolder responseHolder)
  {
    return responseHolder.getStatus().getCode() / 100 == 2;
  }

  @VisibleForTesting
  protected void checkConnection(String host, int port) throws IOException
  {
    new Socket(host, port).close();
  }

  protected StringFullResponseHolder submitRequestWithEmptyContent(
      String taskId,
      HttpMethod method,
      String encodedPathSuffix,
      @Nullable String encodedQueryString,
      boolean retry
  ) throws IOException, ChannelException, NoTaskLocationException
  {
    return submitRequest(taskId, null, method, encodedPathSuffix, encodedQueryString, new byte[0], retry);
  }

  /**
   * To use this method, {@link #objectMapper} should be a jsonMapper.
   */
  protected StringFullResponseHolder submitJsonRequest(
      String taskId,
      HttpMethod method,
      String encodedPathSuffix,
      @Nullable String encodedQueryString,
      byte[] content,
      boolean retry
  ) throws IOException, ChannelException, NoTaskLocationException
  {
    return submitRequest(
        taskId,
        MediaType.APPLICATION_JSON,
        method,
        encodedPathSuffix,
        encodedQueryString,
        content,
        retry
    );
  }

  /**
   * To use this method, {@link #objectMapper} should be a smileMapper.
   */
  protected StringFullResponseHolder submitSmileRequest(
      String taskId,
      HttpMethod method,
      String encodedPathSuffix,
      @Nullable String encodedQueryString,
      byte[] content,
      boolean retry
  ) throws IOException, ChannelException, NoTaskLocationException
  {
    return submitRequest(
        taskId,
        SmileMediaTypes.APPLICATION_JACKSON_SMILE,
        method,
        encodedPathSuffix,
        encodedQueryString,
        content,
        retry
    );
  }

  private Request createRequest(
      String taskId,
      TaskLocation location,
      String path,
      @Nullable String encodedQueryString,
      HttpMethod method,
      @Nullable String mediaType,
      byte[] content
  ) throws MalformedURLException
  {
    final String host = location.getHost();
    final String scheme = location.getTlsPort() >= 0 ? "https" : "http";
    final int port = location.getTlsPort() >= 0 ? location.getTlsPort() : location.getPort();

    // Use URL constructor, not URI, since the path is already encoded.
    // The below line can throw a MalformedURLException, and this method should return immediately without rety.
    final URL serviceUrl = new URL(
        scheme,
        host,
        port,
        encodedQueryString == null ? path : StringUtils.format("%s?%s", path, encodedQueryString)
    );

    final Request request = new Request(method, serviceUrl);
    // used to validate that we are talking to the correct worker
    request.addHeader(ChatHandlerResource.TASK_ID_HEADER, StringUtils.urlEncode(taskId));
    if (content.length > 0) {
      request.setContent(Preconditions.checkNotNull(mediaType, "mediaType"), content);
    }
    return request;
  }

  /**
   * Sends an HTTP request to the task of the specified {@code taskId} and returns a response if it succeeded.
   */
  private StringFullResponseHolder submitRequest(
      String taskId,
      @Nullable String mediaType, // nullable if content is empty
      HttpMethod method,
      String encodedPathSuffix,
      @Nullable String encodedQueryString,
      byte[] content,
      boolean retry
  ) throws IOException, ChannelException, NoTaskLocationException
  {
    final RetryPolicy retryPolicy = retryPolicyFactory.makeRetryPolicy();

    while (true) {
      String path = StringUtils.format("%s/%s/%s", BASE_PATH, StringUtils.urlEncode(taskId), encodedPathSuffix);

      Optional<TaskStatus> status = taskInfoProvider.getTaskStatus(taskId);
      if (!status.isPresent() || !status.get().isRunnable()) {
        throw new TaskNotRunnableException(
            StringUtils.format(
                "Aborting request because task [%s] is not runnable",
                taskId
            )
        );
      }

      final TaskLocation location = taskInfoProvider.getTaskLocation(taskId);
      if (location.equals(TaskLocation.unknown())) {
        throw new NoTaskLocationException(StringUtils.format("No TaskLocation available for task [%s]", taskId));
      }

      final Request request = createRequest(
          taskId,
          location,
          path,
          encodedQueryString,
          method,
          mediaType,
          content
      );

      StringFullResponseHolder response = null;
      try {
        // Netty throws some annoying exceptions if a connection can't be opened, which happens relatively frequently
        // for tasks that happen to still be starting up, so test the connection first to keep the logs clean.
        checkConnection(request.getUrl().getHost(), request.getUrl().getPort());

        response = submitRequest(request);

        int responseCode = response.getStatus().getCode();
        if (responseCode / 100 == 2) {
          return response;
        } else if (responseCode == 400) { // don't bother retrying if it's a bad request
          throw new IAE("Received 400 Bad Request with body: %s", response.getContent());
        } else {
          throw new IOE("Received status [%d] and content [%s]", responseCode, response.getContent());
        }
      }
      catch (IOException | ChannelException e) {

        // Since workers are free to move tasks around to different ports, there is a chance that a task may have been
        // moved but our view of its location has not been updated yet from ZK. To detect this case, we send a header
        // identifying our expected recipient in the request; if this doesn't correspond to the worker we messaged, the
        // worker will return an HTTP 404 with its ID in the response header. If we get a mismatching task ID, then
        // we will wait for a short period then retry the request indefinitely, expecting the task's location to
        // eventually be updated.

        final Duration delay;
        if (response != null && response.getStatus().equals(HttpResponseStatus.NOT_FOUND)) {
          String headerId = StringUtils.urlDecode(
              response.getResponse().headers().get(ChatHandlerResource.TASK_ID_HEADER)
          );
          if (headerId != null && !headerId.equals(taskId)) {
            log.warn(
                "Expected worker to have taskId [%s] but has taskId [%s], will retry in [%d]s",
                taskId,
                headerId,
                TASK_MISMATCH_RETRY_DELAY_SECONDS
            );
            delay = Duration.standardSeconds(TASK_MISMATCH_RETRY_DELAY_SECONDS);
          } else {
            delay = retryPolicy.getAndIncrementRetryDelay();
          }
        } else {
          delay = retryPolicy.getAndIncrementRetryDelay();
        }
        final String urlForLog = request.getUrl().toString();
        if (!retry) {
          // if retry=false, we probably aren't too concerned if the operation doesn't succeed (i.e. the request was
          // for informational purposes only) so don't log a scary stack trace
          log.info("submitRequest failed for [%s], with message [%s]", urlForLog, e.getMessage());
          throw e;
        } else if (delay == null) {
          log.warn(e, "Retries exhausted for [%s], last exception:", urlForLog);
          throw e;
        } else {
          try {
            final long sleepTime = delay.getMillis();
            log.warn(
                "Bad response HTTP [%s] from [%s]; will try again in [%s] (body/exception: [%s])",
                (response != null ? response.getStatus().getCode() : "no response"),
                urlForLog,
                new Duration(sleepTime).toString(),
                (response != null ? response.getContent() : e.getMessage())
            );
            Thread.sleep(sleepTime);
          }
          catch (InterruptedException e2) {
            Thread.currentThread().interrupt();
            e.addSuppressed(e2);
            throw new RuntimeException(e);
          }
        }
      }
      catch (NoTaskLocationException e) {
        log.info(
            "No TaskLocation available for task [%s], this task may not have been assigned to a worker yet "
            + "or may have already completed",
            taskId
        );
        throw e;
      }
      catch (Exception e) {
        log.warn(e, "Exception while sending request");
        throw e;
      }
    }
  }

  private StringFullResponseHolder submitRequest(Request request) throws IOException, ChannelException
  {
    try {
      log.debug("HTTP %s: %s", request.getMethod().getName(), request.getUrl().toString());
      return httpClient.go(request, new StringFullResponseHandler(StandardCharsets.UTF_8), httpTimeout).get();
    }
    catch (Exception e) {
      throw throwIfPossible(e);
    }
  }

  /**
   * Throws if it's possible to throw the given Throwable.
   *

   * - The input throwable shouldn't be null.
   * - If Throwable is an {@link ExecutionException}, this calls itself recursively with the cause of ExecutionException.
   * - If Throwable is an {@link IOException} or a {@link ChannelException}, this simply throws it.
   * - If Throwable is an {@link InterruptedException}, this interrupts the current thread and throws a RuntimeException
   * wrapping the InterruptedException
   * - Otherwise, this simply returns the given Throwable.
   *

   * Note that if the given Throable is an ExecutionException, this can return the cause of ExecutionException.
   */
  private RuntimeException throwIfPossible(Throwable t) throws IOException, ChannelException
  {
    Preconditions.checkNotNull(t, "Throwable shoulnd't null");

    if (t instanceof ExecutionException) {
      if (t.getCause() != null) {
        return throwIfPossible(t.getCause());
      } else {
        return new RuntimeException(t);
      }
    }

    if (t instanceof IOException) {
      throw (IOException) t;
    }

    if (t instanceof ChannelException) {
      throw (ChannelException) t;
    }

    if (t instanceof InterruptedException) {
      Thread.currentThread().interrupt();
      throw new RuntimeException(t);
    }

    Throwables.propagateIfPossible(t);
    return new RuntimeException(t);
  }

  @Override
  public void close()
  {
    executorService.shutdownNow();
  }
}


text:
module Language.JavaScript
       ( interpretJavaScript
       , interpretHostedJavaScript
       , runJavaScript
       , runHostedJavaScript ) where

import Control.Applicative ((<$>))

import Text.Parsec (ParseError)

import Language.JavaScript.AST
import Language.JavaScript.Interpret
import Language.JavaScript.Parser

interpretJavaScript :: (Functor m, Monad m) =>
                       Program ->
                       m (Either Value Completion)
interpretJavaScript program = do
  runJavaScriptT initialState (interpret program)

interpretHostedJavaScript :: (Functor m, Monad m) =>
                       Program ->
                       JavaScriptT m () ->
                       m (Either Value Completion)
interpretHostedJavaScript program hostInit = do
  runJavaScriptT initialState (hostInit >> interpret program)

runJavaScript :: (Functor m, Monad m) =>
                 String -> m (Either ParseError (Either Value Completion))
runJavaScript source = do
  let eAST = parseJavaScript source
  case eAST of
   Right ast -> do
     Right <$> interpretJavaScript ast
   Left e -> return (Left e)

runHostedJavaScript :: (Functor m, Monad m) =>
                       String ->
                       JavaScriptT m () ->
                       m (Either ParseError (Either Value Completion))
runHostedJavaScript source hostInit = do
  let eAST = parseJavaScript source
  case eAST of
   Right ast -> do
     Right <$> interpretHostedJavaScript ast hostInit
   Left e -> return (Left e)