text:
using content::BrowserThread;
using fileapi::SyncStatusCode;

namespace sync_file_system {

namespace {

const char kOrigin[] = "chrome-extension://example";
const char* const kServiceName = DriveFileSyncService::kServiceName;

typedef DriveMetadataStore::ResourceIDMap ResourceIDMap;

fileapi::FileSystemURL URL(const base::FilePath& path) {
  return fileapi::CreateSyncableFileSystemURL(
      GURL(kOrigin), kServiceName, path);
}

std::string GetResourceID(const ResourceIDMap& sync_origins,
                          const GURL& origin) {
  ResourceIDMap::const_iterator itr = sync_origins.find(origin);
  if (itr == sync_origins.end())
    return std::string();
  return itr->second;
}

DriveMetadata CreateMetadata(const std::string& resource_id,
                             const std::string& md5_checksum,
                             bool conflicted,
                             bool to_be_fetched) {
  DriveMetadata metadata;
  metadata.set_resource_id(resource_id);
  metadata.set_md5_checksum(md5_checksum);
  metadata.set_conflicted(conflicted);
  metadata.set_to_be_fetched(to_be_fetched);
  return metadata;
}

}  // namespace

class DriveMetadataStoreTest : public testing::Test {
 public:
  DriveMetadataStoreTest()
      : created_(false) {}

  virtual ~DriveMetadataStoreTest() {}

  virtual void SetUp() OVERRIDE {
    file_thread_.reset(new base::Thread("Thread_File"));
    file_thread_->Start();

    ui_task_runner_ = base::MessageLoopProxy::current();
    file_task_runner_ = file_thread_->message_loop_proxy();

    ASSERT_TRUE(base_dir_.CreateUniqueTempDir());
    ASSERT_TRUE(fileapi::RegisterSyncableFileSystem(kServiceName));
  }

  virtual void TearDown() OVERRIDE {
    EXPECT_TRUE(fileapi::RevokeSyncableFileSystem(kServiceName));

    DropDatabase();
    file_thread_->Stop();
    message_loop_.RunUntilIdle();
  }

 protected:
  void InitializeDatabase() {
    EXPECT_TRUE(ui_task_runner_->RunsTasksOnCurrentThread());

    bool done = false;
    SyncStatusCode status = fileapi::SYNC_STATUS_UNKNOWN;
    bool created = false;

    drive_metadata_store_.reset(
        new DriveMetadataStore(base_dir_.path(), file_task_runner_));
    drive_metadata_store_->Initialize(
        base::Bind(&DriveMetadataStoreTest::DidInitializeDatabase,
                   base::Unretained(this), &done, &status, &created));
    message_loop_.Run();

    EXPECT_TRUE(done);
    EXPECT_EQ(fileapi::SYNC_STATUS_OK, status);

    if (created) {
      EXPECT_FALSE(created_);
      created_ = created;
      return;
    }
    EXPECT_TRUE(created_);
  }

  void DropDatabase() {
    EXPECT_TRUE(ui_task_runner_->RunsTasksOnCurrentThread());
    drive_metadata_store_.reset();
  }

  void DropSyncRootDirectoryInStore() {
    EXPECT_TRUE(ui_task_runner_->RunsTasksOnCurrentThread());
    drive_metadata_store_->sync_root_directory_resource_id_.clear();
  }

  void RestoreSyncRootDirectoryFromDB() {
    EXPECT_TRUE(ui_task_runner_->RunsTasksOnCurrentThread());
    drive_metadata_store_->RestoreSyncRootDirectory(
        base::Bind(&DriveMetadataStoreTest::DidRestoreSyncRootDirectory,
                   base::Unretained(this)));
    message_loop_.Run();
  }

  void DropSyncOriginsInStore() {
    EXPECT_TRUE(ui_task_runner_->RunsTasksOnCurrentThread());
    drive_metadata_store_->batch_sync_origins_.clear();
    drive_metadata_store_->incremental_sync_origins_.clear();
    EXPECT_TRUE(drive_metadata_store_->batch_sync_origins().empty());
    EXPECT_TRUE(drive_metadata_store_->incremental_sync_origins().empty());
  }

  void RestoreSyncOriginsFromDB() {
    EXPECT_TRUE(ui_task_runner_->RunsTasksOnCurrentThread());
    drive_metadata_store_->RestoreSyncOrigins(
        base::Bind(&DriveMetadataStoreTest::DidRestoreSyncOrigins,
                   base::Unretained(this)));
    message_loop_.Run();
  }

  fileapi::SyncStatusCode RemoveOrigin(const GURL& url) {
    fileapi::SyncStatusCode status = fileapi::SYNC_STATUS_UNKNOWN;
    drive_metadata_store_->RemoveOrigin(
        url, base::Bind(&DriveMetadataStoreTest::DidFinishDBTask,
                        base::Unretained(this), &status));
    message_loop_.Run();
    return status;
  }

  fileapi::SyncStatusCode UpdateEntry(const fileapi::FileSystemURL& url,
                                      const DriveMetadata& metadata) {
    fileapi::SyncStatusCode status = fileapi::SYNC_STATUS_UNKNOWN;
    drive_metadata_store_->UpdateEntry(
        url, metadata,
        base::Bind(&DriveMetadataStoreTest::DidFinishDBTask,
                   base::Unretained(this), &status));
    message_loop_.Run();
    return status;
  }

  fileapi::SyncStatusCode DeleteEntry(const fileapi::FileSystemURL& url) {
    fileapi::SyncStatusCode status = fileapi::SYNC_STATUS_UNKNOWN;
    drive_metadata_store_->DeleteEntry(
        url,
        base::Bind(&DriveMetadataStoreTest::DidFinishDBTask,
                   base::Unretained(this), &status));
    message_loop_.Run();
    return status;
  }

  fileapi::SyncStatusCode SetLargestChangeStamp(int64 changestamp) {
    fileapi::SyncStatusCode status = fileapi::SYNC_STATUS_UNKNOWN;
    drive_metadata_store_->SetLargestChangeStamp(
        changestamp, base::Bind(&DriveMetadataStoreTest::DidFinishDBTask,
                                base::Unretained(this), &status));
    message_loop_.Run();
    return status;
  }

  void DidFinishDBTask(fileapi::SyncStatusCode* status_out,
                       fileapi::SyncStatusCode status) {
    *status_out = status;
    message_loop_.Quit();
  }

  DriveMetadataStore* metadata_store() {
    return drive_metadata_store_.get();
  }

  const DriveMetadataStore::MetadataMap& metadata_map() {
    return drive_metadata_store_->metadata_map_;
  }

 private:
  void DidInitializeDatabase(bool* done_out,
                             SyncStatusCode* status_out,
                             bool* created_out,
                             SyncStatusCode status,
                             bool created) {
    *done_out = true;
    *status_out = status;
    *created_out = created;
    message_loop_.Quit();
  }

  void DidRestoreSyncRootDirectory(SyncStatusCode status) {
    EXPECT_EQ(fileapi::SYNC_STATUS_OK, status);
    message_loop_.Quit();
  }

  void DidRestoreSyncOrigins(SyncStatusCode status) {
    EXPECT_EQ(fileapi::SYNC_STATUS_OK, status);
    message_loop_.Quit();
  }

  base::ScopedTempDir base_dir_;

  MessageLoop message_loop_;
  scoped_ptr<base::Thread> file_thread_;

  scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
  scoped_refptr<base::SequencedTaskRunner> file_task_runner_;

  scoped_ptr<DriveMetadataStore> drive_metadata_store_;

  bool created_;

  DISALLOW_COPY_AND_ASSIGN(DriveMetadataStoreTest);
};

TEST_F(DriveMetadataStoreTest, InitializationTest) {
  InitializeDatabase();
}

TEST_F(DriveMetadataStoreTest, ReadWriteTest) {
  InitializeDatabase();

  const fileapi::FileSystemURL url = URL(base::FilePath());
  DriveMetadata metadata;
  EXPECT_EQ(fileapi::SYNC_DATABASE_ERROR_NOT_FOUND,
            metadata_store()->ReadEntry(url, &metadata));

  metadata = CreateMetadata("1234567890", "09876543210", true, false);
  EXPECT_EQ(fileapi::SYNC_STATUS_OK, UpdateEntry(url, metadata));
  EXPECT_EQ(fileapi::SYNC_STATUS_OK, SetLargestChangeStamp(1));

  DropDatabase();
  InitializeDatabase();

  EXPECT_EQ(1, metadata_store()->GetLargestChangeStamp());

  DriveMetadata metadata2;
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            metadata_store()->ReadEntry(url, &metadata2));
  EXPECT_EQ(metadata.resource_id(), metadata2.resource_id());
  EXPECT_EQ(metadata.md5_checksum(), metadata2.md5_checksum());
  EXPECT_EQ(metadata.conflicted(), metadata2.conflicted());

  EXPECT_EQ(fileapi::SYNC_STATUS_OK, DeleteEntry(url));
  EXPECT_EQ(fileapi::SYNC_DATABASE_ERROR_NOT_FOUND,
            metadata_store()->ReadEntry(url, &metadata));
  EXPECT_EQ(fileapi::SYNC_DATABASE_ERROR_NOT_FOUND, DeleteEntry(url));
}

TEST_F(DriveMetadataStoreTest, GetConflictURLsTest) {
  InitializeDatabase();

  fileapi::FileSystemURLSet urls;
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            metadata_store()->GetConflictURLs(&urls));
  EXPECT_EQ(0U, urls.size());

  const base::FilePath path1(FPL("file1"));
  const base::FilePath path2(FPL("file2"));
  const base::FilePath path3(FPL("file3"));

  // Populate metadata in DriveMetadataStore. The metadata identified by "file2"
  // and "file3" are marked as conflicted.
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            UpdateEntry(URL(path1), CreateMetadata("1", "1", false, false)));
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            UpdateEntry(URL(path2), CreateMetadata("2", "2", true, false)));
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            UpdateEntry(URL(path3), CreateMetadata("3", "3", true, false)));

  EXPECT_EQ(fileapi::SYNC_STATUS_OK, metadata_store()->GetConflictURLs(&urls));
  EXPECT_EQ(2U, urls.size());
  EXPECT_FALSE(ContainsKey(urls, URL(path1)));
  EXPECT_TRUE(ContainsKey(urls, URL(path2)));
  EXPECT_TRUE(ContainsKey(urls, URL(path3)));
}

TEST_F(DriveMetadataStoreTest, GetToBeFetchedFilessTest) {
  InitializeDatabase();

  DriveMetadataStore::URLAndResourceIdList list;
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            metadata_store()->GetToBeFetchedFiles(&list));
  EXPECT_TRUE(list.empty());

  const base::FilePath path1(FPL("file1"));
  const base::FilePath path2(FPL("file2"));
  const base::FilePath path3(FPL("file3"));

  // Populate metadata in DriveMetadataStore. The metadata identified by "file2"
  // and "file3" are marked to be fetched.
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            UpdateEntry(URL(path1), CreateMetadata("1", "1", false, false)));
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            UpdateEntry(URL(path2), CreateMetadata("2", "2", false, true)));
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            UpdateEntry(URL(path3), CreateMetadata("3", "3", false, true)));

  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            metadata_store()->GetToBeFetchedFiles(&list));
  EXPECT_EQ(2U, list.size());
  EXPECT_EQ(list[0].first, URL(path2));
  EXPECT_EQ(list[1].first, URL(path3));
}

TEST_F(DriveMetadataStoreTest, StoreSyncRootDirectory) {
  const std::string kResourceID("hoge");

  InitializeDatabase();

  EXPECT_TRUE(metadata_store()->sync_root_directory().empty());

  metadata_store()->SetSyncRootDirectory(kResourceID);
  EXPECT_EQ(kResourceID, metadata_store()->sync_root_directory());

  DropSyncRootDirectoryInStore();
  EXPECT_TRUE(metadata_store()->sync_root_directory().empty());

  RestoreSyncRootDirectoryFromDB();
  EXPECT_EQ(kResourceID, metadata_store()->sync_root_directory());
}

TEST_F(DriveMetadataStoreTest, StoreSyncOrigin) {
  const GURL kOrigin1("chrome-extension://example1");
  const GURL kOrigin2("chrome-extension://example2");
  const std::string kResourceID1("hoge");
  const std::string kResourceID2("fuga");

  InitializeDatabase();

  // Make sure origins have not been marked yet.
  EXPECT_FALSE(metadata_store()->IsBatchSyncOrigin(kOrigin1));
  EXPECT_FALSE(metadata_store()->IsBatchSyncOrigin(kOrigin2));
  EXPECT_FALSE(metadata_store()->IsIncrementalSyncOrigin(kOrigin1));
  EXPECT_FALSE(metadata_store()->IsIncrementalSyncOrigin(kOrigin2));

  // Mark origins as batch sync origins.
  metadata_store()->AddBatchSyncOrigin(kOrigin1, kResourceID1);
  metadata_store()->AddBatchSyncOrigin(kOrigin2, kResourceID2);
  EXPECT_TRUE(metadata_store()->IsBatchSyncOrigin(kOrigin1));
  EXPECT_TRUE(metadata_store()->IsBatchSyncOrigin(kOrigin2));
  EXPECT_EQ(kResourceID1,
            GetResourceID(metadata_store()->batch_sync_origins(), kOrigin1));
  EXPECT_EQ(kResourceID2,
            GetResourceID(metadata_store()->batch_sync_origins(), kOrigin2));

  // Mark |kOrigin1| as an incremental sync origin. |kOrigin2| should have still
  // been marked as a batch sync origin.
  metadata_store()->MoveBatchSyncOriginToIncremental(kOrigin1);
  EXPECT_FALSE(metadata_store()->IsBatchSyncOrigin(kOrigin1));
  EXPECT_TRUE(metadata_store()->IsBatchSyncOrigin(kOrigin2));
  EXPECT_TRUE(metadata_store()->IsIncrementalSyncOrigin(kOrigin1));
  EXPECT_FALSE(metadata_store()->IsIncrementalSyncOrigin(kOrigin2));
  EXPECT_EQ(kResourceID1,
            GetResourceID(metadata_store()->incremental_sync_origins(),
                          kOrigin1));
  EXPECT_EQ(kResourceID2,
            GetResourceID(metadata_store()->batch_sync_origins(), kOrigin2));

  DropSyncOriginsInStore();

  // Make sure origins have been dropped.
  EXPECT_FALSE(metadata_store()->IsBatchSyncOrigin(kOrigin1));
  EXPECT_FALSE(metadata_store()->IsBatchSyncOrigin(kOrigin2));
  EXPECT_FALSE(metadata_store()->IsIncrementalSyncOrigin(kOrigin1));
  EXPECT_FALSE(metadata_store()->IsIncrementalSyncOrigin(kOrigin2));

  RestoreSyncOriginsFromDB();

  // Make sure origins have been restored.
  EXPECT_FALSE(metadata_store()->IsBatchSyncOrigin(kOrigin1));
  EXPECT_TRUE(metadata_store()->IsBatchSyncOrigin(kOrigin2));
  EXPECT_TRUE(metadata_store()->IsIncrementalSyncOrigin(kOrigin1));
  EXPECT_FALSE(metadata_store()->IsIncrementalSyncOrigin(kOrigin2));
  EXPECT_EQ(kResourceID1,
            GetResourceID(metadata_store()->incremental_sync_origins(),
                          kOrigin1));
  EXPECT_EQ(kResourceID2,
            GetResourceID(metadata_store()->batch_sync_origins(), kOrigin2));
}

TEST_F(DriveMetadataStoreTest, RemoveOrigin) {
  const GURL kOrigin1("chrome-extension://example1");
  const GURL kOrigin2("chrome-extension://example2");
  const GURL kOrigin3("chrome-extension://example3");
  const GURL kOrigin4("chrome-extension://example4");
  const std::string kResourceId1("hogera");
  const std::string kResourceId2("fugaga");
  const std::string kResourceId3("piyopiyo");

  InitializeDatabase();
  EXPECT_EQ(fileapi::SYNC_STATUS_OK, SetLargestChangeStamp(1));

  metadata_store()->AddBatchSyncOrigin(kOrigin1, kResourceId1);
  metadata_store()->AddBatchSyncOrigin(kOrigin2, kResourceId2);
  metadata_store()->MoveBatchSyncOriginToIncremental(kOrigin2);
  metadata_store()->AddBatchSyncOrigin(kOrigin3, kResourceId3);

  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            UpdateEntry(
                fileapi::CreateSyncableFileSystemURL(
                    kOrigin1, kServiceName, base::FilePath(FPL("guf"))),
                CreateMetadata("foo", "spam", false, false)));
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            UpdateEntry(
                fileapi::CreateSyncableFileSystemURL(
                    kOrigin2, kServiceName, base::FilePath(FPL("mof"))),
                CreateMetadata("bar", "ham", false, false)));
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            UpdateEntry(
                fileapi::CreateSyncableFileSystemURL(
                    kOrigin3, kServiceName, base::FilePath(FPL("waf"))),
                CreateMetadata("baz", "egg", false, false)));
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            UpdateEntry(
                fileapi::CreateSyncableFileSystemURL(
                    kOrigin4, kServiceName, base::FilePath(FPL("cue"))),
                CreateMetadata("lat", "fork", false, false)));
  EXPECT_EQ(fileapi::SYNC_STATUS_OK,
            UpdateEntry(
                fileapi::CreateSyncableFileSystemURL(
                    kOrigin1, kServiceName, base::FilePath(FPL("tic"))),
                CreateMetadata("zav", "sause", false, false)));

  EXPECT_EQ(fileapi::SYNC_STATUS_OK, RemoveOrigin(kOrigin1));
  EXPECT_EQ(fileapi::SYNC_STATUS_OK, RemoveOrigin(kOrigin2));
  EXPECT_EQ(fileapi::SYNC_STATUS_OK, RemoveOrigin(kOrigin4));

  DropDatabase();
  InitializeDatabase();

  // kOrigin3 should be only remaining batch sync origin.
  EXPECT_EQ(1u, metadata_store()->batch_sync_origins().size());
  EXPECT_TRUE(metadata_store()->IsBatchSyncOrigin(kOrigin3));
  EXPECT_TRUE(metadata_store()->incremental_sync_origins().empty());
  EXPECT_EQ(1u, metadata_map().size());

  DriveMetadataStore::MetadataMap::const_iterator found =
      metadata_map().find(kOrigin3);
  EXPECT_TRUE(found != metadata_map().end() && found->second.size() == 1u);
}

TEST_F(DriveMetadataStoreTest, GetResourceIdForOrigin) {
  const GURL kOrigin1("chrome-extension://example1");
  const GURL kOrigin2("chrome-extension://example2");
  const std::string kResourceId1("hogera");
  const std::string kResourceId2("fugaga");

  InitializeDatabase();
  EXPECT_EQ(fileapi::SYNC_STATUS_OK, SetLargestChangeStamp(1));

  metadata_store()->AddBatchSyncOrigin(kOrigin1, kResourceId1);
  metadata_store()->AddBatchSyncOrigin(kOrigin2, kResourceId2);
  metadata_store()->MoveBatchSyncOriginToIncremental(kOrigin2);

  EXPECT_EQ(kResourceId1, metadata_store()->GetResourceIdForOrigin(kOrigin1));
  EXPECT_EQ(kResourceId2, metadata_store()->GetResourceIdForOrigin(kOrigin2));

  DropDatabase();
  InitializeDatabase();

  EXPECT_EQ(kResourceId1, metadata_store()->GetResourceIdForOrigin(kOrigin1));
  EXPECT_EQ(kResourceId2, metadata_store()->GetResourceIdForOrigin(kOrigin2));
}

}  // namespace sync_file_system


text:
namespace opencv_apps
{

  class ContourArrayStamped : public ros::Msg
  {
    public:
      std_msgs::Header header;
      uint8_t contours_length;
      opencv_apps::Contour st_contours;
      opencv_apps::Contour * contours;

    ContourArrayStamped():
      header(),
      contours_length(0), contours(NULL)
    {
    }

    virtual int serialize(unsigned char *outbuffer) const
    {
      int offset = 0;
      offset += this->header.serialize(outbuffer + offset);
      *(outbuffer + offset++) = contours_length;
      *(outbuffer + offset++) = 0;
      *(outbuffer + offset++) = 0;
      *(outbuffer + offset++) = 0;
      for( uint8_t i = 0; i < contours_length; i++){
      offset += this->contours[i].serialize(outbuffer + offset);
      }
      return offset;
    }

    virtual int deserialize(unsigned char *inbuffer)
    {
      int offset = 0;
      offset += this->header.deserialize(inbuffer + offset);
      uint8_t contours_lengthT = *(inbuffer + offset++);
      if(contours_lengthT > contours_length)
        this->contours = (opencv_apps::Contour*)realloc(this->contours, contours_lengthT * sizeof(opencv_apps::Contour));
      offset += 3;
      contours_length = contours_lengthT;
      for( uint8_t i = 0; i < contours_length; i++){
      offset += this->st_contours.deserialize(inbuffer + offset);
        memcpy( &(this->contours[i]), &(this->st_contours), sizeof(opencv_apps::Contour));
      }
     return offset;
    }

    const char * getType(){ return "opencv_apps/ContourArrayStamped"; };
    const char * getMD5(){ return "6bcf2733566be102cf11fc89685fd962"; };

  };

}
#endif

redpajama_set_name: RedPajamaGithub


text:
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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.
// ----------------------------------------------------------------------------------

namespace Microsoft.Azure.Commands.Resources.Models
{
    using Microsoft.Azure.Commands.Resources.Models.Authorization;
    using ResourceManager.Common;

    /// <summary>
    /// Base class for all resources cmdlets
    /// </summary>
    public abstract class ResourcesBaseCmdlet : AzureRMCmdlet
    {
        /// <summary>
        /// Field that holds the resource client instance
        /// </summary>
        private ResourcesClient resourcesClient;

#if !NETSTANDARD
        /// <summary>
        /// Field that holds the gallery templates client instance
        /// </summary>
        private GalleryTemplatesClient galleryTemplatesClient;
#endif

        /// <summary>
        /// Field that holds the policies client instance
        /// </summary>
        private AuthorizationClient policiesClient;

        /// <summary>
        /// Field that holds the subscripotions client instance
        /// </summary>
        private SubscriptionsClient subscriptionsClient;

        /// <summary>
        /// Gets or sets the resources client
        /// </summary>
        public ResourcesClient ResourcesClient
        {
            get
            {
                if (this.resourcesClient == null)
                {
                    this.resourcesClient = new ResourcesClient(DefaultContext)
                    {
                        VerboseLogger = WriteVerboseWithTimestamp,
                        ErrorLogger = WriteErrorWithTimestamp,
                        WarningLogger = WriteWarningWithTimestamp
                    };
                }
                return this.resourcesClient;
            }

            set { this.resourcesClient = value; }
        }

#if !NETSTANDARD
        /// <summary>
        /// Gets or sets the gallery templates client
        /// </summary>
        public GalleryTemplatesClient GalleryTemplatesClient
        {
            get
            {
                if (this.galleryTemplatesClient == null)
                {
                    // since this accessor can be called before BeginProcessing, use GetCurrentContext if no
                    // profile is passed in
                    this.galleryTemplatesClient = new GalleryTemplatesClient(DefaultContext);
                }

                return this.galleryTemplatesClient;
            }

            set { this.galleryTemplatesClient = value; }
        }
#endif

        /// <summary>
        /// Gets or sets the policies client
        /// </summary>
        public AuthorizationClient PoliciesClient
        {
            get
            {
                if (this.policiesClient == null)
                {
                    this.policiesClient = new AuthorizationClient(DefaultContext);
                }
                return this.policiesClient;
            }

            set { this.policiesClient = value; }
        }

        /// <summary>
        /// Gets or sets the subscriptions client
        /// </summary>
        public SubscriptionsClient SubscriptionsClient
        {
            get
            {
                if (this.subscriptionsClient == null)
                {
                    this.subscriptionsClient = new SubscriptionsClient(DefaultContext);
                }
                return this.subscriptionsClient;
            }

            set { this.subscriptionsClient = value; }
        }

        /// <summary>
        /// Determines the parameter set name.
        /// </summary>
        public virtual string DetermineParameterSetName()
        {
            return this.ParameterSetName;
        }
    }
}


text:
require 'spec_helper'

describe Kludge::Parts do
  let(:parts) { Kludge::Parts.new }
  let(:trunk_val) { mock :trunk_val, :valid? => true, :branch= => true }
  let(:branch_val) { mock :branch_val, :valid? => true, :leaves= => true }
  let(:leaves_val) { mock :leaves_val, :valid? => true }
  let(:trunk)  { Kludge::One.new(:trunk, :value => trunk_val) }
  let(:branch) { Kludge::One.new(:branch, :belongs_to => :trunk, :value => branch_val) }
  let(:leaves) { Kludge::Many.new(:leaves, :belongs_to => :branch, :value => [leaves_val]) }

  before { parts << branch << trunk << leaves }

  describe '#names' do
    it 'returns the names of all parts contained' do
      expect(parts.names).to eql([:branch, :trunk, :leaves])
    end
  end

  describe '#save' do
    it 'calls saves on all of its parts' do
      [branch_val, trunk_val, leaves_val].each { |part| part.should_receive(:save).once }
      parts.save
    end
  end

  describe '#valid?' do
    context 'all parts are valid' do
      it 'returns true if all of its parts return true' do
        expect(parts).to be_valid
      end
    end

    context 'any of its parts are not valid' do
      it 'returns false if any of its parts return false' do
        leaves_val.stub(:valid? => false, :errors => [])
        expect(parts).to_not be_valid
      end
    end
  end

  describe '#graph' do
    before { parts.graph }

    it 'sets parent and children for trunk' do
      expect(trunk.parent).to be_nil
      expect(trunk.children).to eql([branch])
    end

    it 'sets parent and children for branch' do
      expect(branch.parent).to eql(trunk)
      expect(branch.children).to eql([leaves])
    end

    it 'sets parent and children for leaves' do
      expect(leaves.parent).to eql(branch)
      expect(leaves.children).to be_empty
    end

    it 'returns roots of graph' do
      expect(parts.graph).to eql([trunk])
    end
  end

  describe '#leaves' do
    it 'returns branch' do
      expect(parts.leaves).to eql([leaves])
    end
  end
end


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

<Project
	scene="navMeshPlacement/navMeshPlacementS.txt"
	behavior="navMeshPlacement/navMeshPlacementB.txt"
	view="navMeshPlacement/navMeshPlacementV.txt"
	model="orca"
	dumpPath="images"
/>


text:
using Catan.Models;
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;

namespace catan.Utilities
{
    internal class ResourceTypeToSolidBrushConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            switch ((ResourceType)value)
            {
                case ResourceType.Desert:
                    return Brushes.SandyBrown;
                case ResourceType.Hills:
                    return Brushes.DarkRed;
                case ResourceType.Pastures:
                    return Brushes.LightGreen;
                case ResourceType.Mountains:
                    return Brushes.DarkSlateGray;
                case ResourceType.Fields:
                    return Brushes.Wheat;
                case ResourceType.Forests:
                    return Brushes.ForestGreen;
                default:
                    return null;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}


text:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE TS>
<TS version="2.1" language="lv">
<context>
    <name>ImageEditor</name>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/ImageEditor.cpp" line="14"/>
        <source>Zoom In</source>
        <translation>Tuvināt</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/ImageEditor.cpp" line="15"/>
        <source>Zoom Out</source>
        <translation>Tālināt</translation>
    </message>
</context>
<context>
    <name>MainUI</name>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="14"/>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="162"/>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="295"/>
        <source>Take Screenshot</source>
        <translation>Iegūt ekrānuzņēmumu</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="37"/>
        <source>New Screenshot</source>
        <translation>Jauns ekrānuzņēmums</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="43"/>
        <source>Settings</source>
        <translation>Iestatījumi</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="124"/>
        <source>Include Borders</source>
        <translation>Iekļaut apmales</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="149"/>
        <source> Seconds</source>
        <translation> Sekundes</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="152"/>
        <source>Delay </source>
        <translation>Aizture </translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="172"/>
        <source>View/Edit</source>
        <translation>Skatīt/Labot</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="212"/>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="306"/>
        <source>Save As</source>
        <translation>Saglabāt Kā</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="222"/>
        <source>Launch Editor</source>
        <translation>Palaist redaktoru</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="245"/>
        <source>Crop</source>
        <translation>Apgriezt</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="255"/>
        <source>Resize</source>
        <translation>Mainīt izmēru</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="282"/>
        <source>File</source>
        <translation>Fails</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="298"/>
        <source>Ctrl+N</source>
        <translation>Ctrl+N</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="322"/>
        <source>Close</source>
        <translation>Aizvērt</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="325"/>
        <source>Esc</source>
        <translation>Esc</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="67"/>
        <source>Entire Session</source>
        <translation>Visu sesiju</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="81"/>
        <source>Single Window</source>
        <translation>Vienu logu</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="74"/>
        <source>Single Screen</source>
        <translation>Vienu ekrānu</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp" line="78"/>
        <source>Save Screenshot</source>
        <translation>Saglabāt ekrānuzņēmumu</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="309"/>
        <source>Ctrl+S</source>
        <translation>Ctrl+S</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.ui" line="317"/>
        <source>Quick Save</source>
        <translation>Ātrā saglabāšana</translation>
    </message>
    <message>
        <location filename="../../lumina-git/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp" line="78"/>
        <source>PNG Files (*.png);;AllFiles (*)</source>
        <translation>PNG faili (*.png);;Visi faili (*)</translation>
    </message>
</context>
</TS>


text:
package net.bither.xrandom;

import android.hardware.Camera;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

import net.bither.camera.CameraManager;

/**
 * Created by songchenwen on 14-9-11.
 */
public class UEntropyCamera implements SurfaceHolder.Callback, IUEntropySource,
        Thread.UncaughtExceptionHandler {
    private static final long AUTO_FOCUS_INTERVAL_MS = 2500L;

    private static boolean DISABLE_CONTINUOUS_AUTOFOCUS = Build.MODEL.equals("GT-I9100") //
            // Galaxy S2
            || Build.MODEL.equals("SGH-T989") // Galaxy S2
            || Build.MODEL.equals("SGH-T989D") // Galaxy S2 X
            || Build.MODEL.equals("SAMSUNG-SGH-I727") // Galaxy S2 Skyrocket
            || Build.MODEL.equals("GT-I9300") // Galaxy S3
            || Build.MODEL.equals("GT-N7000"); // Galaxy Note

    private final CameraManager cameraManager = new CameraManager();
    private SurfaceHolder surfaceHolder;
    private HandlerThread cameraThread;
    private Handler cameraHandler;

    private UEntropyCollector collector;

    public UEntropyCamera(SurfaceView surfaceView, UEntropyCollector collector) {
        this.collector = collector;
        surfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        surfaceView.getHolder().addCallback(this);
    }

    @Override
    public void surfaceCreated(SurfaceHolder holder) {
        if (surfaceHolder == null) {
            surfaceHolder = holder;
            cameraHandler.post(openRunnable);
        }
    }

    private final Runnable openRunnable = new Runnable() {
        @Override
        public void run() {
            try {
                final Camera camera = cameraManager.open(surfaceHolder,
                        !DISABLE_CONTINUOUS_AUTOFOCUS);

                final String focusMode = camera.getParameters().getFocusMode();
                final boolean nonContinuousAutoFocus = Camera.Parameters.FOCUS_MODE_AUTO.equals
                        (focusMode) || Camera.Parameters.FOCUS_MODE_MACRO.equals(focusMode);

                if (nonContinuousAutoFocus) {
                    cameraHandler.post(new AutoFocusRunnable(camera));
                }

                cameraHandler.post(fetchCameraDataRunnable);

            } catch (final Exception x) {
                uncaughtException(Thread.currentThread(), x);
            }
        }
    };

    private final Runnable closeRunnable = new Runnable() {
        @Override
        public void run() {
            cameraManager.close();

            // cancel background thread
            cameraHandler.removeCallbacksAndMessages(null);
            cameraThread.quit();
        }
    };

    @Override
    public void onResume() {
        if (cameraThread != null && cameraThread.isAlive()) {
            return;
        }
        cameraThread = new HandlerThread("UEntropyCameraThread",
                android.os.Process.THREAD_PRIORITY_BACKGROUND);
        cameraThread.setUncaughtExceptionHandler(this);
        cameraThread.start();
        cameraHandler = new Handler(cameraThread.getLooper());
        if (surfaceHolder != null) {
            cameraHandler.post(openRunnable);
        }
    }

    @Override
    public void onPause() {
        if (cameraThread != null && cameraThread.isAlive()) {
            cameraHandler.post(closeRunnable);
            surfaceHolder.removeCallback(this);
        }
    }

    @Override
    public UEntropyCollector.UEntropySource type() {
        return UEntropyCollector.UEntropySource.Camera;
    }
    private final class AutoFocusRunnable implements Runnable {
        private final Camera camera;

        public AutoFocusRunnable(final Camera camera) {
            this.camera = camera;
        }

        @Override
        public void run() {
            camera.autoFocus(new Camera.AutoFocusCallback() {
                @Override
                public void onAutoFocus(final boolean success, final Camera camera) {
                    // schedule again
                    cameraHandler.postDelayed(AutoFocusRunnable.this, AUTO_FOCUS_INTERVAL_MS);
                }
            });
        }
    }

    private final Runnable fetchCameraDataRunnable = new Runnable() {

        @Override
        public void run() {
            cameraManager.requestPreviewFrame(new Camera.PreviewCallback() {
                @Override
                public void onPreviewFrame(final byte[] data, final Camera camera) {
                    collector.onNewData(data, UEntropyCollector.UEntropySource.Camera);
                    cameraHandler.post(fetchCameraDataRunnable);
                }
            });
        }
    };

    @Override
    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
    }

    @Override
    public void surfaceDestroyed(SurfaceHolder holder) {

    }

    @Override
    public void uncaughtException(Thread thread, Throwable ex) {
        collector.onError(new Exception(ex), UEntropyCamera.this);
    }

}


text:
'use strict';
var components = require('../../components');

exports.attach = function(DocumentPropertyResource) {

	components.apiUtils.addPermissionChecks(DocumentPropertyResource, DocumentPropertyResource);
  components.requestinterceptor.interceptDelete(DocumentPropertyResource, DocumentPropertyResource);
  components.nesting.nestableController(DocumentPropertyResource, DocumentPropertyResource);

};


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

<title> Encrypter 2k (Made by Cool Dude 2k) </title>
<meta http-equiv="content-language" content="en-us">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="editplus">
<meta name="author" content="">
<meta name="keywords" content="">
<meta name="description" content="">

<?php
if ($_POST['Text']==null) {
	if ($_GET['Text']!=null) {
		$_POST['Text']=$_GET['Text'];
		if ($_POST['Encrypter']==null) {
		$_POST['Encrypter']="100"; } }
	if ($_GET['Text']==null) {
		$_POST['Text']="Cool Dude 2k"; } }
?>

<form method="post" action="?">
<select size="1" name="Encrypter">
 <option selected value="100">Encrypt Text 1 Time (Small)</option>
 <option value="150">Encrypt Text 1 Time (Big)</option>
 <option value="200">Encrypt Text 2 Times (Small)</option>
 <option value="250">Encrypt Text 2 Times (Big)</option>
 <option value="300">Encrypt Text 3 Times (Small)</option>
 <option value="400">Encrypt Text 3 Times (Big)</option>
 <option value="500">Decrypt Text</option>
</select>

<select size="1" name="ZipData">
 <option selected value="none">Dont zip/unzip data</option>
 <option value="deflate">gzip/ungzip data with deflate</option>
 <option value="zlib">gzip/ungzip data with zlib</option>
 <option value="bzip">bzip/unbzip data</option>
</select>

<select size="1" name="EncodeData">
 <option selected value="none">Dont encode/decode</option>
 <option value="base64">Base64 encode/decode</option>
 <option value="urlencode">URL encode/decode</option>
</select>

<textarea rows="4" name="Text" cols="20"><?php echo $_POST['Text']; ?></textarea>

<input type="submit" name="Send" value="Send Text">
<input type="reset" name="Reset" value="Reset Text">

</form>
<?php
if ($_POST['Text']!=null) {
require_once('Functions.php');
$_POST['OldText'] = $_POST['Text'];
if($_POST['EncodeData']!="none"&&$_POST['Encrypter']=="500") {
	if($_POST['EncodeData']=="base64") {
		$_POST['Text'] = base64_decode($_POST['Text']); }
	if($_POST['EncodeData']=="urlencode") {
		$_POST['Text'] = urldecode($_POST['Text']); } }
if($_POST['ZipData']!="none"&&$_POST['Encrypter']=="500") {
	if($_POST['ZipData']=="deflate") {
		$_POST['Text'] = gzinflate($_POST['Text']); }
	if($_POST['ZipData']=="zlib") {
		$_POST['Text'] = gzuncompress($_POST['Text']); }
	if($_POST['ZipData']=="bzip") {
		$_POST['Text'] = bzdecompress($_POST['Text']); } }
if ($_POST['Encrypter']=="100") {
$_POST['Text'] = GM2k_Encrypt1($_POST['Text']);	}
if ($_POST['Encrypter']=="150") {
$_POST['Text'] = GM2k_Encrypt1Old($_POST['Text']);	}
if ($_POST['Encrypter']=="200") {
$_POST['Text'] = GM2k_Encrypt2($_POST['Text']);	}
if ($_POST['Encrypter']=="250") {
$_POST['Text'] = GM2k_Encrypt2Old($_POST['Text']);	}
if ($_POST['Encrypter']=="300") {
$_POST['Text'] = GM2k_Encrypt1(GM2k_Encrypt2($_POST['Text']));	}
if ($_POST['Encrypter']=="400") {
$_POST['Text'] = GM2k_Encrypt3($_POST['Text']);	}
if ($_POST['Encrypter']=="500") {
$_POST['Text'] = GM2k_Decrypt($_POST['Text']);	}
$HTML1 = array("<", ">");
$HTML2 = array("<", ">");
$_POST['Text'] = str_replace($HTML1, $HTML2, $_POST['Text']);
$HTML1 = array("<br>", "<br />");
$HTML2 = array("
", "
");
$_POST['Text'] = str_replace($HTML1, $HTML2, $_POST['Text']);
$_POST['Text'] = nl2br($_POST['Text']);
if($_POST['ZipData']!="none"&&$_POST['Encrypter']!="500") {
	if($_POST['ZipData']=="deflate") {
		$_POST['Text'] = gzdeflate($_POST['Text']); }
	if($_POST['ZipData']=="zlib") {
		$_POST['Text'] = gzcompress($_POST['Text']); }
	if($_POST['ZipData']=="bzip") {
		$_POST['Text'] = bzcompress($_POST['Text']); } }
if($_POST['EncodeData']!="none"&&$_POST['Encrypter']!="500") {
	if($_POST['EncodeData']=="base64") {
		$_POST['Text'] = base64_encode($_POST['Text']); }
	if($_POST['EncodeData']=="urlencode") {
		$_POST['Text'] = urlencode($_POST['Text']); } }
echo $_POST['Text']; }
?>


text:
#ifndef YOUBOTCONFIGURATION_H_
#define YOUBOTCONFIGURATION_H_

/* ROS includes */
#include "ros/ros.h"
#include "tf/transform_broadcaster.h"

/* OODL includes */
#include <youbot_driver/youbot/YouBotBase.hpp>
#include <youbot_driver/youbot/YouBotManipulator.hpp>
#include <actionlib/server/simple_action_server.h>
#include <control_msgs/FollowJointTrajectoryAction.h>

typedef actionlib::SimpleActionServer<control_msgs::FollowJointTrajectoryAction> Server;

class JointTrajectoryAction;

namespace youBot
{

class YouBotBaseConfiguration
{
public:

    /// Standard constructor
    YouBotBaseConfiguration();

    /// Standard destructor
    virtual ~YouBotBaseConfiguration();

    /// Handle to the base
    youbot::YouBotBase* youBotBase;

    /// "Name" of the base. Typically derived from name of youBot configuration file.
    std::string baseID;

    /// Joint names for the wheels
    std::vector<std::string> wheelNames;

    /// Receives Twist messages for the base.
    ros::Subscriber baseCommandSubscriber;

    /// Publishes Odometry messages
    ros::Publisher baseOdometryPublisher;

    /// Publishes JointState messages with angles/velocities for the wheels.
    ros::Publisher baseJointStatePublisher;

    /// Service to switch the motor off by setting the PWM value to zero
    ros::ServiceServer switchOffMotorsService;

    /// Service to switch the motor ON by setting the velocity to zero
    ros::ServiceServer switchONMotorsService;

    /// Publishes tf frames as odometry
    tf::TransformBroadcaster odometryBroadcaster;

};

class YouBotArmConfiguration
{
public:

    /// Standard constructor
    YouBotArmConfiguration();

    /// Standard destructor
    virtual ~YouBotArmConfiguration();

    /// Handle to the arm
    youbot::YouBotManipulator* youBotArm;

    /// "Name" of the arm. Typically derived from name of youBot configuration file.
    std::string armID;

    /// Name prefix for topic e.g arm_1/...
    std::string commandTopicName;

    /// Parent frameID for the published messages
    std::string parentFrameIDName;

    /// Names of the joints. Are typically derived from the configuration files
    std::vector<std::string> jointNames;

    ///Joint names for the gripper fingers
    std::vector<std::string> gripperFingerNames;

    const static unsigned int LEFT_FINGER_INDEX = 0;
    const static unsigned int RIGHT_FINGER_INDEX = 1;

    /// Receives "brics_actuator/JointPositions" for the arm joints
    ros::Subscriber armPositionCommandSubscriber;

    /// Receives "brics_actuator/JointVelocities" for the arm joints
    ros::Subscriber armVelocityCommandSubscriber;

	/// Implements a "control_msgs/FollowJointTrajectory" action
	actionlib::ActionServer<control_msgs::FollowJointTrajectoryAction> *armJointTrajectoryAction;

    /// Receives "brics_actuator/JointPositions" for the gripper
    ros::Subscriber gripperPositionCommandSubscriber;

    /// Publishes JointState messages with angles for the arm.
    ros::Publisher armJointStatePublisher;

    /// Service to switch the motor off by setting the PWM value to zero
    ros::ServiceServer switchOffMotorsService;

    /// Service to switch the motor ON by setting the velocity to zero
    ros::ServiceServer switchONMotorsService;

    /// Service to calibrate the arm
    ros::ServiceServer calibrateService;

    //Server* trajectoryActionServer;
    //JointTrajectoryAction* jointTrajectoryAction;

    /**
     * This variable memorizes the last successfully set value for the gripper,
     * so it can be published in the joint state message. This is necessary at the moment, as
     * it is not yet possible to measure the actual distance. Consider the gripper joint state
     * as an open loop value.
     */
    double lastGripperCommand;

};

/**
 * @brief Aggregation class for instantiated parts of a youBot systems and all its name mapping between ROS and the youBot API.
 */
class YouBotConfiguration
{
public:
    YouBotConfiguration();
    virtual ~YouBotConfiguration();

    /// Path to the configuration files, required by OODL (e.g. youbot-base.cfg)
    std::string configurationFilePath;

    ///Flag to indicate if youBot has a base (set after successful initialization)
    bool hasBase;

    ///Flag to indicate if youBot has one or more arms (set after successful initialization)
    bool hasArms;

    /// A youbot system has one base
    YouBotBaseConfiguration baseConfiguration;

    /// A youbot system has one or more arms
    std::vector<YouBotArmConfiguration> youBotArmConfigurations;
    std::map<std::string, int> armNameToArmIndexMapping;

    /// Publishes diagnostic messages
    ros::Publisher diagnosticArrayPublisher;

    ros::Publisher dashboardMessagePublisher;
};

} // namespace youBot

#endif /* YOUBOTCONFIGURATION_H_ */

/* EOF */


text:
[Check out the demo](https://bobby-brennan.github.io/strapping)

Strapping is a web plugin for live-editing custom [Bootstrap](http://getbootstrap.com) themes.
Include Strapping on any page that uses Bootstrap CSS, and use the toolbar to modify the page's
colors, sizes, and fonts.

You can incorporate Strapping into your project in two ways:

1. Include Strapping in **development** to help you customize your site's styles
2. Include Strapping in **production** to allow users and teams to create themes for your site

## Usage
```
npm install --save strapping
```

The `dist/` folder comes with two files:

* strapping.min.js
* sass.worker.js - from [sass.js](http://github.com/medialize/sass.js)

sass.worker.js is rather large (~3MB), so it's only loaded if Strapping
is initialized.

```html
<html>
  <head>
    <script src="path/to/strapping.min.js"></script>
  </head>
  <body onload="strapping.initialize('path/to/sass.worker.js')">
    <div class="alert alert-info">
      Customize Me!
    </div>
  </body>
</html>
```

## Customization

### Saving
By default, Strapping provides buttons for saving the resulting CSS or Sass to a local file.
If you're using Strapping in production to allow your users to customize your UI, you'll probably
want to save the result to a CDN or database. To do this, you can replace the default buttons
with your own:
```
window.save = function(result) {
  if (result.status) throw new Error(result.message);
  console.log(result.css);
  console.log(result.sass);
  console.log(result.json);
  // Pass the result to S3, localStorage, ...
}

strapping.initialize({
  workerPath: 'path/to/sass.worker.js',
  heading: `
<a onclick="strapping.compile()">Preview</a>
<a onclick="strapping.compile(save)">Save</a>
  `,
})
```

### Loading
You can use `strapping.load()` to set the theme using saved JSON or Sass:

```
window.save = function((result) => {
  localStorage.setItem('_variables.scss', result.sass);
})

let saved = localStorage.getItem('_variables.scss');
if (saved) strapping.load(saved);
```

### Position and Styles
By default Strapping will just append itself to the document body. You can also pass
in a parent element:

```html
<body>
  <div id="Strapping"></div>
  <script>
    strapping.initialize({
      workerPath: 'path/to/sass.worker.js',
      parent: document.getElementById('Strapping'),
    });
  </script>
</body>
```

The inserted element will have the id `#StrappingEditor`, so you can also apply CSS to it:

```css
#StrappingEditor {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: 300px;
}
```

### Fields
By default, Strapping allows modification of any Bootstrap variable. You can restrict the list
of available fields using strings and regular expressions:

```js
strapping.initialize({
  workerPath: 'path/to/sass.worker.js',
  fields: [/^(alert-|button-|brand-)/, 'border-radius-base', 'link-color'],
})
```


text:
package org.elasticsearch.action.support.master;

import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.ObjectParser;
import org.elasticsearch.common.xcontent.XContentBuilder;

import java.io.IOException;
import java.util.Objects;

import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;

public abstract class ShardsAcknowledgedResponse extends AcknowledgedResponse {

    private static final ParseField SHARDS_ACKNOWLEDGED = new ParseField("shards_acknowledged");

    protected static <T extends ShardsAcknowledgedResponse> void declareAcknowledgedAndShardsAcknowledgedFields(
            ConstructingObjectParser<T, Void> objectParser) {
        declareAcknowledgedField(objectParser);
        objectParser.declareField(constructorArg(), (parser, context) -> parser.booleanValue(), SHARDS_ACKNOWLEDGED,
                ObjectParser.ValueType.BOOLEAN);
    }

    private boolean shardsAcknowledged;

    protected ShardsAcknowledgedResponse() {
    }

    protected ShardsAcknowledgedResponse(boolean acknowledged, boolean shardsAcknowledged) {
        super(acknowledged);
        assert acknowledged || shardsAcknowledged == false; // if it's not acknowledged, then shards acked should be false too
        this.shardsAcknowledged = shardsAcknowledged;
    }

    /**
     * Returns true if the requisite number of shards were started before
     * returning from the index creation operation. If {@link #isAcknowledged()}
     * is false, then this also returns false.
     */
    public boolean isShardsAcknowledged() {
        return shardsAcknowledged;
    }

    protected void readShardsAcknowledged(StreamInput in) throws IOException {
        shardsAcknowledged = in.readBoolean();
    }

    protected void writeShardsAcknowledged(StreamOutput out) throws IOException {
        out.writeBoolean(shardsAcknowledged);
    }

    @Override
    protected void addCustomFields(XContentBuilder builder, Params params) throws IOException {
        builder.field(SHARDS_ACKNOWLEDGED.getPreferredName(), isShardsAcknowledged());
    }

    @Override
    public boolean equals(Object o) {
        if (super.equals(o)) {
            ShardsAcknowledgedResponse that = (ShardsAcknowledgedResponse) o;
            return shardsAcknowledged == that.shardsAcknowledged;
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), shardsAcknowledged);
    }

}


text:
SlackMe allows you to start a long running process and then forget it until it messages you at the Slack webhook you provide.

## Installation
Note: Because I'm lazy you're gonna have to go and install requests yourself. Simple enough.

Put `slackme` in a bin folder that's in your path.

## Usage
Note: You must set the "SLACK_WEBHOOK" environment variable to the webhook you get from Slack from the channel you wish to ping on completion.

To use, simply pass the command you wish to run as an argument to `slackme`.
e.g. The following command will wait for 5 seconds and then ping your webhook: `slackme sleep 5`


text:
:- ensure_loaded('$REGULUS/PrologLib/compatibility').

%---------------------------------------------------------------

:- module(make_adv_transforms,
	  [make_adv_list/2,
	   test_make_adv_list/1
	   ]
      ).

%---------------------------------------------------------------

:- use_module('$REGULUS/PrologLib/CorpusTools/tokenize_sents').

:- use_module('$REGULUS/PrologLib/utilities').

:- use_module(library(lists)).

%---------------------------------------------------------------

test_make_adv_list(advs) :-
	make_adv_list('$ACCEPT/MT/Europarl/Mmorph/raw_advs.pl',
		      '$ACCEPT/MT/Europarl/Mmorph/advs.pl').

%---------------------------------------------------------------

make_adv_list(RawFile, AdvListFile) :-
	init_make_adv_list(RawFile),
	make_adv_list1(AdvListFile).

make_adv_list1(File) :-
	safe_absolute_file_name(File, AbsFile),
	find_advs(Advs),
	write_out_transforms(Advs, AbsFile).

%---------------------------------------------------------------

init_make_adv_list(File) :-
	safe_absolute_file_name(File, AbsFile),
	format('~N--- Loading advs file: ~w~n', [AbsFile]),
	compile(File).

%---------------------------------------------------------------

% mmorph_entry([surface=virulemment,lemma=virulemment,pos='Adverb',tag=[adv],form=[surface]]).

find_advs(Entries) :-
	findall(adv(Surface),
		(   mmorph_entry([surface=Surface, lemma=_Lemma, pos='Adverb' | _OtherFeats])
		),
		Entries0
	       ),
	sort(Entries0, Entries).

%---------------------------------------------------------------

write_out_transforms(Transforms, AbsTransformFile) :-
	length(Transforms, N),
	list_to_prolog_file(Transforms, AbsTransformFile),
	format('~N--- Written adv file (~d elements): ~w~n', [N, AbsTransformFile]),
	!.


text:
using System;
using System.Linq;
using Bytes2you.Validation.ValidationPredicates.FloatPredicates;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Bytes2you.Validation.UnitTests.ValidationPredicates.FloatPredicates.FloatInfinityValidationPredicateTests
{
    [TestClass]
    public class Match_Should
    {
        [TestMethod]
        public void ReturnTrueAndMatchMessage_WhenArgumentIsFloatPositiveInfinity()
        {
            // Arrange.
            float value = float.PositiveInfinity;

            // Act.
            IValidationPredicateResult result = FloatInfinityValidationPredicate.Instance.Match(value);

            // Assert.
            Assert.IsTrue(result.IsMatch);
            Assert.AreEqual("The argument is infinity.", result.Message);
        }

        [TestMethod]
        public void ReturnTrueAndMatchMessage_WhenArgumentIsFloatNegativeInfinity()
        {
            // Arrange.
            float value = float.NegativeInfinity;

            // Act.
            IValidationPredicateResult result = FloatInfinityValidationPredicate.Instance.Match(value);

            // Assert.
            Assert.IsTrue(result.IsMatch);
            Assert.AreEqual("The argument is infinity.", result.Message);
        }

        [TestMethod]
        public void ReturnFalseAndUnmatchMessage_WhenArgumentIsNotFloatInfinity()
        {
            // Arrange.
            float value = 5;

            // Act.
            IValidationPredicateResult result = FloatInfinityValidationPredicate.Instance.Match(value);

            // Assert.
            Assert.IsFalse(result.IsMatch);
            Assert.AreEqual("Argument value <5> is not infinity.", result.Message);
        }
    }
}


text:
package rootio

import (
	"bytes"
	"compress/zlib"
	"fmt"
	"io"
	"reflect"
	"time"
)

// Key is a key (a label) in a ROOT file
//
//  The Key class includes functions to book space on a file,
//   to create I/O buffers, to fill these buffers
//   to compress/uncompress data buffers.
//
//  Before saving (making persistent) an object on a file, a key must
//  be created. The key structure contains all the information to
//  uniquely identify a persistent object on a file.
//  The Key class is used by ROOT:
//    - to write an object in the Current Directory
//    - to write a new ntuple buffer
type Key struct {
	f *File // underlying file

	bytes    int32     // number of bytes for the compressed object+key
	version  int16     // version of the Key struct
	objlen   int32     // length of uncompressed object
	datetime time.Time // Date/Time when the object was written
	keylen   int32     // number of bytes for the Key struct
	cycle    int16     // cycle number of the object

	// address of the object on file (points to Key.bytes)
	// this is a redundant information used to cross-check
	// the data base integrity
	seekkey  int64
	seekpdir int64 // pointer to the directory supporting this object

	classname string // object class name
	name      string // name of the object
	title     string // title of the object

	read bool
	data []byte
	obj  Object
}

func (k *Key) Class() string {
	return k.classname
}

func (k *Key) Name() string {
	return k.name
}

func (k *Key) Title() string {
	return k.title
}

func (k *Key) Cycle() int {
	return int(k.cycle)
}

// Value returns the data corresponding to the Key's value
func (k *Key) Value() interface{} {
	v, err := k.Object()
	if err != nil {
		panic(err)
	}
	return v
}

// Object returns the (ROOT) object corresponding to the Key's value.
func (k *Key) Object() (Object, error) {
	if k.obj != nil {
		return k.obj, nil
	}

	buf, err := k.Bytes()
	if err != nil {
		return nil, err
	}

	fct := Factory.Get(k.Class())
	if fct == nil {
		return nil, fmt.Errorf("rootio: no registered factory for class %q (key=%q)", k.Class(), k.Name())
	}

	v := fct()
	obj, ok := v.Interface().(Object)
	if !ok {
		return nil, fmt.Errorf("rootio: class %q does not implement rootio.Object (key=%q)", k.Class(), k.Name())
	}

	vv, ok := obj.(ROOTUnmarshaler)
	if !ok {
		return nil, fmt.Errorf("rootio: class %q does not implement rootio.ROOTUnmarshaler (key=%q)", k.Class(), k.Name())
	}

	err = vv.UnmarshalROOT(NewRBuffer(buf, nil, uint32(k.keylen)))
	if err != nil {
		return nil, err
	}

	if vv, ok := obj.(SetFiler); ok {
		vv.SetFile(k.f)
	}

	return obj, nil
}

// Bytes returns the buffer of bytes corresponding to the Key's value
func (k *Key) Bytes() ([]byte, error) {
	if !k.read {
		data, err := k.load()
		if err != nil {
			return nil, err
		}
		k.data = data
		k.read = true
	}
	return k.data, nil
}

func (k *Key) load() ([]byte, error) {
	var buf bytes.Buffer
	if k.isCompressed() {
		// Note: this contains ZL[src][dst] where src and dst are 3 bytes each.
		// Won't bother with this for the moment, since we can cross-check against
		// objlen.
		const rootHDRSIZE = 9

		start := k.seekkey + int64(k.keylen) + rootHDRSIZE
		r := io.NewSectionReader(k.f, start, int64(k.bytes)-int64(k.keylen))
		rc, err := zlib.NewReader(r)
		if err != nil {
			return nil, err
		}

		_, err = io.Copy(&buf, rc)
		if err != nil {
			return nil, err
		}
		return buf.Bytes(), nil
	}
	start := k.seekkey + int64(k.keylen)
	r := io.NewSectionReader(k.f, start, int64(k.bytes))
	_, err := io.Copy(&buf, r)
	if err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}

func (k *Key) isCompressed() bool {
	return k.objlen != k.bytes-k.keylen
}

// UnmarshalROOT decodes the content of data into the Key
func (k *Key) UnmarshalROOT(r *RBuffer) error {
	if r.Err() != nil {
		return r.Err()
	}

	k.bytes = r.ReadI32()
	if k.bytes < 0 {
		k.classname = "[GAP]"
		return nil
	}

	k.version = r.ReadI16()
	k.objlen = r.ReadI32()
	k.datetime = datime2time(r.ReadU32())
	k.keylen = int32(r.ReadI16())
	k.cycle = r.ReadI16()

	if k.version > 1000 {
		k.seekkey = r.ReadI64()
		k.seekpdir = r.ReadI64()
	} else {
		k.seekkey = int64(r.ReadI32())
		k.seekpdir = int64(r.ReadI32())
	}

	k.classname = r.ReadString()
	k.name = r.ReadString()
	k.title = r.ReadString()

	myprintf("key-version: %v\n", k.version)
	myprintf("key-objlen:  %v\n", k.objlen)
	myprintf("key-cdate:   %v\n", k.datetime)
	myprintf("key-keylen:  %v\n", k.keylen)
	myprintf("key-cycle:   %v\n", k.cycle)
	myprintf("key-seekkey: %v\n", k.seekkey)
	myprintf("key-seekpdir:%v\n", k.seekpdir)
	myprintf("key-compress: %v %v %v %v %v\n", k.isCompressed(), k.objlen, k.bytes-k.keylen, k.bytes, k.keylen)
	myprintf("key-class: [%v]\n", k.classname)
	myprintf("key-name:  [%v]\n", k.name)
	myprintf("key-title: [%v]\n", k.title)

	//k.pdat = data

	return r.Err()
}

func init() {
	f := func() reflect.Value {
		o := &Key{}
		return reflect.ValueOf(o)
	}
	Factory.add("TKey", f)
	Factory.add("*rootio.Key", f)
}

var _ Object = (*Key)(nil)
var _ Named = (*Key)(nil)
var _ ROOTUnmarshaler = (*Key)(nil)


text:
layout: post
title: phonenumber v.0.2.0 - memetic polyalloy
date: 2015-08-01
comments: true
categories:
 - rstats
 - r-package
 - software
summary: new version of phonenumber R package
---

The updated version of my R package, [phonenumber](https://stevemyles.site/phonenumber/) ([v.0.2.0 - memetic polyalloy](https://github.com/scumdogsteev/phonenumber/releases/tag/v0.2.0)), is now [available on CRAN](https://CRAN.R-project.org/package=phonenumber).


text: Copyright © 2015 Modern. All Rights Reserved | Design by Depex


text:
package com.arjun.travel;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import java.util.Collections;
import java.util.List;

/**
 * Created by arjun on 9/10/15.
 */
public class NavBarAdapter extends RecyclerView.Adapter<NavBarAdapter.MyViewHolder>{

    private LayoutInflater inflater;
    List<NavBarData> data = Collections.emptyList();
    private Context context;
    public NavBarAdapter(Context context, List<NavBarData> data ){
        this.context = context;
        inflater = LayoutInflater.from(context);
        this.data = data;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.custom_row, parent, false);
        MyViewHolder holder = new MyViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(final MyViewHolder holder, int position) {
        NavBarData current = data.get(position);
        holder.title.setText(current.getTitle());
        holder.title.setTag(R.id.listTitle,current.getIconId());
        /*holder.icon.setImageResource(current.getIconId());*/
        /*holder.icon.setImageURI(Uri.parse(current.getIconUri()));*/
        holder.icon.setImageDrawable(current.getThumb_d());
        holder.discription.setText(current.getDiscription());
        holder.title.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(v.getContext(),holder.title.getText(),Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    public int getItemCount() {
        return data.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnTouchListener {
        TextView title;
        ImageView icon;
        TextView discription;

        public MyViewHolder(View itemView) {
            super(itemView);
            title = (TextView) itemView.findViewById(R.id.listTitle);
            icon = (ImageView) itemView.findViewById(R.id.listIcon);
            discription = (TextView) itemView.findViewById(R.id.listDisc);
            itemView.setOnTouchListener(this);
        }

        @Override
        public void onClick(View v) {

        }

        @Override
        public boolean onTouch(View v, MotionEvent event) {

            LinearLayout li =(LinearLayout) v.findViewById(R.id.custom_row_layout);
            TextView textView = (TextView) v.findViewById(R.id.listTitle);
            li.setBackgroundColor(Color.parseColor("#EEEEEE"));
            context.startActivity(new Intent(context,CarsActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("id",textView.getTag(R.id.listTitle).toString()));
            return false;

        }

    }

    public void delete(int position) {
        data.remove(position);
        notifyItemRemoved(position);
    }

}


text:
package com.pipipark.commons.date.excep;

import com.pipipark.commons.PPPark;
import com.pipipark.commons.date.PPPDateMonth;
import com.pipipark.commons.throwable.ExceptionMessage;
import com.pipipark.commons.throwable.PPPRuntimeException;

/**
 * 月配置异常.
 * @version 1.0
 * @author 陈文杰
联系邮箱

 * @since 2016年12月1日
 */
@SuppressWarnings("serial")
public class DateMonthException extends PPPRuntimeException {

	public DateMonthException(Integer month, Class<PPPDateMonth> cause) {
		super(new ExceptionMessage("Month number {0} no found in {1}", month, PPPark.String.aliasName(cause)));
	}

}


text:
(function () {

  /**
   * @ngdoc service
   * @name ds.datepicker.dsDateFormatService
   *
   * @description
   * Date format helper service to identify the ingredients of a date time format. The {@link ds.datepicker.dsDateFormatService#methods_generateDateFormatFix `generateDateFormatFix()`}
   * method helps to fix dates / date formats, which do not include all ingredients of the raw date. It will fix the new
   * date with the values of the old date.
   *
   * The services is based on {@link http://momentjs.com `moment.js`}. Have a look at the
   * {@link http://momentjs.com/docs/#/displaying/format/ `format options`}, if you need some more information about how
   * to set up the format / which elements can be used.
   */
  angular.module('ds.datepicker')
      .factory('dsDateFormatService', function ($log, $q) {

        var mPublicApi;

        mPublicApi = {
          identifyFormat: identifyFormat,
          generateDateFormatFix: generateDateFormatFix
        };

        return mPublicApi;

        /* ##################
         * ### PUBLIC API ###
         * ################## */

        /**
         * @ngdoc method
         * @name identifyFormat
         * @methodOf ds.datepicker.dsDateFormatService
         *
         * @description
         * Identify the ingredients of a specific format. The method will return an object containing the different date
         * time types in combination with an identifier, if this type will be fulfilled within the format.
         *
         * The following types will be set within the object:
         *
         *  - **`date`** `{boolean}`
         *  - **`hours`** `{boolean}`
         *  - **`milliseconds`** `{boolean}`
         *  - **`minutes`** `{boolean}`
         *  - **`months`** `{boolean}`
         *  - **`seconds`** `{boolean}`
         *  - **`years`** `{boolean}`
         *
         * @param {String} format The date time format string including
         *        {@link http://momentjs.com/docs/#/displaying/format/ `moment.js format options`}.
         * @return {Promise} A promise which will be resolved, if the given input format is a string. It will be
         *         resolved with an object, which describes the ingredients of the format (see description). It will be
         *         rejected, as soon as the format is not a valid string.
         */
        function identifyFormat(format) {
          var tDefer,
              tMoment,
              tParsed,
              tIngredients = {};

          tDefer = $q.defer();

          if (angular.isString(format)) {
            // define a comparable date format object
            tMoment = moment(658665031337);

            // format it according to the given format and then transform it back to an object
            tParsed = moment(tMoment.format(format), format).toObject();

            // finally check which values are set / not set
            angular.forEach(tMoment.toObject(), function (rawValue, type) {
              tIngredients[type] = tParsed[type] === rawValue || tParsed[type] !== 0;
            });

            tDefer.resolve(tIngredients);
          } else {
            tDefer.reject('Unable to identify format - the given format is not a string. [' + format + ']');
          }

          return tDefer.promise;
        }

        /**
         * @ngdoc method
         * @name generateDateFormatFix
         * @methodOf ds.datepicker.dsDateFormatService
         *
         * @description
         * Generate a function which will fix the new date, according to the old date and the information which are
         * contained in the new date. That means, if the format just contains date information and no time information,
         * the time will be used from the old date object and inserted into the new one.
         *
         * The function which will be returned in the `resolve` method accepts the following arguments:
         *
         * ```+js
         *  function(newDate, oldDate){};
         * ```
         *
         * According to the defined format, the missing values in the `newDate` will be updated using the `oldDate`.
         * Finally the `newDate` will also be returned;
         *
         * @param {String} format The date time format string including
         *        {@link http://momentjs.com/docs/#/displaying/format/ `moment.js format options`}.
         * @return {Promise} A promise, which will be resolved with a function, if the given format is a valid format.
         *         For more information about the returned function have a look at the description. The promise will be
         *         rejected, as soon as the given format is not a valid format.
         */
        function generateDateFormatFix(format) {
          var tDefer;

          tDefer = $q.defer();

          // identify the format
          identifyFormat(format)
              .then(function (ingredients) {
                var tFix = [];

                // add all not contained types to the fix array
                angular.forEach(ingredients, function (contains, type) {
                  if (!contains) {
                    tFix.push(type);
                  }
                });

                // finally generate the dateFormatFix and return it as function
                tDefer.resolve(_dateFormatFix(tFix));
              }).catch(tDefer.reject);

          return tDefer.promise;
        }

        /* ######################
         * ### HELPER METHODS ###
         * ###################### */

        /**
         * @name _dateFormatFix
         *
         * @description
         * Generate a function which will update the `newDate`, if not all date time information are contained within
         * the format. In this case, the `oldDate` will be used to update the `newDate`.
         *
         * @param {Array.<String>} fixes Array containing the types, which should be fixed.
         * @return {Function} A function accepting a `newDate` and `oldDate`. The `newDate` will be updated with the
         *         information of the `oldDate`, which are stored in the array of fixes.
         *
         * @private
         */
        function _dateFormatFix(fixes) {
          return function (date, oldDate) {
            // if the oldDate is set, and the array of fixes is bigger than 0, then update the `newDate` with the
            // information of the `oldDate`.
            if (oldDate && oldDate.isValid() && fixes.length > 0) {
              fixes.forEach(function (type) {
                date.set(type, oldDate.get(type));
              });
            }

            return date;
          };
        }

      });
}());


text:
class Floor {
    int maxX;
    int minX;
    int maxY;
    int minY;

    Room *_startingRoom;
    Room *_exitRoom;

    std::map<int, std::map<int, Room * >> _rooms;

    std::vector<Corridor *> _corridors;

    void addRoom(Room *room);

    int roomCount();

    Room *getRandomRoomWithFreeEdge(std::vector<Coordinate *> coordinates, int tries);

    Coordinate *chooseFreeEdge(Coordinate *coordinate);

public:
    Floor(bool debug, Room *previous, int amountRooms, int roomsPerLock, bool last = false);

    ~Floor();

    Room *getStartingRoom() const { return _startingRoom; };

    Room *getExitRoom() const { return _exitRoom; }

    int getMinX() const { return minX; };

    int getMaxX() const { return maxX; };

    int getMinY() const { return minY; };

    int getMaxY() const { return maxY; };

    Room *getRoom(int x, int y);

    const std::vector<Corridor *> &getCorridors() const { return _corridors; }

    const std::map<int, std::map<int, Room *>> *getRooms() const { return &_rooms; }
};

#endif //THE_ELDER_CODES_FLOOR_H


text:
'use strict';

var parseCSS = require('css-rules'),
    cheerio = require('cheerio'),
    Selector = require('style-selector'),
    Property = require('css-property'),
    styleSelector = new Selector('<style attribute>', [1, 0, 0, 0]),
    importantSelector = new Selector('<!important>', [2, 0, 0, 0]),
    ignoredPseudos = ['hover', 'active', 'focus', 'visited', 'link'],
    widthElements = ['table', 'td', 'img'];

module.exports = function (html, css, options) {
    var rules = parseCSS(css),
        editedElements = [],
        $ = cheerio.load(html, {
            decodeEntities: false
        });

    function handleRule(rule) {
        var sel = rule[0],
        style = rule[1],
        selector = new Selector(sel);

        // skip rule if the selector has any pseudos which are ignored
        var parsedSelector = selector.parsed();
        for (var i = 0; i < parsedSelector.length; ++i) {
            var subSel = parsedSelector[i];
            if (subSel.pseudos) {
                for (var j = 0; j < subSel.pseudos.length; ++j) {
                    var subSelPseudo = subSel.pseudos[j];
                    if (ignoredPseudos.indexOf(subSelPseudo.name) >= 0) {
                        return;
                    }
                }
            }
        }

        var $els;
        try {
            $els = $(sel);
        } catch (err) {
            // skip invalid selector
            return;
        }
        $els.each(function (index, el) {
            // go through the properties
            function addProps(style, selector) {
                for (var i = 0, l = style.length; i < l; i++) {
                    var name = style[i],
                        value = style[name],
                        sel = style._importants[name] ? importantSelector : selector,
                        prop = new Property(name, value, sel),
                        existing = el.styleProps[name],
                        winner,
                        loser;

                    if (existing) {
                        winner = existing.compare(prop);
                        loser = prop === winner ? existing : prop;

                      if (winner === prop) {
                          el.styleProps[name] = prop;
                      }
                    } else {
                      el.styleProps[name] = prop;
                    }
                }
            }

            if (!el.styleProps) {
                el.styleProps = {};

                // if the element has inline styles, fake selector with topmost specificity
                if ($(el).attr('style')) {
                    var cssText = '* { ' + $(el).attr('style') + ' } ';
                    addProps(parseCSS(cssText)[0][1], styleSelector);
                }

                // store reference to an element we need to compile style="" attr for
                editedElements.push(el);
            }

            addProps(style, selector);
        });
    }

    function setStyleAttrs(el) {
        var style = [];
        for (var i in el.styleProps) {
            style.push(el.styleProps[i].prop + ': ' + el.styleProps[i].value.replace(/["]/g, '\'') + ';');
        }
        // sorting will arrange styles like padding: before padding-bottom: which will preserve the expected styling
        style = style.sort(function (a, b) {
            var aProp = a.split(':')[0];
            var bProp = b.split(':')[0];
            return (aProp > bProp ? 1 : aProp < bProp ? -1 : 0);
        });
        $(el).attr('style', style.join(' '));
    }

    function setWidthAttrs(el) {
        if (widthElements.indexOf(el.name) > -1) {
            for (var i in el.styleProps) {
                if (el.styleProps[i].prop === 'width' && el.styleProps[i].value.match(/px/)) {
                    var pxWidth = el.styleProps[i].value.replace('px', '');
                    $(el).attr('width', pxWidth);
                    return;
                }
            }
        }
    }

    rules.forEach(handleRule);
    editedElements.forEach(setStyleAttrs);

    if (options && options.applyWidthAttributes) {
        editedElements.forEach(setWidthAttrs);
    }

    return $.html();
};


text:
#include "gazebo/sdf/sdf.hh"
#include "gazebo/math/Pose.hh"
#include "gazebo/common/Console.hh"
#include "gazebo/common/MeshManager.hh"
#include "gazebo/common/Mesh.hh"
#include "gazebo/common/Material.hh"

std::vector<std::string> params;

// To Render high quality: povray +H480 +W640 +R5 +AM2 +A0.3 +Q11 <filename>

// Convert radians to degrees
#define RTOD(r) ((r) * 180 / M_PI)

// Convert degrees to radians
#define DTOR(d) ((d) * M_PI / 180)

void help()
{
  printf("help");
}

bool parse(int argc, char **argv)
{
  if (argc == 1 || std::string(argv[1]) == "help")
  {
    help();
    return false;
  }

  // Get parameters from command line
  for (int i = 1; i < argc; i++)
  {
    std::string p = argv[i];
    boost::trim(p);
    params.push_back(p);
  }

  // Get parameters from stdin
  if (!isatty(fileno(stdin)))
  {
    char str[1024];
    while (!feof(stdin))
    {
      if (fgets(str, 1024, stdin)== NULL)
        break;

      if (feof(stdin))
        break;
      std::string p = str;
      boost::trim(p);
      params.push_back(p);
    }
  }

  return true;
}

gazebo::math::Vector3 Convert(const gazebo::math::Vector3 &_vec)
{
  gazebo::math::Vector3 result;
  gazebo::math::Quaternion rot1(0, M_PI*.5, 0);
  gazebo::math::Quaternion rot2(0, -M_PI*.5, 0);

  result = rot1.RotateVector(_vec);
  result = rot2.RotateVector(result);

  return result;
}

void ProcessMesh(sdf::ElementPtr _elem, const gazebo::math::Pose _pose)
{
  const gazebo::common::Mesh *mesh;

  mesh = gazebo::common::MeshManager::Instance()->Load(
      _elem->GetValueString("filename"));

  const_cast<gazebo::common::Mesh*>(mesh)->RecalculateNormals();

  for (unsigned int i = 0; i < mesh->GetSubMeshCount(); i++)
  {
    const gazebo::common::SubMesh *subMesh = mesh->GetSubMesh(i);
    printf("mesh2 {\n");
    printf("  vertex_vectors {\n");
    printf("    %d, \n    ", subMesh->GetVertexCount());
    for (unsigned int v = 0; v < subMesh->GetVertexCount(); v++)
    {
      gazebo::math::Vector3 vert = subMesh->GetVertex(v);
      // vert = _pose.CoordPositionAdd(vert);
      printf("<%f, %f, %f>, ", vert.x, vert.y, vert.z);
    }
    printf("  }\n");

    printf("  normal_vectors {\n");
    printf("    %d, \n    ", subMesh->GetNormalCount());
    for (unsigned int n = 0; n < subMesh->GetNormalCount(); n++)
    {
      gazebo::math::Vector3 norm = subMesh->GetNormal(n);
      printf("<%f, %f, %f>, ", norm.x, norm.y, norm.z);
    }
    printf("  }\n");

    printf("  uv_vectors {\n");
    printf("    %d, \n", subMesh->GetTexCoordCount());
    for (unsigned int j = 0; j < subMesh->GetTexCoordCount(); j++)
    {
      printf("    <%f, %f>, \n", subMesh->GetTexCoord(j).x,
        1.0 - subMesh->GetTexCoord(j).y);
    }
    printf("  }\n");

    const gazebo::common::Material *mat = mesh->GetMaterial(
        subMesh->GetMaterialIndex());
    if (mat)
    {
      printf("  texture_list {\n");
      printf("    1, \n");
      printf("  texture {\n");
      if (!mat->GetTextureImage().empty())
      {
        printf("    uv_mapping pigment { image_map ");
        printf("{ tiff \"%s\" } }\n",
            mat->GetTextureImage().c_str());
      }
      else
      {
        printf("    pigment { color rgb <%f, %f, %f> }\n",
            mat->GetDiffuse().r, mat->GetDiffuse().g, mat->GetDiffuse().b);
      }

      printf("    finish {\n");
      printf("      ambient color rgb <%f, %f, %f>\n",
          mat->GetAmbient().r, mat->GetAmbient().g, mat->GetAmbient().b);
      printf("      specular %f\n", 1.0);
      printf("    }\n");

      printf("  }\n");
      printf("  }\n");
    }

    printf("  face_indices {\n");
    printf("    %d, \n", subMesh->GetIndexCount() / 3);
    for (unsigned int j = 0; j < subMesh->GetIndexCount(); j+= 3)
    {
      if (mat)
      {
        printf("    <%d, %d, %d>, 0\n", subMesh->GetIndex(j),
            subMesh->GetIndex(j+1), subMesh->GetIndex(j+2));
      }
      else
      {
        printf("    <%d, %d, %d>\n", subMesh->GetIndex(j),
            subMesh->GetIndex(j+1), subMesh->GetIndex(j+2));
      }
    }
    printf("  }\n");

    printf("  normal_indices {\n");
    printf("    %d, \n", subMesh->GetIndexCount() / 3);
    for (unsigned int j = 0; j < subMesh->GetIndexCount(); j+= 3)
    {
      printf("    <%d, %d, %d>, \n", subMesh->GetIndex(j),
        subMesh->GetIndex(j+1), subMesh->GetIndex(j+2));
    }
    printf("  }\n");
/*
    printf("  uv_indices {\n");
    printf("    %d, \n", subMesh->GetIndexCount() / 3);
    for (unsigned int j = 0; j < subMesh->GetIndexCount(); j+= 3)
    {
      printf("    <%d, %d, %d>, \n", subMesh->GetIndex(j),
        subMesh->GetIndex(j+1), subMesh->GetIndex(j+2));
    }
    printf("  }\n");
    */

    gazebo::math::Vector3 rpy = _pose.rot.GetAsEuler();
    printf("  translate <%f, %f, %f>\n", _pose.pos.x, _pose.pos.y, _pose.pos.z);
    printf("  rotate <%f, %f, %f>\n", RTOD(rpy.x), RTOD(rpy.y), RTOD(rpy.z));

    printf("}\n");
  }
}

void ProcessLight(sdf::ElementPtr _elem)
{
  gazebo::math::Pose pose;
  gazebo::common::Color diffuse, specular;

  pose = _elem->GetOrCreateElement("origin")->GetValuePose("pose");
  diffuse = _elem->GetValueColor("diffuse");
  specular = _elem->GetValueColor("specular");
  // double fadeDist =
  // _elem->GetElement("attenuation")->GetValueDouble("range");
  // double constant =
  // _elem->GetElement("attenuation")->GetValueDouble("constant");
  // double linear = _elem->GetElement("attenuation")->GetValueDouble("linear");
  // double quadratic =
  // _elem->GetElement("attenuation")->GetValueDouble("quadratic");

  printf("light_source {\n");
  printf("  <%f, %f, %f>, rgb <%f, %f, %f>\n",
      pose.pos.x, pose.pos.y, pose.pos.z,
      diffuse.r, diffuse.g, diffuse.b);

  std::string type = _elem->GetValueString("type");
  if (type == "point")
  {
    // printf("  pointlight\n");
  }
  else if (type == "directional")
  {
    printf("  parallel\n");
  }
  else if (type == "spot")
  {
    double innerAngle, outerAngle, falloff;
    innerAngle = _elem->GetElement("spot")->GetValueDouble("inner_angle");
    outerAngle = _elem->GetElement("spot")->GetValueDouble("outer_angle");
    falloff = _elem->GetElement("spot")->GetValueDouble("falloff");
    printf("  spotlight\n");
    printf("  radius %f\n", RTOD(innerAngle));
    printf("  falloff %f\n", RTOD(outerAngle));
    printf("  tightness %f\n", falloff);
  }

  if (_elem->HasElement("direction"))
  {
    gazebo::math::Vector3 dir =
      _elem->GetElement("direction")->GetValueVector3("xyz");
    gazebo::math::Plane plane(gazebo::math::Vector3(0, 0, 1));

    double d = plane.Distance(pose.pos, dir);
    double t;
    t = atan2(dir.x, dir.z*-1);
    double x = sin(t) * d;
    t = atan2(dir.y, dir.z*-1);
    double y = sin(t) * d;
    printf("  point_at <%f, %f, 0.0>\n", x, y);
  }

  printf("}\n");
}

void ProcessScene(sdf::ElementPtr _elem)
{
  gazebo::common::Color color;
  if (_elem->HasElement("background"))
  {
    color = _elem->GetValueColor("background");
    printf("background { rgb <%f, %f, %f> }\n", color.r, color.g, color.b);
  }

  if (_elem->HasElement("ambient"))
  {
    color = _elem->GetValueColor("ambient");
    // printf("global_settings { ambient_light rgb <%f, %f, %f> }\n",
        // color.R(), color.G(), color.B());
  }

  // int count = 35;
  int count = 1600;

  // int recursionLimit = 3;
  int recursionLimit = 20;

  // float errorBound = 1.8;
  float errorBound = 1.0;

  // Note: Extreme quality
  printf("global_settings { radiosity{\n");
  printf("  count %d\n", count);
  printf("  recursion_limit %d\n", recursionLimit);
  printf("  error_bound %f\n", errorBound);

  printf("} }\n");
}

void ProcessGeometry(sdf::ElementPtr _elem, const gazebo::math::Pose &_pose)
{
  if (_elem->HasElement("plane"))
  {
    sdf::ElementPtr planeElem = _elem->GetElement("plane");
    gazebo::math::Vector3 normal = planeElem->GetValueVector3("normal");
    printf("plane {\n");
    printf("  <%f, %f, %f>, 0\n", normal.x, normal.y, normal.z);
    printf("  texture {pigment { color Yellow } }\n");
    printf("}\n");
  }
  else if (_elem->HasElement("box"))
  {
    sdf::ElementPtr boxElem = _elem->GetElement("box");
    gazebo::math::Vector3 size = boxElem->GetValueVector3("size");
    printf("box {\n");
    gazebo::math::Vector3 corner1 = _pose.pos - (size/2.0);
    gazebo::math::Vector3 corner2 = _pose.pos + (size/2.0);
    corner1 = _pose.rot.RotateVector(corner1);
    corner2 = _pose.rot.RotateVector(corner2);
    printf(" <%f, %f, %f, >, <%f, %f, %f>\n", corner1.x, corner1.y, corner1.z,
                                            corner2.x, corner2.y, corner2.z);
    printf("}\n");
  }
  else if (_elem->HasElement("cylinder"))
  {
    sdf::ElementPtr cylinderElem = _elem->GetElement("cylinder");
    double radius = cylinderElem->GetValueDouble("radius");
    double length = cylinderElem->GetValueDouble("length");
    gazebo::math::Vector3 capPoint = _pose.pos;
    capPoint.z += length;
    capPoint = _pose.rot.RotateVector(capPoint);
    printf("cylinder {\n");
    printf("  <%f, %f, %f>, <%f, %f, %f>, %f\n",
        _pose.pos.x, _pose.pos.y, _pose.pos.z,
        capPoint.x, capPoint.y, capPoint.z, radius);
    printf("}\n");
  }
  else if (_elem->HasElement("sphere"))
  {
    sdf::ElementPtr sphereElem = _elem->GetElement("sphere");
    double radius = sphereElem->GetValueDouble("radius");

    printf("sphere {\n");
    printf("  <%f, %f, %f> %f\n",
        _pose.pos.x, _pose.pos.y, _pose.pos.z, radius);
    printf("}\n");
  }
  else if (_elem->HasElement("mesh"))
  {
    ProcessMesh(_elem->GetElement("mesh"), _pose);
  }
}

int main(int argc, char **argv)
{
  if (!parse(argc, argv))
    return 0;

  // Load the world file
  sdf::SDFPtr sdf(new sdf::SDF);
  if (!sdf::init(sdf))
  {
    gzerr << "Unable to initialize sdf\n";
    return false;
  }

  if (!sdf::readFile(params[0], sdf))
  {
    gzerr << "Unable to read sdf file[" << params[0] << "]\n";
    return false;
  }

  printf("#include \"colors.inc\"\n");
  printf("#include \"shapes.inc\"\n");
  printf("camera {\n");
  printf("  location <-2, 0, 2>\n");
  printf("  look_at <0, 0, 1>\n");
  printf("  sky <0, 0, 1>\n");
  printf("  direction <1, 0, 0>\n");
  printf("  up <0, 0, -1>\n");
  printf("  right <0, 1, 0>\n");
  printf("}\n");

  sdf::ElementPtr root = sdf->root;

  gazebo::math::Pose modelPose, linkPose, visualPose;

  sdf::ElementPtr worldElem = root->GetElement("world");
  while (worldElem)
  {
    if (worldElem->HasElement("scene"))
      ProcessScene(worldElem->GetElement("scene"));

    if (worldElem->HasElement("light"))
    {
      sdf::ElementPtr lightElem = worldElem->GetElement("light");
      while (lightElem)
      {
        ProcessLight(lightElem);
        lightElem = lightElem->GetNextElement("light");
      }
    }

    sdf::ElementPtr modelElem = worldElem->GetElement("model");
    while (modelElem)
    {
      modelPose = modelElem->GetOrCreateElement("origin")->GetValuePose("pose");

      sdf::ElementPtr linkElem = modelElem->GetElement("link");
      while (linkElem)
      {
        linkPose = linkElem->GetOrCreateElement("origin")->GetValuePose("pose");

        if (linkElem->HasElement("visual"))
        {
          sdf::ElementPtr visualElem = linkElem->GetElement("visual");
          while (visualElem)
          {
            visualPose =
              visualElem->GetOrCreateElement("origin")->GetValuePose("pose");
            // visualPose = (visualPose + linkPose) + modelPose;
            visualPose = modelPose + (linkPose + visualPose);
            // visualPose.pos = modelPose.pos + linkPose.pos + visualPose.pos;
            // visualPose.rot = visualPose.rot * linkPose.rot * modelPose.rot;
            sdf::ElementPtr geomElem = visualElem->GetElement("geometry");
            ProcessGeometry(geomElem, visualPose);

            visualElem = visualElem->GetNextElement("visual");
          }
        }
        linkElem = linkElem->GetNextElement("link");
      }
      modelElem = modelElem->GetNextElement("model");
    }
    worldElem = worldElem->GetNextElement("world");
  }
}


text:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="uk.co.craigwarren.gasblender"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
    </application>

</manifest>


text:
                Glue42 is {{glueStatus}}

Stocks

                <channel-select [channels]="channels" (channelLeaveEmitter)="handleLeaveChannel()" (channelJoinEmitter)="handleJoinChannel($event)"></channel-select>

                        Symbol
                        Description
                        Bid
                        Ask

                        {{stock.RIC}}
                        {{stock.Description}}
                        {{stock.Bid}}
                        {{stock.Ask}}


text:
package io.reflectoring.thymeleafvue;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class ThymeleafVueApplicationTests {

	@Test
	void contextLoads() {
	}

}


text:
<!DOCTYPE html>

						<select>
						 <option th:each="var : ${books}"
                					th:value="${var.id}"
                					th:text="${var.name}">Books</option>

						</select>


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2017 Customerly
    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.
-->
<resources>
    <item type="id" name="io_customerly__progress_view" />
    <item type="id" name="io_customerly__first_contact_swipe_refresh" />
    <item type="id" name="io_customerly__layout_first_contact" />
    <item type="id" name="io_customerly__layout_first_contact__admin_container" />
    <item type="id" name="io_customerly__layout_first_contact__last_activity" />
    <item type="id" name="io_customerly__layout_first_contact__welcome" />
    <item type="id" name="io_customerly__recycler_view_swipe_refresh" />
    <item type="id" name="io_customerly__recycler_view" />
    <item type="id" name="io_customerly__input_layout" />
    <item type="id" name="io_customerly__input_edit_text" />
    <item type="id" name="io_customerly__input_button_attach" />
    <item type="id" name="io_customerly__input_button_send" />
    <item type="id" name="io_customerly__input_attachments" />
    <item type="id" name="io_customerly__input_email_layout" />
    <item type="id" name="io_customerly__input_email_edit_text" />
    <item type="id" name="io_customerly__input_email_button" />
    <item type="id" name="io_customerly__new_conversation_layout" />
    <item type="id" name="io_customerly__new_conversation_button" />
    <item type="id" name="io_customerly__powered_by" />
    <item type="id" name="io_customerly__icon" />
    <item type="id" name="io_customerly__arrow" />
    <item type="id" name="io_customerly__name" />
    <item type="id" name="io_customerly__job" />
    <item type="id" name="io_customerly__last_message" />
    <item type="id" name="io_customerly__time" />
    <item type="id" name="io_customerly__date" />
    <item type="id" name="io_customerly__content" />
    <item type="id" name="io_customerly__bubble" />
    <item type="id" name="io_customerly__profilingform_container_truefalse" />
    <item type="id" name="io_customerly__profilingform_button_true" />
    <item type="id" name="io_customerly__profilingform_button_false" />
    <item type="id" name="io_customerly__profilingform_container_input" />
    <item type="id" name="io_customerly__profilingform_container_date" />
    <item type="id" name="io_customerly__profilingform_input" />
    <item type="id" name="io_customerly__askemail_input" />
    <item type="id" name="io_customerly__askemail_submit" />
    <item type="id" name="io_customerly__profilingform_date" />
    <item type="id" name="io_customerly__profilingform_button_submit_input" />
    <item type="id" name="io_customerly__profilingform_button_submit_date" />
    <item type="id" name="io_customerly__attachment_layout" />
    <item type="id" name="io_customerly__pending_message_label" />
    <item type="id" name="io_customerly__content_sending_progressspinner" />
    <item type="id" name="io_customerly__menu__download" />
    <item type="id" name="io_customerly__menu__open_in_browser" />
    <item type="id" name="io_customerly__back" />
    <item type="id" name="io_customerly__close" />
    <item type="id" name="io_customerly__title" />
    <item type="id" name="io_customerly__toolbar" />
    <item type="id" name="io_customerly__actionlayout" />
    <item type="id" name="io_customerly__subtitle" />
    <item type="id" name="io_customerly__typing_account_icon" />
    <item type="id" name="io_customerly__background_theme" />
    <item type="id" name="io_customerly__cardaccount_name" />
    <item type="id" name="io_customerly__cardaccount_job" />
    <item type="id" name="io_customerly__cardaccount_motto" />
    <item type="id" name="io_customerly__cardaccount_location" />
    <item type="id" name="io_customerly__cardaccount_location_layout" />
    <item type="id" name="io_customerly__cardaccount_fb" />
    <item type="id" name="io_customerly__cardaccount_twitter" />
    <item type="id" name="io_customerly__cardaccount_linkedin" />
    <item type="id" name="io_customerly__cardaccount_instagram" />
    <item type="id" name="io_customerly__cardaccount_cardlayout" />
</resources>


text:
from abc import ABCMeta

from useintest.services.models import User, DockerisedServiceWithUsers
from useintest.services.builders import DockerisedServiceControllerTypeBuilder
from useintest.services.controllers import DockerisedServiceController, ServiceType

ROOT_USERNAME = "root"
ROOT_PASSWORD = "gitlab123"

_repository = "gitlab/gitlab-ce"
_ports = [80, 433, 22]
_start_detector = lambda log_line: "==> /var/log/gitlab/redis/current <==" in log_line
_persistent_error_detector = lambda log_line: "o space left on device" in log_line
_environment_variables = {"GITLAB_ROOT_PASSWORD": ROOT_PASSWORD}

class GitLabBaseServiceController(DockerisedServiceController[ServiceType], metaclass=ABCMeta):
    """
    Base class for GitLab service controllers.
    """
    def start_service(self) -> DockerisedServiceWithUsers[User]:
        service = super().start_service()
        service.root_user = User(ROOT_USERNAME, ROOT_PASSWORD)
        return service

common_setup = {
    "superclass": GitLabBaseServiceController,
    "repository": _repository,
    "start_log_detector": _start_detector,
    "persistent_error_log_detector": _persistent_error_detector,
    "ports": _ports,
    "additional_run_settings": {"environment": _environment_variables}
}

GitLab8_10_4_ce_0ServiceController = DockerisedServiceControllerTypeBuilder(
    name="GitLab8_10_4_ce_0ServiceController",
    tag="8.10.4-ce.0",
    **common_setup).build()

GitLab8_13_11_ce_0ServiceController = DockerisedServiceControllerTypeBuilder(
    name="GitLab8_13_11_ce_0ServiceController",
    tag="8.13.11-ce.0",
    **common_setup).build()

GitLab8_16_6_ce_0ServiceController = DockerisedServiceControllerTypeBuilder(
    name="GitLab8_16_6_ce_0ServiceController",
    tag="8.16.6-ce.0",
    **common_setup).build()

GitLab10_0_3_ce_0ServiceController = DockerisedServiceControllerTypeBuilder(
    name="GitLab10_0_3_ce_0ServiceController",
    tag="10.0.3-ce.0",
    **common_setup).build()

GitLabServiceController = GitLab10_0_3_ce_0ServiceController

gitlab_service_controllers = {GitLab8_10_4_ce_0ServiceController, GitLab8_13_11_ce_0ServiceController,
                              GitLab8_16_6_ce_0ServiceController, GitLab10_0_3_ce_0ServiceController}


text:
package uk.dangrew.nuts.graphics.meal;

import org.junit.Test;

public class PlanManagerPaneTest {

   @Test public void untested() {
      System.out.println( "WARNING: UNTESTED - " + getClass().getName() );
   }//End Method

}//End Class


text:
#include "caffe2/operators/stump_func_op.h"

namespace caffe2 {

template <>
bool StumpFuncOp<float, float, CPUContext>::RunOnDevice() {
  auto& in = Input(0);
  const float* in_data = in.template data<float>();
  auto* out = Output(0);
  out->ResizeLike(in);
  float* out_data = out->template mutable_data<float>();
  for (int i = 0; i < in.size(); i++) {
    out_data[i] = (in_data[i] <= threshold_) ? low_value_ : high_value_;
  }
  return true;
}

REGISTER_CPU_OPERATOR(StumpFunc, StumpFuncOp<float, float, CPUContext>);

OPERATOR_SCHEMA(StumpFunc)
    .NumInputs(1)
    .NumOutputs(1)
    .Input(0, "X", "tensor of float")
    .Output(0, "Y", "tensor of float")
    .SetDoc(R"DOC(
Converts each input element into either high_ or low_value
based on the given threshold.
)DOC");

NO_GRADIENT(StumpFunc);

} // caffe2