text:
namespace et {
namespace core {

//====================
// Tick Manager :: Tickable
//====================

//---------------------------------
// TickManager::operator=
//
// Copy assignment operator copies shallow
//
TickManager::Tickable& TickManager::Tickable::operator=(Tickable const& other)
{
	tickable = other.tickable;
	priority = other.priority;
	return *this;
}

//====================
// Tick Manager
//====================

//---------------------------------
// TickManager::TriggerRealTime
//
// Trigger a tick if this triggerer is currently registered and has already triggered a tick in the last cycle
//
void TickManager::TriggerRealTime(I_RealTimeTickTriggerer* const triggerer)
{
	std::vector<T_RealTimeTriggerer> triggerersCopy = m_RealTimeTriggerers; // ensure adding or removing during tick doesn't cause issues

	auto findResult = std::find_if(triggerersCopy.begin(), triggerersCopy.end(), [triggerer](T_RealTimeTriggerer const& rt)
	{
		return rt.first == triggerer;
	});

	// only trigger a tick if this triggerer is registered
	if (findResult != triggerersCopy.cend())
	{
		// If this triggerer has already been rendered but is calling again we should update everything
		if (findResult->second)
		{
			EndTick();

			for (T_RealTimeTriggerer& rt : m_RealTimeTriggerers)
			{
				rt.second = false;
			}

			Tick();
		}

		// we need to find this triggerer again in the original list to ensure the value is set in a useful way
		findResult = std::find_if(m_RealTimeTriggerers.begin(), m_RealTimeTriggerers.end(), [triggerer](T_RealTimeTriggerer const& rt)
			{
				return rt.first == triggerer;
			});

		ET_ASSERT(findResult != m_RealTimeTriggerers.cend());
		findResult->second = true;
	}
}

//---------------------------------
// TickManager::TriggerDefault
//
// Trigger a tick if this triggerer is currently registered and has already triggered a tick in the last cycle, and there are no real time triggerers
//
void TickManager::TriggerDefault(I_DefaultTickTriggerer* const triggerer)
{
	// if we are rendering in real time default triggerers shouldn't tick
	if (m_RealTimeTriggerers.size() > 0u)
	{
		return;
	}

	auto findResult = std::find_if(m_DefaultTriggerers.begin(), m_DefaultTriggerers.end(), [triggerer](T_DefaultTriggerer const& dt)
	{
		return dt.first == triggerer;
	});

	// only trigger a tick if this triggerer is registered
	if (findResult != m_DefaultTriggerers.cend())
	{
		// If this triggerer has already been rendered but is calling again we should update everything
		if (findResult->second)
		{
			EndTick();

			for (T_DefaultTriggerer& dt : m_DefaultTriggerers)
			{
				dt.second = false;
			}

			Tick();
		}

		findResult->second = true;
	}
}

//---------------------------------
// TickManager::RegisterRealTimeTriggerer
//
// Register a real time triggerer, disabling default tick triggering in the process
//
void TickManager::RegisterRealTimeTriggerer(I_RealTimeTickTriggerer* const triggerer)
{
	auto const findResult = std::find_if(m_RealTimeTriggerers.cbegin(), m_RealTimeTriggerers.cend(), [triggerer](T_RealTimeTriggerer const& rt)
	{
		return rt.first == triggerer;
	});

	if (findResult == m_RealTimeTriggerers.cend())
	{
		m_RealTimeTriggerers.emplace_back(triggerer, true); // by default we have already ticked so that this object can trigger a tick on init
	}
	else
	{
		LOG("TickManager::RegisterRealTimeTriggerer > RealTime triggerer already registered!", LogLevel::Warning);
	}
}

//---------------------------------
// TickManager::RegisterDefaultTriggerer
//
// Register a default triggerer which can tick if there are no real time triggerers active
//
void TickManager::RegisterDefaultTriggerer(I_DefaultTickTriggerer* const triggerer)
{
	auto const findResult = std::find_if(m_DefaultTriggerers.cbegin(), m_DefaultTriggerers.cend(), [triggerer](T_DefaultTriggerer const& dt)
	{
		return dt.first == triggerer;
	});

	if (findResult == m_DefaultTriggerers.cend())
	{
		m_DefaultTriggerers.emplace_back(triggerer, true); // by default we have already ticked so that this object can trigger a tick on init
	}
	else
	{
		LOG("TickManager::RegisterDefaultTriggerer > Default triggerer already registered!", LogLevel::Warning);
	}
}

//---------------------------------
// TickManager::RegisterTickable
//
// Add a triggerable object by inserting it into the list. objects of the highest priority get ticked first. objects of the same priority get ticked in
//  - order of registration
//
void TickManager::RegisterTickable(I_Tickable* const tickableObject, uint32 const priority)
{
	// find the first tickable with a lower priority but also make sure our tickable isn't registered yet
	auto findResult = m_Tickables.end();
	for (auto it = m_Tickables.begin(); it != m_Tickables.end(); ++it)
	{
		if ((*it).tickable == tickableObject)
		{
			LOG("TickManager::RegisterTickable > object already registered!", LogLevel::Warning);
			return;
		}

		if (findResult == m_Tickables.cend() && (*it).priority < priority)
		{
			findResult = it;
		}
	}

	// add at end if there is nothing with a lower priority
	if (findResult == m_Tickables.cend())
	{
		m_Tickables.emplace_back(tickableObject, priority);
	}
	else
	{
		m_Tickables.insert(findResult, Tickable(tickableObject, priority));
	}
}

//---------------------------------
// TickManager::UnregisterRealTimeTriggerer
//
// Remove a realtime triggerer from the list. Doesn't log if it doesn't do anything due to not being in the list
//
void TickManager::UnregisterRealTimeTriggerer(I_RealTimeTickTriggerer* const triggerer)
{
	auto findResult = std::find_if(m_RealTimeTriggerers.begin(), m_RealTimeTriggerers.end(), [triggerer](T_RealTimeTriggerer const& rt)
	{
		return rt.first == triggerer;
	});

	if (findResult != m_RealTimeTriggerers.cend())
	{
		*findResult = std::move(m_RealTimeTriggerers.back());
		m_RealTimeTriggerers.pop_back();
	}
}

//---------------------------------
// TickManager::UnregisterRealTimeTriggerer
//
// Remove a default triggerer from the list. Doesn't log if it doesn't do anything due to not being in the list
//
void TickManager::UnregisterDefaultTriggerer(I_DefaultTickTriggerer* const triggerer)
{
	auto findResult = std::find_if(m_DefaultTriggerers.begin(), m_DefaultTriggerers.end(), [triggerer](T_DefaultTriggerer const& dt)
	{
		return dt.first == triggerer;
	});

	if (findResult != m_DefaultTriggerers.cend())
	{
		*findResult = std::move(m_DefaultTriggerers.back());
		m_DefaultTriggerers.pop_back();
	}
}

//---------------------------------
// TickManager::UnregisterTickable
//
// Stop ticking this object. Can be a slow function due to erasing needing to move all objects in the tickable list that come after
//
void TickManager::UnregisterTickable(I_Tickable* const tickableObject)
{
	auto findResult = std::find_if(m_Tickables.begin(), m_Tickables.end(), [tickableObject](Tickable const& tickable)
	{
		return tickable.tickable == tickableObject;
	});

	if (findResult == m_Tickables.cend())
	{
		LOG("TickManager::UnregisterTickable > attempted to remove a non registered object", LogLevel::Warning);
		return;
	}

	// no remove and swap possible because the order of tickables matters
	m_Tickables.erase(findResult);
}

//---------------------------------
// TickManager::Tick
//
// Start time and performance monitoring, then tick all tickable objects in order of their priority, and finally update the state of input
//
void TickManager::Tick()
{
	BaseContext const* const context = ContextManager::GetInstance()->GetActiveContext();
	if (context != nullptr)
	{
		// start new frame timer and performance
		context->time->Update();

#if ET_CT_IS_ENABLED(ET_CT_DBG_UTIL)
		PerformanceInfo::GetInstance()->StartFrameTimer();
#endif
	}

	// tick all objects
	for (Tickable& tickableObject : m_Tickables)
	{
		tickableObject.tickable->OnTick();
	}

	// Update keystates
	InputManager::GetInstance()->Update();
}

//---------------------------------
// TickManager::EndTick
//
// At the end of the tick stop performance tracking
//
void TickManager::EndTick()
{
	// update performance info
#if ET_CT_IS_ENABLED(ET_CT_DBG_UTIL)
	PerformanceInfo::GetInstance()->Update();
#endif
}

} // namespace core
} // namespace et


text:
@import AddressBook;

@interface VeeABRecordsImporterTests : XCTestCase

@property (nonatomic) ABAddressBookRef addressBook;
@property (nonatomic,assign) NSUInteger numberOfRecordsInAddressBook;

@end

@implementation VeeABRecordsImporterTests

#pragma mark - Methods setup

-(void)setUp
{
    //TODO: green local, red on travis - NSAssert(ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized, @"ABAddressBookGetAuthorizationStatus is not authorized!");
    CFErrorRef* cfError = nil;
    _addressBook = ABAddressBookCreateWithOptions(NULL, cfError);
    if (cfError) {
        NSLog(@"Error while creating address book");
    }
    _numberOfRecordsInAddressBook = [self numberOfRecordsInAddressBook:_addressBook];
}

- (void)testNumberOfImportedRecords
{
    //VeeABRecordsImporter* veeABRecordsImporter = [VeeABRecordsImporter new];
    //NSUInteger numberOfImportedRecords = [[veeABRecordsImporter importVeeABRecordsFromAddressBook:_addressBook] count];
    //BOOL isNumberOfImportedRecordsCorrect = _numberOfRecordsInAddressBook == numberOfImportedRecords;
    //TODO: green local, red on travis - NSAssert(isNumberOfImportedRecordsCorrect, @"Number of imported records is %zd but should be %zd",numberOfImportedRecords,_numberOfRecordsInAddressBook);
}

#pragma mark - Private utils

-(NSUInteger)numberOfRecordsInAddressBook:(ABAddressBookRef)addressBook
{
    NSUInteger numberOfContactsInAddressBook = 0;
    NSArray* allSources = (__bridge_transfer NSArray*)(ABAddressBookCopyArrayOfAllSources(addressBook));
    for (int s = 0; s < allSources.count; s++) {
        ABRecordRef source = (__bridge ABRecordRef)(allSources[s]);
        NSArray* peopleInSource = (__bridge NSArray*)ABAddressBookCopyArrayOfAllPeopleInSource(addressBook, source);
        for (int p = 0; p < peopleInSource.count; p++) {
            numberOfContactsInAddressBook++;
        }
    }
    return numberOfContactsInAddressBook;
}

@end

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;

namespace WindowsFormsApplication1
{

    class BankClass : MyLocation
    {

        public string NameBank, bankSaleDollars, bankBuyDollars, BankAdress , distance;
        public Int32 currentposition;
        PointM bankPoint;
    public  static  string fileName = "banks.db";
    public static   string path = Directory.GetCurrentDirectory()+"\\";
      public static  bool exist = false;

        public BankClass(string allbank)
        {
            bankPoint = new PointM(0, 0);
            currentposition = 0;
            id++; // take from mylocation. if renew location id = 0;
            ParseString(allbank);
            if (exist)
            {

                CalculateDistance(getPointFromFile());
            }
            else
            {
                BankPointFromMe();
                CalculateDistance(bankPoint);
            }

        }

        private PointM getPointFromFile()
        {
            string str;
            try
            {
                if(id == 1)
                    str = File.ReadLines(path + fileName).First();
                else
                str = File.ReadLines(path + fileName).Skip(id-1).First();
            }
            catch
            {
                return bankPoint = new PointM(0,0);
            }
            bankPoint = bankPoint.strToPoint(str);
            return bankPoint;

        }

      private  void CalculateDistance(PointM pointBank)
        {
            /*14880
           1 53.840765   27.70257
            2 53.85123    27.476823
                      -0,010465   0,225747

             */
            if (pointBank.x == 0 || pointBank.y == 0)
            {
                distance = " error ";
            }
            const int dst = 14880;//234;
            double divider = Math.Sqrt(0.010465 * 0.010465 + 0.225747 * 0.225747);//(0.001462 * 0.001462 + 0.002532 * 0.002532);

            pointBank = pointBank - iamHerePoint;

            int dist =Convert.ToInt32( dst * Math.Sqrt(pointBank.x * pointBank.x + pointBank.y * pointBank.y) / divider);
            if (dist > 40000)
                distance = "error";
            else
            distance = dist.ToString();

        }
       private  bool BankPointFromMe()
        {

                if (BankAdress == "")
                {
                    bankPoint.x = 0;
                    bankPoint.y = 0;
                    return false;
                }
                WebRequest requestGeo = WebRequest.Create("https://geocode-maps.yandex.ru/1.x/?geocode="
                   +"г. Минск " + BankAdress + "&lang=ru-RU");
                HttpWebResponse responseGeo = (HttpWebResponse)requestGeo.GetResponse();
                Stream receiveStream = responseGeo.GetResponseStream();
                Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
                StreamReader readStream = new StreamReader(receiveStream, encode);
                string result_str = readStream.ReadToEnd();
                readStream.Close();
                responseGeo.Close();
                PositionFromString(result_str);

            return true;

        }

      private  bool PositionFromString(string result_str)
        {

            try
            {
                result_str = result_str.Remove(0, result_str.IndexOf("<pos>"));
            }
            catch
            {
                bankPoint.x = 0;
                bankPoint.y = 0;
                return false;
            }

            result_str = result_str.Remove(result_str.IndexOf("</pos>"), result_str.Length - result_str.IndexOf("</pos>"));
            result_str = result_str.Remove(0, 5);
            string x = result_str.Substring(0, result_str.IndexOf(' '));
            bankPoint.y = double.Parse(x, CultureInfo.InvariantCulture);
            result_str = result_str.Remove(0, result_str.IndexOf(' '));
            result_str = result_str.Remove(0, 1);

            bankPoint.x = double.Parse(result_str, CultureInfo.InvariantCulture);

           if(!exist)
             File.AppendAllText(path + fileName, bankPoint.ToString());

            CalculateDistance(bankPoint);
            return true;
        }

      private  void ParseString(string what)
        {
            if (0 != what.IndexOf("ttl\">"))
            {
                currentposition = what.IndexOf("ttl\">") + 6;

                what = what.Remove(0, what.IndexOf("ttl\">") + 6);

                int start = what.IndexOf('>') + 1;
                int end = what.IndexOf('<');
                try
                {
                    NameBank = what.Substring(start, end - start);
                }
                catch
                {
                    NameBank = "null";
                }

                currentposition += what.IndexOf("address\">") + 10;
                //
                what = what.Remove(0, what.IndexOf("address\">") + 10);

                start = what.IndexOf('>') + 1;
                end = what.IndexOf('<');
                try
                {
                    BankAdress = what.Substring(start, end - start);
                }
                catch
                {
                    BankAdress = "null ";
                }
                ////

                currentposition += what.IndexOf("first_curr") + 5; //currentposition += what.IndexOf("h_usd") + 5;
                what = what.Remove(0, what.IndexOf("first_curr") + 5); // what = what.Remove(0, what.IndexOf("h_usd") + 5);
                ////
                start = what.IndexOf("\">") + 2;
                end = what.IndexOf('<');
                try
                {
                    bankBuyDollars = what.Substring(start, end - start);
                }
                catch
                {
                    bankBuyDollars = "null";
                }
                ///
                currentposition += what.IndexOf("first_curr") + 5; //currentposition += what.IndexOf("h_usd") + 5;

                what = what.Remove(0, what.IndexOf("first_curr") + 5);//what = what.Remove(0, what.IndexOf("h_usd") + 5);
                ///
                start = what.IndexOf("\">") + 2;
                end = what.IndexOf('<');
                try
                {
                    bankSaleDollars = what.Substring(start, end - start);
                }
                catch
                {
                    bankSaleDollars = "null ";
                }

            }

        }

    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Camera4.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }
        public ActionResult Camera()
        {
            ViewBag.Message = "Camera page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}


text:
def login_as_admin
  create_usertypes
  admin = User.create!(FactoryGirl.attributes_for :user, :admin)
  visit '/'
  click_link("Login")
  fill_in "Email", :with => "user@user.com"
  fill_in "Password", :with => "password"
  click_button('Log in')
end

def login_as_designer
  create_usertypes
  @user = User.create!(FactoryGirl.attributes_for :user, :designer)
  visit '/'
  click_link("Login")
  fill_in "Email", :with => "user@user.com"
  fill_in "Password", :with => "password"
  click_button('Log in')
  visit "/"
end

def create_show_for_designer
  @production = Production.new(FactoryGirl.attributes_for :production)
  @production.designer = @user
  @production.save
end

def create_usertypes
  usertypes= []
  users = ['Designer','ME','Administrator','Lead']
  users.each do |name|
    UserType.create!(name: name)
  end
end


text:
@interface LoginViewController ()

@end

@implementation LoginViewController
{
    void(^loginBlock)(BOOL isLogin);
}
- (void)startLoginWithSuccessBlock:(void(^)(BOOL isLogin))block options:(NSDictionary *)options {
    loginBlock = block;
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController.navigationBar setHidden:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}
- (IBAction)back:(id)sender {
    [self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)login:(id)sender {
    loginBlock(YES);
    [self.navigationController dismissViewControllerAnimated:YES completion:nil];
    [[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:@"login_flag"];
    [[NSUserDefaults standardUserDefaults] synchronize];

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"登录成功,下次无需登录!!" delegate:nil cancelButtonTitle:@"好的" otherButtonTitles:nil, nil];
    [alert show];
}
- (IBAction)cancleLogin:(id)sender {
    [[NSUserDefaults standardUserDefaults] setObject:@"0" forKey:@"login_flag"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    [self.navigationController dismissViewControllerAnimated:YES completion:nil];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end


text:
package dataplex

import (
	"context"
	"fmt"
	"github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
	dclService "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataplex/beta"
	"github.com/GoogleCloudPlatform/declarative-resource-client-library/unstructured"
)

type Zone struct{}

func ZoneToUnstructured(r *dclService.Zone) *unstructured.Resource {
	u := &unstructured.Resource{
		STV: unstructured.ServiceTypeVersion{
			Service: "dataplex",
			Version: "beta",
			Type:    "Zone",
		},
		Object: make(map[string]interface{}),
	}
	if r.AssetStatus != nil && r.AssetStatus != dclService.EmptyZoneAssetStatus {
		rAssetStatus := make(map[string]interface{})
		if r.AssetStatus.ActiveAssets != nil {
			rAssetStatus["activeAssets"] = *r.AssetStatus.ActiveAssets
		}
		if r.AssetStatus.SecurityPolicyApplyingAssets != nil {
			rAssetStatus["securityPolicyApplyingAssets"] = *r.AssetStatus.SecurityPolicyApplyingAssets
		}
		if r.AssetStatus.UpdateTime != nil {
			rAssetStatus["updateTime"] = *r.AssetStatus.UpdateTime
		}
		u.Object["assetStatus"] = rAssetStatus
	}
	if r.CreateTime != nil {
		u.Object["createTime"] = *r.CreateTime
	}
	if r.Description != nil {
		u.Object["description"] = *r.Description
	}
	if r.DiscoverySpec != nil && r.DiscoverySpec != dclService.EmptyZoneDiscoverySpec {
		rDiscoverySpec := make(map[string]interface{})
		if r.DiscoverySpec.CsvOptions != nil && r.DiscoverySpec.CsvOptions != dclService.EmptyZoneDiscoverySpecCsvOptions {
			rDiscoverySpecCsvOptions := make(map[string]interface{})
			if r.DiscoverySpec.CsvOptions.Delimiter != nil {
				rDiscoverySpecCsvOptions["delimiter"] = *r.DiscoverySpec.CsvOptions.Delimiter
			}
			if r.DiscoverySpec.CsvOptions.DisableTypeInference != nil {
				rDiscoverySpecCsvOptions["disableTypeInference"] = *r.DiscoverySpec.CsvOptions.DisableTypeInference
			}
			if r.DiscoverySpec.CsvOptions.Encoding != nil {
				rDiscoverySpecCsvOptions["encoding"] = *r.DiscoverySpec.CsvOptions.Encoding
			}
			if r.DiscoverySpec.CsvOptions.HeaderRows != nil {
				rDiscoverySpecCsvOptions["headerRows"] = *r.DiscoverySpec.CsvOptions.HeaderRows
			}
			rDiscoverySpec["csvOptions"] = rDiscoverySpecCsvOptions
		}
		if r.DiscoverySpec.Enabled != nil {
			rDiscoverySpec["enabled"] = *r.DiscoverySpec.Enabled
		}
		var rDiscoverySpecExcludePatterns []interface{}
		for _, rDiscoverySpecExcludePatternsVal := range r.DiscoverySpec.ExcludePatterns {
			rDiscoverySpecExcludePatterns = append(rDiscoverySpecExcludePatterns, rDiscoverySpecExcludePatternsVal)
		}
		rDiscoverySpec["excludePatterns"] = rDiscoverySpecExcludePatterns
		var rDiscoverySpecIncludePatterns []interface{}
		for _, rDiscoverySpecIncludePatternsVal := range r.DiscoverySpec.IncludePatterns {
			rDiscoverySpecIncludePatterns = append(rDiscoverySpecIncludePatterns, rDiscoverySpecIncludePatternsVal)
		}
		rDiscoverySpec["includePatterns"] = rDiscoverySpecIncludePatterns
		if r.DiscoverySpec.JsonOptions != nil && r.DiscoverySpec.JsonOptions != dclService.EmptyZoneDiscoverySpecJsonOptions {
			rDiscoverySpecJsonOptions := make(map[string]interface{})
			if r.DiscoverySpec.JsonOptions.DisableTypeInference != nil {
				rDiscoverySpecJsonOptions["disableTypeInference"] = *r.DiscoverySpec.JsonOptions.DisableTypeInference
			}
			if r.DiscoverySpec.JsonOptions.Encoding != nil {
				rDiscoverySpecJsonOptions["encoding"] = *r.DiscoverySpec.JsonOptions.Encoding
			}
			rDiscoverySpec["jsonOptions"] = rDiscoverySpecJsonOptions
		}
		if r.DiscoverySpec.Schedule != nil {
			rDiscoverySpec["schedule"] = *r.DiscoverySpec.Schedule
		}
		u.Object["discoverySpec"] = rDiscoverySpec
	}
	if r.DisplayName != nil {
		u.Object["displayName"] = *r.DisplayName
	}
	if r.Labels != nil {
		rLabels := make(map[string]interface{})
		for k, v := range r.Labels {
			rLabels[k] = v
		}
		u.Object["labels"] = rLabels
	}
	if r.Lake != nil {
		u.Object["lake"] = *r.Lake
	}
	if r.Location != nil {
		u.Object["location"] = *r.Location
	}
	if r.Name != nil {
		u.Object["name"] = *r.Name
	}
	if r.Project != nil {
		u.Object["project"] = *r.Project
	}
	if r.ResourceSpec != nil && r.ResourceSpec != dclService.EmptyZoneResourceSpec {
		rResourceSpec := make(map[string]interface{})
		if r.ResourceSpec.LocationType != nil {
			rResourceSpec["locationType"] = string(*r.ResourceSpec.LocationType)
		}
		u.Object["resourceSpec"] = rResourceSpec
	}
	if r.State != nil {
		u.Object["state"] = string(*r.State)
	}
	if r.Type != nil {
		u.Object["type"] = string(*r.Type)
	}
	if r.Uid != nil {
		u.Object["uid"] = *r.Uid
	}
	if r.UpdateTime != nil {
		u.Object["updateTime"] = *r.UpdateTime
	}
	return u
}

func UnstructuredToZone(u *unstructured.Resource) (*dclService.Zone, error) {
	r := &dclService.Zone{}
	if _, ok := u.Object["assetStatus"]; ok {
		if rAssetStatus, ok := u.Object["assetStatus"].(map[string]interface{}); ok {
			r.AssetStatus = &dclService.ZoneAssetStatus{}
			if _, ok := rAssetStatus["activeAssets"]; ok {
				if i, ok := rAssetStatus["activeAssets"].(int64); ok {
					r.AssetStatus.ActiveAssets = dcl.Int64(i)
				} else {
					return nil, fmt.Errorf("r.AssetStatus.ActiveAssets: expected int64")
				}
			}
			if _, ok := rAssetStatus["securityPolicyApplyingAssets"]; ok {
				if i, ok := rAssetStatus["securityPolicyApplyingAssets"].(int64); ok {
					r.AssetStatus.SecurityPolicyApplyingAssets = dcl.Int64(i)
				} else {
					return nil, fmt.Errorf("r.AssetStatus.SecurityPolicyApplyingAssets: expected int64")
				}
			}
			if _, ok := rAssetStatus["updateTime"]; ok {
				if s, ok := rAssetStatus["updateTime"].(string); ok {
					r.AssetStatus.UpdateTime = dcl.String(s)
				} else {
					return nil, fmt.Errorf("r.AssetStatus.UpdateTime: expected string")
				}
			}
		} else {
			return nil, fmt.Errorf("r.AssetStatus: expected map[string]interface{}")
		}
	}
	if _, ok := u.Object["createTime"]; ok {
		if s, ok := u.Object["createTime"].(string); ok {
			r.CreateTime = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.CreateTime: expected string")
		}
	}
	if _, ok := u.Object["description"]; ok {
		if s, ok := u.Object["description"].(string); ok {
			r.Description = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Description: expected string")
		}
	}
	if _, ok := u.Object["discoverySpec"]; ok {
		if rDiscoverySpec, ok := u.Object["discoverySpec"].(map[string]interface{}); ok {
			r.DiscoverySpec = &dclService.ZoneDiscoverySpec{}
			if _, ok := rDiscoverySpec["csvOptions"]; ok {
				if rDiscoverySpecCsvOptions, ok := rDiscoverySpec["csvOptions"].(map[string]interface{}); ok {
					r.DiscoverySpec.CsvOptions = &dclService.ZoneDiscoverySpecCsvOptions{}
					if _, ok := rDiscoverySpecCsvOptions["delimiter"]; ok {
						if s, ok := rDiscoverySpecCsvOptions["delimiter"].(string); ok {
							r.DiscoverySpec.CsvOptions.Delimiter = dcl.String(s)
						} else {
							return nil, fmt.Errorf("r.DiscoverySpec.CsvOptions.Delimiter: expected string")
						}
					}
					if _, ok := rDiscoverySpecCsvOptions["disableTypeInference"]; ok {
						if b, ok := rDiscoverySpecCsvOptions["disableTypeInference"].(bool); ok {
							r.DiscoverySpec.CsvOptions.DisableTypeInference = dcl.Bool(b)
						} else {
							return nil, fmt.Errorf("r.DiscoverySpec.CsvOptions.DisableTypeInference: expected bool")
						}
					}
					if _, ok := rDiscoverySpecCsvOptions["encoding"]; ok {
						if s, ok := rDiscoverySpecCsvOptions["encoding"].(string); ok {
							r.DiscoverySpec.CsvOptions.Encoding = dcl.String(s)
						} else {
							return nil, fmt.Errorf("r.DiscoverySpec.CsvOptions.Encoding: expected string")
						}
					}
					if _, ok := rDiscoverySpecCsvOptions["headerRows"]; ok {
						if i, ok := rDiscoverySpecCsvOptions["headerRows"].(int64); ok {
							r.DiscoverySpec.CsvOptions.HeaderRows = dcl.Int64(i)
						} else {
							return nil, fmt.Errorf("r.DiscoverySpec.CsvOptions.HeaderRows: expected int64")
						}
					}
				} else {
					return nil, fmt.Errorf("r.DiscoverySpec.CsvOptions: expected map[string]interface{}")
				}
			}
			if _, ok := rDiscoverySpec["enabled"]; ok {
				if b, ok := rDiscoverySpec["enabled"].(bool); ok {
					r.DiscoverySpec.Enabled = dcl.Bool(b)
				} else {
					return nil, fmt.Errorf("r.DiscoverySpec.Enabled: expected bool")
				}
			}
			if _, ok := rDiscoverySpec["excludePatterns"]; ok {
				if s, ok := rDiscoverySpec["excludePatterns"].([]interface{}); ok {
					for _, ss := range s {
						if strval, ok := ss.(string); ok {
							r.DiscoverySpec.ExcludePatterns = append(r.DiscoverySpec.ExcludePatterns, strval)
						}
					}
				} else {
					return nil, fmt.Errorf("r.DiscoverySpec.ExcludePatterns: expected []interface{}")
				}
			}
			if _, ok := rDiscoverySpec["includePatterns"]; ok {
				if s, ok := rDiscoverySpec["includePatterns"].([]interface{}); ok {
					for _, ss := range s {
						if strval, ok := ss.(string); ok {
							r.DiscoverySpec.IncludePatterns = append(r.DiscoverySpec.IncludePatterns, strval)
						}
					}
				} else {
					return nil, fmt.Errorf("r.DiscoverySpec.IncludePatterns: expected []interface{}")
				}
			}
			if _, ok := rDiscoverySpec["jsonOptions"]; ok {
				if rDiscoverySpecJsonOptions, ok := rDiscoverySpec["jsonOptions"].(map[string]interface{}); ok {
					r.DiscoverySpec.JsonOptions = &dclService.ZoneDiscoverySpecJsonOptions{}
					if _, ok := rDiscoverySpecJsonOptions["disableTypeInference"]; ok {
						if b, ok := rDiscoverySpecJsonOptions["disableTypeInference"].(bool); ok {
							r.DiscoverySpec.JsonOptions.DisableTypeInference = dcl.Bool(b)
						} else {
							return nil, fmt.Errorf("r.DiscoverySpec.JsonOptions.DisableTypeInference: expected bool")
						}
					}
					if _, ok := rDiscoverySpecJsonOptions["encoding"]; ok {
						if s, ok := rDiscoverySpecJsonOptions["encoding"].(string); ok {
							r.DiscoverySpec.JsonOptions.Encoding = dcl.String(s)
						} else {
							return nil, fmt.Errorf("r.DiscoverySpec.JsonOptions.Encoding: expected string")
						}
					}
				} else {
					return nil, fmt.Errorf("r.DiscoverySpec.JsonOptions: expected map[string]interface{}")
				}
			}
			if _, ok := rDiscoverySpec["schedule"]; ok {
				if s, ok := rDiscoverySpec["schedule"].(string); ok {
					r.DiscoverySpec.Schedule = dcl.String(s)
				} else {
					return nil, fmt.Errorf("r.DiscoverySpec.Schedule: expected string")
				}
			}
		} else {
			return nil, fmt.Errorf("r.DiscoverySpec: expected map[string]interface{}")
		}
	}
	if _, ok := u.Object["displayName"]; ok {
		if s, ok := u.Object["displayName"].(string); ok {
			r.DisplayName = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.DisplayName: expected string")
		}
	}
	if _, ok := u.Object["labels"]; ok {
		if rLabels, ok := u.Object["labels"].(map[string]interface{}); ok {
			m := make(map[string]string)
			for k, v := range rLabels {
				if s, ok := v.(string); ok {
					m[k] = s
				}
			}
			r.Labels = m
		} else {
			return nil, fmt.Errorf("r.Labels: expected map[string]interface{}")
		}
	}
	if _, ok := u.Object["lake"]; ok {
		if s, ok := u.Object["lake"].(string); ok {
			r.Lake = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Lake: expected string")
		}
	}
	if _, ok := u.Object["location"]; ok {
		if s, ok := u.Object["location"].(string); ok {
			r.Location = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Location: expected string")
		}
	}
	if _, ok := u.Object["name"]; ok {
		if s, ok := u.Object["name"].(string); ok {
			r.Name = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Name: expected string")
		}
	}
	if _, ok := u.Object["project"]; ok {
		if s, ok := u.Object["project"].(string); ok {
			r.Project = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Project: expected string")
		}
	}
	if _, ok := u.Object["resourceSpec"]; ok {
		if rResourceSpec, ok := u.Object["resourceSpec"].(map[string]interface{}); ok {
			r.ResourceSpec = &dclService.ZoneResourceSpec{}
			if _, ok := rResourceSpec["locationType"]; ok {
				if s, ok := rResourceSpec["locationType"].(string); ok {
					r.ResourceSpec.LocationType = dclService.ZoneResourceSpecLocationTypeEnumRef(s)
				} else {
					return nil, fmt.Errorf("r.ResourceSpec.LocationType: expected string")
				}
			}
		} else {
			return nil, fmt.Errorf("r.ResourceSpec: expected map[string]interface{}")
		}
	}
	if _, ok := u.Object["state"]; ok {
		if s, ok := u.Object["state"].(string); ok {
			r.State = dclService.ZoneStateEnumRef(s)
		} else {
			return nil, fmt.Errorf("r.State: expected string")
		}
	}
	if _, ok := u.Object["type"]; ok {
		if s, ok := u.Object["type"].(string); ok {
			r.Type = dclService.ZoneTypeEnumRef(s)
		} else {
			return nil, fmt.Errorf("r.Type: expected string")
		}
	}
	if _, ok := u.Object["uid"]; ok {
		if s, ok := u.Object["uid"].(string); ok {
			r.Uid = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Uid: expected string")
		}
	}
	if _, ok := u.Object["updateTime"]; ok {
		if s, ok := u.Object["updateTime"].(string); ok {
			r.UpdateTime = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.UpdateTime: expected string")
		}
	}
	return r, nil
}

func GetZone(ctx context.Context, config *dcl.Config, u *unstructured.Resource) (*unstructured.Resource, error) {
	c := dclService.NewClient(config)
	r, err := UnstructuredToZone(u)
	if err != nil {
		return nil, err
	}
	r, err = c.GetZone(ctx, r)
	if err != nil {
		return nil, err
	}
	return ZoneToUnstructured(r), nil
}

func ListZone(ctx context.Context, config *dcl.Config, project string, location string, lake string) ([]*unstructured.Resource, error) {
	c := dclService.NewClient(config)
	l, err := c.ListZone(ctx, project, location, lake)
	if err != nil {
		return nil, err
	}
	var resources []*unstructured.Resource
	for {
		for _, r := range l.Items {
			resources = append(resources, ZoneToUnstructured(r))
		}
		if !l.HasNext() {
			break
		}
		if err := l.Next(ctx, c); err != nil {
			return nil, err
		}
	}
	return resources, nil
}

func ApplyZone(ctx context.Context, config *dcl.Config, u *unstructured.Resource, opts ...dcl.ApplyOption) (*unstructured.Resource, error) {
	c := dclService.NewClient(config)
	r, err := UnstructuredToZone(u)
	if err != nil {
		return nil, err
	}
	if ush := unstructured.FetchStateHint(opts); ush != nil {
		sh, err := UnstructuredToZone(ush)
		if err != nil {
			return nil, err
		}
		opts = append(opts, dcl.WithStateHint(sh))
	}
	r, err = c.ApplyZone(ctx, r, opts...)
	if err != nil {
		return nil, err
	}
	return ZoneToUnstructured(r), nil
}

func ZoneHasDiff(ctx context.Context, config *dcl.Config, u *unstructured.Resource, opts ...dcl.ApplyOption) (bool, error) {
	c := dclService.NewClient(config)
	r, err := UnstructuredToZone(u)
	if err != nil {
		return false, err
	}
	if ush := unstructured.FetchStateHint(opts); ush != nil {
		sh, err := UnstructuredToZone(ush)
		if err != nil {
			return false, err
		}
		opts = append(opts, dcl.WithStateHint(sh))
	}
	opts = append(opts, dcl.WithLifecycleParam(dcl.BlockDestruction), dcl.WithLifecycleParam(dcl.BlockCreation), dcl.WithLifecycleParam(dcl.BlockModification))
	_, err = c.ApplyZone(ctx, r, opts...)
	if err != nil {
		if _, ok := err.(dcl.ApplyInfeasibleError); ok {
			return true, nil
		}
		return false, err
	}
	return false, nil
}

func DeleteZone(ctx context.Context, config *dcl.Config, u *unstructured.Resource) error {
	c := dclService.NewClient(config)
	r, err := UnstructuredToZone(u)
	if err != nil {
		return err
	}
	return c.DeleteZone(ctx, r)
}

func ZoneID(u *unstructured.Resource) (string, error) {
	r, err := UnstructuredToZone(u)
	if err != nil {
		return "", err
	}
	return r.ID()
}

func (r *Zone) STV() unstructured.ServiceTypeVersion {
	return unstructured.ServiceTypeVersion{
		"dataplex",
		"Zone",
		"beta",
	}
}

func (r *Zone) SetPolicyMember(ctx context.Context, config *dcl.Config, resource *unstructured.Resource, member *unstructured.Resource) (*unstructured.Resource, error) {
	return nil, unstructured.ErrNoSuchMethod
}

func (r *Zone) GetPolicyMember(ctx context.Context, config *dcl.Config, resource *unstructured.Resource, role, member string) (*unstructured.Resource, error) {
	return nil, unstructured.ErrNoSuchMethod
}

func (r *Zone) DeletePolicyMember(ctx context.Context, config *dcl.Config, resource *unstructured.Resource, member *unstructured.Resource) error {
	return unstructured.ErrNoSuchMethod
}

func (r *Zone) SetPolicy(ctx context.Context, config *dcl.Config, resource *unstructured.Resource, policy *unstructured.Resource) (*unstructured.Resource, error) {
	return nil, unstructured.ErrNoSuchMethod
}

func (r *Zone) SetPolicyWithEtag(ctx context.Context, config *dcl.Config, resource *unstructured.Resource, policy *unstructured.Resource) (*unstructured.Resource, error) {
	return nil, unstructured.ErrNoSuchMethod
}

func (r *Zone) GetPolicy(ctx context.Context, config *dcl.Config, resource *unstructured.Resource) (*unstructured.Resource, error) {
	return nil, unstructured.ErrNoSuchMethod
}

func (r *Zone) Get(ctx context.Context, config *dcl.Config, resource *unstructured.Resource) (*unstructured.Resource, error) {
	return GetZone(ctx, config, resource)
}

func (r *Zone) Apply(ctx context.Context, config *dcl.Config, resource *unstructured.Resource, opts ...dcl.ApplyOption) (*unstructured.Resource, error) {
	return ApplyZone(ctx, config, resource, opts...)
}

func (r *Zone) HasDiff(ctx context.Context, config *dcl.Config, resource *unstructured.Resource, opts ...dcl.ApplyOption) (bool, error) {
	return ZoneHasDiff(ctx, config, resource, opts...)
}

func (r *Zone) Delete(ctx context.Context, config *dcl.Config, resource *unstructured.Resource) error {
	return DeleteZone(ctx, config, resource)
}

func (r *Zone) ID(resource *unstructured.Resource) (string, error) {
	return ZoneID(resource)
}

func init() {
	unstructured.Register(&Zone{})
}


text:
package japgolly.scalajs.react

import scala.annotation.implicitNotFound

sealed trait UpdateSnapshot {
  type Value
}

object UpdateSnapshot {

  sealed trait None extends UpdateSnapshot {
    override final type Value = Unit
  }

  sealed trait Some[A] extends UpdateSnapshot {
    override final type Value = A
  }

  @implicitNotFound("You can only specify getSnapshotBeforeUpdate once, and it has to be before " +
    "you specify componentDidUpdate, otherwise the snapshot type could become inconsistent.")
  sealed trait SafetyProof[U <: UpdateSnapshot]

  implicit def safetyProof[U <: UpdateSnapshot](implicit ev: U =:= UpdateSnapshot.None): SafetyProof[U] =
    null.asInstanceOf[SafetyProof[U]]
}


text:
This README would normally document whatever steps are necessary to get the
application up and running.

Things you may want to cover:

* Ruby version

* System dependencies

* Configuration

* Database creation

* Database initialization

* How to run the test suite

  To launch ircbot,

   RAILS_ENV=production DISABLE_SPRING=true nohup bundle exec rails runner lib/tasks/ircbot.rb &

* Services (job queues, cache servers, search engines, etc.)

* Deployment instructions

* ...


text:
package org.kie.workbench.common.dmn.api.definition;

import org.kie.workbench.common.dmn.api.property.dmn.Text;

/**
 * Implementations have a {@link Text} property.
 */
public interface HasText extends HasValue<Text> {

    /**
     * Returns the {@link Text}
     * Convenience method replicating {@link HasValue#getValue()} to honour DMN model semantics.
     * @return
     */
    Text getText();

    /**
     * Sets the {@link Text}
     * Convenience method replicating {@link HasValue#setValue(Object)} to honour DMN model semantics.
     * @param text
     */
    void setText(final Text text);

    /**
     * Returns the {@link Text}
     * @return
     */
    @Override
    default Text getValue() {
        return getText();
    }

    /**
     * Sets the {@link Text}
     * @param text
     */
    @Override
    default void setValue(final Text text) {
        setText(text);
    }

    HasText NOP = new HasText() {

        private final Text TEXT = new Text();

        @Override
        public Text getText() {
            return TEXT;
        }

        @Override
        public void setText(final Text text) {
            //Do nothing
        }
    };
}


text:
ReFlex is a software-based system that provides remote access to Flash with performance nearly identical to local Flash access. ReFlex closely integrates network and storage processing in a dataplane  kernel to achieve low latency and high throughput at low resource requirements. ReFlex uses a novel I/O scheduler to enforce tail latency and throughput service-level objectives (SLOs) for multiple clients sharing a remote Flash device.

ReFlex is an extension of the [IX dataplace operating system](https://github.com/ix-project/ix). ReFlex uses Intel [DPDK](http://dpdk.org) for fast packet processing and Intel [SPDK](http://www.spdk.io) for high performance access to NVMe Flash. There are two implementations of ReFlex currently available: a kernel implementation and a userspace implementation.

In the kernel implementation (available in the [master](https://github.com/stanford-mast/reflex/tree/master) branch of this repository), the ReFlex kernel runs as a guest OS in Linux and relies on the [Dune](https://github.com/project-dune/dune) kernel for memory management and direct access to hardware (e.g., NIC and NVMe Flash queues) from userspace applications. This is the original implementation of ReFlex, as presented in the [paper](https://web.stanford.edu/group/mast/cgi-bin/drupal/system/files/reflex_asplos17.pdf) published at ASPLOS'17.

In the userspace implementation (available in the [userspace](https://github.com/stanford-mast/reflex/tree/userspace) branch), network and storage processing is implemented in userspace and ReFlex uses the standard `igb_uio` module to bind a network device to a DPDK-provided network device driver. The userspace version of ReFlex does not require the Dune kernel module to be loaded. This means the userspace version of ReFlex is simpler to deploy.

## Requirements for userspace version of ReFlex

ReFlex requires a NVMe Flash device and a [network interface card supported by Intel DPDK](http://dpdk.org/doc/nics). We have tested ReFlex with the Intel 82599 10GbE NIC and the following NVMe SSDs: Samsung PM1725 and Intel P3600. We have also tested ReFlex on Amazon Web Services EC2 instances i3.4xlarge (see end of setup instructions below for AWS EC2 instance setup).

ReFlex has been successfully tested on Ubuntu 16.04 LTS with kernel 4.4.0.

**Note:** ReFlex provides an efficient *dataplane* for remote access to Flash. To deploy ReFlex in a datacenter cluster, ReFlex should be combined with a control plane to manage Flash resources across machines and optimize the allocation of Flash IOPS and capacity.

## Setup Instructions

There is currently no binary distribution of ReFlex. You will therefore need to compile the project from source, as described below.

1. Obtain ReFlex source code and fetch dependencies:

   ```
   git clone https://github.com/stanford-mast/reflex.git
   cd reflex
   git checkout userspace
   ./deps/fetch-deps.sh
   ```

2. Install library dependencies:

   ```
   sudo apt-get install libconfig-dev libnuma-dev libpciaccess-dev libaio-dev libevent-dev g++-multilib libcunit1-dev libssl-dev
   ```

3. Build the dependecies:

   ```
   sudo chmod +r /boot/System.map-`uname -r`
   make -sj64 -C deps/dpdk config T=x86_64-native-linuxapp-gcc
   make -sj64 -C deps/dpdk
   make -sj64 -C deps/dpdk install T=x86_64-native-linuxapp-gcc DESTDIR=deps/dpdk/x86_64-native-linuxapp-gcc
   export REFLEX_HOME=`pwd`
   cd deps/spdk
   ./configure --with-dpdk=$REFLEX_HOME/deps/dpdk/x86_64-native-linuxapp-gcc
   make
   cd ../..
   ```

4. Build ReFlex:

   ```
   make -sj64
   ```
5. Set up the environment:

   ```
   cp ix.conf.sample ix.conf
    # modify at least host_addr, gateway_addr, devices, and nvme_devices

   sudo modprobe -r ixgbe
   sudo modprobe -r nvme
   sudo modprobe uio
   sudo insmod deps/dpdk/build/kmod/igb_uio.ko
   sudo deps/dpdk/usertools/dpdk-devbind.py --bind=igb_uio 0000:06:00.0   # insert device PCI address here!!!

   sudo deps/spdk/scripts/setup.sh

   sudo sh -c 'for i in /sys/devices/system/node/node*/hugepages/hugepages-2048kB/nr_hugepages; do echo 4096 > $i; done'
   ```

6. Precondition the SSD and derive the request cost model:

   It is necessary to precondition the SSD to acheive steady-state performance and reproducible results across runs. We recommend preconditioning the SSD with the following local Flash tests: write *sequentially* to the entire address space using 128KB requests, then write *randomly* to the device with 4KB requests until you see performance reach steady state. The random write test typically takes about 10 to 20 minutes, depending on the device model and capacity.

   After preconditioning, you should derive the request cost model for your SSD:

   ```
   cp sample.devmodel nvme_devname.devmodel
    # update request costs and token limits to match your SSD performance
    # see instructions in comments of file sample.devmodel
	# in ix.conf file, update nvme_device_model=nvme_devname.devmodel
   ```
   You may use any I/O load generation tool (e.g. [fio](https://github.com/axboe/fio)) for preconditioning and request calibration tests. Note that if you use a Linux-based tool, you will need to reload the nvme kernel module for these tests (remember to unload it before running the ReFlex server).

   For your convenience, we provide an open-loop, local Flash load generator based on the SPDK perf example application [here](https://github.com/anakli/spdk_perf). We modified the SPDK perf example application to report read and write percentile latencies. We also made the load generator open-loop, so you can sweep throughput by specifying a target IOPS instead of queue depth. See setup instructions for ReFlex users in the repository's [README](https://github.com/anakli/spdk_perf/blob/master/README.md).

### Instructions for setting up an AWS EC2 instance to run ReFlex

To run ReFlex on Amazon Web Servies EC2, you will need an instance type that supports [Enhanced Networking](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking.html#enabling_enhanced_networking) (this means the instance has a DPDK-supported Enhanced Networking Adapter). The instance also needs to have NVMe Flash. Use an i3.4xlarge or larger instance with Ubuntu 16.04 Linux. Using a dedicated instance is strongly recommended for performance measurements.

You will need to setup a [Virtual Private Cloud (VPC)](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-vpc.html) for your instance(s) so that you can add Ethernet interfaces on the instance(s) running ReFlex. When you are ready to launch your ReFlex instance, in the "configure instance details" step, you need to add an extra network interface. This is required because you need to bind one interface to the userspace igb_uio driver for ReFlex/DPDK and you need one interface bound to the kernel NIC driver to SSH into your instance. In the "configure instance details" step, set the network for your instance to be your VPC network and use the subnet you created within your VPC. You can create the subnet from the VPC dashboard.

To connect to your instance, you should create an [Elastic IP address](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) and then associate it to the eth0 interface on your instance. Go to your VPC dashboard -> Elastic IPs -> Allocate new address. Next, associate this address to the eth0 interface on your ReFlex instance after you have obtained the interface ID and private IP address by hovering over the eth0 field in the description of your instance in the EC2 dashboard.

When you have successfully launched and connected to your instance, follow the ReFlex setup instructions (steps 1-6) above.

## Running ReFlex

### 1. Run the ReFlex server:

   ```
   sudo ./dp/ix
   ```

   ReFlex runs one dataplane thread per CPU core. If you want to run multiple ReFlex threads (to support higher throughput), set the `cpu` list in ix.conf and add `fdir` rules to steer traffic identified by {dest IP, src IP, dest port} to a particular core.

#### Registering service level objectives (SLOs) for ReFlex tenants:

* A *tenant* is a logical abstraction for accounting for and enforcing SLOs. ReFlex supports two types of tenants: latency-critical (LC) and best-effort (BE) tenants.
* The current implementation of ReFlex requires tenant SLOs to be specified statically (before running ReFlex) in `pp_accept()` in `apps/reflex_server.c`. Each port ReFlex listens on can be associated with a separate SLO. The tenant should communicate with ReFlex using the destination port that corresponds to the appropriate SLO. This is a temporary implementation until there is proper client API support for a tenant to dynamically register SLOs with ReFlex.

 > As future work, a more elegant approach would be to i) implement a ReFlex control plane that listens on a dedicated admin port, ii) provide a client API for a tenant to register with ReFlex on this admin port and specify its SLO, and iii) provide a response from the ReFlex control plane to the tenant, indicating which port the tenant should use to communicate with the ReFlex data plane.

### 2. Run a ReFlex client:

There are several options for clients:

1. Run a Linux-based client that opens TCP connections to ReFlex and sends read/write reqs to logical blocks.

	* This client option avoids the performance overheads of the filesystem  and block layers in the client machine. However, the client is still subject to any latency or throughput inefficiencies of the networking layer in the  Linux operating system.

	On the client machine, setup the `mutilate` load generator. We provide a modified version of `mutilate` which supports the ReFlex block protocol.

	```
	git clone https://github.com/anakli/mutilate.git
	cd mutilate
	sudo apt-get install scons libevent-dev gengetopt libzmq-dev
	scons
	```

	To achieve the best performance with a Linux client, we recommend tuning NIC settings and disabling CPU and PCIe link power management on the client.

	Network setup tuning (recommended):

	```
	 # enable jumbo frames
	sudo ifconfig ethX mtu 9000
	 # tune interrupt coalescing
	sudo ethtool -C ethX rx-usecs 50
	 # disable LRO/GRO offloads
	sudo ethtool -K ethX lro off
	sudo ethtool -K ethX gro off
	```

	Disable power mangement (recommended):

   	```
	## to disable CPU power management, run:
	#!/bin/bash
	for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
    	echo performance > $i
	done

	## to disable PCIe link power management:
	sudo vi /etc/default/grub
     # modify existing line:
     # GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pcie_aspm=force processor.max_cstate=1 idle=poll"
   	sudo grub-mkconfig -o /boot/grub/grub.cfg
   	sudo reboot
   	sudo su
   	echo performance > /sys/module/pcie_aspm/parameters/policy
   	```

	Run Linux client:

	```
	./mutilate -s IP:PORT --noload -r NUM_LOGICAL_BLOCK_ADDRESSES -K 8 -V 4096 --binary
	```

	This command is for an unloaded latency test; it launches a single client thread issuing requests with queue depth 1. Sample expected output:

	```
    #type       avg     std     min     5th    10th    90th    95th    99th     max
	read      115.2     8.7   101.8   107.3   108.1   125.8   127.6   129.1   351.3
	update      0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0
	op_q        1.0     0.0     1.0     1.0     1.0     1.1     1.1     1.1     1.0

	Total QPS = 8662.4 (519747 / 60.0s)
	```

	Follow instructions in [mutilate README](https://github.com/anakli/mutilate/blob/master/README.md) to launch multiple client threads across multiple agent machines for high-throughput tests.

2. Run an IX-based client that opens TCP connections to ReFlex and sends read/write requests to logical blocks.

	* This client option avoids networking and storage (filesystem and block layer) overhead on the client machine. It requires the client machine to run IX.

   Clone ReFlex source code (userspace branch) on client machine and follow steps 1 to 6 in the setup instructions in userspace branch README. Comment out `nvme_devices` in ix.conf.

   There are currently two modes (open-loop and closed-loop testing) available on the IX-based client.

   To run the open-loop ReFlex client:

   ```
   # example: sudo ./dp/ix -s 10.79.6.130 -p 1234 -w seq -T 1 -i 1000 -r 100 -S 1 -R 1024 -P 0
   ```

   To run the closed-loop ReFlex client:
   ```
    # example: sudo ./dp/ix -s 10.79.6.130 -p 1234 -w seq -T 1 -i 1000 -r 100 -S 0 -R 1024 -P 0 -d 1 -t 5
   ```

   More descriptions for the command line options can be found by running
   ```
   sudo ./dp/ix -h

   Usage:
   sudo ./dp/ix
   to run ReFlex server, no parameters required
   to run ReFlex client, set the following options
   -s  server IP address
   -p  server port number
   -w  workload type [seq/rand] (default=rand)
   -T  number of threads (default=1)
   -i  target IOPS for open-loop test (default=50000)
   -r  percentage of read requests (default=100)
   -S  sweep multiple target IOPS for open-loop test (default=1)
   -R  request size in bytes (default=1024)
   -P  precondition (default=0)
   -d  queue depth for closed-loop test (default=0)
   -t  execution time for closed-loop test (default=0)
   ```

   Sample output:

   ```
   RqIOPS:	 IOPS: 	 Avg:  	 10th: 	 20th: 	 30th: 	 40th: 	 50th: 	 60th: 	 70th: 	 80th: 	 90th: 	 95th: 	 99th: 	 max:  	 missed:
   1000   	 1000  	 98    	 92    	 93    	 94    	 94    	 95    	 96    	 110   	 111   	 112   	 113   	 117   	 149   	 0
   10000  	 10000 	 98    	 92    	 92    	 93    	 94    	 94    	 95    	 110   	 111   	 112   	 112   	 113   	 172   	 9
   50000  	 49999 	 100   	 92    	 93    	 94    	 95    	 95    	 96    	 111   	 111   	 113   	 114   	 134   	 218   	 682
   100000 	 99999 	 102   	 93    	 94    	 95    	 96    	 97    	 104   	 112   	 113   	 116   	 122   	 155   	 282   	 44385
   150000 	 150001	 105   	 94    	 95    	 96    	 98    	 100   	 109   	 113   	 115   	 120   	 132   	 168   	 357   	 303583
   200000 	 199997	 109   	 96    	 97    	 99    	 101   	 105   	 112   	 115   	 118   	 127   	 145   	 178   	 440   	 923940
   ```

   For high-throughput tests, increase the number of IX client threads (and CPU cores configured in client ix.conf). You may also want to run multiple ReFlex threads on the server.

3.  Run a legacy client application using the ReFlex remote block device driver.

	* This client option is provided to support legacy applications. ReFlex exposes a standard Linux remote block device interface to the client (which appears to the client as a local block device). The client can mount a filesystem on the block device. With this approach, the client is subject to overheads in the Linux filesystem, block storage layer and network stack.

    On the client, change into the reflex_nbd directory and type make. Be sure that the remote ReFlex server is running and that it is ping-able from the client. Load the reflex.ko module, type dmesg to check whether the driver was successfully loaded. To reproduce the fio results from the paper do the following.
    ```
    cd reflex_nbd
    make

	sudo modprobe ixgbe
	sudo modprobe nvme
	 # make sure you have started reflex_server on the server machine and can ping it

	sudo insmod reflex.ko
    sudo mkfs.ext4 /dev/reflex0
    sudo mkdir /mnt/reflex
    sudo mount /dev/reflex0 /mnt/reflex
	sudo chmod a+rw /mnt/reflex
    touch /mnt/reflex/fio
    sudo apt install fio
    for i in 1 2 4 8 16 32 ; do BLKSIZE=4k DEPTH=$i fio randread_remote.fio; done
    ```
## Reference

Please refer to the ReFlex [paper](https://web.stanford.edu/group/mast/cgi-bin/drupal/system/files/reflex_asplos17.pdf):

Ana Klimovic, Heiner Litz, Christos Kozyrakis
ReFlex: Remote Flash == Local Flash
in the 22nd International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS'22), 2017

## License and Copyright

ReFlex is free software. You can redistribute and/or modify the code under the terms of the BSD License. See [LICENSE](https://github.com/stanford-mast/reflex/blob/master/LICENSE).

The original ReFlex code was written collaboratively by Ana Klimovic and Heiner Litz at Stanford University. Per Stanford University policy, the copyright of the original code remains with the Board of Trustees of Leland Stanford Junior University.

## Future work

The userspace implementation of ReFlex is for the ReFlex server. We are working on a shared userspace library based on ReFlex/IX which will allow client applications to submit requests to a remote ReFlex server using the efficient DPDK-based TCP network processing in ReFlex/IX.

The current implementation of ReFlex would also benefit from the following:

* Client API support for tenants to dynamically register SLOs.
* Support for multiple NVMe device management by a single ReFlex server.
* Support for light weight network protocol such as UDP (currently use TCP/IP).


text:
package org.teavm.classlib.java.util;

import org.teavm.classlib.java.lang.TRuntimeException;

public class TNoSuchElementException extends TRuntimeException {
    private static final long serialVersionUID = -4890604137042866919L;

    public TNoSuchElementException() {
        super();
    }

    public TNoSuchElementException(String message) {
        super(message);
    }
}


text:
namespace xc
{
	namespace detail
	{
		//
		class capture_observable
		{
		public:
			//
			capture_observable(
				const std::vector<std::unique_ptr<frame_grabber_unit>>& units)
			{
				for (const auto& unit : units)
				{
					this->units.push_back(unit.get());
					this->wait_handles.emplace_back(unit->capture_event().handle());
				}
				this->wait_handles.emplace_back(this->close_event.handle());

				this->connect();
			}

			capture_observable(const capture_observable&) = delete;

			capture_observable& operator=(const capture_observable&) = delete;

			//
			~capture_observable()
			{
				try
				{
					this->disconnect();
				}
				catch (const std::exception& ex)
				{
					more::error(ex.what());
				}
			}

			//
			void connect()
			{
				this->disconnect();
				this->thread = std::thread(&capture_observable::observe, this);
			}

			//
			void disconnect()
			{
				if (this->thread.joinable() == true)
				{
					this->close_event.set();
					this->thread.join();
				}
			}

			rxcpp::observable<image_view> get() const
			{
				return this->fault_subject.get_observable();
			}

		private:
			//
			template<typename observer>
			bool_t on_wait_success(
				observer&& observer,
				DWORD wait_handle_index)
			{
				if (wait_handle_index == units.size())
				{
					observer.on_completed();
					return false;
				}
				else
				{
					try
					{
						observer.on_next(
							this->units[wait_handle_index]->get_last_captured_image());
					}
					catch (const std::exception& ex)
					{
						logging::error(std::string(ex.what()));
					}
					return true;
				}
			}

			template<typename observer>
			bool_t on_wait_abandoned(
				observer&& observer,
				DWORD wait_handle_index)
			{
				if (wait_handle_index == units.size())
					logging::error("Close wait handle abandoned unexpectedly.");
				else
					logging::error("Fault wait handle for unit on port %i abandoned unexpectedly.",
						this->units[wait_handle_index]->port());
				observer.on_completed();
				return false;
			}

			template<typename observer>
			bool_t on_wait_timeout(observer&& observer)
			{
				logging::error("Wait timed out unexpectedly.");
				observer.on_completed();
				return false;
			}

			template<typename observer>
			bool_t on_wait_failed(observer&& observer)
			{

				logging::error(win32::get_last_error().what());
				observer.on_completed();
				return false;
			}

			void observe()
			{
				bool_t observing = true;

				auto observer = this->fault_subject.get_subscriber().get_observer();
				while (observing == true)
				{
					DWORD wait_result = ::WaitForMultipleObjects(
						static_cast<DWORD>(this->wait_handles.size()),
						this->wait_handles.data(),
						false, INFINITE);

					if (wait_result == WAIT_FAILED)
						observing = on_wait_failed(observer);
					else if (wait_result == WAIT_TIMEOUT)
						observing = on_wait_timeout(observer);
					else if ((wait_result & WAIT_ABANDONED_0) == WAIT_ABANDONED_0)
						observing = on_wait_abandoned(observer, wait_result - WAIT_ABANDONED_0);
					else if ((wait_result & WAIT_OBJECT_0) == WAIT_OBJECT_0)
						observing = on_wait_success(observer, wait_result - WAIT_OBJECT_0);
					else
						observing = on_wait_failed(observer);
				}
			}

			rxcpp::subjects::subject<image_view> fault_subject;

			std::vector<HANDLE> wait_handles;
			std::vector<frame_grabber_unit*> units;

			win32::manual_reset_event close_event;
			std::thread thread;
		};
	}
}


text:
[![CI Status](http://img.shields.io/travis/stagebloc/CocoaBloc-Camera.svg?style=flat)](https://travis-ci.org/stagebloc/CocoaBloc-Camera/branches)
[![Version](https://img.shields.io/cocoapods/v/CocoaBloc-Camera.svg?style=flat)](http://cocoapods.org/pods/CocoaBloc-Camera)
[![License](https://img.shields.io/cocoapods/l/CocoaBloc-Camera.svg?style=flat)](http://cocoapods.org/pods/CocoaBloc-Camera)
[![Platform](https://img.shields.io/cocoapods/p/CocoaBloc-Camera.svg?style=flat)](http://cocoapods.org/pods/CocoaBloc-Camera)

## Installation

CocoaBloc-Camera is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'CocoaBloc-Camera'
```

## Getting Started
#### Implementing CococaBloc-Camera:
1. Init a `SBCameraViewController`
2. Set the `SBCameraViewController's` `delegate`.
3. Present the `SBCameraViewController`.
4. Handle `SBCaptureViewControllerDelegate` callbacks.

#### Example Implementation
```objc
@implementation ViewController

. . .

//create an SBCameraViewController
- (void)launchCameraController {
    // ===> 1. Init a `SBCameraViewController`
    SBCameraViewController *cameraController = [[SBCameraViewController alloc] initWithReviewOptions:reviewOptions initialCaptureType:SBCaptureTypeVideo];

    // ===> 2. Set the `SBCameraViewController's` `delegate`.
    cameraController.captureDelegate = self;

    // ===> 3. Present the `SBCameraViewController`.
    [self presentViewController:cameraController animated:YES completion:nil];
}

. . .

// ===> 4. Handle `SBCaptureViewControllerDelegate` callbacks.
#pragma mark - SBCaptureViewControllerDelegate
- (void)cameraControllerCancelled:(SBCaptureViewController*)controller {
    //The user just attempted to close the controller.
    [self dismissViewControllerAnimated:YES completion:nil];
}

//The SBCaptureViewControllerDelegate protocol inherits from SBReviewControllerDelegate
//hence the different name "reviewController:..."
- (void)reviewController:(SBReviewController*)controller acceptedAsset:(SBAsset*)asset {

    //The user just accepted the SBAsset, do something with it!

    //This is also a good time to dismiss the SBCameraViewController you launched earlier.
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end
```

## Trying the Example Project
To try our example project, run the following via command line:
```ruby
pod try 'CocoaBloc-Camera'
```

## License

CocoaBloc-Camera is available under the MIT license. See the LICENSE file for more info.


text:
namespace {

// Backoff policy for testing registration request.
const net::BackoffEntry::Policy kDefaultBackoffPolicy = {
  // Number of initial errors (in sequence) to ignore before applying
  // exponential back-off rules.
  0,

  // Initial delay for exponential back-off in ms.
  15000,  // 15 seconds.

  // Factor by which the waiting time will be multiplied.
  2,

  // Fuzzing percentage. ex: 10% will spread requests randomly
  // between 90%-100% of the calculated time.
  0.5,  // 50%.

  // Maximum amount of time we are willing to delay our request in ms.
  1000 * 60 * 5, // 5 minutes.

  // Time to keep an entry from being discarded even when it
  // has no significant state, -1 to never discard.
  -1,

  // Don't use initial delay unless the last request was an error.
  false,
};

const network::TestURLLoaderFactory::PendingRequest* PendingForURL(
    network::TestURLLoaderFactory* factory,
    const std::string& url) {
  GURL gurl(url);
  std::vector<network::TestURLLoaderFactory::PendingRequest>* pending =
      factory->pending_requests();
  for (const auto& pending_request : *pending) {
    if (pending_request.request.url == gurl)
      return &pending_request;
  }
  return nullptr;
}

}  // namespace

namespace gcm {

GCMRequestTestBase::GCMRequestTestBase()
    : shared_factory_(
          base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>(
              &test_url_loader_factory_)),
      retry_count_(0) {}

GCMRequestTestBase::~GCMRequestTestBase() {
}

const net::BackoffEntry::Policy& GCMRequestTestBase::GetBackoffPolicy() const {
  return kDefaultBackoffPolicy;
}

void GCMRequestTestBase::OnAboutToCompleteFetch() {}

void GCMRequestTestBase::SetResponseForURLAndComplete(
    const std::string& url,
    net::HttpStatusCode status_code,
    const std::string& response_body,
    int net_error_code) {
  if (retry_count_++)
    FastForwardToTriggerNextRetry();

  OnAboutToCompleteFetch();
  EXPECT_TRUE(test_url_loader_factory_.SimulateResponseForPendingRequest(
      GURL(url), network::URLLoaderCompletionStatus(net_error_code),
      network::CreateURLResponseHead(status_code), response_body));
}

const net::HttpRequestHeaders* GCMRequestTestBase::GetExtraHeadersForURL(
    const std::string& url) {
  const network::TestURLLoaderFactory::PendingRequest* pending_request =
      PendingForURL(&test_url_loader_factory_, url);
  return pending_request ? &pending_request->request.headers : nullptr;
}

bool GCMRequestTestBase::GetUploadDataForURL(const std::string& url,
                                             std::string* data_out) {
  const network::TestURLLoaderFactory::PendingRequest* pending_request =
      PendingForURL(&test_url_loader_factory_, url);
  if (!pending_request)
    return false;
  *data_out = network::GetUploadData(pending_request->request);
  return true;
}

void GCMRequestTestBase::VerifyFetcherUploadDataForURL(
    const std::string& url,
    std::map<std::string, std::string>* expected_pairs) {
  std::string upload_data;
  ASSERT_TRUE(GetUploadDataForURL(url, &upload_data));

  // Verify data was formatted properly.
  base::StringTokenizer data_tokenizer(upload_data, "&=");
  while (data_tokenizer.GetNext()) {
    auto iter = expected_pairs->find(data_tokenizer.token());
    ASSERT_TRUE(iter != expected_pairs->end()) << data_tokenizer.token();
    ASSERT_TRUE(data_tokenizer.GetNext()) << data_tokenizer.token();
    ASSERT_EQ(iter->second, data_tokenizer.token());
    // Ensure that none of the keys appears twice.
    expected_pairs->erase(iter);
  }

  ASSERT_EQ(0UL, expected_pairs->size());
}

void GCMRequestTestBase::FastForwardToTriggerNextRetry() {
  // Here we compute the maximum delay time by skipping the jitter fluctuation
  // that only affects in the negative way.
  int next_retry_delay_ms = kDefaultBackoffPolicy.initial_delay_ms;
  next_retry_delay_ms *=
      pow(kDefaultBackoffPolicy.multiply_factor, retry_count_);
  task_environment_.FastForwardBy(
      base::TimeDelta::FromMilliseconds(next_retry_delay_ms));
}

}  // namespace gcm


text:
package org.cleandroid.core.validation;

import java.lang.annotation.Annotation;

public interface CleandroidValidator {

	public boolean isValid(Object value, Annotation constraint);
	public String getErrorMessage();

}


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    android:id="@+id/layout_content"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/refresh"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="@+id/layout_content"
        app:layout_constraintStart_toStartOf="@+id/layout_content"
        app:layout_constraintTop_toTopOf="@+id/layout_content"
        tools:layout_constraintEnd_creator="0"
        tools:layout_constraintStart_creator="0"
        tools:layout_editor_absoluteX="0dp">

        <com.fastaccess.cheaphlight.ui.widgets.recyclerview.DynamicRecyclerView
            android:id="@+id/recycler"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="@dimen/spacing_large"
            app:layoutManager="@string/staggered_layout_manager"
            app:layout_constraintLeft_toLeftOf="@+id/refresh"
            app:spanCount="2"
            tools:listitem="@layout/county_row_item"/>

    </android.support.v4.widget.SwipeRefreshLayout>

    <include
        layout="@layout/empty_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="@+id/layout_content"
        app:layout_constraintStart_toStartOf="@+id/layout_content"
        app:layout_constraintTop_toTopOf="@+id/layout_content"
        tools:layout_constraintBottom_creator="0"
        tools:layout_constraintEnd_creator="0"
        tools:layout_constraintStart_creator="0"
        tools:layout_constraintTop_creator="0"/>

    <include
        layout="@layout/progress_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:paddingBottom="?attr/actionBarSize"
        app:layout_constraintBottom_toBottomOf="@+id/layout_content"
        app:layout_constraintEnd_toEndOf="@+id/layout_content"
        app:layout_constraintStart_toStartOf="@+id/layout_content"
        app:layout_constraintTop_toTopOf="@+id/layout_content"
        tools:layout_constraintBottom_creator="0"
        tools:layout_constraintEnd_creator="0"
        tools:layout_constraintStart_creator="0"
        tools:layout_constraintTop_creator="0"
        tools:layout_editor_absoluteX="205dp"
        tools:layout_editor_absoluteY="382dp"/>
</android.support.constraint.ConstraintLayout>


text:
cask 'little-flocker' do
  version '1.4.6'
  sha256 'df3b30bb7c157ace96489f62b2b22aaf9a2a786694e02e0ebf5b20d93a465f64'

  url "https://www.littleflocker.com/downloads/LittleFlocker-#{version}.dmg"
  name 'Little Flocker'
  homepage 'https://www.littleflocker.com/'

  pkg 'Install Little Flocker.pkg'

  uninstall pkgutil: 'com.zdziarski.LittleFlockerDaemon'

  zap       delete: [
                      '~/Library/Caches/com.zdziarski.LittleFlockerUpdater',
                      '~/Library/Cookies/com.zdziarski.LittleFlockerUpdater.binarycookies',
                      '~/Library/Preferences/com.zdziarski.LittleFlockerConfiguration.plist',
                      '~/Library/Preferences/com.zdziarski.LittleFlockerUpdater.plist',
                      '/Users/Shared/Little Flocker',
                      '/Users/Shared/Little Flocker Extras',
                    ]

  caveats do
    reboot
  end
end


text:
describe('W3C IDBObjectStore.get Tests', function () {
    var FDBKeyRange = IDBKeyRange;
    var createdb = support.createdb;

    // idbobjectstore_get
    it('key is a number', function (done) {
        var db,
          record = { key: 3.14159265, property: "data" };

        var open_rq = createdb(done);
        open_rq.onupgradeneeded = function(e) {
            db = e.target.result;
            db.createObjectStore("store", { keyPath: "key" })
              .add(record);
        }

        open_rq.onsuccess = function(e) {
            var rq = db.transaction("store")
                       .objectStore("store")
                       .get(record.key);

            rq.onsuccess = function(e) {
                assert.equal(e.target.result.key, record.key);
                assert.equal(e.target.result.property, record.property);
                done();
            };
        }
    });

    // idbobjectstore_get2
    it('key is a string', function (done) {
        var db,
          record = { key: "this is a key that's a string", property: "data" };

        var open_rq = createdb(done);
        open_rq.onupgradeneeded = function(e) {
            db = e.target.result;
            db.createObjectStore("store", { keyPath: "key" })
              .add(record);
        };

        open_rq.onsuccess = function(e) {
            var rq = db.transaction("store")
                       .objectStore("store")
                       .get(record.key);

            rq.onsuccess = function(e) {
                assert.equal(e.target.result.key, record.key);
                assert.equal(e.target.result.property, record.property);
                done();
            };
        };
    });

    // idbobjectstore_get3
    it('key is a Date', function (done) {
        var db,
          record = { key: new Date(), property: "data" };

        var open_rq = createdb(done);
        open_rq.onupgradeneeded = function(e) {
            db = e.target.result;
            db.createObjectStore("store", { keyPath: "key" })
              .add(record);
        }

        open_rq.onsuccess = function(e) {
            var rq = db.transaction("store")
                       .objectStore("store")
                       .get(record.key);

            rq.onsuccess = function(e) {
                assert.equal(e.target.result.key.valueOf(), record.key.valueOf());
                assert.equal(e.target.result.property, record.property);
                done();
            };
        }
    });

    // idbobjectstore_get4
    it("attempt to retrieve a record that doesn't exist", function (done) {
        var db;

        var open_rq = createdb(done);
        open_rq.onupgradeneeded = function(e) {
            db = e.target.result;
            var rq = db.createObjectStore("store", { keyPath: "key" })
                       .get(1);
            rq.onsuccess = function(e) {
                assert.equal(e.target.results, undefined);
                setTimeout(function() { done(); }, 10);
            };
        };

        open_rq.onsuccess = function() {};
    });

    // idbobjectstore_get5
    it('returns the record with the first key in the range', function (done) {
        var db
        var open_rq = createdb(done)

        open_rq.onupgradeneeded = function(e) {
            db = e.target.result
            var os = db.createObjectStore("store")

            for(var i = 0; i < 10; i++)
                os.add("data" + i, i)
        }

        open_rq.onsuccess = function (e) {
            db.transaction("store")
              .objectStore("store")
              .get( FDBKeyRange.bound(3, 6) )
              .onsuccess = function(e)
            {
                assert.equal(e.target.result, "data3", "get(3-6)");
                done();
            };
        }
    });

    // idbobjectstore_get6
    it('throw TransactionInactiveError on aborted transaction', function (done) {
        var db;

        var open_rq = createdb(done);
        open_rq.onupgradeneeded = function(e) {
            db = e.target.result;
            db.createObjectStore("store", { keyPath: "key" })
        }

        open_rq.onsuccess = function (e) {
            var store = db.transaction("store")
                          .objectStore("store");
            store.transaction.abort();
            support.throws(function () {
                store.get(1);
            }, 'TransactionInactiveError');
            done();
        }
    });

    // idbobjectstore_get7
    it('throw DataError when using invalid key', function (done) {
        var db;

        var open_rq = createdb(done);
        open_rq.onupgradeneeded = function(e) {
            db = e.target.result;
            db.createObjectStore("store", { keyPath: "key" })
        }

        open_rq.onsuccess = function(e) {
            var store = db.transaction("store")
                          .objectStore("store")
            support.throws(function () {
                store.get(null)
            }, 'DataError');
            done();
        }
    });
});


text:
package org.ovirt.engine.core.common.utils;

import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

import org.junit.Assert;
import org.junit.Test;

public class ListUtilsTest {
    @Test
    public void filter() {
        Assert.assertNull("null list must result in null", ListUtils.filter(null, null));
        Assert.assertNull("null list must result in null, even if the filter is not null", ListUtils.filter(null, null));
        Assert.assertTrue("empty list must be an empty list", ListUtils.filter(new ArrayList<String>(), null).isEmpty());
        Assert.assertTrue("empty list must be an empty list",
                ListUtils.filter(new ArrayList<String>(), new ListUtils.Filter<String>() {

                    @Override
                    public List<String> filter(List<String> data) {
                        return data;
                    }
                }).isEmpty());

        List<String> testList = new ArrayList<String>();
        testList.add("bla");
        testList.add("bli");
        testList.add("blu");
        testList.add("blo");
        testList.add("foo");
        testList.add("bar");
        List<String> filtered =
                ListUtils.filter(testList, new ListUtils.PredicateFilter<String>(new ListUtils.Predicate<String>() {
                    @Override
                    public boolean evaluate(String obj) {
                        return obj.endsWith("a");
                    }
                }));

        Assert.assertEquals("only one element should match the criteria", 1, filtered.size());
        Assert.assertEquals("and it should be 'bla'", "bla", filtered.get(0));
    }

    @Test
    public void nullSafeAdd() {
        ListUtils.nullSafeAdd(null, "foo");
        ListUtils.nullSafeAdd(null, new Object());
        ListUtils.nullSafeAdd(null, 1L);

        final ArrayList<String> list = new ArrayList<String>();
        ListUtils.nullSafeAdd(list, "foo");
        Assert.assertEquals(1, list.size());
        Assert.assertTrue(list.contains("foo"));
    }

    @Test
    public void testListsEqual() {
        List<String> lst1 = Arrays.asList("a", "b", "c");

        Assert.assertFalse(ListUtils.listsEqual(lst1, Arrays.asList("a")));
        Assert.assertFalse(ListUtils.listsEqual(lst1, Arrays.asList("d", "e", "f")));
        Assert.assertFalse(ListUtils.listsEqual(lst1, Arrays.asList("b", "c", "d")));
        Assert.assertTrue(ListUtils.listsEqual(lst1, Arrays.asList("c", "b", "a")));
    }

    @Test
    public void testGetAddedElements() {
        List<String> list1 = new ArrayList<String>();
        List<String> list2 = new ArrayList<String>();

        list1.add("string1");
        list2.add("string1");

        assertTrue(ListUtils.getAddedElements(list1, list2).isEmpty());

        list2.add("string2");
        list2.add("string3");
        list1.add("string4");

        Collection<String> addedElements = ListUtils.getAddedElements(list1, list2);
        assertTrue(addedElements.size() == 2);
        assertTrue(addedElements.contains("string2"));
        assertTrue(addedElements.contains("string3"));

        addedElements = ListUtils.getAddedElements(list2, list1);
        assertTrue(addedElements.size() == 1);
        assertTrue(addedElements.contains("string4"));
    }

    @Test
    public void testFirstMatch() {
        List<String> source = Arrays.asList("zero", "one", "two ", "three");

        Assert.assertEquals("one", ListUtils.firstMatch(source, "one", "two"));
        Assert.assertEquals("one", ListUtils.firstMatch(source, "two", "one"));
        Assert.assertEquals(null, ListUtils.firstMatch(source, null));
    }
}


text:
from datetime import date, timedelta

from django.contrib import messages
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.views.decorators.http import require_POST, require_http_methods
from django.utils.translation import ugettext as _

from kitsune.access.decorators import login_required
from kitsune.groups.forms import AddUserForm
from kitsune.wiki.models import Locale
from kitsune.wiki.utils import active_contributors

LEADER = 'leader'
REVIEWER = 'reviewer'
EDITOR = 'editor'
ROLE_ATTRS = {
    LEADER: 'leaders',
    REVIEWER: 'reviewers',
    EDITOR: 'editors',
}

def locale_list(request):
    """List the support KB locales."""
    locales = Locale.objects.all()
    return render(request, 'wiki/locale_list.html', {
        'locales': locales})

def locale_details(request, locale_code, leader_form=None, reviewer_form=None,
                   editor_form=None):
    """Show the locale details page."""
    locale = get_object_or_404(Locale, locale=locale_code)
    leaders = locale.leaders.all().select_related('profile')
    reviewers = locale.reviewers.all().select_related('profile')
    editors = locale.editors.all().select_related('profile')
    active = active_contributors(
        from_date=date.today() - timedelta(days=90), locale=locale_code)
    user_can_edit = _user_can_edit(request.user, locale)
    return render(
        request,
        'wiki/locale_details.html',
        {'locale': locale,
         'leaders': leaders,
         'reviewers': reviewers,
         'editors': editors,
         'active': active,
         'user_can_edit': user_can_edit,
         'leader_form': leader_form or AddUserForm(),
         'reviewer_form': reviewer_form or AddUserForm(),
         'editor_form': editor_form or AddUserForm()})

@login_required
@require_POST
def add_to_locale(request, locale_code, role):
    """Add a user to the locale role."""
    locale = get_object_or_404(Locale, locale=locale_code)

    if not _user_can_edit(request.user, locale):
        raise PermissionDenied

    form = AddUserForm(request.POST)
    if form.is_valid():
        for user in form.cleaned_data['users']:
            getattr(locale, ROLE_ATTRS[role]).add(user)
        msg = _('{users} added successfully!').format(
            users=request.POST.get('users'))
        messages.add_message(request, messages.SUCCESS, msg)
        return HttpResponseRedirect(locale.get_absolute_url())

    msg = _('There were errors adding users, see below.')
    messages.add_message(request, messages.ERROR, msg)
    return locale_details(request, locale_code, **{role + '_form': form})

@login_required
@require_http_methods(['GET', 'POST'])
def remove_from_locale(request, locale_code, user_id, role):
    """Remove a user from the locale role."""
    locale = get_object_or_404(Locale, locale=locale_code)
    user = get_object_or_404(User, id=user_id)

    if not _user_can_edit(request.user, locale):
        raise PermissionDenied

    if request.method == 'POST':
        getattr(locale, ROLE_ATTRS[role]).remove(user)
        msg = _('{user} removed from successfully!').format(
            user=user.username)
        messages.add_message(request, messages.SUCCESS, msg)
        return HttpResponseRedirect(locale.get_absolute_url())

    return render(request, 'wiki/confirm_remove_from_locale.html',
                  {'locale': locale, 'leader': user, 'role': role})

def _user_can_edit(user, locale):
    """Can the given user edit the given locale members?"""
    return (user.has_perm('wiki.change_locale') or
            user in locale.leaders.all())


text:
from msrest.serialization import Model

class ArrayWrapper(Model):
    """ArrayWrapper

    :param value:
    :type value: list of str
    """

    _validation = {
        'value': {'required': True},
    }

    _attribute_map = {
        'value': {'key': 'value', 'type': '[str]'},
    }

    def __init__(self, value, **kwargs):
        self.value = value


text:
/**
 * @file
 * @brief System/hardware module for STM32F4 processor
 */

#include <kernel.h>
#include <device.h>
#include <init.h>
#include <soc.h>
#include <arch/cpu.h>
#include <cortex_m/exc.h>

/**
 * @brief This function configures the source of stm32cube time base.
 *        Cube HAL expects a 1ms tick which matches with k_uptime_get_32.
 *        Tick interrupt priority is not used
 * @return HAL status
 */
uint32_t HAL_GetTick(void)
{
	return k_uptime_get_32();
}

/**
 * @brief Perform basic hardware initialization at boot.
 *
 * This needs to be run from the very beginning.
 * So the init priority has to be 0 (zero).
 *
 * @return 0
 */
static int st_stm32f4_init(struct device *arg)
{
	u32_t key;

	ARG_UNUSED(arg);

	key = irq_lock();

	_ClearFaults();

	/* Install default handler that simply resets the CPU
	 * if configured in the kernel, NOP otherwise
	 */
	NMI_INIT();

	irq_unlock(key);

#ifdef CONFIG_CLOCK_CONTROL_STM32_CUBE
	/* Update CMSIS SystemCoreClock variable (HCLK) */
	/* At reset, System core clock is set to 4MHz */
	SystemCoreClock = 4000000;
#else
	/* Update CMSIS SystemCoreClock variable (HCLK) */
	SystemCoreClock = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC;
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */

	return 0;
}

SYS_INIT(st_stm32f4_init, PRE_KERNEL_1, 0);


text:
describe('nclProjectsWelcomePage component: ', function () {
    var $componentController;
    var $rootScope;
    var $q;
    var ngDialog;
    var ctrl;

    beforeEach(function () {
        module('nuclio.app');

        inject(function (_$rootScope_, _$componentController_, _$q_, _ngDialog_) {
            $rootScope = _$rootScope_;
            $componentController = _$componentController_;
            $q = _$q_;
            ngDialog = _ngDialog_;

            var element = angular.element('<ncl-projects-welcome-page></ncl-projects-welcome-page>');
            var ImportService = {
                importService: null
            };

            ctrl = $componentController('nclProjectsWelcomePage', {$element: element, ImportService: ImportService});
        });
    });

    afterEach(function () {
        $componentController = null;
        $rootScope = null;
        $q = null;
        ngDialog = null;
        ctrl = null;
    });

    describe('$onDestroy(): ', function () {
        it('should close opened ngDialog', function () {
            spyOn(ngDialog, 'close');

            ctrl.$onDestroy();

            expect(ngDialog.close).toHaveBeenCalled();
        });
    });

    describe('openNewProjectDialog(): ', function () {

        // todo
        it('should open ngDialog', function () {
            spyOn(ngDialog, 'open').and.callThrough();

            ctrl.openNewProjectDialog();

            expect(ngDialog.open).toHaveBeenCalled();
        });
    });
});


text:
<?php

namespace CmsAddress\View\Helper;

use Zend\View\Helper\AbstractHelper,
    CmsAddress\Mapping\AddressInterface,
    CmsAddress\Mapping\IndividualAddressInterface,
    CmsAddress\Mapping\LegalAddressInterface;

/**
 * View helper for rendering address
 */
class Address extends AbstractHelper
{
    /**
     * @var AddressInterface
     */
    protected $entity;

    /**
     * @var string
     */
    protected $locale;

    /**
     * @var string
     */
    protected $template;

    /**
     * @param AddressInterface $addressEntity
     * @param string $locale
     * @param string $template
     * @return self|string
     */
    public function __invoke(AddressInterface $address = null, $locale = null, $template = null)
    {
        if (func_num_args() === 0) {
            return $this;
        }

        if (null !== $address) {
            if (null !== $locale) {
                $this->setLocale($locale);
            }

            if (null !== $template) {
            	$this->setTemplate($template);
            }

            return $this->render($address);
        }
    }

    /**
     * Render address
     *
     * @param AddressInterface $address
     * @return string
     */
    public function render(AddressInterface $address)
    {
        $this->setEntity($address);
        return $this->format();
    }

    /**
     * @param AddressInterface $address
     * @return self
     */
    public function setEntity(AddressInterface $address)
    {
    	$this->entity = $address;
    	return $this;
    }

    /**
     * @return AddressInterface
     */
    public function getEntity()
    {
    	return $this->entity;
    }

    /**
     * @param string $locale
     * @return self
     */
    public function setLocale($locale)
    {
        $this->locale = $locale;
        return $this;
    }

    /**
     * @return string
     */
    public function getLocale()
    {
        if (null === $this->locale) {
            $this->setLocale(\Locale::getDefault());
        }

        return $this->locale;
    }

    /**
     * @param string $template
     * @return self
     */
    public function setTemplate($template)
    {
        $this->template = $template;
        return $this;
    }

    /**
     * @return string
     */
    public function getTemplate()
    {
        return $this->template;
    }

    /**
     * @return string
     */
    protected function format()
    {
        $address = [];

        $entity = $this->getEntity();
        $locality = $entity->getLocality();

        $country = $locality->getCountry();
        $address[] = $country->getVariant() ?: $country->getName();
        $address[] = $entity->getPostCode();
        $address[] = $locality->getName();
        $address[] = $entity->getStreet();

        $houseNumber = $entity->getHouseNumber();
        if ($houseNumber) {
            $address[] = "д. $houseNumber";
        }

        $housing = $entity->getHousing();
        if ($housing) {
            if (is_numeric($housing)) {
                $address[] = "корп. $housing";
            } else {
                $address[count($address) - 1] .= $housing;
            }
        }

        if ($entity instanceof LegalAddressInterface) {
            if ($officeNumer = $entity->getOfficeNumber()) {
                $address[] = "оф. $officeNumer";
            }
        } elseif ($entity instanceof IndividualAddressInterface) {
            if ($apartmentNumer = $entity->getApartmentNumber()) {
            	$address[] = "кв. $apartmentNumer";
            }
        }

        return implode(', ', $address);
    }
}


text:
def default_serializer_options
  {root: false}
end

def json_for(target, options = {})
  options = default_serializer_options.merge(options)
  options[:scope] ||= self
  target.active_model_serializer.new(target, options).to_json
end


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

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <link rel="stylesheet" href="docgen-resources/docgen.css" type="text/css">
  <meta name="generator" content="FreeMarker Docgen (DocBook 5)">
  <title>
    FreeMarker Manual - Export Control
  </title>

        You are here:
          FreeMarker Manual
            >
          Appendixes
            >
          Legal
            >
          Export Control

Bookmarks:
Alpha. index, Expressions, ?builtins, #directives, .spec_vars, FAQ, Glossary, API, Home

Next page: Glossary

Previous page

Parent page

Contents

Export Control

The FreeMarker source code doesn't include cryptography.
        Furthermore it's binary (downloadable) forms don't include any
        cryptography software. Hence, FreeMarker has no Export Control
        Classification Number (ECCN). Where an ECCN should be filled, the
        label "not subject to EAR" could be used.

FreeMarker itself doesn't add any exporting limitations.

Next page: Glossary

Previous page

Parent page

Contents

        You are here:
          FreeMarker Manual
            >
          Appendixes
            >
          Legal
            >
          Export Control

            FreeMarker Manual -- For FreeMarker 2.3.21

          HTML generated: 2014-10-12 18:53:30 GMT