text:
namespace blink {

// Suppress warning: global constructors, because struct WrapperTypeInfo is trivial
// and does not depend on another global objects.
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
const WrapperTypeInfo V8TestInterfaceEventInitConstructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceEventInitConstructor::domTemplate, V8TestInterfaceEventInitConstructor::trace, V8TestInterfaceEventInitConstructor::traceWrappers, 0, nullptr, "TestInterfaceEventInitConstructor", &V8Event::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromActiveScriptWrappable, WrapperTypeInfo::NotInheritFromEventTarget, WrapperTypeInfo::Independent };
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic pop
#endif

// This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfaceEventInitConstructor.h.
// For details, see the comment of DEFINE_WRAPPERTYPEINFO in
// bindings/core/v8/ScriptWrappable.h.
const WrapperTypeInfo& TestInterfaceEventInitConstructor::s_wrapperTypeInfo = V8TestInterfaceEventInitConstructor::wrapperTypeInfo;

// not [ActiveScriptWrappable]
static_assert(
    !std::is_base_of<ActiveScriptWrappable, TestInterfaceEventInitConstructor>::value,
    "TestInterfaceEventInitConstructor inherits from ActiveScriptWrappable, but is not specifying "
    "[ActiveScriptWrappable] extended attribute in the IDL file.  "
    "Be consistent.");
static_assert(
    std::is_same<decltype(&TestInterfaceEventInitConstructor::hasPendingActivity),
                 decltype(&ScriptWrappable::hasPendingActivity)>::value,
    "TestInterfaceEventInitConstructor is overriding hasPendingActivity(), but is not specifying "
    "[ActiveScriptWrappable] extended attribute in the IDL file.  "
    "Be consistent.");

namespace TestInterfaceEventInitConstructorV8Internal {

static void readonlyStringAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
  v8::Local<v8::Object> holder = info.Holder();

  TestInterfaceEventInitConstructor* impl = V8TestInterfaceEventInitConstructor::toImpl(holder);

  v8SetReturnValueString(info, impl->readonlyStringAttribute(), info.GetIsolate());
}

void readonlyStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
  TestInterfaceEventInitConstructorV8Internal::readonlyStringAttributeAttributeGetter(info);
}

static void isTrustedAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
  v8::Local<v8::Object> holder = info.Holder();

  TestInterfaceEventInitConstructor* impl = V8TestInterfaceEventInitConstructor::toImpl(holder);

  v8SetReturnValueBool(info, impl->isTrusted());
}

void isTrustedAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
  TestInterfaceEventInitConstructorV8Internal::isTrustedAttributeGetter(info);
}

static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) {
  ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ConstructionContext, "TestInterfaceEventInitConstructor");

  if (UNLIKELY(info.Length() < 2)) {
    exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, info.Length()));
    return;
  }

  V8StringResource<> type;
  TestInterfaceEventInit testInterfaceEventInit;
  type = info[0];
  if (!type.prepare())
    return;

  if (!isUndefinedOrNull(info[1]) && !info[1]->IsObject()) {
    exceptionState.throwTypeError("parameter 2 ('testInterfaceEventInit') is not an object.");

    return;
  }
  V8TestInterfaceEventInit::toImpl(info.GetIsolate(), info[1], testInterfaceEventInit, exceptionState);
  if (exceptionState.hadException())
    return;

  TestInterfaceEventInitConstructor* impl = TestInterfaceEventInitConstructor::create(type, testInterfaceEventInit);
  v8::Local<v8::Object> wrapper = info.Holder();
  wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceEventInitConstructor::wrapperTypeInfo, wrapper);
  v8SetReturnValue(info, wrapper);
}

} // namespace TestInterfaceEventInitConstructorV8Internal

const V8DOMConfiguration::AccessorConfiguration V8TestInterfaceEventInitConstructorAccessors[] = {
    {"readonlyStringAttribute", TestInterfaceEventInitConstructorV8Internal::readonlyStringAttributeAttributeGetterCallback, 0, 0, 0, nullptr, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
    {"isTrusted", TestInterfaceEventInitConstructorV8Internal::isTrustedAttributeGetterCallback, 0, 0, 0, nullptr, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
};

void V8TestInterfaceEventInitConstructor::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
  if (!info.IsConstructCall()) {
    V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("TestInterfaceEventInitConstructor"));
    return;
  }

  if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) {
    v8SetReturnValue(info, info.Holder());
    return;
  }

  TestInterfaceEventInitConstructorV8Internal::constructor(info);
}

static void installV8TestInterfaceEventInitConstructorTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::FunctionTemplate> interfaceTemplate) {
  // Initialize the interface object's template.
  V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplate, V8TestInterfaceEventInitConstructor::wrapperTypeInfo.interfaceName, V8Event::domTemplate(isolate, world), V8TestInterfaceEventInitConstructor::internalFieldCount);
  interfaceTemplate->SetCallHandler(V8TestInterfaceEventInitConstructor::constructorCallback);
  interfaceTemplate->SetLength(2);
  v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
  ALLOW_UNUSED_LOCAL(signature);
  v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->InstanceTemplate();
  ALLOW_UNUSED_LOCAL(instanceTemplate);
  v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->PrototypeTemplate();
  ALLOW_UNUSED_LOCAL(prototypeTemplate);
  // Register DOM constants, attributes and operations.
  V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, V8TestInterfaceEventInitConstructorAccessors, WTF_ARRAY_LENGTH(V8TestInterfaceEventInitConstructorAccessors));
}

v8::Local<v8::FunctionTemplate> V8TestInterfaceEventInitConstructor::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) {
  return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterfaceEventInitConstructorTemplate);
}

bool V8TestInterfaceEventInitConstructor::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) {
  return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
}

v8::Local<v8::Object> V8TestInterfaceEventInitConstructor::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) {
  return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
}

TestInterfaceEventInitConstructor* V8TestInterfaceEventInitConstructor::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value) {
  return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : nullptr;
}

}  // namespace blink


text:
package com.jorgecastilloprz.pagedheadlistview.testapp.fragments.headerfragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.jorgecastilloprz.pagedheadlistview.testapp.R;

/**
 * Created by jorge on 31/07/14.
 */
public class FourthHeaderFragment extends Fragment {

    private View rootView;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        rootView = inflater.inflate(R.layout.fragment_header_fourth, container, false);

        return rootView;
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace GraduatedCylinder;

public partial struct Jerk : IDimension<Jerk, JerkUnit>
{

    public static Acceleration operator *(Jerk jerk, Time time) {
        jerk = jerk.In(JerkUnit.KiloMetersPerSecondCubed);
        time = time.In(TimeUnit.Second);
        return new Acceleration(jerk.Value * time.Value, AccelerationUnit.MeterPerSquareSecond);
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
 Contributors: Kjersti Fagerholt, Roar Gjøvaag, Ragnhild Krogh, Espen Strømjordet,
 Audun Sæther, Hanne Marie Trelease, Eivind Halmøy Wolden

 "Copyright 2015 The TAG CLOUD/SINTEF project

 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."
 -->
<!-- A XML-representation of what the stored_story table is supposed to look like after doing the database operations in insertRecommendationsTest() in DatabaseConnectionTest.java -->
<dataset>
	<stored_story userId="1" storyId="DF.1098" explanation="" rating="" false_recommend="0" type_of_recommendation="0" recommend_ranking="3" in_frontend_array="0" estimated_Rating="0.00000"/>
	<stored_story userId="1" storyId="DF.1501" explanation="" rating="" false_recommend="0" type_of_recommendation="0" recommend_ranking="4" in_frontend_array="0" estimated_Rating="0.00000"/>
	<stored_story userId="1" storyId="DF.1709" explanation="mahout" rating="" false_recommend="0" type_of_recommendation="0" recommend_ranking="" in_frontend_array="0" estimated_Rating="0.00000"/>
	<stored_story userId="1" storyId="DF.1812" explanation="mahout" rating="3" false_recommend="0" type_of_recommendation="0" recommend_ranking="1" in_frontend_array="0" estimated_Rating="0.00000"/>
	<stored_story userId="1" storyId="DF.1849" explanation="mahout" rating="" false_recommend="0" type_of_recommendation="0" recommend_ranking="" in_frontend_array="1" estimated_Rating="0.00000"/>
	<stored_story userId="1" storyId="DF.1901" explanation="mahout" rating="5" false_recommend="0" type_of_recommendation="0" recommend_ranking="2" in_frontend_array="1" estimated_Rating="0.00000"/>
	<stored_story userId="2" storyId="DF.1812" explanation="mahout" rating="" false_recommend="0" type_of_recommendation="0" recommend_ranking="1" in_frontend_array="1" estimated_Rating="0.00000"/>
	<stored_story userId="2" storyId="DF.1901" explanation="mahout" rating="" false_recommend="0" type_of_recommendation="1" recommend_ranking="2" in_frontend_array="0" estimated_Rating="0.00000"/>
</dataset>


text:
[?php

/**
 * <?php echo $this->modelName ?> form base class.
 *
 * @method <?php echo $this->modelName ?> getObject() Returns the current form's model object
 *
 * @package    ##PROJECT_NAME##
 * @subpackage form
 * @author     ##AUTHOR_NAME##
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class Base<?php echo $this->modelName ?>Form extends <?php echo $this->getFormClassToExtend() . "\n" ?>
{
  public function setup()
  {
    $this->setWidgets(array(
<?php foreach ($this->getColumns() as $column): ?>
      '<?php echo $column->getFieldName() ?>'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($column->getFieldName())) ?> => new <?php echo $this->getWidgetClassForColumn($column) ?>(<?php echo $this->getWidgetOptionsForColumn($column) ?>),
<?php endforeach; ?>
<?php foreach ($this->getManyToManyRelations() as $relation): ?>
      '<?php echo $this->underscore($relation['alias']) ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($this->underscore($relation['alias']).'_list')) ?> => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => '<?php echo $relation['table']->getOption('name') ?>')),
<?php endforeach; ?>
    ));

    $this->setValidators(array(
<?php foreach ($this->getColumns() as $column): ?>
      '<?php echo $column->getFieldName() ?>'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($column->getFieldName())) ?> => new <?php echo $this->getValidatorClassForColumn($column) ?>(<?php echo $this->getValidatorOptionsForColumn($column) ?>),
<?php endforeach; ?>
<?php foreach ($this->getManyToManyRelations() as $relation): ?>
      '<?php echo $this->underscore($relation['alias']) ?>_list'<?php echo str_repeat(' ', $this->getColumnNameMaxLength() - strlen($this->underscore($relation['alias']).'_list')) ?> => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => '<?php echo $relation['table']->getOption('name') ?>', 'required' => false)),
<?php endforeach; ?>
    ));

<?php if ($uniqueColumns = $this->getUniqueColumnNames()): ?>
    $this->validatorSchema->setPostValidator(
<?php if (count($uniqueColumns) > 1): ?>
      new sfValidatorAnd(array(
<?php foreach ($uniqueColumns as $uniqueColumn): ?>
        new sfValidatorDoctrineUnique(array('model' => '<?php echo $this->table->getOption('name') ?>', 'column' => array('<?php echo implode("', '", $uniqueColumn) ?>'))),
<?php endforeach; ?>
      ))
<?php else: ?>
      new sfValidatorDoctrineUnique(array('model' => '<?php echo $this->table->getOption('name') ?>', 'column' => array('<?php echo implode("', '", $uniqueColumns[0]) ?>')))
<?php endif; ?>
    );

<?php endif; ?>
    $this->widgetSchema->setNameFormat('<?php echo $this->underscore($this->modelName) ?>[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return '<?php echo $this->modelName ?>';
  }

<?php if ($this->getManyToManyRelations()): ?>
  public function updateDefaultsFromObject()
  {
    parent::updateDefaultsFromObject();

<?php foreach ($this->getManyToManyRelations() as $relation): ?>
    if (isset($this->widgetSchema['<?php echo $this->underscore($relation['alias']) ?>_list']))
    {
      $this->setDefault('<?php echo $this->underscore($relation['alias']) ?>_list', $this->object-><?php echo $relation['alias']; ?>->getPrimaryKeys());
    }

<?php endforeach; ?>
  }

  protected function doSave($con = null)
  {
<?php foreach ($this->getManyToManyRelations() as $relation): ?>
    $this->save<?php echo $relation['alias'] ?>List($con);
<?php endforeach; ?>

    parent::doSave($con);
  }

<?php foreach ($this->getManyToManyRelations() as $relation): ?>
  public function save<?php echo $relation['alias'] ?>List($con = null)
  {
    if (!$this->isValid())
    {
      throw $this->getErrorSchema();
    }

    if (!isset($this->widgetSchema['<?php echo $this->underscore($relation['alias']) ?>_list']))
    {
      // somebody has unset this widget
      return;
    }

    if (null === $con)
    {
      $con = $this->getConnection();
    }

    $existing = $this->object-><?php echo $relation['alias']; ?>->getPrimaryKeys();
    $values = $this->getValue('<?php echo $this->underscore($relation['alias']) ?>_list');
    if (!is_array($values))
    {
      $values = array();
    }

    $unlink = array_diff($existing, $values);
    if (count($unlink))
    {
      $this->object->unlink('<?php echo $relation['alias'] ?>', array_values($unlink));
    }

    $link = array_diff($values, $existing);
    if (count($link))
    {
      $this->object->link('<?php echo $relation['alias'] ?>', array_values($link));
    }
  }

<?php endforeach; ?>
<?php endif; ?>
}


text:
require 'spec_helper'
require 'timecop'

describe WorkspacesController do
  render_views

  let(:owner) { users(:no_collaborators) }
  let(:other_user) { users(:the_collaborator) }
  before do
    log_in owner
    stub(Alpine::API).delete_work_flow.with_any_args
  end

  describe "#index" do
    let(:private_workspace) { workspaces(:private_with_no_collaborators) }

    it "returns workspaces that are public" do
      get :index, :format => :json
      response.code.should == "200"
      decoded_response.map(&:name).should include workspaces(:public).name
    end

    it "returns workspaces the user is a member of" do
      log_in other_user
      get :index, :format => :json
      response.code.should == "200"
      decoded_response.map(&:name).should include private_workspace.name
    end

    it "does not return private workspaces user is not a member of" do
      other_private = workspaces(:private)
      get :index, :format => :json
      decoded_response.collect(&:name).should_not include other_private.name
    end

    it "includes private workspaces owned by the authenticated user" do
      get :index, :format => :json
      decoded_response.collect(&:name).should include private_workspace.name
    end

    it "sorts by workspace name" do
      get :index, :format => :json
      decoded_response[0].name.downcase.should < decoded_response[1].name.downcase
    end

    it "scopes by active status" do
      get :index, :active => 1, :format => :json
      decoded_response.size.should == Workspace.workspaces_for(owner).active.count
    end

    it "scopes by memberships" do
      get :index, :user_id => other_user.id, :format => :json
      inaccessible_workspaces = other_user.workspaces - Workspace.accessible_to(owner)
      decoded_response.size.should == other_user.workspaces.count - inaccessible_workspaces.length
      decoded_response.map(&:name).should_not include(workspaces(:private).name)
    end

    it "shows admins all workspaces scoped by membership" do
      log_in users(:admin)
      get :index, :user_id => other_user.id, :format => :json
      decoded_response.size.should == other_user.workspaces.count
    end

    describe "pagination" do

      it "paginates the collection" do
        get :index, :page => 1, :per_page => 2, :format => :json
        decoded_response.length.should == 2
      end

      it "accepts a page parameter" do
        get :index, :page => 2, :per_page => 2, :format => :json
        decoded_response.first.name.should == Workspace.workspaces_for(owner).order("lower(name) ASC")[2].name
      end

      it "defaults the per_page to fifty" do
        get :index, :format => :json
        request.params[:per_page].should == 50
      end
    end

    generate_fixture "workspaceSet.json" do
      get :index, :show_latest_comments => 'true', :format => :json
    end

    # this mocks a Presenter.present call, which is no longer used for workspaces index
    # it_behaves_like :succinct_list
  end

  describe "#create" do
    context "with valid parameters" do
      let(:params) { {:name => "foobar"} }
      it "creates a workspace" do
        expect {
          post :create, params
        }.to change(Workspace, :count).by(1)
      end

      it "creates an event for public workspace" do
        expect_to_add_event(Events::PublicWorkspaceCreated, owner) do
          post :create, params.merge(:public => true)
        end
      end

      it "creates an event for private workspace" do
        expect_to_add_event(Events::PrivateWorkspaceCreated, owner) do
          post :create, params.merge(:public => false)
        end
      end

      it "presents the workspace" do
        mock_present do |workspace|
          workspace.should be_a(Workspace)
          workspace.name.should == "foobar"
        end
        post :create, params
      end

      it "adds the owner as a member of the workspace" do
        post :create, params
        Workspace.last.memberships.first.user.should == owner
      end

      it "sets the authenticated user as the owner of the new workspace" do
        post :create, params
        Workspace.last.owner.should == owner
      end

      it "creates a private workspace by default" do
        post :create, params
        Workspace.last.public.should be_false
      end
    end
  end

  describe "#show" do
    let(:owner) { users(:owner) }
    let(:workspace) { workspaces(:public) }

    context "with a valid workspace id" do
      it "uses authentication" do
        mock(Authority).authorize!.with_any_args
        get :show, :id => workspace.to_param
      end

      it "succeeds" do
        get :show, :id => workspace.to_param
        response.should be_success
      end

      it "presents the workspace" do
        mock.proxy(controller).present(workspace, :presenter_options => {:show_latest_comments => false})
        get :show, :id => workspace.to_param
      end

      it "has the update permission if the user is a member" do
        log_in other_user
        get :show, :id => workspace.to_param
        response.decoded_body["response"]["permission"].should include("update")
      end
    end

    context "with an invalid workspace id" do
      it "returns not found" do
        get :show, :id => 'bogus'
        response.should be_not_found
      end
    end

    generate_fixture "workspace.json" do
      get :show, :id => workspace.to_param, :show_latest_comments => 'true'
    end

    generate_fixture "project.json" do
      get :show, :id => workspaces(:project).to_param, :show_latest_comments => 'true'
    end
  end

  #Add contexts for the different params and workspaces
  describe "#update" do
    let(:public_workspace) { workspaces(:public_with_no_collaborators) }
    let(:private_workspace) { workspaces(:private_with_no_collaborators) }
    let(:workspace) {private_workspace}
    let(:workspace_params) { {
        :owner => {id: "3"},
        :public => workspace.public?.to_s
    } }

    let(:params) { {
        :id => workspace.id,
        :workspace => workspace_params
    } }

    before do
      stub(Sunspot).index.with_any_args
    end

    context "when the current user is a member" do
      before do
        log_in users(:the_collaborator)
      end
      it "can update the name of the workspace " do
        workspace_params[:name] = "new name"
        put :update, params
        response.should be_success
      end

      it "can update the summary of the workspace" do
        workspace_params[:summary] = "new summary"
        put :update, params
        response.should be_success
      end

      it "cannot change any attributes other than name and summary" do
        workspace_params[:public] = !workspace.public
        put :update, params
        response.should be_forbidden
      end
    end

    context "when the current user has update authorization" do
      it "uses authentication" do
        #mock(Authority).authorize!(:update, workspace, owner)
        #put :update, params
      end

      it "can change the owner" do
        member = users(:the_collaborator)

        put :update, params.merge(:workspace => workspace_params.merge(:owner_id => member.id.to_s))

        workspace.reload
        workspace.owner.should == member
        response.should be_success
      end

      it "can set the is_project attribute" do
        put :update, params.merge(:workspace => workspace_params.merge(:is_project => "true"))

        workspace.reload
        workspace.is_project.should == true
        response.should be_success
      end

      context "changing a public workspace" do
        let(:workspace) {public_workspace}

        it "allows updating the workspace's privacy" do
          put :update, params.merge(:workspace => workspace_params.merge(:public => "false"))
          workspace.reload
          workspace.should_not be_public
          response.should be_success
        end

        it "generates an event" do
          expect_to_add_event(Events::WorkspaceMakePrivate, owner) do
            put :update, params.merge(:workspace => workspace_params.merge(:public => "false"))
          end
        end
      end

      context "changing a private workspace" do
        let(:workspace) {private_workspace}

        it "allows updating the workspace's privacy" do
          put :update, params.merge(:workspace => workspace_params.merge(:public => "true"))

          workspace.reload
          workspace.should be_public
          response.should be_success
        end

        it "generates an event" do
          expect_to_add_event(Events::WorkspaceMakePublic, owner) do
            put :update, params.merge(:workspace => workspace_params.merge(:public => "true"))
          end
        end
      end

      context "changing project status or reason" do
        before { workspace.update_column(:project_status, 'at_risk') }
        let(:message) { 'Been working hard!' }

        context "changing project status and reason" do
          it "generates an event" do
            expect_to_add_event(Events::ProjectStatusChanged, owner) do
              put :update, params.merge(:workspace => workspace_params.merge(
                  :project_status => "on_track", :project_status_reason => message)
              )
            end
          end
        end
      end

      describe "changing the show_sandbox_datasets attribute" do
        context "from true to false" do
          before do
            workspace.show_sandbox_datasets = true
            workspace.save
          end

          it "can change the show_sandbox_datasets attribute" do
            put :update, params.merge(:workspace => workspace_params.merge(:show_sandbox_datasets => "false"))

            response.should be_success
            workspace.reload.show_sandbox_datasets.should be_false
          end

          it 'generates an WorkspaceToNoLongerShowSandboxDatasets event' do
            expect_to_add_event(Events::WorkspaceToNoLongerShowSandboxDatasets, owner) do
              put :update, params.merge(:workspace => workspace_params.merge(:show_sandbox_datasets => "false"))
            end
          end
        end

        context "from false to true" do
          before do
            workspace.show_sandbox_datasets = false
            workspace.save
          end

          it "can change the show_sandbox_datasets attribute" do
            put :update, params.merge(:workspace => workspace_params.merge(:show_sandbox_datasets => "true"))

            response.should be_success
            workspace.reload.show_sandbox_datasets.should be_true
          end

          it 'generates an WorkspaceToShowSandboxDatasets event' do
            expect_to_add_event(Events::WorkspaceToShowSandboxDatasets, owner) do
              put :update, params.merge(:workspace => workspace_params.merge(:show_sandbox_datasets => "true"))
            end
          end
        end
      end

      describe 'unarchiving workspace' do
        let(:workspace) {workspaces(:archived)}

        it 'unarchives the workspace' do
          put :update, params.merge(:workspace => workspace_params.merge(:archived => false))
          workspace.reload
          workspace.archived_at.should be_nil
          workspace.archiver.should be_nil
          response.should be_success
        end

        it 'generates an event' do
          expect_to_add_event(Events::WorkspaceUnarchived, owner) do
            put :update, params.merge(:workspace => workspace_params.merge(:archived => false))
          end
        end
      end

      describe 'updating an archived workspace' do
        let(:workspace) {workspaces(:archived)}

        it 'does not generate an event' do
          expect {
            put :update, params.merge(:workspace => workspace_params.merge(:summary => 'new summary'))
          }.to_not change(Events::Base, :count)
        end
      end

      describe 'archiving the workspace' do
        let(:workspace) { workspaces(:public) }

        before :each do
          log_in workspace.owner
        end

        before do
          [Import].each do |stuff|
            any_instance_of(stuff) do |import|
              stub(import).tables_have_consistent_schema { true }
              stub(import).table_exists? { true }
            end
          end
        end

        it 'archives the workspace' do
          Timecop.freeze do
            put :update, params.merge(:workspace => workspace_params.merge(:archived => true))
            workspace.reload

            workspace.archived_at.to_i.should == Time.current.to_i
            workspace.archiver.should == workspace.owner
          end
        end

        it 'generates an event' do
          expect_to_add_event(Events::WorkspaceArchived, workspace.owner) do
            put :update, params.merge(:workspace => workspace_params.merge(:archived => true))
          end
        end
      end
    end
  end

  describe "#destroy" do
    let(:workspace) { workspaces(:public) }
    let(:params) { {:id => workspace.id} }

    before do
      [Import].each do |stuff|
        any_instance_of(stuff) do |import|
          stub(import).tables_have_consistent_schema { true }
          stub(import).table_exists? { true }
        end
      end
    end

    before :each do
      log_in workspace.owner
    end

    it "uses authorization" do
      log_in other_user
      delete :destroy, :id => workspace.to_param
      response.should be_forbidden
    end

    it "destroys the workspace" do
      expect {
        delete :destroy, params
      }.to change(Workspace, :count).by(-1)
    end

    it "destroys the workspace" do
      delete :destroy, params
      response.code.should == "200"
    end

    it "creates an event" do
      expect_to_add_event(Events::WorkspaceDeleted, workspace.owner) do
        post :destroy, params
      end
    end
  end

  context 'in demo mode' do
    let(:public_workspace) { workspaces(:public_with_no_collaborators) }
    let(:private_workspace) { workspaces(:private_with_no_collaborators) }
    let(:workspace) {private_workspace}
    let(:workspace_params) { {
        :owner => {id: '3'},
        :public => workspace.public?.to_s
    } }

    it_behaves_like 'a protected demo mode controller', [:create, :destroy] do
      let(:params) { {
          :id => workspace.id,
          :workspace => workspace_params
      } }
    end
  end

  def expect_to_add_event(event_class, actor)
    expect {
      yield
    }.to change(event_class.by(actor), :count).by(1)
  end
end


text:
package java.text;

import java.io.Serializable;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Locale;
import java.util.ResourceBundle;

import org.apache.harmony.text.internal.nls.Messages;

/**
 * Format is the abstract superclass of classes which format and parse objects
 * according to Locale specific rules.
 */
public abstract class Format implements Serializable, Cloneable {

    private static final long serialVersionUID = -299282585814624189L;

    /**
     * Constructs a new instance of Format.
     *
     */
    public Format() {
    }

    /**
     * Answers a copy of this Format.
     *
     * @return a shallow copy of this Format
     *
     * @see java.lang.Cloneable
     */
    @Override
    public Object clone() {
        try {
            return super.clone();
        } catch (CloneNotSupportedException e) {
            return null;
        }
    }

    static ResourceBundle getBundle(final Locale locale) {
        return AccessController
                .doPrivileged(new PrivilegedAction<ResourceBundle>() {
                    public ResourceBundle run() {
                        return ResourceBundle
                                .getBundle(
                                        "org.apache.harmony.luni.internal.locale.Locale", locale); //$NON-NLS-1$
                    }
                });
    }

    String convertPattern(String template, String fromChars, String toChars,
            boolean check) {
        if (!check && fromChars.equals(toChars)) {
            return template;
        }
        boolean quote = false;
        StringBuilder output = new StringBuilder();
        int length = template.length();
        for (int i = 0; i < length; i++) {
            int index;
            char next = template.charAt(i);
            if (next == '\'') {
                quote = !quote;
            }
            if (!quote && (index = fromChars.indexOf(next)) != -1) {
                output.append(toChars.charAt(index));
            } else if (check
                    && !quote
                    && ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z'))) {
                // text.05=Invalid pattern char {0} in {1}
                throw new IllegalArgumentException(Messages.getString(
                        "text.05", String.valueOf(next), template)); //$NON-NLS-1$
            } else {
                output.append(next);
            }
        }
        if (quote) {
            // text.04=Unterminated quote
            throw new IllegalArgumentException(Messages.getString("text.04")); //$NON-NLS-1$
        }
        return output.toString();
    }

    /**
     * Formats the specified object using the rules of this Format.
     *
     *
     * @param object
     *            the object to format
     * @return the formatted String
     *
     * @exception IllegalArgumentException
     *                when the object cannot be formatted by this Format
     */
    public final String format(Object object) {
        return format(object, new StringBuffer(), new FieldPosition(0))
                .toString();
    }

    /**
     * Formats the specified object into the specified StringBuffer using the
     * rules of this Format. If the field specified by the FieldPosition is
     * formatted, set the begin and end index of the formatted field in the
     * FieldPosition.
     *
     * @param object
     *            the object to format
     * @param buffer
     *            the StringBuffer
     * @param field
     *            the FieldPosition
     * @return the StringBuffer parameter buffer
     *
     * @exception IllegalArgumentException
     *                when the object cannot be formatted by this Format
     */
    public abstract StringBuffer format(Object object, StringBuffer buffer,
            FieldPosition field);

    /**
     * Formats the specified object using the rules of this format and returns
     * an AttributedCharacterIterator with the formatted String and no
     * attributes.
     *

     * Subclasses should return an AttributedCharacterIterator with the
     * appropriate attributes.
     *
     * @param object
     *            the object to format
     * @return an AttributedCharacterIterator with the formatted object and
     *         attributes
     *
     * @exception IllegalArgumentException
     *                when the object cannot be formatted by this Format
     */
    public AttributedCharacterIterator formatToCharacterIterator(Object object) {
        return new AttributedString(format(object)).getIterator();
    }

    /**
     * Parse the specified String using the rules of this Format.
     *
     * @param string
     *            the String to parse
     * @return the object resulting from the parse
     *
     * @exception ParseException
     *                when an error occurs during parsing
     */
    public Object parseObject(String string) throws ParseException {
        ParsePosition position = new ParsePosition(0);
        Object result = parseObject(string, position);
        if (position.getErrorIndex() != -1 || position.getIndex() == 0) {
            throw new ParseException(null, position.getErrorIndex());
        }
        return result;
    }

    /**
     * Parse the specified String starting at the index specified by the
     * ParsePosition. If the string is successfully parsed, the index of the
     * ParsePosition is updated to the index following the parsed text.
     *
     * @param string
     *            the String to parse
     * @param position
     *            the ParsePosition, updated on return with the index following
     *            the parsed text, or on error the index is unchanged and the
     *            error index is set to the index where the error occurred
     * @return the object resulting from the parse, or null if there is an error
     */
    public abstract Object parseObject(String string, ParsePosition position);

    static boolean upTo(String string, ParsePosition position,
            StringBuffer buffer, char stop) {
        int index = position.getIndex(), length = string.length();
        boolean lastQuote = false, quote = false;
        while (index < length) {
            char ch = string.charAt(index++);
            if (ch == '\'') {
                if (lastQuote) {
                    buffer.append('\'');
                }
                quote = !quote;
                lastQuote = true;
            } else if (ch == stop && !quote) {
                position.setIndex(index);
                return true;
            } else {
                lastQuote = false;
                buffer.append(ch);
            }
        }
        position.setIndex(index);
        return false;
    }

    static boolean upToWithQuotes(String string, ParsePosition position,
            StringBuffer buffer, char stop, char start) {
        int index = position.getIndex(), length = string.length(), count = 1;
        boolean quote = false;
        while (index < length) {
            char ch = string.charAt(index++);
            if (ch == '\'') {
                quote = !quote;
            }
            if (!quote) {
                if (ch == stop) {
                    count--;
                }
                if (count == 0) {
                    position.setIndex(index);
                    return true;
                }
                if (ch == start) {
                    count++;
                }
            }
            buffer.append(ch);
        }
        // text.07=Unmatched braces in the pattern
        throw new IllegalArgumentException(Messages.getString("text.07")); //$NON-NLS-1$
    }

    /**
     * This inner class is used to represent Format attributes in the
     * AttributedCharacterIterator that formatToCharacterIterator() method
     * returns in the Format subclasses.
     */
    public static class Field extends AttributedCharacterIterator.Attribute {

        private static final long serialVersionUID = 276966692217360283L;

        /**
         * Constructs a new instance of Field with the given fieldName.
         */
        protected Field(String fieldName) {
            super(fieldName);
        }
    }
}


text:
Tagline

Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies. Curabitur et ligula.

      Learn more


text:
package br.com.brokenbits.jopts;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import org.junit.Test;

public class ArgumentParameterTypeTest {

	@Test
	public void testGetTypeClass() {

		assertNull(ArgumentParameterType.NONE.getTypeClass());
		assertEquals(Long.class, ArgumentParameterType.LONG.getTypeClass());
		assertEquals(Double.class, ArgumentParameterType.DOUBLE.getTypeClass());
		assertEquals(String.class, ArgumentParameterType.STRING.getTypeClass());
	}

	@Test
	public void testParseNone() {

		assertNull(ArgumentParameterType.NONE.parse(null));
	}

	@Test(expected=IllegalArgumentException.class)
	public void testParseNoneFail() {

		assertNull(ArgumentParameterType.NONE.parse(""));
	}

	@Test
	public void testParseLong() {
		Object v;

		for (String s: new String[]{"0", "-1", "2", "1231435124"}) {
			v = ArgumentParameterType.LONG.parse(s);
			assertTrue(v instanceof Long);
			assertEquals(new Long(Long.parseLong(s)), (Long)v);
		}
	}

	@Test
	public void testParseLongFail() {

		for (String s: new String[]{null, "", "a", "2.1"}) {
			try {
				ArgumentParameterType.LONG.parse(s);
				fail();
			} catch (IllegalArgumentException e) {}
		}
	}

	@Test
	public void testParseDouble() {
		Object v;

		for (String s: new String[]{"0", "-1", "2", "1231435124"}) {
			v = ArgumentParameterType.DOUBLE.parse(s);
			assertTrue(v instanceof Double);
			assertEquals(new Double(Double.parseDouble(s)), (Double)v);
		}
	}

	@Test
	public void testParseDoubleFail() {

		for (String s: new String[]{null, "", "a"}) {
			try {
				ArgumentParameterType.DOUBLE.parse(s);
				fail();
			} catch (IllegalArgumentException e) {}
		}
	}

	@Test
	public void testParseString() {
		Object v;

		for (String s: new String[]{"0", "-1", "2", "1231435124"}) {
			v = ArgumentParameterType.STRING.parse(s);
			assertTrue(v instanceof String);
			assertEquals(s, v);
		}
	}

	@Test(expected=IllegalArgumentException.class)
	public void testParseStringFail() {

		ArgumentParameterType.DOUBLE.parse(null);
	}

	@Test
	public void testForClass() {

		// Valid types
		assertEquals(ArgumentParameterType.NONE, ArgumentParameterType.forClass(null));
		assertEquals(ArgumentParameterType.LONG, ArgumentParameterType.forClass(Long.class));
		assertEquals(ArgumentParameterType.LONG, ArgumentParameterType.forClass(Long.TYPE));
		assertEquals(ArgumentParameterType.DOUBLE, ArgumentParameterType.forClass(Double.class));
		assertEquals(ArgumentParameterType.DOUBLE, ArgumentParameterType.forClass(Double.TYPE));
		assertEquals(ArgumentParameterType.STRING, ArgumentParameterType.forClass(String.class));

		// Unknown types
		assertNull(ArgumentParameterType.forClass(Object.class));
	}

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>of-ocaml: Error</title>
    <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
    <link href="../../../../../bootstrap.min.css" rel="stylesheet">
    <link href="../../../../../bootstrap-custom.css" rel="stylesheet">
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

             Coq bench

clean / released

8.5.0 / of-ocaml - 1.2.1

            « Up

              of-ocaml

                1.2.1
                Error

 (2020-06-25 03:38:52 UTC)

Context

# Packages matching: installed
# Name              # Installed # Synopsis
base-bigarray       base
base-num            base        Num library distributed with the OCaml compiler
base-threads        base
base-unix           base
camlp5              7.12        Preprocessor-pretty-printer of OCaml
conf-findutils      1           Virtual package relying on findutils
coq                 8.5.0       Formal proof management system.
num                 0           The Num library for arbitrary-precision integer and rational arithmetic
ocaml               4.05.0      The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0      Official 4.05.0 release
ocaml-config        1           OCaml Switch Configuration
# opam file:
opam-version: "2.0"
maintainer: "dev@clarus.me"
homepage: "https://github.com/clarus/coq-of-ocaml"
dev-repo: "git+https://github.com/clarus/coq-of-ocaml.git"
bug-reports: "https://github.com/clarus/coq-of-ocaml/issues"
authors: ["Guillaume Claret"]
license: "MIT"
build: [
  ["sh" "-c" "cd OCaml && ./configure.sh"]
  [make "-C" "OCaml" "-j%{jobs}%"]
  [make "-j%{jobs}%"]
]
install: [make "-C" "OCaml" "install"]
depends: [
  "conf-ruby" {build}
  "coq" {>= "8.5"}
  "ocaml" {>= "4.05.0" & < "4.06.0"}
  "smart-print"
  "yojson"
]
tags: [
  "date:2015-08-31"
  "keyword:compilation"
  "keyword:ocaml"
]
synopsis: "Compile OCaml to Coq"
extra-files: ["coq-of-ocaml.install" "md5=aaa1f52ec40bedefd2674f46a44cd578"]
url {
  src: "https://github.com/clarus/coq-of-ocaml/archive/1.2.1.tar.gz"
  checksum: "md5=e8cb5565b8ce622d2afa5bcc59873ad2"
}

Lint

Command

true

Return code

0

Dry install

Dry install with the current Coq version:

Command

opam install -y --show-action coq-of-ocaml.1.2.1 coq.8.5.0

Return code

0

Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:

Command

true

Return code

0

Install dependencies

Command

opam list; echo; ulimit -Sv 4000000; timeout 2h opam install -y --deps-only coq-of-ocaml.1.2.1 coq.8.5.0

Return code

0

Duration

9 m 35 s

Install

Command

opam list; echo; ulimit -Sv 16000000; timeout 2h opam install -y -v coq-of-ocaml.1.2.1 coq.8.5.0

Return code

7936

Duration

23 s

Output

# Packages matching: installed
# Name                   # Installed # Synopsis
base-bigarray            base
base-num                 base        Num library distributed with the OCaml compiler
base-threads             base
base-unix                base
biniou                   1.2.1       Binary data format designed for speed, safety, ease of use and backward compatibility as protocols evolve
camlp5                   7.12        Preprocessor-pretty-printer of OCaml
conf-findutils           1           Virtual package relying on findutils
conf-m4                  1           Virtual package relying on m4
conf-ruby                1.0.0       Virtual package relying on Ruby
coq                      8.5.0       Formal proof management system.
cppo                     1.6.6       Code preprocessor like cpp for OCaml
dune                     2.6.0       Fast, portable, and opinionated build system
easy-format              1.3.2       High-level and functional interface to the Format module of the OCaml standard library
num                      0           The Num library for arbitrary-precision integer and rational arithmetic
ocaml                    4.05.0      The OCaml compiler (virtual package)
ocaml-base-compiler      4.05.0      Official 4.05.0 release
ocaml-config             1           OCaml Switch Configuration
ocaml-secondary-compiler 4.08.1-1    OCaml 4.08.1 Secondary Switch Compiler
ocamlfind                1.8.1       A library manager for OCaml
ocamlfind-secondary      1.8.1       ocamlfind support for ocaml-secondary-compiler
smart-print              0.3.0       A pretty-printing library in OCaml
yojson                   1.7.0       Yojson is an optimized parsing and printing library for the JSON format
[NOTE] Package coq is already installed (current version is 8.5.0).
The following actions will be performed:
  - install coq-of-ocaml 1.2.1
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing  1/1: [coq-of-ocaml.1.2.1: http]
[coq-of-ocaml.1.2.1] downloaded from https://github.com/clarus/coq-of-ocaml/archive/1.2.1.tar.gz
Processing  1/1:
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing  1/2: [coq-of-ocaml: sh]
+ /home/bench/.opam/opam-init/hooks/sandbox.sh "build" "sh" "-c" "cd OCaml && ./configure.sh" (CWD=/home/bench/.opam/ocaml-base-compiler.4.05.0/.opam-switch/build/coq-of-ocaml.1.2.1)
Processing  1/2: [coq-of-ocaml: make OCaml]
+ /home/bench/.opam/opam-init/hooks/sandbox.sh "build" "make" "-C" "OCaml" "-j4" (CWD=/home/bench/.opam/ocaml-base-compiler.4.05.0/.opam-switch/build/coq-of-ocaml.1.2.1)
- make: Entering directory '/home/bench/.opam/ocaml-base-compiler.4.05.0/.opam-switch/build/coq-of-ocaml.1.2.1/OCaml'
- "coqdep" -c -R "." OCaml "OCaml.v" > "OCaml.v.d" || ( RV=$?; rm -f "OCaml.v.d"; exit ${RV} )
- "coqdep" -c -R "." OCaml "List.v" > "List.v.d" || ( RV=$?; rm -f "List.v.d"; exit ${RV} )
- "coqdep" -c -R "." OCaml "Libraries.v" > "Libraries.v.d" || ( RV=$?; rm -f "Libraries.v.d"; exit ${RV} )
- "coqdep" -c -R "." OCaml "Effect.v" > "Effect.v.d" || ( RV=$?; rm -f "Effect.v.d"; exit ${RV} )
- "coqdep" -c -R "." OCaml "Basics.v" > "Basics.v.d" || ( RV=$?; rm -f "Basics.v.d"; exit ${RV} )
- "coqc"  -q  -R "." OCaml   Libraries
- "coqc"  -q  -R "." OCaml   Effect
- "coqc"  -q  -R "." OCaml   Basics
- "coqc"  -q  -R "." OCaml   List
- "coqc"  -q  -R "." OCaml   OCaml
- make: Leaving directory '/home/bench/.opam/ocaml-base-compiler.4.05.0/.opam-switch/build/coq-of-ocaml.1.2.1/OCaml'
Processing  1/2: [coq-of-ocaml: make]
+ /home/bench/.opam/opam-init/hooks/sandbox.sh "build" "make" "-j4" (CWD=/home/bench/.opam/ocaml-base-compiler.4.05.0/.opam-switch/build/coq-of-ocaml.1.2.1)
- ocamlbuild src/coqOfOCaml.native -lflags -I,+compiler-libs,ocamlcommon.cmxa -use-ocamlfind -package smart_print,compiler-libs,yojson,str
- make: ocamlbuild: Command not found
- make: *** [Makefile:6: default] Error 127
[ERROR] The compilation of coq-of-ocaml failed at "/home/bench/.opam/opam-init/hooks/sandbox.sh build make -j4".
#=== ERROR while compiling coq-of-ocaml.1.2.1 =================================#
# context              2.0.6 | linux/x86_64 | ocaml-base-compiler.4.05.0 | file:///home/bench/run/opam-coq-archive/released
# path                 ~/.opam/ocaml-base-compiler.4.05.0/.opam-switch/build/coq-of-ocaml.1.2.1
# command              ~/.opam/opam-init/hooks/sandbox.sh build make -j4
# exit-code            2
# env-file             ~/.opam/log/coq-of-ocaml-30686-335865.env
# output-file          ~/.opam/log/coq-of-ocaml-30686-335865.out
### output ###
# ocamlbuild src/coqOfOCaml.native -lflags -I,+compiler-libs,ocamlcommon.cmxa -use-ocamlfind -package smart_print,compiler-libs,yojson,str
# make: ocamlbuild: Command not found
# make: *** [Makefile:6: default] Error 127
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build coq-of-ocaml 1.2.1
+-
- No changes have been performed
# Run eval $(opam env) to update the current shell environment
'opam install -y -v coq-of-ocaml.1.2.1 coq.8.5.0' failed.

Installation size

No files were installed.

Uninstall

Command

true

Return code

0

Missing removes

                none

Wrong removes

                none

          Sources are on GitHub. © Guillaume Claret.


text:
import os

import pandas as pd

import is24crawler.settings

column_names = ['price', 'area', 'rooms', 'address', 'latitude', 'longitude', 'zone', 'band', 'x', 'y', 'date']
df = pd.read_csv(is24crawler.settings.CSV_FILE_PATH, header = None, delimiter = "|")
df.columns = column_names

# specified format at task: rooms | price | area | address | year | UTM x-coord | UTM y-coord | price per square meter
rdf = pd.DataFrame([df.rooms, df.price, df.area, df.address, pd.to_datetime(df.date).dt.year, df.x, df.y,
                    df.price / df.area]).transpose()
rcolumns = rdf.columns.values
rcolumns[-1] = "squaremeter price"
rdf.columns = rcolumns

filePath = os.path.join(is24crawler.settings.OUT_DIR, "apartments-reformatted.csv")
rdf.to_csv(filePath, sep = '\t', header = True, index = False)

print("reformatted csv written to: '{}'".format(filePath))


text:
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->

        <!--状态栏颜色-->
        <item name="colorPrimaryDark">#303f9f</item>
        <!--Toolbar颜色-->
        <item name="colorPrimary">#dcdddd</item>
    </style>

</resources>


text:
using System;
using System.Linq;
using Microsoft.Azure;
using Microsoft.Azure.Management.ApiManagement.SmapiModels;

namespace Microsoft.Azure.Management.ApiManagement.SmapiModels
{
    /// <summary>
    /// Get Property operation response details.
    /// </summary>
    public partial class PropertyGetResponse : AzureOperationResponse
    {
        private string _eTag;

        /// <summary>
        /// Optional. Gets or sets ETag value.
        /// </summary>
        public string ETag
        {
            get { return this._eTag; }
            set { this._eTag = value; }
        }

        private PropertyContract _value;

        /// <summary>
        /// Optional. Gets or sets result of the Get Property operation.
        /// </summary>
        public PropertyContract Value
        {
            get { return this._value; }
            set { this._value = value; }
        }

        /// <summary>
        /// Initializes a new instance of the PropertyGetResponse class.
        /// </summary>
        public PropertyGetResponse()
        {
        }
    }
}


text:
package com.sohu.cache.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * 应用发布状态
 *
 * @author leifu
 * @Time 2014年6月28日
 */
public enum AppStatusEnum {
    STATUS_INITIALIZE(0, "未分配"),
    STATUS_ALLOCATED(1, "已申请未审批"),
    STATUS_PUBLISHED(2, "运行中"),
    STATUS_OFFLINE(3, "已下线"),
    STATUS_DENY(4, "驳回");

    private int status;

    private String info;

    private static Map<Integer, AppStatusEnum> MAP = new HashMap<Integer, AppStatusEnum>();
    static {
        for (AppStatusEnum appStatusEnum : AppStatusEnum.values()) {
            MAP.put(appStatusEnum.getStatus(), appStatusEnum);
        }
    }

    private AppStatusEnum(int status, String info) {
        this.status = status;
        this.info = info;
    }

    public static AppStatusEnum getByStatus(int status) {
        return MAP.get(status);
    }

    public int getStatus() {
        return status;
    }

    public String getInfo() {
        return info;
    }

}


text:
layout: page
title: "Rita Claire Klees"
comments: true
description: "blanks"
keywords: "Rita Claire Klees,CU,Boulder"
---
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://dl.dropboxusercontent.com/s/pc42nxpaw1ea4o9/highcharts.js?dl=0"></script>
<!-- <script src="../assets/js/highcharts.js"></script> -->
<style type="text/css">@font-face {
	font-family: "Bebas Neue";
	src: url(https://www.filehosting.org/file/details/544349/BebasNeue Regular.otf) format("opentype");
	}
	h1.Bebas {
		font-family: "Bebas Neue", Verdana, Tahoma;
	}
</style>
</head>

#### TEACHING INFORMATION

**College**: College of Arts and Sciences, College of Engineering and Applied Science

**Classes taught**: CVEN 5834, CVEN 5919, CVEN 5929, CVEN 5939, CVEN 5969, PSCI 2028, SSIR 1010

#### CVEN 5834: Special Topics

**Terms taught**: Fall 2011, Fall 2014

**Instructor rating**: 4.79

**Standard deviation in instructor rating**: 0.29

**Average grade** (4.0 scale): 3.83

**Standard deviation in grades** (4.0 scale): 0.11

**Average workload** (raw): 2.88

**Standard deviation in workload** (raw): 0.18

#### CVEN 5919: Sustainable Community Development 1

**Terms taught**: Fall 2015, Fall 2016

**Instructor rating**: 4.89

**Standard deviation in instructor rating**: 0.04

**Average grade** (4.0 scale): 3.98

**Standard deviation in grades** (4.0 scale): 0.0

**Average workload** (raw): 3.26

**Standard deviation in workload** (raw): 0.01

#### CVEN 5929: Sustainable Community Development 2

**Terms taught**: Spring 2014, Spring 2015, Spring 2016

**Instructor rating**: 4.48

**Standard deviation in instructor rating**: 0.36

**Average grade** (4.0 scale): 3.84

**Standard deviation in grades** (4.0 scale): 0.15

**Average workload** (raw): 3.32

**Standard deviation in workload** (raw): 0.6

#### CVEN 5939: Sustainable Community Development Field Practicum

**Terms taught**: Fall 2014, Fall 2015

**Instructor rating**: 0.0

**Standard deviation in instructor rating**: 0.0

**Average grade** (4.0 scale): 3.98

**Standard deviation in grades** (4.0 scale): 0.02

**Average workload** (raw): 0.0

**Standard deviation in workload** (raw): 0.0

#### CVEN 5969: Water, Sanitation, and Hygiene

**Terms taught**: Fall 2016

**Instructor rating**: 4.92

**Standard deviation in instructor rating**: 0.0

**Average grade** (4.0 scale): 4.0

**Standard deviation in grades** (4.0 scale): 0.0

**Average workload** (raw): 2.62

**Standard deviation in workload** (raw): 0.0

#### PSCI 2028: Special Topics

**Terms taught**: Spring 2012, Fall 2012, Fall 2012

**Instructor rating**: 4.47

**Standard deviation in instructor rating**: 0.38

**Average grade** (4.0 scale): 3.36

**Standard deviation in grades** (4.0 scale): 0.16

**Average workload** (raw): 2.3

**Standard deviation in workload** (raw): 0.12

#### SSIR 1010: Social Entrepreneurship & Sustainability

**Terms taught**: Fall 2013, Fall 2013, Fall 2014, Fall 2014

**Instructor rating**: 4.6

**Standard deviation in instructor rating**: 0.24

**Average grade** (4.0 scale): 3.27

**Standard deviation in grades** (4.0 scale): 0.21

**Average workload** (raw): 2.29

**Standard deviation in workload** (raw): 0.37


text:
package com.vaadin.ui.components.colorpicker;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.shared.ui.colorpicker.Color;
import com.vaadin.ui.AbstractColorPicker.Coordinates2Color;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Slider;
import com.vaadin.ui.Slider.ValueOutOfBoundsException;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

/**
 * A component that represents color selection popup within a color picker.
 *
 * @since 7.0.0
 */
public class ColorPickerPopup extends Window implements ClickListener,
        ColorChangeListener, ColorSelector {

    private static final String STYLENAME = "v-colorpicker-popup";

    private static final Method COLOR_CHANGE_METHOD;
    static {
        try {
            COLOR_CHANGE_METHOD = ColorChangeListener.class.getDeclaredMethod(
                    "colorChanged", new Class[] { ColorChangeEvent.class });
        } catch (final java.lang.NoSuchMethodException e) {
            // This should never happen
            throw new java.lang.RuntimeException(
                    "Internal error finding methods in ColorPicker");
        }
    }

    /** The tabs. */
    private final TabSheet tabs = new TabSheet();

    private Component rgbTab;

    private Component hsvTab;

    private Component swatchesTab;

    /** The layout. */
    private final VerticalLayout layout;

    /** The ok button. */
    private final Button ok = new Button("OK");

    /** The cancel button. */
    private final Button cancel = new Button("Cancel");

    /** The resize button. */
    private final Button resize = new Button("show/hide history");

    /** The selected color. */
    private Color selectedColor = Color.WHITE;

    /** The history. */
    private ColorPickerHistory history;

    /** The history container. */
    private Layout historyContainer;

    /** The rgb gradient. */
    private ColorPickerGradient rgbGradient;

    /** The hsv gradient. */
    private ColorPickerGradient hsvGradient;

    /** The red slider. */
    private Slider redSlider;

    /** The green slider. */
    private Slider greenSlider;

    /** The blue slider. */
    private Slider blueSlider;

    /** The hue slider. */
    private Slider hueSlider;

    /** The saturation slider. */
    private Slider saturationSlider;

    /** The value slider. */
    private Slider valueSlider;

    /** The preview on the rgb tab. */
    private ColorPickerPreview rgbPreview;

    /** The preview on the hsv tab. */
    private ColorPickerPreview hsvPreview;

    /** The preview on the swatches tab. */
    private ColorPickerPreview selPreview;

    /** The color select. */
    private ColorPickerSelect colorSelect;

    /** The selectors. */
    private final Set<ColorSelector> selectors = new HashSet<ColorSelector>();

    /**
     * Set true while the slider values are updated after colorChange. When
     * true, valueChange reactions from the sliders are disabled, because
     * otherwise the set color may become corrupted as it is repeatedly re-set
     * in valueChangeListeners using values from sliders that may not have been
     * updated yet.
     */
    private boolean updatingColors = false;

    private ColorPickerPopup() {
        // Set the layout
        layout = new VerticalLayout();
        layout.setSpacing(false);
        layout.setMargin(false);
        layout.setWidth("100%");
        layout.setHeight(null);

        setContent(layout);
        setStyleName(STYLENAME);
        setResizable(false);
        setImmediate(true);
        // Create the history
        history = new ColorPickerHistory();
        history.addColorChangeListener(this);
    }

    /**
     * Instantiates a new color picker popup.
     */
    public ColorPickerPopup(Color initialColor) {
        this();
        selectedColor = initialColor;
        initContents();
    }

    private void initContents() {
        // Create the preview on the rgb tab
        rgbPreview = new ColorPickerPreview(selectedColor);
        rgbPreview.setWidth("240px");
        rgbPreview.setHeight("20px");
        rgbPreview.addColorChangeListener(this);
        selectors.add(rgbPreview);

        // Create the preview on the hsv tab
        hsvPreview = new ColorPickerPreview(selectedColor);
        hsvPreview.setWidth("240px");
        hsvPreview.setHeight("20px");
        hsvPreview.addColorChangeListener(this);
        selectors.add(hsvPreview);

        // Create the preview on the swatches tab
        selPreview = new ColorPickerPreview(selectedColor);
        selPreview.setWidth("100%");
        selPreview.setHeight("20px");
        selPreview.addColorChangeListener(this);
        selectors.add(selPreview);

        // Create the tabs
        rgbTab = createRGBTab(selectedColor);
        tabs.addTab(rgbTab, "RGB", null);

        hsvTab = createHSVTab(selectedColor);
        tabs.addTab(hsvTab, "HSV", null);

        swatchesTab = createSelectTab();
        tabs.addTab(swatchesTab, "Swatches", null);

        // Add the tabs
        tabs.setWidth("100%");

        layout.addComponent(tabs);

        // Add the history
        history.setWidth("97%");
        history.setHeight("22px");

        // Create the default colors
        List<Color> defaultColors = new ArrayList<Color>();
        defaultColors.add(Color.BLACK);
        defaultColors.add(Color.WHITE);

        // Create the history
        VerticalLayout innerContainer = new VerticalLayout();
        innerContainer.setWidth("100%");
        innerContainer.setHeight(null);
        innerContainer.addComponent(history);

        VerticalLayout outerContainer = new VerticalLayout();
        outerContainer.setWidth("99%");
        outerContainer.setHeight("27px");
        outerContainer.addComponent(innerContainer);
        historyContainer = outerContainer;

        layout.addComponent(historyContainer);

        // Add the resize button for the history
        resize.addClickListener(this);
        resize.setData(new Boolean(false));
        resize.setWidth("100%");
        resize.setHeight("10px");
        resize.setPrimaryStyleName("resize-button");
        layout.addComponent(resize);

        // Add the buttons
        ok.setWidth("70px");
        ok.addClickListener(this);

        cancel.setWidth("70px");
        cancel.addClickListener(this);

        HorizontalLayout buttons = new HorizontalLayout();
        buttons.addComponent(ok);
        buttons.addComponent(cancel);
        buttons.setWidth("100%");
        buttons.setHeight("30px");
        buttons.setComponentAlignment(ok, Alignment.MIDDLE_CENTER);
        buttons.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER);
        layout.addComponent(buttons);
    }

    /**
     * Creates the RGB tab.
     *
     * @return the component
     */
    private Component createRGBTab(Color color) {
        VerticalLayout rgbLayout = new VerticalLayout();
        rgbLayout.setMargin(new MarginInfo(false, false, true, false));
        rgbLayout.addComponent(rgbPreview);
        rgbLayout.setStyleName("rgbtab");

        // Add the RGB color gradient
        rgbGradient = new ColorPickerGradient("rgb-gradient", RGBConverter);
        rgbGradient.setColor(color);
        rgbGradient.addColorChangeListener(this);
        rgbLayout.addComponent(rgbGradient);
        selectors.add(rgbGradient);

        // Add the RGB sliders
        VerticalLayout sliders = new VerticalLayout();
        sliders.setStyleName("rgb-sliders");

        redSlider = createRGBSlider("Red", "red");
        greenSlider = createRGBSlider("Green", "green");
        blueSlider = createRGBSlider("Blue", "blue");
        setRgbSliderValues(color);

        redSlider.addValueChangeListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                double red = (Double) event.getProperty().getValue();
                if (!updatingColors) {
                    Color newColor = new Color((int) red, selectedColor
                            .getGreen(), selectedColor.getBlue());
                    setColor(newColor);
                }
            }
        });

        sliders.addComponent(redSlider);

        greenSlider.addValueChangeListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                double green = (Double) event.getProperty().getValue();
                if (!updatingColors) {
                    Color newColor = new Color(selectedColor.getRed(),
                            (int) green, selectedColor.getBlue());
                    setColor(newColor);
                }
            }
        });
        sliders.addComponent(greenSlider);

        blueSlider.addValueChangeListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                double blue = (Double) event.getProperty().getValue();
                if (!updatingColors) {
                    Color newColor = new Color(selectedColor.getRed(),
                            selectedColor.getGreen(), (int) blue);
                    setColor(newColor);
                }
            }
        });
        sliders.addComponent(blueSlider);

        rgbLayout.addComponent(sliders);

        return rgbLayout;
    }

    private Slider createRGBSlider(String caption, String styleName) {
        Slider redSlider = new Slider(caption, 0, 255);
        redSlider.setImmediate(true);
        redSlider.setStyleName("rgb-slider");
        redSlider.setWidth("220px");
        redSlider.addStyleName(styleName);
        return redSlider;
    }

    /**
     * Creates the hsv tab.
     *
     * @return the component
     */
    private Component createHSVTab(Color color) {
        VerticalLayout hsvLayout = new VerticalLayout();
        hsvLayout.setMargin(new MarginInfo(false, false, true, false));
        hsvLayout.addComponent(hsvPreview);
        hsvLayout.setStyleName("hsvtab");

        // Add the hsv gradient
        hsvGradient = new ColorPickerGradient("hsv-gradient", HSVConverter);
        hsvGradient.setColor(color);
        hsvGradient.addColorChangeListener(this);
        hsvLayout.addComponent(hsvGradient);
        selectors.add(hsvGradient);

        VerticalLayout sliders = new VerticalLayout();
        sliders.setStyleName("hsv-sliders");

        hueSlider = new Slider("Hue", 0, 360);
        saturationSlider = new Slider("Saturation", 0, 100);
        valueSlider = new Slider("Value", 0, 100);

        float[] hsv = color.getHSV();
        setHsvSliderValues(hsv);

        hueSlider.setStyleName("hsv-slider");
        hueSlider.addStyleName("hue-slider");
        hueSlider.setWidth("220px");
        hueSlider.setImmediate(true);
        hueSlider.addValueChangeListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                if (!updatingColors) {
                    float hue = (Float.parseFloat(event.getProperty()
                            .getValue().toString())) / 360f;
                    float saturation = (Float.parseFloat(saturationSlider
                            .getValue().toString())) / 100f;
                    float value = (Float.parseFloat(valueSlider.getValue()
                            .toString())) / 100f;

                    // Set the color
                    Color color = new Color(Color.HSVtoRGB(hue, saturation,
                            value));
                    setColor(color);

                    /*
                     * Set the background color of the hue gradient. This has to
                     * be done here since in the conversion the base color
                     * information is lost when color is black/white
                     */
                    Color bgColor = new Color(Color.HSVtoRGB(hue, 1f, 1f));
                    hsvGradient.setBackgroundColor(bgColor);
                }
            }
        });
        sliders.addComponent(hueSlider);

        saturationSlider.setStyleName("hsv-slider");
        saturationSlider.setWidth("220px");
        saturationSlider.setImmediate(true);
        saturationSlider.addValueChangeListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                if (!updatingColors) {
                    float hue = (Float.parseFloat(hueSlider.getValue()
                            .toString())) / 360f;
                    float saturation = (Float.parseFloat(event.getProperty()
                            .getValue().toString())) / 100f;
                    float value = (Float.parseFloat(valueSlider.getValue()
                            .toString())) / 100f;
                    Color color = new Color(Color.HSVtoRGB(hue, saturation,
                            value));
                    setColor(color);
                }
            }
        });
        sliders.addComponent(saturationSlider);

        valueSlider.setStyleName("hsv-slider");
        valueSlider.setWidth("220px");
        valueSlider.setImmediate(true);
        valueSlider.addValueChangeListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                if (!updatingColors) {
                    float hue = (Float.parseFloat(hueSlider.getValue()
                            .toString())) / 360f;
                    float saturation = (Float.parseFloat(saturationSlider
                            .getValue().toString())) / 100f;
                    float value = (Float.parseFloat(event.getProperty()
                            .getValue().toString())) / 100f;

                    Color color = new Color(Color.HSVtoRGB(hue, saturation,
                            value));
                    setColor(color);
                }
            }
        });

        sliders.addComponent(valueSlider);
        hsvLayout.addComponent(sliders);

        return hsvLayout;
    }

    /**
     * Creates the select tab.
     *
     * @return the component
     */
    private Component createSelectTab() {
        VerticalLayout selLayout = new VerticalLayout();
        selLayout.setMargin(new MarginInfo(false, false, true, false));
        selLayout.addComponent(selPreview);
        selLayout.addStyleName("seltab");

        colorSelect = new ColorPickerSelect();
        colorSelect.addColorChangeListener(this);
        selLayout.addComponent(colorSelect);

        return selLayout;
    }

    @Override
    public void buttonClick(ClickEvent event) {
        // History resize was clicked
        if (event.getButton() == resize) {
            boolean state = (Boolean) resize.getData();

            // minimize
            if (state) {
                historyContainer.setHeight("27px");
                history.setHeight("22px");

                // maximize
            } else {
                historyContainer.setHeight("90px");
                history.setHeight("85px");
            }

            resize.setData(new Boolean(!state));
        }

        // Ok button was clicked
        else if (event.getButton() == ok) {
            history.setColor(getColor());
            fireColorChanged();
            close();
        }

        // Cancel button was clicked
        else if (event.getButton() == cancel) {
            close();
        }

    }

    /**
     * Notifies the listeners that the color changed
     */
    public void fireColorChanged() {
        fireEvent(new ColorChangeEvent(this, getColor()));
    }

    /**
     * Gets the history.
     *
     * @return the history
     */
    public ColorPickerHistory getHistory() {
        return history;
    }

    @Override
    public void setColor(Color color) {
        if (color == null) {
            return;
        }

        selectedColor = color;

        hsvGradient.setColor(selectedColor);
        hsvPreview.setColor(selectedColor);

        rgbGradient.setColor(selectedColor);
        rgbPreview.setColor(selectedColor);

        selPreview.setColor(selectedColor);
    }

    @Override
    public Color getColor() {
        return selectedColor;
    }

    /**
     * Gets the color history.
     *
     * @return the color history
     */
    public List<Color> getColorHistory() {
        return Collections.unmodifiableList(history.getHistory());
    }

    @Override
    public void colorChanged(ColorChangeEvent event) {
        setColor(event.getColor());

        updatingColors = true;

        setRgbSliderValues(selectedColor);
        float[] hsv = selectedColor.getHSV();
        setHsvSliderValues(hsv);

        updatingColors = false;

        for (ColorSelector s : selectors) {
            if (event.getSource() != s && s != this
                    && s.getColor() != selectedColor) {
                s.setColor(selectedColor);
            }
        }
    }

    private void setRgbSliderValues(Color color) {
        try {
            redSlider.setValue(((Integer) color.getRed()).doubleValue());
            blueSlider.setValue(((Integer) color.getBlue()).doubleValue());
            greenSlider.setValue(((Integer) color.getGreen()).doubleValue());
        } catch (ValueOutOfBoundsException e) {
            getLogger().log(
                    Level.WARNING,
                    "Unable to set RGB color value to " + color.getRed() + ","
                            + color.getGreen() + "," + color.getBlue(), e);
        }
    }

    private void setHsvSliderValues(float[] hsv) {
        try {
            hueSlider.setValue(((Float) (hsv[0] * 360f)).doubleValue());
            saturationSlider.setValue(((Float) (hsv[1] * 100f)).doubleValue());
            valueSlider.setValue(((Float) (hsv[2] * 100f)).doubleValue());
        } catch (ValueOutOfBoundsException e) {
            getLogger().log(
                    Level.WARNING,
                    "Unable to set HSV color value to " + hsv[0] + "," + hsv[1]
                            + "," + hsv[2], e);
        }
    }

    @Override
    public void addColorChangeListener(ColorChangeListener listener) {
        addListener(ColorChangeEvent.class, listener, COLOR_CHANGE_METHOD);
    }

    @Override
    public void removeColorChangeListener(ColorChangeListener listener) {
        removeListener(ColorChangeEvent.class, listener);
    }

    /**
     * Checks the visibility of the given tab
     *
     * @param tab
     *            The tab to check
     * @return true if tab is visible, false otherwise
     */
    private boolean tabIsVisible(Component tab) {
        Iterator<Component> tabIterator = tabs.getComponentIterator();
        while (tabIterator.hasNext()) {
            if (tabIterator.next() == tab) {
                return true;
            }
        }
        return false;
    }

    /**
     * How many tabs are visible
     *
     * @return The number of tabs visible
     */
    private int tabsNumVisible() {
        Iterator<Component> tabIterator = tabs.getComponentIterator();
        int tabCounter = 0;
        while (tabIterator.hasNext()) {
            tabIterator.next();
            tabCounter++;
        }
        return tabCounter;
    }

    /**
     * Checks if tabs are needed and hides them if not
     */
    private void checkIfTabsNeeded() {
        tabs.hideTabs(tabsNumVisible() == 1);
    }

    /**
     * Set RGB tab visibility
     *
     * @param visible
     *            The visibility of the RGB tab
     */
    public void setRGBTabVisible(boolean visible) {
        if (visible && !tabIsVisible(rgbTab)) {
            tabs.addTab(rgbTab, "RGB", null);
            checkIfTabsNeeded();
        } else if (!visible && tabIsVisible(rgbTab)) {
            tabs.removeComponent(rgbTab);
            checkIfTabsNeeded();
        }
    }

    /**
     * Set HSV tab visibility
     *
     * @param visible
     *            The visibility of the HSV tab
     */
    public void setHSVTabVisible(boolean visible) {
        if (visible && !tabIsVisible(hsvTab)) {
            tabs.addTab(hsvTab, "HSV", null);
            checkIfTabsNeeded();
        } else if (!visible && tabIsVisible(hsvTab)) {
            tabs.removeComponent(hsvTab);
            checkIfTabsNeeded();
        }
    }

    /**
     * Set Swatches tab visibility
     *
     * @param visible
     *            The visibility of the Swatches tab
     */
    public void setSwatchesTabVisible(boolean visible) {
        if (visible && !tabIsVisible(swatchesTab)) {
            tabs.addTab(swatchesTab, "Swatches", null);
            checkIfTabsNeeded();
        } else if (!visible && tabIsVisible(swatchesTab)) {
            tabs.removeComponent(swatchesTab);
            checkIfTabsNeeded();
        }
    }

    /**
     * Set the History visibility
     *
     * @param visible
     */
    public void setHistoryVisible(boolean visible) {
        historyContainer.setVisible(visible);
        resize.setVisible(visible);
    }

    /**
     * Set the preview visibility
     *
     * @param visible
     */
    public void setPreviewVisible(boolean visible) {
        hsvPreview.setVisible(visible);
        rgbPreview.setVisible(visible);
        selPreview.setVisible(visible);
    }

    /** RGB color converter */
    private Coordinates2Color RGBConverter = new Coordinates2Color() {

        @Override
        public Color calculate(int x, int y) {
            float h = (x / 220f);
            float s = 1f;
            float v = 1f;

            if (y < 110) {
                s = y / 110f;
            } else if (y > 110) {
                v = 1f - (y - 110f) / 110f;
            }

            return new Color(Color.HSVtoRGB(h, s, v));
        }

        @Override
        public int[] calculate(Color color) {

            float[] hsv = color.getHSV();

            int x = Math.round(hsv[0] * 220f);
            int y = 0;

            // lower half
            if (hsv[1] == 1f) {
                y = Math.round(110f - (hsv[1] + hsv[2]) * 110f);
            } else {
                y = Math.round(hsv[1] * 110f);
            }

            return new int[] { x, y };
        }
    };

    /** HSV color converter */
    Coordinates2Color HSVConverter = new Coordinates2Color() {
        @Override
        public int[] calculate(Color color) {

            float[] hsv = color.getHSV();

            // Calculate coordinates
            int x = Math.round(hsv[2] * 220.0f);
            int y = Math.round(220 - hsv[1] * 220.0f);

            // Create background color of clean color
            Color bgColor = new Color(Color.HSVtoRGB(hsv[0], 1f, 1f));
            hsvGradient.setBackgroundColor(bgColor);

            return new int[] { x, y };
        }

        @Override
        public Color calculate(int x, int y) {
            float saturation = 1f - (y / 220.0f);
            float value = (x / 220.0f);
            float hue = Float.parseFloat(hueSlider.getValue().toString()) / 360f;

            Color color = new Color(Color.HSVtoRGB(hue, saturation, value));
            return color;
        }
    };

    private static Logger getLogger() {
        return Logger.getLogger(ColorPickerPopup.class.getName());
    }
}


text:
<?php

namespace Phprest\Util\DataStructure;

class MimeProcessResult
{
    /**
     * @var string
     */
    public $mime;

    /**
     * @var string
     */
    public $vendor;

    /**
     * @var int|string
     */
    public $apiVersion;

    /**
     * @var string json|xml
     */
    public $format;

    /**
     * @param string $mime
     * @param string $vendor
     * @param int|string $apiVersion
     * @param string $format
     */
    public function __construct($mime, $vendor, $apiVersion, $format)
    {
        $this->mime         = $mime;
        $this->vendor       = $vendor;
        $this->apiVersion   = $apiVersion;
        $this->format       = $format;
    }
}


text:
"""Deep Q learning graph

The functions in this file can are used to create the following functions:

======= act ========

    Function to chose an action given an observation

    Parameters
    ----------
    observation: object
        Observation that can be feed into the output of make_obs_ph
    stochastic: bool
        if set to False all the actions are always deterministic (default False)
    update_eps_ph: float
        update epsilon a new value, if negative not update happens
        (default: no update)

    Returns
    -------
    Tensor of dtype tf.int64 and shape (BATCH_SIZE,) with an action to be performed for
    every element of the batch.

======= train =======

    Function that takes a transition (s,a,r,s') and optimizes Bellman equation's error:

        td_error = Q(s,a) - (r + gamma * max_a' Q(s', a'))
        loss = huber_loss[td_error]

    Parameters
    ----------
    obs_t: object
        a batch of observations
    action: np.array
        actions that were selected upon seeing obs_t.
        dtype must be int32 and shape must be (batch_size,)
    reward: np.array
        immediate reward attained after executing those actions
        dtype must be float32 and shape must be (batch_size,)
    obs_tp1: object
        observations that followed obs_t
    done: np.array
        1 if obs_t was the last observation in the episode and 0 otherwise
        obs_tp1 gets ignored, but must be of the valid shape.
        dtype must be float32 and shape must be (batch_size,)
    weight: np.array
        imporance weights for every element of the batch (gradient is multiplied
        by the importance weight) dtype must be float32 and shape must be (batch_size,)

    Returns
    -------
    td_error: np.array
        a list of differences between Q(s,a) and the target in Bellman's equation.
        dtype is float32 and shape is (batch_size,)

======= update_target ========

    copy the parameters from optimized Q function to the target Q function.
    In Q learning we actually optimize the following error:

        Q(s,a) - (r + gamma * max_a' Q'(s', a'))

    Where Q' is lagging behind Q to stablize the learning. For example for Atari

    Q' is set to Q once every 10000 updates training steps.

"""
import tensorflow as tf
import baselines.common.tf_util as U
from cleverhans.attacks import FastGradientMethod, BasicIterativeMethod, CarliniWagnerL2
from cleverhans.model import CallableModelWrapper

def build_act(make_obs_ph, q_func, num_actions, attack=None, scope="deepq", reuse=None, model_path=''):
    """Creates the act function:

    Parameters
    ----------
    make_obs_ph: str -> tf.placeholder or TfInput
        a function that take a name and creates a placeholder of input with that name
    q_func: (tf.Variable, int, str, bool) -> tf.Variable
        the model that takes the following inputs:
            observation_in: object
                the output of observation placeholder
            num_actions: int
                number of actions
            scope: str
            reuse: bool
                should be passed to outer variable scope
        and returns a tensor of shape (batch_size, num_actions) with values of every action.
    num_actions: int
        number of actions.
    scope: str or VariableScope
        optional scope for variable_scope.
    reuse: bool or None
        whether or not the variables should be reused. To be able to reuse the scope must be given.

    Returns
    -------
    act: (tf.Variable, bool, float) -> tf.Variable
        function to select and action given observation.
`       See the top of the file for details.
    """
    with tf.variable_scope(scope, reuse=reuse):
        observations_ph = U.ensure_tf_input(make_obs_ph("observation"))
        stochastic_ph = tf.placeholder(tf.bool, (), name="stochastic")
        update_eps_ph = tf.placeholder(tf.float32, (), name="update_eps")

        eps = tf.get_variable("eps", (), initializer=tf.constant_initializer(0))

        q_values = q_func(observations_ph.get(), num_actions, scope="q_func", concat_softmax=True)
        deterministic_actions = tf.argmax(q_values, axis=1)
        batch_size = tf.shape(observations_ph.get())[0]
        random_actions = tf.random_uniform(tf.stack([batch_size]), minval=0, maxval=num_actions, dtype=tf.int64)
        chose_random = tf.random_uniform(tf.stack([batch_size]), minval=0, maxval=1, dtype=tf.float32) < eps
        stochastic_actions = tf.where(chose_random, random_actions, deterministic_actions)

        output_actions = tf.cond(stochastic_ph, lambda: stochastic_actions, lambda: deterministic_actions)
        update_eps_expr = eps.assign(tf.cond(update_eps_ph >= 0, lambda: update_eps_ph, lambda: eps))

        act = U.function(inputs=[observations_ph, stochastic_ph, update_eps_ph],
                         outputs=output_actions,
                         givens={update_eps_ph: -1.0, stochastic_ph: True},
                         updates=[update_eps_expr])

        # Load model before attacks graph construction so that TF won't
        # complain can't load parameters for attack
        U.load_state(model_path)

        if attack != None:
            if attack == 'fgsm':
                def wrapper(x):
                    return q_func(x, num_actions, scope="q_func", reuse=True, concat_softmax=True)
                adversary = FastGradientMethod(CallableModelWrapper(wrapper, 'probs'), sess=U.get_session())
                adv_observations = adversary.generate(observations_ph.get(), eps=1.0/255.0,
                                                      clip_min=0, clip_max=1.0) * 255.0
            elif attack == 'iterative':
                def wrapper(x):
                    return q_func(x, num_actions, scope="q_func", reuse=True, concat_softmax=True)
                adversary = BasicIterativeMethod(CallableModelWrapper(wrapper, 'probs'), sess=U.get_session())
                adv_observations = adversary.generate(observations_ph.get(), eps=1.0/255.0,
                                                      clip_min=0, clip_max=1.0) * 255.0
            elif attack == 'cwl2':
                def wrapper(x):
                    return q_func(x, num_actions, scope="q_func", reuse=True)
                adversary = CarliniWagnerL2(CallableModelWrapper(wrapper, 'logits'), sess=U.get_session())
                cw_params = {'binary_search_steps': 1,
                             'max_iterations': 100,
                             'learning_rate': 0.1,
                             'initial_const': 10,
                             'clip_min': 0,
                             'clip_max': 1.0}
                adv_observations = adversary.generate(observations_ph.get(), **cw_params) * 255.0

            craft_adv_obs = U.function(inputs=[observations_ph, stochastic_ph, update_eps_ph],
                            outputs=adv_observations,
                            givens={update_eps_ph: -1.0, stochastic_ph: True},
                            updates=[update_eps_expr])

        if attack == None:
            craft_adv_obs = None

        return act, craft_adv_obs

def build_train(make_obs_ph, q_func, num_actions, optimizer, grad_norm_clipping=None, gamma=1.0, double_q=True, scope="deepq", reuse=None):
    """Creates the train function:

    Parameters
    ----------
    make_obs_ph: str -> tf.placeholder or TfInput
        a function that takes a name and creates a placeholder of input with that name
    q_func: (tf.Variable, int, str, bool) -> tf.Variable
        the model that takes the following inputs:
            observation_in: object
                the output of observation placeholder
            num_actions: int
                number of actions
            scope: str
            reuse: bool
                should be passed to outer variable scope
        and returns a tensor of shape (batch_size, num_actions) with values of every action.
    num_actions: int
        number of actions
    reuse: bool
        whether or not to reuse the graph variables
    optimizer: tf.train.Optimizer
        optimizer to use for the Q-learning objective.
    grad_norm_clipping: float or None
        clip gradient norms to this value. If None no clipping is performed.
    gamma: float
        discount rate.
    double_q: bool
        if true will use Double Q Learning (https://arxiv.org/abs/1509.06461).
        In general it is a good idea to keep it enabled.
    scope: str or VariableScope
        optional scope for variable_scope.
    reuse: bool or None
        whether or not the variables should be reused. To be able to reuse the scope must be given.

    Returns
    -------
    act: (tf.Variable, bool, float) -> tf.Variable
        function to select and action given observation.
`       See the top of the file for details.
    train: (object, np.array, np.array, object, np.array, np.array) -> np.array
        optimize the error in Bellman's equation.
`       See the top of the file for details.
    update_target: () -> ()
        copy the parameters from optimized Q function to the target Q function.
`       See the top of the file for details.
    debug: {str: function}
        a bunch of functions to print debug data like q_values.
    """
    act_f = build_act(make_obs_ph, q_func, num_actions, scope=scope, reuse=reuse)

    with tf.variable_scope(scope, reuse=reuse):
        # set up placeholders
        obs_t_input = U.ensure_tf_input(make_obs_ph("obs_t"))
        act_t_ph = tf.placeholder(tf.int32, [None], name="action")
        rew_t_ph = tf.placeholder(tf.float32, [None], name="reward")
        obs_tp1_input = U.ensure_tf_input(make_obs_ph("obs_tp1"))
        done_mask_ph = tf.placeholder(tf.float32, [None], name="done")
        importance_weights_ph = tf.placeholder(tf.float32, [None], name="weight")

        # q network evaluation
        q_t = q_func(obs_t_input.get(), num_actions, scope="q_func", reuse=True)  # reuse parameters from act
        q_func_vars = U.scope_vars(U.absolute_scope_name("q_func"))

        # target q network evalution
        q_tp1 = q_func(obs_tp1_input.get(), num_actions, scope="target_q_func")
        target_q_func_vars = U.scope_vars(U.absolute_scope_name("target_q_func"))

        # q scores for actions which we know were selected in the given state.
        q_t_selected = tf.reduce_sum(q_t * tf.one_hot(act_t_ph, num_actions), 1)

        # compute estimate of best possible value starting from state at t + 1
        if double_q:
            q_tp1_using_online_net = q_func(obs_tp1_input.get(), num_actions, scope="q_func", reuse=True)
            q_tp1_best_using_online_net = tf.arg_max(q_tp1_using_online_net, 1)
            q_tp1_best = tf.reduce_sum(q_tp1 * tf.one_hot(q_tp1_best_using_online_net, num_actions), 1)
        else:
            q_tp1_best = tf.reduce_max(q_tp1, 1)
        q_tp1_best_masked = (1.0 - done_mask_ph) * q_tp1_best

        # compute RHS of bellman equation
        q_t_selected_target = rew_t_ph + gamma * q_tp1_best_masked

        # compute the error (potentially clipped)
        td_error = q_t_selected - tf.stop_gradient(q_t_selected_target)
        errors = U.huber_loss(td_error)
        weighted_error = tf.reduce_mean(importance_weights_ph * errors)
        # compute optimization op (potentially with gradient clipping)
        if grad_norm_clipping is not None:
            optimize_expr = U.minimize_and_clip(optimizer,
                                                weighted_error,
                                                var_list=q_func_vars,
                                                clip_val=grad_norm_clipping)
        else:
            optimize_expr = optimizer.minimize(weighted_error, var_list=q_func_vars)

        # update_target_fn will be called periodically to copy Q network to target Q network
        update_target_expr = []
        for var, var_target in zip(sorted(q_func_vars, key=lambda v: v.name),
                                   sorted(target_q_func_vars, key=lambda v: v.name)):
            update_target_expr.append(var_target.assign(var))
        update_target_expr = tf.group(*update_target_expr)

        # Create callable functions
        train = U.function(
            inputs=[
                obs_t_input,
                act_t_ph,
                rew_t_ph,
                obs_tp1_input,
                done_mask_ph,
                importance_weights_ph
            ],
            outputs=td_error,
            updates=[optimize_expr]
        )
        update_target = U.function([], [], updates=[update_target_expr])

        q_values = U.function([obs_t_input], q_t)

        return act_f, train, update_target, {'q_values': q_values}


text:
'use strict';
var util = require('util');
var yeoman = require('yeoman-generator');

var StandardappGenerator = module.exports = function StandardappGenerator(args, options, config) {
	var instance = this;

	// By calling `NamedBase` here, we get the argument to the subgenerator call
	// as `this.name`.
	yeoman.generators.NamedBase.apply(this, arguments);

	// Load options from parent generator
	this.nested = instance.options.nested;
	this.appName = instance.options.appName;
	this.appNS = instance.options.appNS;
	this.jsPath = instance.options.jsPath;
	this.appType = instance.options.appType;
	this.createController = instance.options.createController;
	this.controllerName = instance.options.controllerName;
	this.createExampleClasses = instance.options.createExampleClasses;

};

util.inherits(StandardappGenerator, yeoman.generators.NamedBase);

StandardappGenerator.prototype.files = function files() {
	this.mkdir(this.jsPath + '/');
	this.mkdir(this.jsPath + '/' + this.appNS);
	this.template('js/APP/main.js', this.jsPath + '/' + this.appNS + '/main.js');

	this.mkdir(this.jsPath + '/lib');
	this.template('js/lib/hbs.js', this.jsPath + '/' + 'lib/hbs.js');
	this.template('js/lib/jquery-1.10.2.min.js', this.jsPath + '/' + 'lib/jquery-1.10.2.min.js');
	this.template('js/lib/modernizr-2.6.2.min.js', this.jsPath + '/' + 'lib/modernizr-2.6.2.min.js');

	this.controllerPath = '';
	if (this.createExampleClasses) {
		this.controllerPath = this.appNS + '.controllers.' + this.controllerName;

		this.mkdir(this.jsPath + '/' + this.appNS + '/examples');
		this.template('js/APP/examples/MyClass.js', this.jsPath + '/' + this.appNS + '/examples/MyClass.js');
		this.template('js/APP/examples/MySingleton.js', this.jsPath + '/' + this.appNS + '/examples/MySingleton.js');
		this.template('js/APP/examples/MySubclass.js', this.jsPath + '/' + this.appNS + '/examples/MySubclass.js');
		this.template('js/APP/examples/MyWidget.js', this.jsPath + '/' + this.appNS + '/examples/MyWidget.js');

		this.template('index.html', 'index.html');

		this.mkdir('css');
		this.copy('css/bootstrap.css', 'css/bootstrap.css');
	}

	if (this.createController) {
		this.mkdir(this.jsPath + '/' + this.appNS + '/controllers');
		this.template('js/APP/controllers/mysection.js', this.jsPath + '/' + this.appNS + '/controllers/' + this.controllerName + '.js');
	}
};


text:
import java.lang.Math;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.Callable;
import java.util.Random;

public class HashWorker implements Callable<HashResult> {
    private Random random;
    private HashResult localMaxima;
    private byte[] target;
    private MessageDigest md;
    private int maxLength;
    private int reset;

    public HashWorker(Random initialRandom,
            String algorithm,
            int maxLength,
            byte[] target,
            int reset) throws NoSuchAlgorithmException {
        this.random = new Random(initialRandom.nextLong());
        this.md = MessageDigest.getInstance(algorithm);
        this.target = target;
        this.maxLength = maxLength;
        this.reset = reset;
    }

    public HashResult call() {
        for (int reset = this.reset; reset > 0; reset--) {
            hashNext();
        }
        return localMaxima;
    }

    private void hashNext() {
        int bufLength = Math.abs(this.random.nextInt() % maxLength);
        byte[] buf = new byte[bufLength];
        this.random.nextBytes(buf);
        this.md.reset();
        this.md.update(buf);
        byte[] digest = this.md.digest();
        int distance = hammingDistance(digest, target);
        if (localMaxima == null || distance > localMaxima.getDistance()) {
            localMaxima = new HashResult(distance, buf);
        }
    }

    private int hammingDistance(byte[] b1, byte[] b2) {
        assert b1.length == b2.length : "Cannot compute hamming distance";
        int result = 0;
        for (int i = 0; i < b1.length; i++){
            result += hammingDistance(b1[i], b2[i]);
        }
        return result;
    }

    private int hammingDistance(byte b1, byte b2) {
        int result = 0;
        int bRes = b1 ^ b2;
        result += bRes & 0x1;
        result += (bRes & 0x2) >> 1;
        result += (bRes & 0x4) >> 2;
        result += (bRes & 0x8) >> 3;
        result += (bRes & 0x10) >> 4;
        result += (bRes & 0x20) >> 5;
        result += (bRes & 0x40) >> 6;
        result += (bRes & 0x80) >> 7;
        return result;
    }
}