text:
var	http = require('http');
var dispatcher = require('./dispatcher');
var	WebSocketServer = require('ws').Server;

dispatcher.setStatic('/static');
var adminWS = [ ];

var notify = function(req, res) {
	for(c in adminWS) {
		if(typeof adminWS[c].send === "function") {
			adminWS[c].send(JSON.stringify({
				id: req.connection.remoteAddress,
				userAgent: req.headers['user-agent'],
				time: (new Date()).getTime()
			}));
		}
	}
}

dispatcher.onGet("/homepage", function(req, res) {
    res.end("<h1>Homepage</h1");
    notify(req, res);
});

var server = http.createServer(function (req, res) {
    dispatcher.dispatch(req, res);
});
server.listen(1337, '127.0.0.1');

var wss = new WebSocketServer({server:server});
wss.on('connection', function(ws) {
    adminWS.push(ws);
});

redpajama_set_name: RedPajamaGithub


text:
QUnit.test('options#minContainerHeight', function (assert) {
  var done = assert.async();
  var util = window.Util;
  var image = util.createImage();
  var minContainerHeight = 361;

  assert.expect(1);

  return new Cropper(image, {
    minContainerHeight: minContainerHeight,

    ready: function () {
      var cropper = this.cropper;
      var containerData = cropper.getContainerData();

      assert.strictEqual(Math.round(containerData.height), minContainerHeight);

      done();
    }
  });
});


text:
NSString *const kCommonUploadBaseResult = @"result";
NSString *const kCommonUploadBaseImages = @"images";

@interface CommonUploadBase ()

- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;

@end

@implementation CommonUploadBase

@synthesize result = _result;
@synthesize images = _images;

+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
    return [[self alloc] initWithDictionary:dict];
}

- (instancetype)initWithDictionary:(NSDictionary *)dict
{
    self = [super init];

    // This check serves to make sure that a non-NSDictionary object
    // passed into the model class doesn't break the parsing.
    if(self && [dict isKindOfClass:[NSDictionary class]]) {
            self.result = [[self objectOrNilForKey:kCommonUploadBaseResult fromDictionary:dict] boolValue];
    NSObject *receivedCommonUploadImages = [dict objectForKey:kCommonUploadBaseImages];
    NSMutableArray *parsedCommonUploadImages = [NSMutableArray array];
    if ([receivedCommonUploadImages isKindOfClass:[NSArray class]]) {
        for (NSDictionary *item in (NSArray *)receivedCommonUploadImages) {
            if ([item isKindOfClass:[NSDictionary class]]) {
                [parsedCommonUploadImages addObject:[CommonUploadImages modelObjectWithDictionary:item]];
            }
       }
    } else if ([receivedCommonUploadImages isKindOfClass:[NSDictionary class]]) {
       [parsedCommonUploadImages addObject:[CommonUploadImages modelObjectWithDictionary:(NSDictionary *)receivedCommonUploadImages]];
    }

    self.images = [NSArray arrayWithArray:parsedCommonUploadImages];

    }

    return self;

}

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
    [mutableDict setValue:[NSNumber numberWithBool:self.result] forKey:kCommonUploadBaseResult];
    NSMutableArray *tempArrayForImages = [NSMutableArray array];
    for (NSObject *subArrayObject in self.images) {
        if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
            // This class is a model object
            [tempArrayForImages addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
        } else {
            // Generic object
            [tempArrayForImages addObject:subArrayObject];
        }
    }
    [mutableDict setValue:[NSArray arrayWithArray:tempArrayForImages] forKey:kCommonUploadBaseImages];

    return [NSDictionary dictionaryWithDictionary:mutableDict];
}

- (NSString *)description
{
    return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}

#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
    id object = [dict objectForKey:aKey];
    return [object isEqual:[NSNull null]] ? nil : object;
}

#pragma mark - NSCoding Methods

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];

    self.result = [aDecoder decodeBoolForKey:kCommonUploadBaseResult];
    self.images = [aDecoder decodeObjectForKey:kCommonUploadBaseImages];
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{

    [aCoder encodeBool:_result forKey:kCommonUploadBaseResult];
    [aCoder encodeObject:_images forKey:kCommonUploadBaseImages];
}

- (id)copyWithZone:(NSZone *)zone
{
    CommonUploadBase *copy = [[CommonUploadBase alloc] init];

    if (copy) {

        copy.result = self.result;
        copy.images = [self.images copyWithZone:zone];
    }

    return copy;
}

@end


text:
package org.hisp.dhis.dxf2.events.enrollment;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;

import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.dxf2.events.event.Note;
import org.hisp.dhis.dxf2.events.trackedentity.Attribute;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author Morten Olav Hansen <mortenoh@gmail.com>
 */
@JacksonXmlRootElement( localName = "enrollment", namespace = DxfNamespaces.DXF_2_0 )
public class Enrollment
{
    private String enrollment;

    private Date created;

    private Date lastUpdated;

    private String trackedEntity;

    private String trackedEntityInstance;

    private String program;

    private EnrollmentStatus status;

    private String orgUnit;

    private String orgUnitName;

    private Date enrollmentDate;

    private Date incidentDate;

    private List<Attribute> attributes = new ArrayList<>();

    private List<Note> notes = new ArrayList<>();

    private Boolean followup;

    private String completedBy;

    private Date completedDate;

    public Enrollment()
    {
    }

    @JsonProperty( required = true )
    @JacksonXmlProperty( isAttribute = true )
    public String getEnrollment()
    {
        return enrollment;
    }

    public void setEnrollment( String enrollment )
    {
        this.enrollment = enrollment;
    }

    @JsonProperty( required = true )
    @JacksonXmlProperty( isAttribute = true )
    public Date getCreated()
    {
        return created;
    }

    public void setCreated( Date created )
    {
        this.created = created;
    }

    @JsonProperty( required = true )
    @JacksonXmlProperty( isAttribute = true )
    public Date getLastUpdated()
    {
        return lastUpdated;
    }

    public void setLastUpdated( Date lastUpdated )
    {
        this.lastUpdated = lastUpdated;
    }

    @JsonProperty( required = true )
    @JacksonXmlProperty( isAttribute = true )
    public String getTrackedEntity()
    {
        return trackedEntity;
    }

    public void setTrackedEntity( String trackedEntity )
    {
        this.trackedEntity = trackedEntity;
    }

    @JsonProperty( required = true )
    @JacksonXmlProperty( isAttribute = true )
    public String getTrackedEntityInstance()
    {
        return trackedEntityInstance;
    }

    public void setTrackedEntityInstance( String trackedEntityInstance )
    {
        this.trackedEntityInstance = trackedEntityInstance;
    }

    @JsonProperty( required = true )
    @JacksonXmlProperty( isAttribute = true )
    public String getProgram()
    {
        return program;
    }

    public void setProgram( String program )
    {
        this.program = program;
    }

    @JsonProperty( required = true )
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public EnrollmentStatus getStatus()
    {
        return status;
    }

    public void setStatus( EnrollmentStatus status )
    {
        this.status = status;
    }

    @JsonProperty
    @JacksonXmlProperty( isAttribute = true )
    public String getOrgUnit()
    {
        return orgUnit;
    }

    public void setOrgUnit( String orgUnit )
    {
        this.orgUnit = orgUnit;
    }

    @JsonProperty
    @JacksonXmlProperty( isAttribute = true )
    public String getOrgUnitName()
    {
        return orgUnitName;
    }

    public void setOrgUnitName( String orgUnitName )
    {
        this.orgUnitName = orgUnitName;
    }

    @JsonProperty( required = true )
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public Date getEnrollmentDate()
    {
        return enrollmentDate;
    }

    public void setEnrollmentDate( Date enrollmentDate )
    {
        this.enrollmentDate = enrollmentDate;
    }

    @JsonProperty( required = true )
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public Date getIncidentDate()
    {
        return incidentDate;
    }

    public void setIncidentDate( Date incidentDate )
    {
        this.incidentDate = incidentDate;
    }

    @JsonProperty
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public List<Attribute> getAttributes()
    {
        return attributes;
    }

    public void setAttributes( List<Attribute> attributes )
    {
        this.attributes = attributes;
    }

    @JsonProperty
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public List<Note> getNotes()
    {
        return notes;
    }

    public void setNotes( List<Note> notes )
    {
        this.notes = notes;
    }

    @JsonProperty
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public Boolean getFollowup()
    {
        return followup;
    }

    public void setFollowup( Boolean followup )
    {
        this.followup = followup;
    }

    @JsonProperty
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public String getCompletedBy()
    {
        return completedBy;
    }

    public void setCompletedBy( String completedBy )
    {
        this.completedBy = completedBy;
    }

    @JsonProperty
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public Date getCompletedDate()
    {
        return completedDate;
    }

    public void setCompletedDate( Date completedDate )
    {
        this.completedDate = completedDate;
    }

    @Override
    public boolean equals( Object o )
    {
        if ( this == o ) return true;
        if ( o == null || getClass() != o.getClass() ) return false;

        Enrollment that = (Enrollment) o;

        if ( attributes != null ? !attributes.equals( that.attributes ) : that.attributes != null ) return false;
        if ( enrollmentDate != null ? !enrollmentDate.equals( that.enrollmentDate ) : that.enrollmentDate != null ) return false;
        if ( incidentDate != null ? !incidentDate.equals( that.incidentDate ) : that.incidentDate != null ) return false;
        if ( enrollment != null ? !enrollment.equals( that.enrollment ) : that.enrollment != null ) return false;
        if ( trackedEntityInstance != null ? !trackedEntityInstance.equals( that.trackedEntityInstance ) : that.trackedEntityInstance != null )
            return false;
        if ( program != null ? !program.equals( that.program ) : that.program != null ) return false;
        if ( status != that.status ) return false;
        if ( notes != null ? !notes.equals( that.notes ) : that.notes != null ) return false;
        if ( completedBy != null ? !completedBy.equals( that.completedBy ) : that.completedBy != null ) return false;
        if ( completedDate != null ? !completedDate.equals( that.completedDate ) : that.completedDate != null ) return false;

        return true;
    }

    @Override
    public int hashCode()
    {
        int result = enrollment != null ? enrollment.hashCode() : 0;
        result = 31 * result + (trackedEntityInstance != null ? trackedEntityInstance.hashCode() : 0);
        result = 31 * result + (program != null ? program.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (enrollmentDate != null ? enrollmentDate.hashCode() : 0);
        result = 31 * result + (incidentDate != null ? incidentDate.hashCode() : 0);
        result = 31 * result + (attributes != null ? attributes.hashCode() : 0);
        result = 31 * result + (notes != null ? notes.hashCode() : 0);
        result = 31 * result + (completedBy != null ? completedBy.hashCode() : 0);
        result = 31 * result + (completedDate != null ? completedDate.hashCode() : 0);
        return result;
    }

    @Override
    public String toString()
    {
        return "Enrollment{" +
            "enrollment='" + enrollment + '\'' +
            ", trackedEntityInstance='" + trackedEntityInstance + '\'' +
            ", program='" + program + '\'' +
            ", status=" + status +
            ", dateOfEnrollment=" + enrollmentDate +
            ", incidentDate=" + incidentDate +
            ", attributes=" + attributes +
            ", notes=" + notes +
            ", completedBy=" + completedBy +
            ", completedDate=" + completedDate +
            '}';
    }
}


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

#include "chrome/browser/media_galleries/chromeos/mtp_device_task_helper.h"

#include <algorithm>
#include <limits>
#include <memory>
#include <utility>

#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/check_op.h"
#include "base/ranges/algorithm.h"
#include "chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator.h"
#include "chrome/browser/media_galleries/chromeos/mtp_read_file_worker.h"
#include "chrome/browser/media_galleries/chromeos/snapshot_file_details.h"
#include "components/storage_monitor/storage_monitor.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/io_buffer.h"
#include "services/device/public/mojom/mtp_manager.mojom.h"
#include "storage/browser/file_system/async_file_util.h"
#include "storage/common/file_system/file_system_util.h"
#include "third_party/cros_system_api/dbus/service_constants.h"

using storage_monitor::StorageMonitor;

namespace {

// Splits |file_ids| into |file_ids_to_read_now| and |file_ids_to_read_later|.
// This is used to prevent GetFileInfo() from being called with too many entries
// at once.
void SplitFileIds(const std::vector<uint32_t>& file_ids,
                  std::vector<uint32_t>* file_ids_to_read_now,
                  std::vector<uint32_t>* file_ids_to_read_later) {
  DCHECK(file_ids_to_read_now);
  DCHECK(file_ids_to_read_now->empty());
  DCHECK(file_ids_to_read_later);
  DCHECK(file_ids_to_read_later->empty());

  // When reading directory entries, this is the number of entries for
  // GetFileInfo() to read in one operation. If set too low, efficiency goes
  // down slightly due to the overhead of D-Bus calls. If set too high, then
  // slow devices may trigger a D-Bus timeout.
  // The value below is a good initial estimate.
  static constexpr size_t kFileInfoToFetchChunkSize = 25;

  size_t chunk_size = kFileInfoToFetchChunkSize;
  if (file_ids.size() <= chunk_size) {
    *file_ids_to_read_now = file_ids;
  } else {
    std::copy_n(file_ids.begin(), chunk_size,
                std::back_inserter(*file_ids_to_read_now));
    std::copy(file_ids.begin() + chunk_size, file_ids.end(),
              std::back_inserter(*file_ids_to_read_later));
  }
}

device::mojom::MtpManager* GetMediaTransferProtocolManager() {
  return StorageMonitor::GetInstance()->media_transfer_protocol_manager();
}

base::File::Info FileInfoFromMTPFileEntry(
    device::mojom::MtpFileEntryPtr file_entry) {
  base::File::Info file_entry_info;
  file_entry_info.size = file_entry->file_size;
  file_entry_info.is_directory =
      file_entry->file_type ==
      device::mojom::MtpFileEntry::FileType::FILE_TYPE_FOLDER;
  file_entry_info.is_symbolic_link = false;
  file_entry_info.last_modified =
      base::Time::FromTimeT(file_entry->modification_time);
  file_entry_info.last_accessed = file_entry_info.last_modified;
  file_entry_info.creation_time = base::Time();
  return file_entry_info;
}

}  // namespace

MTPDeviceTaskHelper::MTPDeviceTaskHelper() {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
}

MTPDeviceTaskHelper::~MTPDeviceTaskHelper() {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
}

void MTPDeviceTaskHelper::OpenStorage(const std::string& storage_name,
                                      const bool read_only,
                                      OpenStorageCallback callback) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  DCHECK(!storage_name.empty());
  if (!device_handle_.empty()) {
    content::GetIOThreadTaskRunner({})->PostTask(
        FROM_HERE, base::BindOnce(std::move(callback), true));
    return;
  }

  const std::string mode =
      read_only ? mtpd::kReadOnlyMode : mtpd::kReadWriteMode;
  GetMediaTransferProtocolManager()->OpenStorage(
      storage_name, mode,
      base::BindOnce(&MTPDeviceTaskHelper::OnDidOpenStorage,
                     weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
}

void MTPDeviceTaskHelper::GetFileInfo(
    uint32_t file_id,
    GetFileInfoSuccessCallback success_callback,
    ErrorCallback error_callback) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (device_handle_.empty())
    return HandleDeviceError(std::move(error_callback),
                             base::File::FILE_ERROR_FAILED);

  const std::vector<uint32_t> file_ids = {file_id};
  GetMediaTransferProtocolManager()->GetFileInfo(
      device_handle_, file_ids,
      base::BindOnce(&MTPDeviceTaskHelper::OnGetFileInfo,
                     weak_ptr_factory_.GetWeakPtr(),
                     std::move(success_callback), std::move(error_callback)));
}

void MTPDeviceTaskHelper::CreateDirectory(
    const uint32_t parent_id,
    const std::string& directory_name,
    CreateDirectorySuccessCallback success_callback,
    ErrorCallback error_callback) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (device_handle_.empty())
    return HandleDeviceError(std::move(error_callback),
                             base::File::FILE_ERROR_FAILED);

  GetMediaTransferProtocolManager()->CreateDirectory(
      device_handle_, parent_id, directory_name,
      base::BindOnce(&MTPDeviceTaskHelper::OnCreateDirectory,
                     weak_ptr_factory_.GetWeakPtr(),
                     std::move(success_callback), std::move(error_callback)));
}

void MTPDeviceTaskHelper::ReadDirectory(
    const uint32_t directory_id,
    ReadDirectorySuccessCallback success_callback,
    ErrorCallback error_callback) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (device_handle_.empty())
    return HandleDeviceError(std::move(error_callback),
                             base::File::FILE_ERROR_FAILED);

  GetMediaTransferProtocolManager()->ReadDirectoryEntryIds(
      device_handle_, directory_id,
      base::BindOnce(
          &MTPDeviceTaskHelper::OnReadDirectoryEntryIdsToReadDirectory,
          weak_ptr_factory_.GetWeakPtr(), success_callback,
          std::move(error_callback)));
}

void MTPDeviceTaskHelper::CheckDirectoryEmpty(
    uint32_t directory_id,
    CheckDirectoryEmptySuccessCallback success_callback,
    ErrorCallback error_callback) {
  if (device_handle_.empty())
    return HandleDeviceError(std::move(error_callback),
                             base::File::FILE_ERROR_FAILED);

  GetMediaTransferProtocolManager()->ReadDirectoryEntryIds(
      device_handle_, directory_id,
      base::BindOnce(&MTPDeviceTaskHelper::OnCheckedDirectoryEmpty,
                     weak_ptr_factory_.GetWeakPtr(),
                     std::move(success_callback), std::move(error_callback)));
}

void MTPDeviceTaskHelper::WriteDataIntoSnapshotFile(
    SnapshotRequestInfo request_info,
    const base::File::Info& snapshot_file_info) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (device_handle_.empty()) {
    return HandleDeviceError(std::move(request_info.error_callback),
                             base::File::FILE_ERROR_FAILED);
  }

  if (!read_file_worker_)
    read_file_worker_ = std::make_unique<MTPReadFileWorker>(device_handle_);
  read_file_worker_->WriteDataIntoSnapshotFile(std::move(request_info),
                                               snapshot_file_info);
}

void MTPDeviceTaskHelper::ReadBytes(
    MTPDeviceAsyncDelegate::ReadBytesRequest request) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (device_handle_.empty()) {
    return HandleDeviceError(std::move(request.error_callback),
                             base::File::FILE_ERROR_FAILED);
  }

  const std::vector<uint32_t> file_ids = {request.file_id};
  GetMediaTransferProtocolManager()->GetFileInfo(
      device_handle_, file_ids,
      base::BindOnce(&MTPDeviceTaskHelper::OnGetFileInfoToReadBytes,
                     weak_ptr_factory_.GetWeakPtr(), std::move(request)));
}

void MTPDeviceTaskHelper::RenameObject(
    const uint32_t object_id,
    const std::string& new_name,
    RenameObjectSuccessCallback success_callback,
    ErrorCallback error_callback) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

  GetMediaTransferProtocolManager()->RenameObject(
      device_handle_, object_id, new_name,
      base::BindOnce(&MTPDeviceTaskHelper::OnRenameObject,
                     weak_ptr_factory_.GetWeakPtr(),
                     std::move(success_callback), std::move(error_callback)));
}

MTPDeviceTaskHelper::MTPEntry::MTPEntry() : file_id(0) {}

// TODO(yawano) storage_name is not used, delete it.
void MTPDeviceTaskHelper::CopyFileFromLocal(
    const std::string& storage_name,
    const int source_file_descriptor,
    const uint32_t parent_id,
    const std::string& file_name,
    CopyFileFromLocalSuccessCallback success_callback,
    ErrorCallback error_callback) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

  GetMediaTransferProtocolManager()->CopyFileFromLocal(
      device_handle_, source_file_descriptor, parent_id, file_name,
      base::BindOnce(&MTPDeviceTaskHelper::OnCopyFileFromLocal,
                     weak_ptr_factory_.GetWeakPtr(),
                     std::move(success_callback), std::move(error_callback)));
}

void MTPDeviceTaskHelper::DeleteObject(
    const uint32_t object_id,
    DeleteObjectSuccessCallback success_callback,
    ErrorCallback error_callback) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

  GetMediaTransferProtocolManager()->DeleteObject(
      device_handle_, object_id,
      base::BindOnce(&MTPDeviceTaskHelper::OnDeleteObject,
                     weak_ptr_factory_.GetWeakPtr(),
                     std::move(success_callback), std::move(error_callback)));
}

void MTPDeviceTaskHelper::CloseStorage() const {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (device_handle_.empty())
    return;
  GetMediaTransferProtocolManager()->CloseStorage(device_handle_,
                                                  base::DoNothing());
}

void MTPDeviceTaskHelper::OnDidOpenStorage(
    OpenStorageCallback completion_callback,
    const std::string& device_handle,
    bool error) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  device_handle_ = device_handle;
  content::GetIOThreadTaskRunner({})->PostTask(
      FROM_HERE, base::BindOnce(std::move(completion_callback), !error));
}

void MTPDeviceTaskHelper::OnGetFileInfo(
    GetFileInfoSuccessCallback success_callback,
    ErrorCallback error_callback,
    std::vector<device::mojom::MtpFileEntryPtr> entries,
    bool error) const {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (error || entries.size() != 1) {
    return HandleDeviceError(std::move(error_callback),
                             base::File::FILE_ERROR_NOT_FOUND);
  }

  content::GetIOThreadTaskRunner({})->PostTask(
      FROM_HERE,
      base::BindOnce(std::move(success_callback),
                     FileInfoFromMTPFileEntry(std::move(entries[0]))));
}

void MTPDeviceTaskHelper::OnCreateDirectory(
    CreateDirectorySuccessCallback success_callback,
    ErrorCallback error_callback,
    const bool error) const {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (error) {
    content::GetIOThreadTaskRunner({})->PostTask(
        FROM_HERE, base::BindOnce(std::move(error_callback),
                                  base::File::FILE_ERROR_FAILED));
    return;
  }

  content::GetIOThreadTaskRunner({})->PostTask(FROM_HERE,
                                               std::move(success_callback));
}

void MTPDeviceTaskHelper::OnReadDirectoryEntryIdsToReadDirectory(
    ReadDirectorySuccessCallback success_callback,
    ErrorCallback error_callback,
    const std::vector<uint32_t>& file_ids,
    bool error) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

  if (error)
    return HandleDeviceError(std::move(error_callback),
                             base::File::FILE_ERROR_FAILED);

  if (file_ids.empty()) {
    content::GetIOThreadTaskRunner({})->PostTask(
        FROM_HERE,
        base::BindOnce(success_callback, MTPEntries(), /*has_more=*/false));
    return;
  }

  std::vector<uint32_t> file_ids_to_read_now;
  std::vector<uint32_t> file_ids_to_read_later;
  SplitFileIds(file_ids, &file_ids_to_read_now, &file_ids_to_read_later);

  GetMediaTransferProtocolManager()->GetFileInfo(
      device_handle_, file_ids_to_read_now,
      base::BindOnce(&MTPDeviceTaskHelper::OnGotDirectoryEntries,
                     weak_ptr_factory_.GetWeakPtr(),
                     std::move(success_callback), std::move(error_callback),
                     file_ids_to_read_now, file_ids_to_read_later));
}

void MTPDeviceTaskHelper::OnGotDirectoryEntries(
    ReadDirectorySuccessCallback success_callback,
    ErrorCallback error_callback,
    const std::vector<uint32_t>& expected_file_ids,
    const std::vector<uint32_t>& file_ids_to_read,
    std::vector<device::mojom::MtpFileEntryPtr> file_entries,
    bool error) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

  if (error)
    return HandleDeviceError(std::move(error_callback),
                             base::File::FILE_ERROR_FAILED);

  // Use |expected_file_ids| to verify the results are the requested ids.
  std::vector<uint32_t> sorted_expected_file_ids = expected_file_ids;
  std::sort(sorted_expected_file_ids.begin(), sorted_expected_file_ids.end());
  for (const auto& entry : file_entries) {
    std::vector<uint32_t>::const_iterator it =
        std::lower_bound(sorted_expected_file_ids.begin(),
                         sorted_expected_file_ids.end(), entry->item_id);
    if (it == sorted_expected_file_ids.end()) {
      return HandleDeviceError(std::move(error_callback),
                               base::File::FILE_ERROR_FAILED);
    }
  }

  MTPEntries entries;
  base::FilePath current;
  MTPDeviceObjectEnumerator file_enum(std::move(file_entries));
  while (!(current = file_enum.Next()).empty()) {
    MTPEntry entry;
    entry.name = storage::VirtualPath::BaseName(current).value();
    bool ret = file_enum.GetEntryId(&entry.file_id);
    DCHECK(ret);
    entry.file_info.is_directory = file_enum.IsDirectory();
    entry.file_info.size = file_enum.Size();
    entry.file_info.last_modified = file_enum.LastModifiedTime();
    entries.push_back(entry);
  }

  bool has_more = !file_ids_to_read.empty();

  content::GetIOThreadTaskRunner({})->PostTask(
      FROM_HERE, base::BindOnce(success_callback, entries, has_more));

  if (!has_more)
    return;

  std::vector<uint32_t> file_ids_to_read_now;
  std::vector<uint32_t> file_ids_to_read_later;
  SplitFileIds(file_ids_to_read, &file_ids_to_read_now,
               &file_ids_to_read_later);

  GetMediaTransferProtocolManager()->GetFileInfo(
      device_handle_, file_ids_to_read_now,
      base::BindOnce(&MTPDeviceTaskHelper::OnGotDirectoryEntries,
                     weak_ptr_factory_.GetWeakPtr(), success_callback,
                     std::move(error_callback), file_ids_to_read_now,
                     file_ids_to_read_later));
}

void MTPDeviceTaskHelper::OnCheckedDirectoryEmpty(
    CheckDirectoryEmptySuccessCallback success_callback,
    ErrorCallback error_callback,
    const std::vector<uint32_t>& file_ids,
    bool error) const {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (error)
    return HandleDeviceError(std::move(error_callback),
                             base::File::FILE_ERROR_FAILED);

  content::GetIOThreadTaskRunner({})->PostTask(
      FROM_HERE, base::BindOnce(std::move(success_callback), file_ids.empty()));
}

void MTPDeviceTaskHelper::OnGetFileInfoToReadBytes(
    MTPDeviceAsyncDelegate::ReadBytesRequest request,
    std::vector<device::mojom::MtpFileEntryPtr> entries,
    bool error) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  DCHECK(request.buf.get());
  DCHECK_GE(request.buf_len, 0);
  DCHECK_GE(request.offset, 0);
  if (error || entries.size() != 1) {
    return HandleDeviceError(std::move(request.error_callback),
                             base::File::FILE_ERROR_FAILED);
  }

  base::File::Info file_info = FileInfoFromMTPFileEntry(std::move(entries[0]));
  if (file_info.is_directory) {
    return HandleDeviceError(std::move(request.error_callback),
                             base::File::FILE_ERROR_NOT_A_FILE);
  }
  if (file_info.size < 0 ||
      file_info.size > std::numeric_limits<uint32_t>::max() ||
      request.offset > file_info.size) {
    return HandleDeviceError(std::move(request.error_callback),
                             base::File::FILE_ERROR_FAILED);
  }
  if (request.offset == file_info.size) {
    content::GetIOThreadTaskRunner({})->PostTask(
        FROM_HERE,
        base::BindOnce(std::move(request.success_callback), file_info, 0u));
    return;
  }

  uint32_t bytes_to_read =
      std::min(base::checked_cast<uint32_t>(request.buf_len),
               base::saturated_cast<uint32_t>(file_info.size - request.offset));
  auto file_id = request.file_id;
  auto offset = base::checked_cast<uint32_t>(request.offset);
  GetMediaTransferProtocolManager()->ReadFileChunk(
      device_handle_, file_id, offset, bytes_to_read,
      base::BindOnce(&MTPDeviceTaskHelper::OnDidReadBytes,
                     weak_ptr_factory_.GetWeakPtr(), std::move(request),
                     file_info));
}

void MTPDeviceTaskHelper::OnDidReadBytes(
    MTPDeviceAsyncDelegate::ReadBytesRequest request,
    const base::File::Info& file_info,
    const std::string& data,
    bool error) const {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (error) {
    return HandleDeviceError(std::move(request.error_callback),
                             base::File::FILE_ERROR_FAILED);
  }

  CHECK_LE(base::checked_cast<int>(data.length()), request.buf_len);
  base::ranges::copy(data, request.buf->data());

  content::GetIOThreadTaskRunner({})->PostTask(
      FROM_HERE, base::BindOnce(std::move(request.success_callback), file_info,
                                data.length()));
}

void MTPDeviceTaskHelper::OnRenameObject(
    RenameObjectSuccessCallback success_callback,
    ErrorCallback error_callback,
    const bool error) const {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (error) {
    content::GetIOThreadTaskRunner({})->PostTask(
        FROM_HERE, base::BindOnce(std::move(error_callback),
                                  base::File::FILE_ERROR_FAILED));
    return;
  }

  content::GetIOThreadTaskRunner({})->PostTask(FROM_HERE,
                                               std::move(success_callback));
}

void MTPDeviceTaskHelper::OnCopyFileFromLocal(
    CopyFileFromLocalSuccessCallback success_callback,
    ErrorCallback error_callback,
    const bool error) const {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (error) {
    content::GetIOThreadTaskRunner({})->PostTask(
        FROM_HERE, base::BindOnce(std::move(error_callback),
                                  base::File::FILE_ERROR_FAILED));
    return;
  }

  content::GetIOThreadTaskRunner({})->PostTask(FROM_HERE,
                                               std::move(success_callback));
}

void MTPDeviceTaskHelper::OnDeleteObject(
    DeleteObjectSuccessCallback success_callback,
    ErrorCallback error_callback,
    const bool error) const {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  if (error) {
    content::GetIOThreadTaskRunner({})->PostTask(
        FROM_HERE, base::BindOnce(std::move(error_callback),
                                  base::File::FILE_ERROR_FAILED));
    return;
  }

  content::GetIOThreadTaskRunner({})->PostTask(FROM_HERE,
                                               std::move(success_callback));
}

void MTPDeviceTaskHelper::HandleDeviceError(ErrorCallback error_callback,
                                            base::File::Error error) const {
  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  content::GetIOThreadTaskRunner({})->PostTask(
      FROM_HERE, base::BindOnce(std::move(error_callback), error));
}


text:
namespace ExtendedXmlSerializer.Core.Specifications
{
	sealed class DefaultValueSpecification<T> : ISpecification<T>
	{
		public static DefaultValueSpecification<T> Default { get; } = new DefaultValueSpecification<T>();

		DefaultValueSpecification() : this(default) {}

		readonly T _default;

		public DefaultValueSpecification(T @default) => _default = @default;

		public bool IsSatisfiedBy(T parameter) => Equals(_default, parameter);
	}
}


text:
from __future__ import print_function
import sys
import os
import shutil
import inspect
import getopt
from collections import defaultdict

if __name__ == '__main__':

    throot = os.path.abspath(
        os.path.join(sys.path[0], os.pardir, os.pardir))

    options = defaultdict(bool)
    opts, args = getopt.getopt(
        sys.argv[1:],
        'o:f:',
        ['rst', 'help', 'nopdf', 'cache', 'check', 'test'])
    options.update(dict([x, y or True] for x, y in opts))
    if options['--help']:
        print('Usage: %s [OPTIONS] [files...]' % sys.argv[0])
        print('  -o <dir>: output the html files in the specified dir')
        print('  --cache: use the doctree cache')
        print('  --rst: only compile the doc (requires sphinx)')
        print('  --nopdf: do not produce a PDF file from the doc, only HTML')
        print('  --test: run all the code samples in the documentaton')
        print('  --check: treat warnings as errors')
        print('  --help: this help')
        print('If one or more files are specified after the options then only '
              'those files will be built. Otherwise the whole tree is '
              'processed. Specifying files will implies --cache.')
        sys.exit(0)

    if not(options['--rst'] or options['--test']):
        # Default is now rst
        options['--rst'] = True

    def mkdir(path):
        try:
            os.mkdir(path)
        except OSError:
            pass

    # create the putput folder docs, since github page will use /docs folder for Github page.
    outdir = options['-o'] or (throot + '/docs')
    # create the output folder latex
    latexdir = options['-o'] or (throot + '/latex')

    files = None
    if len(args) != 0:
        files = [os.path.abspath(f) for f in args]
    currentdir = os.getcwd()
    mkdir(outdir)
    #mkdir(latexdir)
    os.chdir(outdir)

    # add .gitignore file to your github repository
    ignore_path = os.path.join(throot, '.gitignore')
    if not os.path.exists(ignore_path):
        ignore_txt = open(throot + '/doc/scripts/'+'gitignore.txt')
        gitignore = open(ignore_path,'a')
        for x in ignore_txt.readlines():
            gitignore.write(x)
        ignore_txt.close()
        gitignore.close()

    # add .nojekyll file to fix the github pages issues
    nojekyll_path = os.path.join(outdir, '.nojekyll')
    if not os.path.exists(nojekyll_path):
        nojekyll = open(nojekyll_path,'a')
        nojekyll.close()

    # Make sure the appropriate 'theano' directory is in the PYTHONPATH
    pythonpath = os.environ.get('PYTHONPATH', '')
    pythonpath = os.pathsep.join([throot, pythonpath])
    sys.path[0:0] = [throot]  # We must not use os.environ.

    # Make sure we don't use gpu to compile documentation
    env_th_flags = os.environ.get('THEANO_FLAGS', '')
    os.environ['THEANO_FLAGS'] = 'device=cpu,force_device=True'

    def call_sphinx(builder, workdir):
        import sphinx
        if options['--check']:
            extraopts = ['-W']
        else:
            extraopts = []
        if not options['--cache'] and files is None:
            extraopts.append('-E')
        docpath = os.path.join(throot, 'doc')
        inopt = [docpath, workdir]
        if files is not None:
            inopt.extend(files)
        try:
            import sphinx.cmd.build
            ret = sphinx.cmd.build.build_main(
                ['-b', builder] + extraopts + inopt)
        except ImportError:
            # Sphinx < 1.7 - build_main drops first argument
            ret = sphinx.build_main(
                ['', '-b', builder] + extraopts + inopt)
        if ret != 0:
            sys.exit(ret)

    if options['--all'] or options['--rst']:
        mkdir("doc")
        sys.path[0:0] = [os.path.join(throot, 'doc')]
        call_sphinx('html', '.')

        if not options['--nopdf']:
            # Generate latex file in a temp directory
            import tempfile
            workdir = tempfile.mkdtemp()
            #workdir = latexdir
            call_sphinx('latex', workdir)
            # Compile to PDF
            os.chdir(workdir)
            os.system('make')
            try:
                shutil.copy(os.path.join(workdir, 'pyspark.pdf'), outdir)
                os.chdir(outdir)
                # remove the workdir folder
                shutil.rmtree(workdir)
            except OSError as e:
                print('OSError:', e)
            except IOError as e:
                print('IOError:', e)

    if options['--test']:
        mkdir("doc")
        sys.path[0:0] = [os.path.join(throot, 'doc')]
        call_sphinx('doctest', '.')

    # To go back to the original current directory.
    os.chdir(currentdir)

    # Reset THEANO_FLAGS
    #os.environ['THEANO_FLAGS'] = env_th_flags


text:
/**
 * @fileoverview Earth Engine Developer's Guide examples
 *   from 'Reducers - linearFit' section
 */

// [START earthengine__reducers13__linear_fit]
// This function adds a time band to the image.
var createTimeBand = function(image) {
  // Scale milliseconds by a large constant to avoid very small slopes
  // in the linear regression output.
  return image.addBands(image.metadata('system:time_start').divide(1e18));
};

// Load the input image collection: projected climate data.
var collection = ee.ImageCollection('NASA/NEX-DCP30_ENSEMBLE_STATS')
  .filter(ee.Filter.eq('scenario', 'rcp85'))
  .filterDate(ee.Date('2006-01-01'), ee.Date('2050-01-01'))
  // Map the time band function over the collection.
  .map(createTimeBand);

// Reduce the collection with the linear fit reducer.
// Independent variable are followed by dependent variables.
var linearFit = collection.select(['system:time_start', 'pr_mean'])
  .reduce(ee.Reducer.linearFit());

// Display the results.
Map.setCenter(-100.11, 40.38, 5);
Map.addLayer(linearFit,
  {min: 0, max: [-0.9, 8e-5, 1], bands: ['scale', 'offset', 'scale']}, 'fit');
// [END earthengine__reducers13__linear_fit]


text:
package com.facebook.buck.parser.config;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import com.facebook.buck.core.config.BuckConfig;
import com.facebook.buck.core.config.BuckConfigTestUtils;
import com.facebook.buck.core.config.FakeBuckConfig;
import com.facebook.buck.io.filesystem.ProjectFilesystem;
import com.facebook.buck.io.filesystem.impl.FakeProjectFilesystem;
import com.facebook.buck.parser.implicit.ImplicitInclude;
import com.facebook.buck.testutil.TemporaryPaths;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class ParserConfigTest {

  @Rule public TemporaryPaths temporaryFolder = new TemporaryPaths();

  @Rule public ExpectedException thrown = ExpectedException.none();

  @Test
  public void testGetAllowEmptyGlobs() throws IOException {
    assertTrue(getDefaultConfig().getAllowEmptyGlobs());
    ParserConfig config = parseConfig("[build]\nallow_empty_globs = false");
    assertFalse(config.getAllowEmptyGlobs());
  }

  @Test
  public void testGetGlobHandler() throws IOException {
    assertThat(getDefaultConfig().getGlobHandler(), equalTo(ParserConfig.GlobHandler.PYTHON));

    for (ParserConfig.GlobHandler handler : ParserConfig.GlobHandler.values()) {
      ParserConfig config = parseConfig("[project]\nglob_handler = " + handler);
      assertThat(config.getGlobHandler(), equalTo(handler));
    }
  }

  @Test
  public void testGetBuildFileSearchMethod() throws IOException {
    ParserConfig config;

    config = getDefaultConfig();
    assertEquals(
        config.getBuildFileSearchMethod(), ParserConfig.BuildFileSearchMethod.FILESYSTEM_CRAWL);

    config = parseConfig("[project]\nbuild_file_search_method = filesystem_crawl");
    assertEquals(
        config.getBuildFileSearchMethod(), ParserConfig.BuildFileSearchMethod.FILESYSTEM_CRAWL);

    config = parseConfig("[project]\nbuild_file_search_method = watchman");
    assertEquals(config.getBuildFileSearchMethod(), ParserConfig.BuildFileSearchMethod.WATCHMAN);
  }

  @Test
  public void testGetPathsCheckMethod() throws IOException {
    ParserConfig config;

    config = getDefaultConfig();
    assertEquals(config.getPathsCheckMethod(), ParserConfig.PathsCheckMethod.FILESYSTEM);

    config = parseConfig("[project]\npaths_check_method = filesystem");
    assertEquals(config.getPathsCheckMethod(), ParserConfig.PathsCheckMethod.FILESYSTEM);

    config = parseConfig("[project]\npaths_check_method = watchman");
    assertEquals(config.getPathsCheckMethod(), ParserConfig.PathsCheckMethod.WATCHMAN);

    config = parseConfig("[project]\npaths_check_method = none");
    assertEquals(config.getPathsCheckMethod(), ParserConfig.PathsCheckMethod.NONE);
  }

  @Test
  public void testGetPackageBoundaryCheckMethod() throws IOException {
    ParserConfig config;
    config = getDefaultConfig();
    assertEquals(
        config.getPackageBoundaryCheckMethod(), ParserConfig.PackageBoundaryCheckMethod.FILESYSTEM);

    config = parseConfig("[project]\npackage_boundary_check_method = filesystem");
    assertEquals(
        config.getPackageBoundaryCheckMethod(), ParserConfig.PackageBoundaryCheckMethod.FILESYSTEM);

    config = parseConfig("[project]\npackage_boundary_check_method = watchman");
    assertEquals(
        config.getPackageBoundaryCheckMethod(), ParserConfig.PackageBoundaryCheckMethod.WATCHMAN);
  }

  @Test
  public void testGetWatchCells() throws IOException {
    assertTrue("watch_cells defaults to true", getDefaultConfig().getWatchCells());

    ParserConfig config = parseConfig("[project]\nwatch_cells = false");
    assertFalse(config.getWatchCells());

    config = parseConfig("[project]\nwatch_cells = true");
    assertTrue(config.getWatchCells());
  }

  @Test
  public void shouldReturnThreadCountIfParallelParsingIsEnabled() {
    BuckConfig config =
        FakeBuckConfig.builder()
            .setSections("[project]", "parsing_threads = 2", "parallel_parsing = true")
            .build();

    ParserConfig parserConfig = config.getView(ParserConfig.class);

    assertTrue(parserConfig.getEnableParallelParsing());
    assertEquals(2, parserConfig.getNumParsingThreads());
  }

  @Test
  public void shouldReturnOneThreadCountIfParallelParsingIsNotEnabled() {
    BuckConfig config =
        FakeBuckConfig.builder()
            .setSections("[project]", "parsing_threads = 3", "parallel_parsing = false")
            .build();

    ParserConfig parserConfig = config.getView(ParserConfig.class);

    assertFalse(parserConfig.getEnableParallelParsing());
    assertEquals(1, parserConfig.getNumParsingThreads());
  }

  @Test
  public void shouldGetReadOnlyDirs() {
    String existingPath1 = "tmp/tmp-file";
    String existingPath2 = "tmp2/tmp2-file";
    ImmutableSet<Path> readOnlyPaths =
        ImmutableSet.of(Paths.get(existingPath1), Paths.get(existingPath2));
    ProjectFilesystem filesystem = new FakeProjectFilesystem(readOnlyPaths);

    ParserConfig parserConfig =
        FakeBuckConfig.builder()
            .setSections("[project]", "read_only_paths = " + existingPath1 + "," + existingPath2)
            .setFilesystem(filesystem)
            .build()
            .getView(ParserConfig.class);

    assertTrue(parserConfig.getReadOnlyPaths().isPresent());
    assertThat(
        parserConfig.getReadOnlyPaths().get(),
        is(equalTo(ImmutableList.of(Paths.get(existingPath1), Paths.get(existingPath2)))));

    String notExistingDir = "not/existing/path";
    parserConfig =
        FakeBuckConfig.builder()
            .setSections("[project]", "read_only_paths = " + notExistingDir)
            .setFilesystem(filesystem)
            .build()
            .getView(ParserConfig.class);

    assertTrue(parserConfig.getReadOnlyPaths().get().isEmpty());
  }

  @Test
  public void whenParserPythonPathIsNotSetDefaultIsUsed() {
    ParserConfig parserConfig = getDefaultConfig();
    assertEquals(
        "Should return an empty optional",
        "<not set>",
        parserConfig.getPythonModuleSearchPath().orElse("<not set>"));
  }

  @Test
  public void whenParserPythonPathIsSet() {
    ParserConfig parserConfig =
        FakeBuckConfig.builder()
            .setSections(
                ImmutableMap.of("parser", ImmutableMap.of("python_path", "foobar:spamham")))
            .build()
            .getView(ParserConfig.class);
    assertEquals(
        "Should return the configured string",
        "foobar:spamham",
        parserConfig.getPythonModuleSearchPath().orElse("<not set>"));
  }

  @Test
  public void getImplicitIncludes() {
    ImmutableMap<String, ImplicitInclude> actual =
        FakeBuckConfig.builder()
            .setSections(
                ImmutableMap.of(
                    "buildfile",
                    ImmutableMap.of(
                        "package_includes",
                        "=>//:includes.bzl::get_name::get_value,foo/bar=>//foo/bar:includes.bzl::get_name::get_value")))
            .build()
            .getView(ParserConfig.class)
            .getPackageImplicitIncludes();

    ImmutableMap<String, ImplicitInclude> expected =
        ImmutableMap.of(
            "",
            ImplicitInclude.fromConfigurationString("//:includes.bzl::get_name::get_value"),
            "foo/bar",
            ImplicitInclude.fromConfigurationString("//foo/bar:includes.bzl::get_name::get_value"));

    assertEquals(expected, actual);
  }

  private ParserConfig getDefaultConfig() {
    return FakeBuckConfig.empty().getView(ParserConfig.class);
  }

  private ParserConfig parseConfig(String... configStrings) throws IOException {
    String configString = Joiner.on("\n").join(configStrings);
    Reader reader = new StringReader(configString);
    return BuckConfigTestUtils.createWithDefaultFilesystem(temporaryFolder, reader)
        .getView(ParserConfig.class);
  }
}


text:
MiscPortfolioSamples
====================

This is a set of view controllers that were taken from different projects to demonstrate my coding style


text:
fast-archiver file format
~~~~~~~~~~~~~~~~~~~~~~~~~

Header
------

fast-archiver files begin with an eight-byte header; the idea for this header
was liberated from the PNG spec, but "PNG" has been replaced with "FA1".  It's
expected that any radical changes to the file format would change the header
(eg. FA2, FA2...).

Header [8 bytes]: 0x89, 0x46, 0x41, 0x31, 0x0D, 0x0A, 0x1A, 0x0A

Blocks
------

Following that is an unlimited number of blocks.  Every block has this same
header (all values are in network byte-order / big-endian):

    uint16 -- size of file path in bytes

    byte[n] -- UTF-8 encoded file path

    byte -- block type identifier

The last byte is an identifier for the type of block:

    0 = data block

    1 = start file block

    2 = end file block

    3 = directory block

    4 = checksum block

Additional block types may be added in the future to support symlinks, or maybe
additional metadata like ACLs.

Data Block
==========

A data block is part of a file.  Data blocks in the archive will appear
sequentially in the order that the were read from the data file.  The format of
the block is:

    uint16 -- size of block

    byte[n] -- raw data

Start File
==========

This block indicates the beginning of a file.  All the data blocks for a file
will appear between the start file and end file blocks for that file, allowing
the archive extraction to know when to close and open the file.  The format is:

    uint32 -- UID of the file

    uint32 -- GID of the file

    uint32 -- Permission mode of the file

End File
========

This block indicates the end of a file.  There is no data in the block.

Directory
=========

The directory block contains information on a directory.  Directories are
always archived before the files contained in them.  The format of this block
is:

    uint32 -- UID of the directory

    uint32 -- GID of the directory

    uint32 -- Permission mode of the directory

Checksum
========

Checksum blocks appear arbitrarily in the archive format, and contain a CRC64
checksum of all the data in the file so far, including the file header,
including the checksum block type, and including the checksum value of any
previous checksum blocks.  The file path of the checksum block is zero bytes.
The checksum block just contains:

    uint64 -- CRC64 checksum


text:
package com.nesscomputing.config;

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

public class TestConfig
{
    @Test
    public void testEmpty()
    {
        final Config emptyConfig = Config.getEmptyConfig();
        Assert.assertNotNull(emptyConfig);
        Assert.assertFalse(emptyConfig.getConfiguration().getKeys().hasNext());
    }
}


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model backend\models\Person */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'person_type')->textInput(['maxlength' => true]) ?>

        <?= Html::submitButton($model->isNewRecord ? 'บันทึก' : 'บันทึก', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

    <?php ActiveForm::end(); ?>


text:
package dashboard.sab;

public class SabRole {
    public final String shortName;
    public final String roleName;

    public SabRole(String shortName, String roleName) {
        this.shortName = shortName;
        this.roleName = roleName;
    }
}


text:
#region Apache License

//-----------------------------------------------------------------------
// <copyright file="JsonStatusResult.cs" company="StrixIT">
// Copyright 2015 StrixIT. Author R.G. Schurgers MA MSc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
//-----------------------------------------------------------------------

#endregion Apache License

using System.Dynamic;
using System.Web.Mvc;

namespace StrixIT.Platform.Web
{
    /// <summary>
    /// A class to present Json post reponse results in a uniform way.
    /// </summary>
    public class JsonStatusResult : JsonResult
    {
        #region Private Fields

        private dynamic _resultData = new ExpandoObject();

        #endregion Private Fields

        #region Public Constructors

        public JsonStatusResult()
        {
            this._resultData.Success = false;
            this._resultData.Message = null;
            this._resultData.Data = null;
            base.Data = this._resultData;
        }

        #endregion Public Constructors

        #region Public Properties

        /// <summary>
        /// Gets or sets the result data.
        /// </summary>
        public new object Data
        {
            get
            {
                return this._resultData;
            }

            set
            {
                this._resultData.Data = value;
            }
        }

        /// <summary>
        /// Gets or sets the message. If an error occurred on the server while processing the post
        /// request, an error message is stored here.
        /// </summary>
        public string Message
        {
            get
            {
                return this._resultData.Message;
            }

            set
            {
                this._resultData.Message = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the post request was successful.
        /// </summary>
        public bool Success
        {
            get
            {
                return this._resultData.Success;
            }

            set
            {
                this._resultData.Success = value;
            }
        }

        #endregion Public Properties
    }
}


text:
try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

with open('README.md') as readme_file:
    readme = readme_file.read()

with open('HISTORY.rst') as history_file:
    history = history_file.read()

requirements = [
    'cnr-server',
    'cnrclient',
    'futures',
    'requests',
    'pyyaml',
    'jinja2',
    'jsonpatch',
    'tabulate',
    'termcolor',
    'python-etcd',
    'semantic_version',
    'flask',
    'Flask>=0.10.1',
    'flask-cors',
    'jsonnet',
]

secure_requirements = [
    'ecdsa',
    'cryptography',
    'urllib3[secure]',
]

test_requirements = [
    "pytest",
    "pytest-cov",
    'pytest-flask',
    "pytest-ordering",
    "requests-mock"
]

setup(
    name='kpm',
    version='0.21.1-pre',
    description="KPM cli",
    long_description=readme + '\n\n' + history,
    author="Antoine Legrand",
    author_email='2t.antoine@gmail.com',
    url='https://github.com/coreos/kpm',
    packages=[
        'kpm',
        'kpm.api',
        'kpm.api.impl',
        'kpm.commands',
        'kpm.platforms',
        'kpm.formats',
        'kpm.convert'
    ],
    scripts=[
        'bin/kpm'
    ],
    package_dir={'kpm':
                 'kpm'},
    include_package_data=True,
    install_requires=requirements,
    license="Apache License version 2",
    zip_safe=False,
    keywords=['kpm', 'kpmpy', 'kubernetes'],
    classifiers=[
        'Development Status :: 2 - Pre-Alpha',
        'Intended Audience :: Developers',
        'Natural Language :: English',
        "Programming Language :: Python :: 2",
        'Programming Language :: Python :: 2.7',
    ],
    test_suite='tests',
    tests_require=test_requirements,
    extras_require={
        'secure': secure_requirements
    },
    dependency_links=[
        'https://github.com/google/jsonnet/archive/227079272a19d03adf34332e2a0c11906e081894.zip#egg=jsonnet'
    ]
)


text:
fw_installed java && return 0

# TODO: Someday get away from apt-get
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
sudo apt-get install -o Dpkg::Options::="--force-confold" --force-yes -y oracle-java8-installer

# Setup environment variables
JAVA_HOME=/usr/lib/jvm/java-8-oracle
echo "export JAVA_HOME=${JAVA_HOME}" > $IROOT/java.installed
echo -e "export PATH=\$JAVA_HOME/bin:\$PATH" >> $IROOT/java.installed

source $IROOT/java.installed


text:
package io.katharsis.spring.jpa;

import java.util.concurrent.Callable;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;

import io.katharsis.core.internal.boot.TransactionRunner;

public class SpringTransactionRunner implements TransactionRunner {

	@Autowired
	private PlatformTransactionManager platformTransactionManager;

	@Override
	public <T> T doInTransaction(final Callable<T> callable) {
		TransactionTemplate template = new TransactionTemplate(platformTransactionManager);
		return template.execute(new TransactionCallback<T>() {

			@Override
			public T doInTransaction(TransactionStatus status) {
				try {
					return callable.call();
				}
				catch (RuntimeException e) {
					throw e;
				}
				catch (Exception e) {
					throw new IllegalStateException(e);
				}
			}
		});
	}
}


text:
#include <pick_and_place_application/pick_and_place.h>

using moveit::planning_interface::MoveItErrorCode;

/* MOVING ARM TO WAIT POSITION
  Goal:
    - Use the "moveit_cpp::PlanningComponent" to plan a trajectory that moves the robot to the "wait" target.
    - Execute the planned trajectory on the robot

  Hints:
    - "cfg.WAIT_POSE_NAME" contains the name of the wait target.
    - You can send a trajectory with the "execute()" method of the "moveit_cpp" object.
*/

void pick_and_place_application::PickAndPlaceApp::moveToWaitPosition()
{
  // RCLCPP_ERROR(node->get_logger(),"moveToWaitPosition is not implemented yet.  Aborting."); exit(1);

  if (!moveit_cpp->getPlanningSceneMonitor()->requestPlanningSceneState())
  {
    throw std::runtime_error("Failed to get planning scene");
  }

  // setting up planning configuration
  moveit_cpp::PlanningComponent planning_component(cfg.ARM_GROUP_NAME, moveit_cpp);
  moveit_cpp::PlanningComponent::PlanRequestParameters plan_parameters;
  plan_parameters.load(node);
  plan_parameters.planner_id = cfg.PLANNER_ID;
  plan_parameters.planning_time = cfg.PLANNING_TIME;
  plan_parameters.planning_attempts = cfg.PLANNING_ATTEMPTS;

  /*

     Fill Code:
     * Goal:
     * - Set robot wait target
     * Hints:
     * - The "WAIT_POSE_NAME" variable is a member of the "cfg" object.
     */
  planning_component.setGoal(cfg.WAIT_POSE_NAME);

  // now plan the trajectory
  moveit_cpp::PlanningComponent::PlanSolution plan_solution = planning_component.plan(plan_parameters);
  if (plan_solution)
  {
    RCLCPP_INFO_STREAM(node->get_logger(), "Move " << cfg.WAIT_POSE_NAME << " Succeeded");
  }
  else
  {
    RCLCPP_INFO_STREAM(node->get_logger(), "Move " << cfg.WAIT_POSE_NAME << " Failed");
    throw std::runtime_error("Failed to plan move to wait position");
  }

  /*
   Fill Code:
   * Goal:
   * - Execute the trajectory on the robot
   * Hints:
   * - The "execute" method takes 3 parameters: planning group name, trajectory, and blocking.
   * - The robot trajectory is the primary result of the "plan()" call above, along with other data.
   */

  bool succeeded = false;
  succeeded = moveit_cpp->execute(cfg.ARM_GROUP_NAME, plan_solution.trajectory, true);

  // check if the execution succeeded
  if (!succeeded)
  {
    throw std::runtime_error("Failed to execute trajectory to wait position");
  }
}


text:
#ifndef itkFEMScatteredDataPointSetToImageFilter_h
#define itkFEMScatteredDataPointSetToImageFilter_h

#include "itkPointSetToImageFilter.h"
#include "itkVectorContainer.h"
#include "vnl/vnl_matrix.h"

#include "itkMesh.h"
#include "itkFEMObject.h"
#include "itkFEMElement3DC0LinearTetrahedronStrain.h"
#include "itkFEMElement3DC0LinearHexahedronStrain.h"
#include "itkFEMElement2DC0LinearTriangularStrain.h"
#include "itkFEMElement2DC0LinearQuadrilateralStrain.h"
#include "itkFEMElement2DC0LinearQuadrilateralMembrane.h"
#include "itkFEMRobustSolver.h"
#include "itkFEMLoadNoisyLandmark.h"
#include "itkImageToRectilinearFEMObjectFilter.h"
#include "itkTriangleCell.h"
#include "itkTetrahedronCell.h"
#include "itkQuadrilateralCell.h"
#include "itkHexahedronCell.h"

namespace itk
{
namespace fem
{
/** \class FEMScatteredDataPointSetToImageFilter
 * \brief Scattered data approximation to interpolation
 * in the presence of outliers
 *
 * Given a 2- or 3-D scattered and noisy data, this filter is able to approximate
 * the data while rejecting outliers, and then it advances toward interpolation.
 *
 * This filter also takes the confidence and structrual information into account,
 * if users can provide a scalar to represent the confidence and a tensor
 * to represent the structural information for each feature point.
 *
 * This filter requires a point set, of which each point is associated with a
 * 2-D or 3-D displacement, as input, and outputs a deformation field. Two
 * optional point sets are supported.
 * Confidence point set: this point set defines the confidence associated with
 * each point, which will make the solver behavior like a weighted Least Square
 * Tensor point set: this point set defines a tensor associated with each point,
 * such as a structural tensor.
 *
 * The purpose of this filter is to facilitate the use of the FEMRobustSolver,
 * which does the concrete work on finding the solution. See FEMRobustSolver for
 * details.
 *
 * \code
 *
 *  const unsigned int ParametricDimension = 3;
 *  const unsigned int DataDimension = 3;
 *
 *  typedef int                                           PixelType;
 *  typedef itk::Image<PixelType, ParametricDimension>    InputImageType;
 *  typedef float                                         RealType;
 *  typedef itk::Vector<RealType, DataDimension>          VectorType;
 *  typedef itk::Matrix<RealType, DataDimension,
 *  DataDimension>                                        MatrixType;
 *  typedef itk::Image<VectorType, ParametricDimension>   VectorImageType;
 *  typedef itk::PointSet <VectorType,
 *  ParametricDimension>                                  PointSetType;
 *
 *  typedef itk::PointSet <MatrixType,
 *   ParametricDimension>                                  TensorPointSetType;
 *
 *  typedef itk::PointSet <RealType, ParametricDimension> ConfidencePointSetType;
 *
 *
 *  typedef itk::Mesh< VectorType, ParametricDimension >  MeshType;
 *
 *  typedef itk::FEMScatteredDataPointSetToImageFilter
 *  <PointSetType, MeshType, VectorImageType,
 *  ConfidencePointSetType, TensorPointSetType>           FilterType;
 *
 *  FilterType::Pointer filter = FilterType::New();
 *
 *  filter->SetInput(displacementPointSet);
 *  filter->SetConfidencePointSet(confidencePointSet); //optional
 *  filter->SetTensorPointSet(tensorPointSet); //optional
 *  filter->SetMesh(aITKMesh);
 *  filter->Update();
 *
 *  DeformationField::Pointer = filter->GetOutput();
 *
 * \endcode
 *
 * \author Yixun Liu
 *
 * \par REFERENCE
 * O. Clatz, H. Delingette, I.-F. Talos, A. Golby, R. Kikinis, F. Jolesz,
 * N. Ayache, and S. Warfield, "Robust non-rigid registration to capture brain
 * shift from intra-operative MRI", IEEE Trans. Med. Imag.,
 * 24(11);1417-27, 2005.
 *
 * \par REFERENCE
 * Yixun Liu, Andriy Fedorov, Ron Kikinis and Nikos Chrisochoides,
 * "Real-time Non-rigidRegistration of Medical Images on a Cooperative Parallel
 * Architecture", IEEE International Conference on Bioinformatics & Biomedicine,
 * pp. 401-404, November 2009.
 *
 * \sa FEMRobustSolver
 *
 * \ingroup ITKFEM
 */

template<typename TInputPointSet, typename TInputMesh, typename TOutputImage, typename TInputConfidencePointSet, typename TInputTensorPointSet>
class ITK_TEMPLATE_EXPORT FEMScatteredDataPointSetToImageFilter:
  public PointSetToImageFilter< TInputPointSet, TOutputImage >
{
public:
  typedef FEMScatteredDataPointSetToImageFilter                 Self;
  typedef PointSetToImageFilter<TInputPointSet, TOutputImage>   Superclass;
  typedef SmartPointer<Self>                                    Pointer;
  typedef SmartPointer<const Self>                              ConstPointer;

  /** Method for creation through the object factory. */
  itkNewMacro( Self );

  /** Extract dimension from the output image. */
  itkStaticConstMacro( ImageDimension, unsigned int, TOutputImage::ImageDimension );

  /** Displacement point set typedef support */
  typedef TInputPointSet                                              PointSetType;
  typedef typename PointSetType::PointType                            PointType;
  typedef typename PointSetType::PointsContainer                      PointsContainer;
  typedef typename PointsContainer::ConstIterator                     PointsIterator;
  typedef typename PointSetType::PixelType                            PointDataType;
  typedef typename PointSetType::PointDataContainer                   PointDataContainerType;
  typedef typename PointDataContainerType::ConstIterator              PointDataIterator;

  /** Confidence point set typedef support */
  typedef TInputConfidencePointSet                                            ConfidencePointSetType;
  typedef typename ConfidencePointSetType::PointsContainer::ConstIterator     ConfidencePointsIterator;
  typedef typename ConfidencePointSetType::PixelType                          ConfidencePointDataType;
  typedef typename ConfidencePointSetType::PointDataContainer                 ConfidencePointDataContainerType;

  /** Tensor point set typedef support */
  typedef TInputTensorPointSet                                                TensorPointSetType;
  typedef typename TensorPointSetType::PointsContainer::ConstIterator         TensorPointsIterator;
  typedef typename TensorPointSetType::PixelType                              TensorPointDataType;
  typedef typename TensorPointSetType::PointDataContainer                     TensorPointDataContainerType;
  typedef typename TensorPointDataContainerType::Iterator                     TensorPointDataIterator;

  /** Mesh typedef support */
  typedef TInputMesh                              MeshType;
  typedef typename MeshType::CellType             CellType;
  typedef typename CellType::CellAutoPointer      CellAutoPointer;
  typedef typename MeshType::CellsContainer       CellsContainer;
  typedef typename CellsContainer::ConstIterator  CellIterator;

  typedef TriangleCell<CellType>                  TriangleType;
  typedef TetrahedronCell<CellType>               TetrahedronType;
  typedef QuadrilateralCell<CellType>             QuadrilateralType;
  typedef HexahedronCell<CellType>                HexahedronType;
  typedef typename CellType::PointIdIterator      PointIdIterator;

  /** Image typedef support */
  typedef TOutputImage                                        ImageType;
  typedef typename ImageType::PixelType                       PixelType;
  typedef typename ImageType::RegionType                      RegionType;
  typedef typename ImageType::SizeType                        SizeType;
  typedef typename ImageType::IndexType                       IndexType;
  typedef typename ImageType::SpacingType                     SpacingType;
  typedef ContinuousIndex<SpacePrecisionType, ImageDimension> ContinuousIndexType;

  typedef ImageToRectilinearFEMObjectFilter<ImageType> ImageToRectilinearFEMObjectFilterType;

  /** FEMObject typedef support */
  typedef FEMObject<ImageDimension>                 FEMObjectType;

  /** FEM solver typedef support */
  typedef RobustSolver<ImageDimension>              FEMSolverType;

  /** FEM element typedef support */
  typedef Element3DC0LinearTetrahedronStrain        FEMTetrahedronType;
  typedef Element3DC0LinearHexahedronStrain         FEMHexahedronType;
  typedef Element2DC0LinearTriangularStrain         FEM2DTriangleType;
  typedef Element2DC0LinearQuadrilateralStrain      FEM2DQuadrilateralType;

  /** FEM node typedef support */
  typedef Element::Node                             NodeType;

  /** FEM Load typedef support */
  typedef LoadNoisyLandmark                         LoadType;

  /** FEM material typedef support */
  typedef MaterialLinearElasticity                  MaterialType;
  typedef MaterialType::Pointer                     MaterialPointerType;

  /** FEM element typedef support */
  typedef Element::VectorType                       FEMVectorType;
  typedef Element::MatrixType                       FEMMatrixType;

  /** FEM container typedef support */
  typedef typename FEMObjectType::LoadContainerType        LoadContainerType;
  typedef typename FEMObjectType::NodeContainerType        NodeContainerType;
  typedef typename FEMObjectType::ElementContainerType     ElementContainerType;
  typedef typename FEMObjectType::MaterialContainerType    MaterialContainerType;

  /** Helper functions */
  itkSetConstObjectMacro(ConfidencePointSet, ConfidencePointSetType);

  itkSetConstObjectMacro(TensorPointSet, TensorPointSetType);

  itkSetObjectMacro(Mesh, MeshType);
  itkGetModifiableObjectMacro(Mesh, MeshType);

  itkSetObjectMacro(FEMSolver, FEMSolverType);
  itkGetModifiableObjectMacro(FEMSolver, FEMSolverType);

  /** Get/Set the number of voxels/pixels in each dimension used during the mesh generation */
  itkGetConstReferenceMacro(PixelsPerElement, ContinuousIndexType);
  itkSetMacro(PixelsPerElement, ContinuousIndexType);

  /** Set/Get the spacing of the rectilinear element */
  void SetElementSpacing(const SpacingType & elementSpacing);
  itkGetConstReferenceMacro(SpacingPerElement, SpacingType);

  /** Get the number of element in each dimension of the generated mesh */
  itkGetConstReferenceMacro(NumberOfElements, SizeType);

protected:

  FEMScatteredDataPointSetToImageFilter();
  virtual ~FEMScatteredDataPointSetToImageFilter();

  /** Generate 2D/3D rectilinear mesh */
  void GenerateRectilinearMesh();

  /** Generate a 2D quadrilateral mesh */
  void Generate2DQuadrilateralMesh();

  /** generate 3D hexahedral mesh */
  void Generate3DHexahedralMesh();

  /** Initialize FEMObject from a mesh and feature points */
  void InitializeFEMObject(FEMObjectType * femObject);

  /** Initialize Materials */
  void InitializeMaterials(FEMObjectType * femObject);

  /** Initialize Nodes */
  void InitializeNodes(FEMObjectType * femObject);

  /** Initialize Elements */
  void InitializeElements(FEMObjectType * femObject);

  /** Initialize Loads */
  void InitializeLoads(FEMObjectType * femObject);

  /** Run the solver and call ProduceDeformationField to produce deformation field */
  void GenerateData() ITK_OVERRIDE;

  void ProduceDeformationField();

  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

private:

  ITK_DISALLOW_COPY_AND_ASSIGN(FEMScatteredDataPointSetToImageFilter);

  typename FEMObjectType::Pointer      m_FEMObject;
  typename FEMSolverType::Pointer      m_FEMSolver;
  typename FEMSolverType::ConstPointer m_FEMDeformedObject;
  typename MeshType::Pointer           m_Mesh;

  typename ConfidencePointSetType::ConstPointer m_ConfidencePointSet;
  typename TensorPointSetType::ConstPointer     m_TensorPointSet;

  /** Rectilinear mesh */
  SizeType                 m_NumberOfElements;
  ContinuousIndexType      m_PixelsPerElement;
  SpacingType              m_SpacingPerElement;

  /** Material */
  MaterialPointerType m_Material;
};

}// end namespace fem
}// end namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#include "itkFEMScatteredDataPointSetToImageFilter.hxx"
#endif

#endif


text:
$(document).ready(function(){
	$('#btn-search').on('click', function(event){
		$('#search-form').slideToggle();
		event.stopPropagation();
	});
	$('#search-form').on('click', function(event){
		event.stopPropagation();
	});

	$('#btn-slide-menu').on('click', function(event){
		$('#slide-menu').toggleClass('slide-menu-opened');
		$('#base-wrapper').toggleClass('faded');
		$('#main').toggleClass('pushed-main');
		event.stopPropagation();
	});
	$('#slide-menu').on('click', function(event){
		event.stopPropagation();
	});
});

$(document).on('click', function(){
	$('#search-form').slideUp();
	$('#slide-menu').removeClass('slide-menu-opened');
	$('#base-wrapper').removeClass('faded');
	$('#main').removeClass('pushed-main');
});


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="initializeOwnerServiceDaoImpl">

    <!-- 初始化数据 add by wuxw 2018-07-03 -->
    <delete id="deleteBuildingOwner" parameterType="Map">
        delete from building_owner where 1=1
            and community_id = #{communityId}
    </delete>
</mapper>


text:
package org.continuousassurance.swamp.api;

import org.continuousassurance.swamp.session.Session;
import org.continuousassurance.swamp.session.handlers.PackageHandler;

import java.util.List;
import java.util.Map;

import static edu.uiuc.ncsa.security.core.util.BeanUtils.checkEquals;

/**
 * This models a SWAMP package. Note that the name is PackageThing since the name "Package" is already
 * in use in Java (for reflection of classes). Supported properties are
 *

 *
name = the name given to this package

 *
description = a human readable description of this package

 *
type = the type of this package. These are strings that are server dependent, e.g. "Java bytecode"

 *
external uri - The external uri for the source of this package.

 *
package sharing status - the access of the package: public, private

 *
package type id - the internal numeric code this instance of the SWAMP uses. Generally not portable between instances

 *

 *
Created by Jeff Gaynor

 * on 11/18/14 at  3:06 PM
 */
public class PackageThing extends SwampThing {

    public PackageThing(Session session) {
        super(session);
    }
    public PackageThing(Session session, Map map) {
        super(session, map);
    }

    @Override
    public String toString() {
        String out = "Package[uuid=" + getIdentifier() + ", name=" + getName() + ", description=" + getDescription() + ",type=" + getType() + "]";
        return out;
    }

    @Override
    protected SwampThing getNewInstance() {
        return new PackageThing(getSession());
    }

    @Override
    public String getIDKey() {
        return PackageHandler.PACKAGE_UUID_KEY;
    }

    public String getName() {
        return getString(PackageHandler.PACKAGE_NAME_KEY);
    }

    public void setName(String name) {
        put(PackageHandler.PACKAGE_NAME_KEY, name);
    }

    public String getDescription() {
        return getString(PackageHandler.PACKAGE_DESCRIPTION_KEY);
    }

    public void setDescription(String description) {
        put(PackageHandler.PACKAGE_DESCRIPTION_KEY, description);
    }

    public String getType() {
        return getString(PackageHandler.PACKAGE_TYPE_KEY);
    }

    public void setType(String type) {
        put(PackageHandler.PACKAGE_TYPE_KEY, type);
    }

    public List<PackageVersion> getVersions() {
        return versions;
    }

    public void setVersions(List<PackageVersion> versions) {
        this.versions = versions;
    }

    List<PackageVersion> versions;

    @Override
    public boolean equals(Object object) {
        if (object == null) return false;
        if (!(object instanceof PackageThing)) return false;
        PackageThing pt = (PackageThing) object;
        if (!checkEquals(getIdentifier(), pt.getIdentifier())) return false;
        //if(!checkEquals(getOwnerUUID(), pt.getOwnerUUID())) return false;
        if (!checkEquals(getType(), pt.getType())) return false;
        if (!checkEquals(getIdentifier(), pt.getIdentifier())) return false;
        return true;
    }
}


text:
FROM base
MAINTAINER pascal.de.poorter@cubis.be

# Add the ambari repo to the repository list
RUN cd /etc/apt/sources.list.d && \
    wget http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.2.0.0/ambari.list && \
    apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD && \
    apt-get update && \
    apt-get install -y ambari-agent

RUN apt-get update && \
    apt-get install -y software-properties-common

# add the java component.
RUN sudo add-apt-repository ppa:webupd8team/java && \
    apt-get update && \
    echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections && \
    apt-get install -y oracle-java8-installer

# Copy startup script into the docker image
COPY bootstrap.sh /root/bootstrap.sh
RUN chmod +x /root/bootstrap.sh

# Copy PortLocker program to image. Portlocker is used with the docker
# installation for Spark Hana Controller and locks some ports from being
# used by the Controller node programs during the retrieval of data by
# hana SDA. The communications is on ports 56000 - 58000. Data retrieval
# is submitted to the spark hana controller driver, that distributes the
# data requests to one of the namenodes. Since we cannot directly communicate
# with the docker containers, communication is done through the docker host and
# unique ports. Using Port Locker we can prevent that e.g. port 56000 is used by
# all executioner nodes. We will lock 56000 and 56050 from the Secondary docker
# container. This way the master node will use 56000 and 56050 and the secondary
# node will use 56100 and 56150. Ports will be mapped in a similar way in the
# docker-compose.yml file.
RUN mkdir -p /root/com/cubis
COPY PortLocker.class /root/com/cubis/

EXPOSE 2181 2202 4040 7860 7861 8020 8042 8080 8088 8300 8500 9083 9099 9225 10000 18080 45054 49152 49155 50070 56100 56150


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">
<title>Uses of Class org.jpasecurity.persistence.security.CriteriaHolder (JPA Security 1.0.0-SNAPSHOT API)</title>
<meta name="date" content="2019-07-31">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
org.jpasecurity.persistence.security.CriteriaHolder

Packages that use CriteriaHolder

Package
Description

org.jpasecurity.persistence.security

Uses of CriteriaHolder in org.jpasecurity.persistence.security

Methods in org.jpasecurity.persistence.security with parameters of type CriteriaHolder

Modifier and Type
Method and Description

boolean
CriteriaVisitor.visit(JpqlAbs node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlAbs</tt> node.

boolean
CriteriaVisitor.visit(JpqlAbstractSchemaName node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlAbstractSchemaName</tt> node.

boolean
CriteriaVisitor.visit(JpqlAdd node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlAdd</tt> node.

boolean
CriteriaVisitor.visit(JpqlAll node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlAll</tt> node.

boolean
CriteriaVisitor.visit(JpqlAnd node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlAnd</tt> node.

boolean
CriteriaVisitor.visit(JpqlAny node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlAny</tt> node.

boolean
CriteriaVisitor.visit(JpqlAscending node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlAscending</tt> node.

boolean
CriteriaVisitor.visit(JpqlAverage node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlAverage</tt> node.

boolean
CriteriaVisitor.visit(JpqlBetween node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlBetween</tt> node.

boolean
CriteriaVisitor.visit(JpqlBooleanLiteral node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlBooleanLiteral</tt> node.

boolean
CriteriaVisitor.visit(JpqlCollectionValuedPath node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlCollectionValuedPath</tt> node.

boolean
CriteriaVisitor.visit(JpqlConcat node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlConcat</tt> node.

boolean
CriteriaVisitor.visit(JpqlConstructor node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlConstructor</tt> node.

boolean
CriteriaVisitor.visit(JpqlConstructorParameter node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlConstructorParameter</tt> node.

boolean
CriteriaVisitor.visit(JpqlCount node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlCount</tt> node.

boolean
CriteriaVisitor.visit(JpqlCurrentDate node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlCurrentDate</tt> node.

boolean
CriteriaVisitor.visit(JpqlCurrentTime node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlCurrentTime</tt> node.

boolean
CriteriaVisitor.visit(JpqlCurrentTimestamp node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlCurrentTimestamp</tt> node.

boolean
CriteriaVisitor.visit(JpqlDecimalLiteral node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlDecimalLiteral</tt> node.

boolean
CriteriaVisitor.visit(JpqlDescending node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlDescending</tt> node.

boolean
CriteriaVisitor.visit(JpqlDistinct node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlDistinct</tt> node.

boolean
CriteriaVisitor.visit(JpqlDistinctPath node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlDistinctPath</tt> node.

boolean
CriteriaVisitor.visit(JpqlDivide node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlDivide</tt> node.

boolean
CriteriaVisitor.visit(JpqlEquals node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlEquals</tt> node.

boolean
CriteriaVisitor.visit(JpqlEscapeCharacter node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlEscapeCharacter</tt> node.

boolean
CriteriaVisitor.visit(JpqlExists node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlExists</tt> node.

boolean
CriteriaVisitor.visit(JpqlFromItem node,
     CriteriaHolder criteriaHolder)

Called when visiting a <tt>JpqlFromItem</tt> node.

boolean
CriteriaVisitor.visit(JpqlGreaterOrEquals node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlGreaterOrEquals</tt> node.

boolean
CriteriaVisitor.visit(JpqlGreaterThan node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlGreaterThan</tt> node.

boolean
CriteriaVisitor.visit(JpqlGroupBy node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlGroupBy</tt> node.

boolean
CriteriaVisitor.visit(JpqlHaving node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlHaving</tt> node.

boolean
CriteriaVisitor.visit(JpqlInCollection node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlInCollection</tt> node.

boolean
CriteriaVisitor.visit(JpqlIn node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlIn</tt> node.

boolean
CriteriaVisitor.visit(JpqlIndex node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlIndex</tt> node.

boolean
CriteriaVisitor.visit(JpqlInnerFetchJoin node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlInnerFetchJoin</tt> node.

boolean
CriteriaVisitor.visit(JpqlInnerJoin node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlInnerJoin</tt> node.

boolean
CriteriaVisitor.visit(JpqlIntegerLiteral node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlIntegerLiteral</tt> node.

boolean
CriteriaVisitor.visit(JpqlIsEmpty node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlIsEmpty</tt> node.

boolean
CriteriaVisitor.visit(JpqlIsNull node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlIsNull</tt> node.

boolean
CriteriaVisitor.visit(JpqlLength node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlLength</tt> node.

boolean
CriteriaVisitor.visit(JpqlLessOrEquals node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlLessOrEquals</tt> node.

boolean
CriteriaVisitor.visit(JpqlLessThan node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlLessThan</tt> node.

boolean
CriteriaVisitor.visit(JpqlLike node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlLike</tt> node.

boolean
CriteriaVisitor.visit(JpqlLocate node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlLocate</tt> node.

boolean
CriteriaVisitor.visit(JpqlLower node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlLower</tt> node.

boolean
CriteriaVisitor.visit(JpqlMaximum node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlMaximum</tt> node.

boolean
CriteriaVisitor.visit(JpqlMemberOf node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlMemberOf</tt> node.

boolean
CriteriaVisitor.visit(JpqlMinimum node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlMinimum</tt> node.

boolean
CriteriaVisitor.visit(JpqlMod node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlMod</tt> node.

boolean
CriteriaVisitor.visit(JpqlMultiply node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlMultiply</tt> node.

boolean
CriteriaVisitor.visit(JpqlNamedInputParameter node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlNamedInputParameter</tt> node.

boolean
CriteriaVisitor.visit(JpqlNegative node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlNegative</tt> node.

boolean
CriteriaVisitor.visit(JpqlNot node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlNot</tt> node.

boolean
CriteriaVisitor.visit(JpqlNotEquals node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlNotEquals</tt> node.

boolean
CriteriaVisitor.visit(JpqlOr node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlOr</tt> node.

boolean
CriteriaVisitor.visit(JpqlOrderBy node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlOrderBy</tt> node.

boolean
CriteriaVisitor.visit(JpqlOrderByItem node,
     CriteriaHolder query)

boolean
CriteriaVisitor.visit(JpqlOuterFetchJoin node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlOuterFetchJoin</tt> node.

boolean
CriteriaVisitor.visit(JpqlOuterJoin node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlOuterJoin</tt> node.

boolean
CriteriaVisitor.visit(JpqlPath node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlPath</tt> node.

boolean
CriteriaVisitor.visit(JpqlPatternValue node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlPatternValue</tt> node.

boolean
CriteriaVisitor.visit(JpqlSelect node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlSelect</tt> node.

boolean
CriteriaVisitor.visit(JpqlSelectExpression node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlSelectExpression</tt> node.

boolean
CriteriaVisitor.visit(JpqlSelectExpressions node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlSelectExpressions</tt> node.

boolean
CriteriaVisitor.visit(JpqlSetClause node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlSetClause</tt> node.

boolean
CriteriaVisitor.visit(JpqlSize node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlSize</tt> node.

boolean
CriteriaVisitor.visit(JpqlSqrt node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlSqrt</tt> node.

boolean
CriteriaVisitor.visit(JpqlStringLiteral node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlStringLiteral</tt> node.

boolean
CriteriaVisitor.visit(JpqlSubselect node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlSubselect</tt> node.

boolean
CriteriaVisitor.visit(JpqlSubstring node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlSubstring</tt> node.

boolean
CriteriaVisitor.visit(JpqlSubtract node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlSubtract</tt> node.

boolean
CriteriaVisitor.visit(JpqlSum node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlSum</tt> node.

boolean
CriteriaVisitor.visit(JpqlTrimBoth node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlTrimBoth</tt> node.

boolean
CriteriaVisitor.visit(JpqlTrimCharacter node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlTrimCharacter</tt> node.

boolean
CriteriaVisitor.visit(JpqlTrim node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlTrim</tt> node.

boolean
CriteriaVisitor.visit(JpqlTrimLeading node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlTrimLeading</tt> node.

boolean
CriteriaVisitor.visit(JpqlTrimTrailing node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlTrimTrailing</tt> node.

boolean
CriteriaVisitor.visit(JpqlType node,
     CriteriaHolder query)

boolean
CriteriaVisitor.visit(JpqlUpper node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlUpper</tt> node.

boolean
CriteriaVisitor.visit(JpqlWhere node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlWhere</tt> node.

boolean
CriteriaVisitor.visit(JpqlWith node,
     CriteriaHolder query)

Called when visiting a <tt>JpqlWith</tt> node.

boolean
CriteriaVisitor.visitPath(Node node,
         CriteriaHolder query)

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2019. All Rights Reserved.