text:
require 'spec_helper'

# This spec is more of a functional spec for all of the model bits put together
describe "models" do

  before do
    Dragonfly.app.use_datastore(:memory)
  end

  describe "using the module" do
    it "adds 'dragonfly_accessor'" do
      klass = Class.new do
        extend Dragonfly::Model
        dragonfly_accessor :hello
      end
    end
  end

  describe "defining accessors" do

    before(:each) do
      @app1, @app2 = Dragonfly.app(:img), Dragonfly.app(:vid)
      app1, app2 = @app1, @app2
      @model_class = new_model_class do
        dragonfly_accessor :preview_image, :app => app1
        dragonfly_accessor :trailer_video, :app => app2
      end
      @classes = @model_class.dragonfly_attachment_classes
      @class1, @class2 = @classes
    end

    it "should return the attachment classes" do
      @class1.superclass.should == Dragonfly::Model::Attachment
      @class2.superclass.should == Dragonfly::Model::Attachment
    end

    it "should associate the correct app with each class" do
      @class1.app.should == @app1
      @class2.app.should == @app2
    end

    it "should associate the correct attribute with each class" do
      @class1.attribute.should == :preview_image
      @class2.attribute.should == :trailer_video
    end

    it "should associate the correct model class with each class" do
      @class1.model_class.should == @model_class
      @class2.model_class.should == @model_class
    end

    it "should allow passing the app name as the :app value" do
      klass = new_model_class do
        dragonfly_accessor :egg_nog, :app => :vid
      end
      klass.dragonfly_attachment_classes.first.app.should == @app2
    end

    it "should default the app to the default app" do
      klass = new_model_class do
        dragonfly_accessor :egg_nog
      end
      klass.dragonfly_attachment_classes.first.app.should == Dragonfly.app
    end
  end

  describe "correctly defined" do

    before(:each) do
      @app = test_app
      @item_class = new_model_class('Item', :preview_image_uid, :preview_image_size) do
        dragonfly_accessor :preview_image
      end
      @item = @item_class.new
    end

    it "should provide a reader" do
      @item.should respond_to(:preview_image)
    end

    it "should provide a writer" do
      @item.should respond_to(:preview_image=)
    end

    describe "when there has been nothing assigned" do
      it "the reader should return nil" do
        @item.preview_image.should be_nil
      end
      it "the uid should be nil" do
        @item.preview_image_uid.should be_nil
      end
      it "should not try to store anything on save" do
        @app.datastore.should_not_receive(:write)
        @item.save!
      end
      it "should not try to destroy anything on save" do
        @app.datastore.should_not_receive(:destroy)
        @item.save!
      end
      it "should not try to destroy anything on destroy" do
        @app.datastore.should_not_receive(:destroy)
        @item.destroy
      end
    end

    describe "after a record with an empty uid is saved" do
      before(:each) do
        @item.preview_image_uid = ''
        @item.save!
      end

      it "should not try to destroy anything on destroy" do
        @app.datastore.should_not_receive(:destroy)
        @item.destroy
      end
    end

    describe "when the uid is set manually" do
      before(:each) do
        @item.preview_image_uid = 'some_known_uid'
      end
      it "should not try to read any data" do
        @app.datastore.should_not_receive(:read)
        @item.save!
      end
      it "should not try to destroy any data" do
        @app.datastore.should_not_receive(:destroy)
        @item.save!
      end
      it "should not try to store any data" do
        @app.datastore.should_not_receive(:write)
        @item.save!
      end
    end

    describe "when there has been some thing assigned but not saved" do
      before(:each) do
        @item.preview_image = "DATASTRING"
      end
      it "the reader should return an attachment" do
        @item.preview_image.should be_a(Dragonfly::Model::Attachment)
      end
      it "the uid should be nil" do
        @item.preview_image_uid.should be_nil
      end
      it "should store the image when saved" do
        @app.datastore.should_receive(:write).with(content_with_data("DATASTRING"), hash_including)
        @item.save!
      end
      it "should not try to destroy anything on destroy" do
        @app.datastore.should_not_receive(:destroy)
        @item.destroy
      end
      it "should return nil for the url" do
        @item.preview_image.url.should be_nil
      end
      describe "when the uid is set manually" do
        before(:each) do
          @item.preview_image_uid = 'some_known_uid'
        end
        it "should not try to read any data" do
          @app.datastore.should_not_receive(:read)
          @item.save!
        end
        it "should not try to destroy any data" do
          @app.datastore.should_not_receive(:destroy)
          @item.save!
        end
        it "should not try to store any data" do
          @app.datastore.should_not_receive(:write)
          @item.save!
        end
      end

    end

    describe "when something has been assigned and saved" do

      before(:each) do
        @item.preview_image = "DATASTRING"
        @app.datastore.should_receive(:write).with(content_with_data("DATASTRING"), hash_including).once.and_return('some_uid')
        @item.save!
      end

      it "should have the correct uid" do
        @item.preview_image_uid.should == 'some_uid'
      end
      it "should not try to store anything if saved again" do
        @app.datastore.should_not_receive(:write)
        @item.save!
      end

      it "should not try to destroy anything if saved again" do
        @app.datastore.should_not_receive(:destroy)
        @item.save!
      end

      it "should destroy the data on destroy" do
        @app.datastore.should_receive(:destroy).with('some_uid')
        @item.destroy
      end

      it "should destroy the old data when the uid is set manually" do
        @app.datastore.should_receive(:destroy).with('some_uid')
        @item.preview_image_uid = 'some_known_uid'
        @item.save!
      end

      # SEE model_urls_spec.rb for urls

      describe "when accessed by a new model object" do
        before(:each) do
          @item = @item_class.find(@item.id)
        end
        it "should destroy the data on destroy" do
          @app.datastore.should_receive(:destroy).with(@item.preview_image_uid)
          @item.destroy
        end
      end

      describe "when something new is assigned" do
        before(:each) do
          @item.preview_image = "ANEWDATASTRING"
          @app.datastore.stub(:write).and_return('some_uid')
        end
        it "should set the uid to nil" do
          @item.preview_image_uid.should be_nil
        end
        it "should destroy the old data when saved" do
          @app.datastore.should_receive(:destroy).with('some_uid')
          @item.save!
        end

        it "should not try to destroy the old data if saved again" do
          @app.datastore.should_receive(:destroy).with('some_uid')
          @item.save!
          @app.datastore.should_not_receive(:destroy).with('some_uid')
          @item.save!
        end
        it "should destroy the old data when saved, even if yet another thing is assigned" do
          @item.preview_image = "YET ANOTHER DATA STRING"
          @app.datastore.should_receive(:destroy).with('some_uid')
          @item.save!
        end
        it "should store the new data when saved" do
          @app.datastore.should_receive(:write).with(content_with_data("ANEWDATASTRING"), hash_including)
          @item.save!
        end
        it "should destroy the old data on destroy" do
          @app.datastore.should_receive(:destroy).with('some_uid')
          @item.destroy
        end
        it "should destroy the old data on destroy, even if yet another thing is assigned" do
          @item.preview_image = "YET ANOTHER DATA STRING"
          @app.datastore.should_receive(:destroy).with('some_uid')
          @item.destroy
        end
        it "should destroy the old data when the uid has been set manually" do
          @app.datastore.should_receive(:destroy).with('some_uid')
          @item.preview_image_uid = 'some_known_uid'
          @item.save!
        end
        it "should return the new size" do
          @item.preview_image.size.should == 14
        end
        it "should return the new data" do
          @item.preview_image.data.should == 'ANEWDATASTRING'
        end

        it 'should mark the attribute as changed' do
          @item.preview_image_uid_changed?.should be_true
        end
      end

      describe "when it is set to nil" do
        before(:each) do
          @item.preview_image = nil
        end
        it "should set the uid to nil" do
          @item.preview_image_uid.should be_nil
        end
        it "should return the attribute as nil" do
          @item.preview_image.should be_nil
        end
        it "should destroy the data on save" do
          @app.datastore.should_receive(:destroy).with('some_uid')
          @item.save!
          @item.preview_image.should be_nil
        end
        it "should destroy the old data on destroy" do
          @app.datastore.should_receive(:destroy).with('some_uid')
          @item.destroy
        end

        it 'should mark the attribute as changed' do
          @item.preview_image_uid_changed?.should be_true
        end

      end

    end

    describe "other types of assignment" do
      before(:each) do
        @app.add_generator :egg do |content|
          content.update "Gungedin"
        end
        @app.add_processor :doogie do |content|
          content.update content.data.upcase
        end
      end

      describe "assigning with a job" do
        before(:each) do
          @job = @app.generate(:egg)
          @item.preview_image = @job
        end

        it "should work" do
          @item.preview_image.data.should == 'Gungedin'
        end

        it "should not be affected by subsequent changes to the job" do
          @job.process!(:doogie)
          @item.preview_image.data.should == 'Gungedin'
        end
      end

      describe "assigning with another attachment" do
        before(:each) do
          @item_class.class_eval do
            attr_accessor :other_image_uid
            dragonfly_accessor :other_image
          end
        end
        it "should work like assigning the job" do
          @item.preview_image = 'eggheads'
          @item.other_image = @item.preview_image
          @item.preview_image = 'dogchin'
          @item.other_image.data.should == 'eggheads'
        end
      end

      describe "assigning by means of a bang method" do
        before(:each) do
          @app.add_processor :double do |content|
            content.update content.data * 2
          end
          @item.preview_image = "HELLO"
        end
        it "should modify as if being assigned again" do
          @item.preview_image.process!(:double)
          @item.preview_image.data.should == 'HELLOHELLO'
        end
        it "should update the magic attributes" do
          @item.preview_image.process!(:double)
          @item.preview_image_size.should == 10
        end
        it "should work repeatedly" do
          @item.preview_image.process!(:double).process!(:double)
          @item.preview_image.data.should == 'HELLOHELLOHELLOHELLO'
          @item.preview_image_size.should == 20
        end
      end
    end

    describe "remote_url" do
      it "should give the remote url if the uid is set" do
        @item.preview_image_uid = 'some/uid'
        @app.should_receive(:remote_url_for).with('some/uid', :some => 'param').and_return('http://egg.nog')
        @item.preview_image.remote_url(:some => 'param').should == 'http://egg.nog'
      end
      it "should return nil if the content is not yet saved" do
        @item.preview_image = "hello"
        @item.preview_image.remote_url(:some => 'param').should be_nil
      end
    end

  end

  describe "extra properties" do

    before(:each) do
      @app = test_app
      @app.add_analyser :some_analyser_method do |content|
        "abc" + content.data[0..0]
      end
      @app.add_analyser :number_of_As do |content|
        content.data.count('A')
      end

      @item_class = new_model_class('Item',
        :preview_image_uid,
        :preview_image_some_analyser_method,
        :preview_image_blah_blah,
        :preview_image_size,
        :preview_image_name,
        :other_image_uid
        ) do
        dragonfly_accessor :preview_image
        dragonfly_accessor :other_image
      end
      @item = @item_class.new
    end

    describe "magic attributes" do

      it "should default the magic attribute as nil" do
        @item.preview_image_some_analyser_method.should be_nil
      end

      it "should set the magic attribute when assigned" do
        @item.preview_image = '123'
        @item.preview_image_some_analyser_method.should == 'abc1'
      end

      it "should not set non-magic attributes with the same prefix when assigned" do
        @item.preview_image_blah_blah = 'wassup'
        @item.preview_image = '123'
        @item.preview_image_blah_blah.should == 'wassup'
      end

      it "should update the magic attribute when something else is assigned" do
        @item.preview_image = '123'
        @item.preview_image = '456'
        @item.preview_image_some_analyser_method.should == 'abc4'
      end

      it "should not reset non-magic attributes with the same prefix when set to nil" do
        @item.preview_image_blah_blah = 'wassup'
        @item.preview_image = '123'
        @item.preview_image = nil
        @item.preview_image_blah_blah.should == 'wassup'
      end

      it "should work for size too" do
        @item.preview_image = '123'
        @item.preview_image_size.should == 3
      end

      it "should store the original file name if it exists" do
        data = 'jasdlkf sadjl'
        data.stub(:original_filename).and_return('hello.png')
        @item.preview_image = data
        @item.preview_image_name.should == 'hello.png'
      end

      it "sets to nil if the analysis method blows up" do
        @app.add_analyser :some_analyser_method do |content|
          raise "oh dear"
        end
        @item.preview_image = '123'
        @item.preview_image_some_analyser_method.should be_nil
      end

    end

    describe "delegating methods to the job" do
      before(:each) do
        @item.preview_image = "DATASTRING"
      end
      it "should have properties from the analyser" do
        @item.preview_image.number_of_As.should == 2
      end
      it "should report that it responds to analyser methods" do
        @item.preview_image.respond_to?(:number_of_As).should be_true
      end
      it "should include analyser methods in methods" do
        @item.preview_image.methods.map{|m| m.to_sym }.should include(:number_of_As)
      end
      it "should include analyser methods in public_methods" do
        @item.preview_image.public_methods.map{|m| m.to_sym }.should include(:number_of_As)
      end

      it "should update when something new is assigned" do
        @item.preview_image = 'ANEWDATASTRING'
        @item.preview_image.number_of_As.should == 3
      end

      describe "from a new model object" do
        before(:each) do
          item = @item_class.create!(:preview_image => 'DATASTRING')
          @item = @item_class.find(item.id)
        end
        it "should load the content then delegate the method" do
          @item.preview_image.number_of_As.should == 2
        end
        it "should use the magic attribute if there is one, and not load the content" do
          @app.datastore.should_not_receive(:read)
          @item.should_receive(:preview_image_some_analyser_method).at_least(:once).and_return('result yo')
          @item.preview_image.some_analyser_method.should == 'result yo'
        end

        it "should use the magic attribute for size if there is one, and not the job object" do
          @item.preview_image.send(:job).should_not_receive(:size)
          @item.should_receive("preview_image_size").and_return(17)
          @item.preview_image.size.should == 17
        end

        it "should use the magic attribute for name if there is one, and not the job object" do
          @item.preview_image.send(:job).should_not_receive(:name)
          @item.should_receive("preview_image_name").and_return('jeffrey.bungle')
          @item.preview_image.name.should == 'jeffrey.bungle'
        end

        it "should delegate 'size' to the job object if there is no magic attribute for it" do
          @item.other_image = 'blahdata'
          @item.other_image.send(:job).should_receive(:size).and_return 54
          @item.other_image.size.should == 54
        end

      end

      it "should not raise an error if a non-existent method is called" do
        # Just checking method missing works ok
        lambda{
          @item.preview_image.eggbert
        }.should raise_error(NoMethodError)
      end
    end

    describe "setting things on the attachment" do

      before(:each) do
        @item = @item_class.new
      end

      describe "name" do
        before(:each) do
          @item.preview_image = "Hello"
          @item.preview_image.name = 'hello.there'
        end
        it "should allow for setting the name" do
          @item.preview_image.name.should == 'hello.there'
        end
        it "should update the magic attribute" do
          @item.preview_image_name.should == 'hello.there'
        end
        it "should return the name" do
          (@item.preview_image.name = 'no.silly').should == 'no.silly'
        end
        it "should update the ext too" do
          @item.preview_image.ext.should == 'there'
        end
      end

      describe "meta" do
        before :each do
          @item.preview_image = 'hello'
        end
        it "should include meta info about the model by default" do
          @item.preview_image.meta.should include_hash('model_class' => 'Item', 'model_attachment' => 'preview_image')
        end
        it "provides accessors" do
          @item.preview_image.meta = {'slime' => 'balls'}
          @item.preview_image.meta.should == {'slime' => 'balls'}
        end
        it "provides add_meta" do
          @item.preview_image.add_meta('sum' => 'ting').should == @item.preview_image
          @item.preview_image.meta['sum'].should == 'ting'
        end
      end

    end

  end

  describe "inheritance" do

    before(:all) do
      @app = test_app
      @app2 = test_app(:two)
      @car_class = new_model_class('Car', :image_uid, :reliant_image_uid) do
        dragonfly_accessor :image
      end
      @photo_class = new_model_class('Photo', :image_uid) do
        dragonfly_accessor :image, :app => :two
      end

      @base_class = @car_class
      class ReliantRobin < @car_class; dragonfly_accessor :reliant_image; end
      @subclass = ReliantRobin
      class ReliantRobinWithModule < @car_class
        include Module.new
        dragonfly_accessor :reliant_image
      end
      @subclass_with_module = ReliantRobinWithModule
      @unrelated_class = @photo_class
    end

    it "should allow assigning base class accessors" do
      @base_class.create! :image => 'blah'
    end
    it "should not allow assigning subclass accessors in the base class" do
      @base_class.new.should_not respond_to(:reliant_image=)
    end
    it "should allow assigning base class accessors in the subclass" do
      @subclass.create! :image => 'blah'
    end
    it "should allow assigning subclass accessors in the subclass" do
      @subclass.create! :reliant_image => 'blah'
    end
    it "should allow assigning base class accessors in the subclass, even if it has mixins" do
      @subclass_with_module.create! :image => 'blah'
    end
    it "should allow assigning subclass accessors in the subclass, even if it has mixins" do
      @subclass_with_module.create! :reliant_image => 'blah'
    end
    it "should return the correct attachment classes for the base class" do
      @base_class.dragonfly_attachment_classes.should match_attachment_classes([[@car_class, :image, @app]])
    end
    it "should return the correct attachment classes for the subclass" do
      @subclass.dragonfly_attachment_classes.should match_attachment_classes([[ReliantRobin, :image, @app], [ReliantRobin, :reliant_image, @app]])
    end
    it "should return the correct attachment classes for the subclass with module" do
      @subclass_with_module.dragonfly_attachment_classes.should match_attachment_classes([[ReliantRobinWithModule, :image, @app], [ReliantRobinWithModule, :reliant_image, @app]])
    end
    it "should return the correct attachment classes for a class from a different hierarchy" do
      @unrelated_class.dragonfly_attachment_classes.should match_attachment_classes([[@photo_class, :image, @app2]])
    end
  end

  describe "setting the url" do
    before(:each) do
      @item_class = new_model_class('Item', :preview_image_uid, :preview_image_name) do
        dragonfly_accessor :preview_image
      end
      @item = @item_class.new
      stub_request(:get, "http://some.url/yo.png").to_return(:body => "aaaaayo")
    end

    it "should allow setting the url" do
      @item.preview_image_url = 'http://some.url/yo.png'
      @item.preview_image.data.should == 'aaaaayo'
    end
    it "should return nil always for the reader" do
      @item.preview_image_url = 'http://some.url/yo.png'
      @item.preview_image_url.should be_nil
    end
    it "should have set the name" do
      @item.preview_image_url = 'http://some.url/yo.png'
      @item.preview_image_name.should == 'yo.png'
      @item.preview_image.meta['name'].should == 'yo.png'
    end
    [nil, ""].each do |value|
      it "should do nothing if set with #{value.inspect}" do
        @item.preview_image_url = value
        @item.preview_image.should be_nil
      end
    end
  end

  describe "removing the accessor with e.g. a form" do
    before(:each) do
      @item_class = new_model_class('Item', :preview_image_uid) do
        dragonfly_accessor :preview_image
      end
      @item = @item_class.new
      @item.preview_image = "something"
    end

    [
      1,
      "1",
      true,
      "true",
      "blahblah"
    ].each do |value|
      it "should remove the accessor if passed #{value.inspect}" do
        @item.remove_preview_image = value
        @item.preview_image.should be_nil
      end

      it "should return true when called if set with #{value.inspect}" do
        @item.remove_preview_image = value
        @item.remove_preview_image.should be_true
      end
    end

    [
      0,
      "0",
      false,
      "false",
      "",
      nil
    ].each do |value|
      it "should not remove the accessor if passed #{value.inspect}" do
        @item.remove_preview_image = value
        @item.preview_image.should_not be_nil
      end

      it "should return false when called if set with #{value.inspect}" do
        @item.remove_preview_image = value
        @item.remove_preview_image.should be_false
      end
    end

    it "should return false by default for the getter" do
      @item.remove_preview_image.should be_false
    end

  end

  describe "callbacks" do

    describe "after_assign" do

      before(:each) do
        @app = test_app
        @item_class = new_model_class('Item', :preview_image_uid, :title)
      end

      describe "as a block" do

        def set_after_assign(*args, &block)
          @item_class.class_eval do
            dragonfly_accessor :preview_image do
              after_assign(*args, &block)
            end
          end
        end

        it "should call it after assign" do
          x = nil
          set_after_assign{ x = 3 }
          @item_class.new.preview_image = "hello"
          x.should == 3
        end

        it "should not call it after unassign" do
          x = nil
          set_after_assign{ x = 3 }
          @item_class.new.preview_image = nil
          x.should be_nil
        end

        it "should yield the attachment" do
          x = nil
          set_after_assign{|a| x = a.data }
          @item_class.new.preview_image = "discussion"
          x.should == "discussion"
        end

        it "should evaluate in the model context" do
          x = nil
          set_after_assign{ x = title.upcase }
          item = @item_class.new
          item.title = "big"
          item.preview_image = "jobs"
          x.should == "BIG"
        end

        it "should allow passing a symbol for calling a model method" do
          set_after_assign :set_title
          item = @item_class.new
          def item.set_title; self.title = 'duggen'; end
          item.preview_image = "jobs"
          item.title.should == "duggen"
        end

        it "should allow passing multiple symbols" do
          set_after_assign :set_title, :upcase_title
          item = @item_class.new
          def item.set_title; self.title = 'doobie'; end
          def item.upcase_title; self.title.upcase!; end
          item.preview_image = "jobs"
          item.title.should == "DOOBIE"
        end

        it "should not re-trigger callbacks (causing an infinite loop)" do
          set_after_assign{|a| self.preview_image = 'dogman' }
          item = @item_class.new
          item.preview_image = "hello"
        end

      end

    end

    describe "after_unassign" do
      before(:each) do
        @app = test_app
        @item_class = new_model_class('Item', :preview_image_uid, :title) do
          dragonfly_accessor :preview_image do
            after_unassign{ self.title = 'unassigned' }
          end
        end
        @item = @item_class.new :title => 'yo'
      end

      it "should not call it after assign" do
        @item.preview_image = 'suggs'
        @item.title.should == 'yo'
      end

      it "should call it after unassign" do
        @item.preview_image = nil
        @item.title.should == 'unassigned'
      end
    end

    describe "copy_to" do
      before(:each) do
        @app = test_app
        @app.add_processor(:append) do |content, string|
          content.update(content.data + string)
        end
        @item_class = new_model_class('Item', :preview_image_uid, :other_image_uid, :yet_another_image_uid, :title) do
          dragonfly_accessor :preview_image do
            copy_to(:other_image){|a| a.process(:append, title) }
            copy_to(:yet_another_image)
          end
          dragonfly_accessor :other_image
          dragonfly_accessor :yet_another_image
        end
        @item = @item_class.new :title => 'yo'
      end

      it "should copy to the other image when assigned" do
        @item.preview_image = 'hello bear'
        @item.other_image.data.should == 'hello bearyo'
      end

      it "should remove the other image when unassigned" do
        @item.preview_image = 'hello bear'
        @item.preview_image = nil
        @item.other_image.should be_nil
      end

      it "should allow simply copying over without args" do
        @item.preview_image = 'hello bear'
        @item.yet_another_image.data.should == 'hello bear'
      end

    end

  end

  describe "storage_options" do

    def set_storage_options(*args, &block)
      @item_class.class_eval do
        dragonfly_accessor :preview_image do
          storage_options(*args, &block)
        end
      end
    end

    before(:each) do
      @app = test_app
      @item_class = new_model_class('Item', :preview_image_uid, :title)
    end

    it "should send the specified options to the datastore on store" do
      set_storage_options :egg => 'head'
      item = @item_class.new :preview_image => 'hello'
      @app.datastore.should_receive(:write).with(anything, hash_including(:egg => 'head'))
      item.save!
    end

    it "should allow putting in a proc" do
      set_storage_options{ {:egg => 'numb'} }
      item = @item_class.new :preview_image => 'hello'
      @app.datastore.should_receive(:write).with(anything, hash_including(:egg => 'numb'))
      item.save!
    end

    it "should yield the attachment and exec in model context" do
      set_storage_options{|a| {:egg => (a.data + title)} }
      item = @item_class.new :title => 'lump', :preview_image => 'hello'
      @app.datastore.should_receive(:write).with(anything, hash_including(:egg => 'hellolump'))
      item.save!
    end

    it "should allow giving it a method symbol" do
      set_storage_options :special_ops
      item = @item_class.new :preview_image => 'hello'
      def item.special_ops; {:a => 1}; end
      @app.datastore.should_receive(:write).with(anything, hash_including(:a => 1))
      item.save!
    end

    it "should allow setting more than once" do
      @item_class.class_eval do
        dragonfly_accessor :preview_image do
          storage_options{{ :a => title, :b => 'dumple' }}
          storage_options{{ :b => title.upcase, :c => 'digby' }}
        end
      end
      item = @item_class.new :title => 'lump', :preview_image => 'hello'
      @app.datastore.should_receive(:write).with(anything, hash_including(
        :a => 'lump', :b => 'LUMP', :c => 'digby'
      ))
      item.save!
    end

    it "gives a deprecation warning for storage_xxx methods" do
      expect {
        @item_class.class_eval do
          dragonfly_accessor :preview_image do
            storage_egg :fried
          end
        end
      }.to raise_error(/deprecated/)
    end
  end

  describe "default" do
    before do
      @app = test_app
      @item_class = new_model_class('Item', :image_uid) do
        dragonfly_accessor :image do
          default SAMPLES_DIR.join('beach.jpg')
        end
      end
      @item = @item_class.new
    end

    it "gives a default image when not set" do
      @item.image.name.should == 'beach.jpg'
      @item.image.size.should == 25932
    end

    it "acts as normal otherwise" do
      @item.image = "asdf"
      @item.image.data.should == "asdf"
    end

    it "adds to the path whitelist" do
      path = SAMPLES_DIR.join('beach.jpg')
      @app.fetch_file_whitelist.should include File.expand_path(path)
    end
  end

  describe "unknown config method" do
    it "should raise an error" do
      item_class = new_model_class('Item', :preview_image_uid)
      lambda{
        item_class.class_eval do
          dragonfly_accessor :preview_image do
            what :now?
          end
        end
      }.should raise_error(NoMethodError)
    end
  end

  describe "xxx_changed?" do
    before(:each) do
      @item_class = new_model_class('Item', :preview_image_uid) do
        dragonfly_accessor :preview_image
      end
      @item = @item_class.new
    end

    it "should be changed when assigned" do
      expect( @item.preview_image_changed? ).to be_false
      @item.preview_image = 'ggg'
      expect( @item.preview_image_changed? ).to be_true
    end

    describe "after saving" do
      before do
        @item.preview_image = 'ggg'
        @item.save!
      end

      it "should not be changed" do
        expect( @item.preview_image_changed? ).to be_false
      end

      it "should be changed when set to nil" do
        @item.preview_image = nil
        expect( @item.preview_image_changed? ).to be_true
      end

      it "should be changed when changed" do
        @item.preview_image = "asdf"
        expect( @item.preview_image_changed? ).to be_true
      end

      it "should not be changed when reloaded" do
        item = @item_class.find(@item.id)
        expect( @item.preview_image_changed? ).to be_false
      end

    end
  end

  describe "retain and pending" do
    before(:each) do
      @app=test_app
      @app.add_analyser :some_analyser_method do |content|
        content.data.upcase
      end
      @item_class = new_model_class('Item',
        :preview_image_uid,
        :preview_image_some_analyser_method,
        :preview_image_size,
        :preview_image_name
        ) do
        dragonfly_accessor :preview_image
      end
      @item = @item_class.new
    end

    it "should return nil if there are no changes" do
      @item.retained_preview_image.should be_nil
    end

    it "should return nil if assigned but not saved" do
      @item.preview_image = 'hello'
      @item.retained_preview_image.should be_nil
    end

    it "should return nil if assigned and saved" do
      @item.preview_image = 'hello'
      @item.save!
      @item.retained_preview_image.should be_nil
    end

    it "should return the saved stuff if assigned and retained" do
      @item.preview_image = 'hello'
      @item.preview_image.name = 'dog.biscuit'
      @app.datastore.should_receive(:write).with do |content, opts|
        content.data.should == 'hello'
      end.and_return('new/uid')
      @item.preview_image.retain!
      Dragonfly::Serializer.json_b64_decode(@item.retained_preview_image).should == {
        'uid' => 'new/uid',
        'some_analyser_method' => 'HELLO',
        'size' => 5,
        'name' => 'dog.biscuit'
      }
    end

    it "should rescue analysis errors" do
      @app.add_analyser(:some_analyser_method){ raise "oh no!" }
      @item.preview_image = 'hello'
      @item.preview_image.retain!
      attrs = Dragonfly::Serializer.json_b64_decode(@item.retained_preview_image)
      attrs['some_analyser_method'].should be_nil
    end

    it "should return nil if assigned, retained and saved" do
      @item.preview_image = 'hello'
      @item.preview_image.retain!
      @item.save!
      @item.retained_preview_image.should be_nil
    end

    it "should return nil if assigned, saved and retained" do
      @item.preview_image = 'hello'
      @item.save!
      @item.preview_image.retain!
      @item.retained_preview_image.should be_nil
    end

    it "should return nil if no changes have been made" do
      @item.preview_image = 'hello'
      @item.save!
      item = @item_class.find(@item.id)
      item.preview_image.retain!
      item.retained_preview_image.should be_nil
    end
  end

  describe "assigning from a pending state" do
    before(:each) do
      @app=test_app
      @app.add_analyser :some_analyser_method do |content|
        content.data.upcase
      end
      @uid = @app.store('retrieved yo')
      @pending_string = Dragonfly::Serializer.json_b64_encode(
        'uid' => @uid,
        'some_analyser_method' => 'HELLO',
        'size' => 5,
        'name' => 'dog.biscuit'
      )
      @item_class = new_model_class('Item',
        :preview_image_uid,
        :preview_image_size,
        :preview_image_some_analyser_method,
        :preview_image_name
        ) do
        dragonfly_accessor :preview_image
      end
      @item = @item_class.new
    end

    it "should be retained" do
      @item.dragonfly_attachments[:preview_image].should_receive(:retain!)
      @item.retained_preview_image = @pending_string
    end

    it "should update the attributes" do
      @item.retained_preview_image = @pending_string
      @item.preview_image_uid.should == @uid
      @item.preview_image_some_analyser_method.should == 'HELLO'
      @item.preview_image_size.should == 5
      @item.preview_image_name.should == 'dog.biscuit'
    end

    it "should be a normal fetch job" do
      @item.retained_preview_image = @pending_string
      @item.preview_image.data.should == 'retrieved yo'
    end

    it "should give the correct url" do
      @item.retained_preview_image = @pending_string
      @item.preview_image.url.should =~ %r{^/\w+/dog.biscuit}
    end

    it "should raise an error if the pending string contains a non-magic attr method" do
      pending_string = Dragonfly::Serializer.json_b64_encode(
        'uid' => @uid,
        'some_analyser_method' => 'HELLO',
        'size' => 5,
        'name' => 'dog.biscuit',
        'something' => 'else'
      )
      item = @item
      lambda{
        item.retained_preview_image = pending_string
      }.should raise_error(Dragonfly::Model::Attachment::BadAssignmentKey)
    end

    [nil, "", "asdfsad"].each do |value|
      it "should do nothing if assigned with #{value}" do
        @item.retained_preview_image = value
        @item.preview_image_uid.should be_nil
      end
    end

    it "should return the pending string again" do
      @item.retained_preview_image = @pending_string
      Dragonfly::Serializer.json_b64_decode(@item.retained_preview_image).should ==
        Dragonfly::Serializer.json_b64_decode(@pending_string)
    end

    it "should destroy the old one on save" do
      @item.preview_image = 'oldone'
      @app.datastore.should_receive(:write).with(content_with_data('oldone'), anything).and_return('old/uid')
      @item.save!
      item = @item_class.find(@item.id)
      item.retained_preview_image = @pending_string
      @app.datastore.should_receive(:destroy).with('old/uid')
      item.save!
    end

    describe "combinations of assignment" do
      it "should destroy the previously retained one if something new is then assigned" do
        @item.retained_preview_image = @pending_string
        @app.datastore.should_receive(:destroy).with(@uid)
        @item.preview_image = 'yet another new thing'
      end

      it "should destroy the previously retained one if something new is already assigned" do
        @item.preview_image = 'yet another new thing'
        @app.datastore.should_receive(:destroy).with(@uid)
        @item.retained_preview_image = @pending_string
      end

      it "should destroy the previously retained one if nil is then assigned" do
        @item.retained_preview_image = @pending_string
        @app.datastore.should_receive(:destroy).with(@uid)
        @item.preview_image = nil
      end

      it "should destroy the previously retained one if nil is already assigned" do
        @item.preview_image = nil
        @app.datastore.should_receive(:destroy).with(@uid)
        @item.retained_preview_image = @pending_string
      end

      describe "automatically retaining (hack to test for existence of hidden form field)" do
        it "should automatically retain if set as an empty string then changed" do
          @item.retained_preview_image = ""
          @item.dragonfly_attachments[:preview_image].should_receive(:retain!)
          @item.preview_image = "hello"
        end

        it "should automatically retain if changed then set as an empty string" do
          @item.preview_image = "hello"
          @item.preview_image.should_receive(:retain!)
          @item.retained_preview_image = ""
        end

        it "should retain if retained_string then accessor is assigned" do
          @item.retained_preview_image = @pending_string
          @item.preview_image.should_receive(:retain!)
          @item.preview_image = 'yet another new thing'
        end

        it "should retain if accessor then retained_string is assigned" do
          @item.preview_image = 'yet another new thing'
          @item.preview_image.should_receive(:retain!)
          @item.retained_preview_image = @pending_string
        end
      end
    end

  end

  describe "xxx_stored?" do
    before do
      item_class = new_model_class('Item', :photo_uid) do
        dragonfly_accessor :photo
      end
      @item = item_class.new
    end

    it "returns false if unassigned" do
      @item.photo_stored?.should be_false
    end

    it "returns false if assigned but not stored" do
      @item.photo = "Asdf"
      @item.photo_stored?.should be_false
    end

    it "returns true if stored" do
      @item.photo = "Asdf"
      @item.save!
      @item.photo_stored?.should be_true
    end
  end

  describe "misc properties" do
    before(:each) do
      @item_class = new_model_class('Item', :photo_uid) do
        dragonfly_accessor :photo
      end
      @item = @item_class.new :photo => 'blug'
    end

    it "returns the b64_data" do
      @item.photo.b64_data.should =~ /^data:/
    end

    it "returns the mime_type" do
      @item.photo.ext = 'txt'
      @item.photo.mime_type.should == 'text/plain'
    end
  end

  describe "inspect" do
    before(:each) do
      @item_class = new_model_class('Item', :preview_image_uid) do
        dragonfly_accessor :preview_image
      end
      @item = @item_class.new :preview_image => 'blug'
      @item.save!
    end
    it "should be awesome" do
      @item.preview_image.inspect.should =~ %r{^<Dragonfly Attachment uid="[^"]+", app=:default>$}
    end
  end

  describe 'overwriting instance methods' do
    let(:klass) do
      new_model_class('Item', :foo_uid) do
        dragonfly_accessor :foo

        def foo
          super
        end
      end
    end

    let(:item) { klass.new }

    it 'works as expected when calling super' do
      item.foo.should be_nil
      item.foo = 'DATASTRING'
      item.foo.should be_a(Dragonfly::Model::Attachment)
    end
  end
end

redpajama_set_name: RedPajamaGithub


A Junior Account Director or Senior Account Manager ready to step up is required to join an award winning full-service advertising agency. The agency has strong digital capabilities and are part of a global network. They are recognised as one of the world's best in creative, technology and innovation.
As a Junior Account Director, you will pay a crucial role in the leadership of client accounts, develop strategic direction for major clients and deliver clients commercial objectives.
You will currently be working at a top advertising agency as a SAM ready to step up to JAD or as a JAD.
You will be a commercially focused client services professional with an eagerness to work in one of the most prestigious Ad agency's in the world.
You will be used to overseeing strategy and delivering exceptional quality across all client materials.
This is a fantastic opportunity for a Junior Account Director and won't be around for long so click 'APPLY' to send your CV now.


> >> >> Don't add it as an EA. It's *not* an EA, it's a timestamp.
> >> > provide you with access to this attribute?
> >> > would seem to be an extension - an extended attribute.
> >> > access, it seems to be a very different class of thing to other timestamps.
> >> > which happens to be initialised to the current time when a file is created.
> >> > user-settable metadata.  Sounds like an EA to me.
> >> > cannot be set.  Would that be really useful to you?
> >> important) to read the creation time of an existing file.
> > assist the conversation I think.
> > pointless ... or I'm missing something.
> cases that I have heard of (backup/archive applications).
important to be clear and open about that).


Holomua Institute, LLC | Integrity. Abundance. Prosperity.
Holomua (hō lō mü ah) in Hawaiian means improvement or progress and our team is committed to growth in the areas of leadership and business development for our clients.Integrity. Abundance. Prosperity.


text:
Finland Europe
Photos Highlights Trails Protection
Repovesi National Park is located in the far southeastern side of Finland just a few hours northeast of Helsinki. The park covers an area of 5.8 square miles (15 sq km) making it one of the smaller of the 40 national parks found in the country.
The park is renowned for the varied waterways and forests that blanket the terrain. The waterways are ponds, lakes, and streams, while the forest is comprised of pine and birch.
Although the park is fairly small, it is packed with terrains that invite and welcome exploration. The rolling hills are blanketed with beautiful thick forests creating serene settings for walking, boating, or hiking.
The forested and aquatic habitats sustain a variety of wildlife. Some of the most common and hopeful sightings include the moose, bear, deer, and lynx. There are a variety of birds to enjoy with a particularly diverse collection of ground-feeding species.
Repovesi National Park Photo Gallery
The park is a spectacular place to hike and explore the outdoors. For those who enjoy forested trails accented with ponds and streams, this is the place. Hiking is the highlight and most popular activity of the national park.
Many people find the observation towers that have been added in some areas as the highlight. These towers provide a bird's eye view of the picturesque landscapes. A chance to look out over the forests, ponds, and lake is what some describe as the best views in the park.
Olhavanvuori
Olhavanvuori is a rock formation that rises nearly vertical out of the water. It is capped on top with some of the birch and pine forests the park is well-known for. From atop Olhavanvuori, visitors will have stunning views over Lake Olhavanlampi.
Olhavanvuori rises 164 feet (50 m) out of Lake Olhavanlampi. The extensive forest that surrounds the lake becomes quite apparent when hikers reach the top of the mountain.
Kultareitti Water Taxi
The Kultareitti Water Taxi is also known as the Kultareitti Golden Route Cruise. The pleasure trip travels from Vuohijarvi Lake to Repovesi. Views of the trip include panoramic views of the forested shoreline, the picturesque landscape, the Lapinsalmi suspension bridge, the Lopponen cave, and the Mustalammenvuori observation tower.
This is a relaxing and scenic trip that provides an excellent atmosphere for viewing the striking landscapes and hear stories of the history of the area.
Lapinsalmi Suspension Bridge
One of the highlights of the park is the Lapinsalmi Suspension Bridge. The bridge extends across a distance of 164 feet (50 meters) while reaching a height of 32.8 feet (10 m). The bridge provides excellent panoramic views of the lake and area below.
Repovesi National Park Trails
The national park features over 31 miles (50 km) of trails, which may be accompanied by observation towers that enhance the views of the landscape with panoramic views overhead.
Ketunlenkki Trail
This is a 3-mile (5 km) loop trail, affectionately known as Fox Trail, that provides a solid glimpse into most of the features of the national park. It is rated as easy and family-friendly.
Olhavanvuori Rock Trail
This trail begins in the Saarijarvi parking area and ascends over a distance of 1.86 miles (3 km) out to Olhavanvuori Rock where you will also find a lookout tower atop Mustalamminvuori Hill.
Koppelonkierros Trail
This is a loop trail circling 5.15 miles (8.3 km) that traverses through the forest, along Tervajarvi Lake, and under striking cliff faces. The clifftops and lookout points that deliver panoramic views of the lake and surrounding area are the highlight of the trek.
Korpinkierros Trail
This is a loop trail that travels around Olhavanlampi Pond. The loop trail covers a distance of 2.80 miles (4.5 km) while providing spectacular views of the pond and rock faces rising out of the water.
Kaakkurin Kierros Trail
This is a loop trail that experiences an accumulative elevation gain of 2,627 feet (800.71 m) while covering a distance of 16.5 miles (26.55 km). The trail meanders through the forest, along a river, and past a lake. There are chances to see wildlife along the journey with a series of spectacular panoramic views of the forest and waterways that make this such a unique place.
Park Protection
Repovesi National Park was created to protect this pristine habitat and ecosystem that supports the wildlife in the area as well as the astounding picturesque landscapes for future generations to enjoy.
This is one of the favorite wilderness areas within the country. It is imperative to invest in the protection of this remarkable landscape.
Repovesi Highlights
Observation Towers
Kultareitti water taxi route
All Trails, Best Trails In Repovesi National Park, https://www.alltrails.com/parks/finland/kymenlaakso/repovesi-national-park, retrieved September 2020.
Finland Naturally, Repovesi National Park, https://finlandnaturally.com/repovesi-national-park/, retrieved September 2020.
Her Finland, A Beginner's Guide for Repovesi National Park, https://herfinland.com/repovesi-national-park/, retrieved September 2020.
Kouvola, Repovesi National Park, https://visitkouvola.fi/en/c/165/repovesi-national-park, retrieved September 2020.
National Parks Finland, Repovesi National Park, https://www.nationalparks.fi/en/repovesinp, retrieved September 2020.
Visit Finland, Repovesi National Park, https://www.visitfinland.com/mystay/product/repovesi-national-park/11598/, retrieved September 2020.

redpajama_set_name: RedPajamaCommonCrawl


text:
\section{Introduction} \label{sec:intro}
The birth of planets inside protostellar disks has been traced back in time, as a result of
recent ALMA high-angular resolution observations showing substructures in the dust distribution of young ($<$1 Myr) disks which may be caused by the interaction of the disk material with forming planets \citep{Sheehan2017, Sheehan2020, Segura-Cox2020}.
Protostellar Class 0/I disks are thus the ideal environment to investigate the initial conditions and the chemical content which will be at least partially inherited by forming planets \citep[e.g.][]{Oberg2021}.
From a chemical point of view, close binaries are unique laboratories as they are expected to originate from the same parent core, i.e. the same initial gas composition and similar gas conditions, in terms of temperature, density and UV illumination. Observed differences in the chemistry of the two binary  components are then expected to be the result of a chemical evolution inside the system \citep[e.g.][]{Manigand2019}.
SVS13-A is a perfect case of study since it is a very well studied Class I protostellar system in NGC1333, hosting a rich chemistry including emission from several interstellar complex organic molecules \citep[hereafter iCOMs; ][]{Lopez2015,Codella2016,Bianchi2017a, Desimone2017, Bianchi2019a, Belloche2020, Yang2021, Diaz2021}. The two components of the binary system (VLA4A and VLA4B) have a separation of $\sim$ 0$\farcs$3 ($\sim$ 90 au at the source distance of 299 pc) and they have been imaged in the continuum using ALMA \citep{Tobin2016,Tobin2018,Diaz2021}. Recently, the presence of two hot corinos in both VLA4A and VLA4B has been reported by \citet{Diaz2021}. The detection of ethylene glycol only towards VLA4A suggests the possibility of a different chemistry at work in the two binaries,
calling for mapping different iCOMs using different excitation transitions.
In this Letter, we present ALMA high-angular resolution observations, imaging the SVS13-A binary system using a large number of lines (17) due to both O-bearing and N-bearing iCOMs, namely methanol (CH$_{\rm 3}$OH and $^{13}$CH$_{\rm 3}$OH), acetaldehyde (CH$_{\rm3}$CHO), dymethyl ether (CH$_{\rm 3}$OCH$_{\rm 3}$) and formamide (NH$_{\rm 2}$CHO), down to planet-formation scales.

\section{Observations} \label{sec:obs}

The system SVS13-A was observed with ALMA (2018.1.01461.S) in Band 6.
Data were acquired on 2019 September 8 using the C43-6 configuration, with baselines between 43 m and 5.9 km.
The observations were centered at
$\alpha_{\rm J2000}$ = 03$^{\rm h}$ 29$^{\rm m}$ 3$\fs$8,
$\delta_{\rm J2000}$ = +31$\degr$ 16$\arcmin$ 03$\farcs$8.
The quasar J0510+1800 was used as bandpass and flux calibrator, while J0336+3218 as phase calibrator.
The absolute flux calibration uncertainty is 20\%.
Data were calibrated using the standard ALMA calibration pipeline within \textsc{CASA} \citep{McMullin2007}.
Phase self-calibration has been performed using the \textsc{IRAM-GILDAS}\footnote{\url{http://www.iram.fr/IRAMFR/GILDAS}} package, after the determination of line-free continuum channels, and the solutions applied both to the continuum and the spectral cubes.
The observed spectral windows, as well as the synthesized beam and the r.m.s. noise of the continuum-subtracted line-cubes, using spectral channels of 122 kHz (0.15 km s$^{-1}$), are reported in Table \ref{Tab:obs}.

\section{Results} \label{sec:res}

\begin{figure*}[ht]
\centering
\includegraphics[scale=0.7]{Continuum-revised.eps}
\caption{Dust continuum emission at 257 GHz as observed by ALMA (colour scale and contours). First contours (gray) and steps (black) are 8$\sigma$, corresponding to 3.35 mJy beam$^{-1}$. The beam size is 0$\farcs$19 $\times$ 0$\farcs$13 (PA=+5$^{\circ}$). The binary system is composed of VLA4A (right) and VLA4B (left). Coordinates are $\alpha_{\rm J2000}$ = 03$^{\rm h}$ 29$^{\rm m}$ 3$\fs$75, $\delta_{\rm J2000}$ = +31$\degr$ 16$\arcmin$ 03$\farcs$81 and $\alpha_{\rm J2000}$ = 03$^{\rm h}$ 29$^{\rm m}$ 3$\fs$773, $\delta_{\rm J2000}$ = +31$\degr$ 16$\arcmin$ 03$\farcs$81 for VLA4A and VLA4B, respectively.
The blue arrows indicate the directions toward HH11 (133$\degr$) as well as the
main axis of the H$_{\rm 2}$/CO jet (155$\degr$) as inferred by \citet{Lefevre2017}.
\label{fig:continuum}}
\end{figure*}

\subsection{Continuum emission} \label{subsec:cont}

Figure \ref{fig:continuum} shows the SVS13-A map of the dust continuum emission at 1.3mm.
The two emission peaks correspond to the two components of the SVS13-A system previously observed with ALMA as well as at cm-wavelengths \citep{Carrasco2008, Tobin2018, Diaz2021}: VLA4A and VLA4B.
In addition, the map shows arc-like structures in agreement with what observed by \citet{Tobin2016,Tobin2018} and \citet{Diaz2021}: a bright arc (up to 32$\sigma$) extending from the southern edge of the continuum associated with VLA4A towards the south-east, and two fainter arcs (up to 16$\sigma$) parallel to the first one and extending on the east (i.e. from the southern edge of the continuum associated with VLA4B) and on the west side of VLA4A.
In addition, the present image shows further three elongated structures extend from the northern edge of the continuum associated with VLA4A and B towards the north, with a slightly negative PA.
As the ALMA beam is roughly elongated along the N-S direction (PA =+5$\degr$) , we checked for the presence of possible artefacts cause by the cleaning process by repeating the cleaning using  different  tapering.  With  a  larger  circular  beam all the elongated arc-like structures, including the three structures towards the north, are less evident but still present. The presence of accretion streamers, suggested for VLA4B \citep{Diaz2021}, is then confirmed by the present ALMA dataset also towards VLA4A and it has an impact on the following discussion on the origin of iCOMs emission (Sec. \ref{subsec:morphology}).

The continuum emission associated with VLA4A and VLA4B has a disk-like structure.
We modelled the continuum emission in the \textit{uv} plane
assuming two elliptical inclined disks centered on the continuum peak positions.
The best fitting is obtained with one disk of axes 0$\farcs$602 (0$\farcs$001) $\times$ 0$\farcs$231 (0$\farcs$077) and PA 41.1$\degr$ (0.1$\degr$) centered towards VLA4A and a second disk of axes 0$\farcs$325 (0$\farcs$242) $\times$ 0$\farcs$205 (0$\farcs$153) and PA 33.8$\degr$ (0.1$\degr$) centered towards VLA4B.
The integrated fluxes are 183.15 (0.87) mJy and 126.06 (0.55) mJy for VLA4A and VLA4B, respectively.
The sizes are: $\sim$ 180 $\times$ 70 au (VLA4A), and 90 $\times$ 70 au (VLA4B). From the axis ratio we can infer an inclination of 67$\degr$ and 51$\degr$ (with
respect to the plane of the sky) for the VLA4A and VLA4B disks, respectively.
We calculate the disk masses
assuming isothermal and optically thin dust emission. If we assume a dust temperature of 140 K, as derived from the lines analysis, a dust-to-gas ratio of 1/100, and a dust mass opacity coefficient k$_{\rm \nu}$ of 1.0 cm$^2$ g$^{-1}$ \citep{Ossenkopf1994}, we obtain 0.029 M$_{\odot}$ for VLA4A and 0.020 M$_{\odot}$ for VLA4B. The value obtained for VLA4B is consistent with what reported by \citet{Diaz2021} while the one for VLA4A is higher of a factor 3.
If we assume, a lower dust temperature of 30 K, we obtain 0.159 M$_{\odot}$ for VLA4A and 0.110 M$_{\odot}$ for VLA4B, in good agreement with what found by \citet{Tobin2018}.

\subsection{Emission from iCOMs} \label{subsec:iCOMs}
We detected a total of 17 emission lines from 4 iCOMs (Table \ref{Tab:lines}). More specifically, we detected 4 lines of CH$_{\rm 3}$OH and 5 lines of $^{13}$CH$_{\rm 3}$OH, covering upper level energies (E$_{\rm up}$) from 57 K to 804 K. We detected also two CH$_{\rm 3}$CHO lines (84 K), 4 lines of CH$_{\rm 3}$OCH$_{\rm 3}$ (26-226 K), and 3 lines of NH$_{\rm 2}$CHO (79-127 K).
In Fig. \ref{fig:iCOMs} we show the emission of one representative line for each  species, integrated on three velocity intervals. Namely, the CH$_{\rm 3}$OH 25$_{\rm 3,22}$--25$_{\rm 2,23}$ A at 241.589 GHz, the $^{13}$CH$_{\rm 3}$OH 14$_{\rm 3,12}$--14$_{\rm 2,13}$ A line at 256.827 GHz, the CH$_{\rm 3}$CHO 13$_{\rm 1,13}$--12$_{\rm 1,12}$ E line at 242.106 GHz, the 13$_{\rm 1,13}$--12$_{\rm 0,12}$ EA, AE, EE, AA transitions at 241.946 GHz and the NH$_{\rm 2}$CHO 12$_{\rm 4,9}$--11$_{\rm 4,8}$ transition at 255.059 GHz. The lines are representative of each species, independently from their upper level energy. All the maps are reported in Figs. \ref{fig:maps1}--\ref{fig:maps5}.
Figure \ref{fig:iCOMs} also shows the iCOMs spectra extracted in the positions corresponding to the continuum peak position of the two sources VLA4A and VLA4B.
From the $^{13}$CH$_{\rm 3}$OH spectra, we reveal different systemic velocities for VLA4A (+7.7 km s$^{-1}$) and VLA4B (+8.5 km s$^{-1}$).
The iCOMs spatial distribution is different for the different species.
For CH$_{\rm 3}$OH and $^{13}$CH$_{\rm 3}$OH, in the interval between +4.0 and +7.5 km s$^{-1}$, the line emission traces VLA4A, with an elongation towards the north. In the velocity intervals 7.5-8.7 km s$^{-1}$, corresponding to the systemic velocity reported for SVS13-A, and 8.8-12.0 km s$^{-1}$ interval, the line emission is associated with both protostars, peaking in between. A beam deconvolved size of 0$\farcs$6 $\times$ 0$\farcs$4 is derived from a simple 2D Gaussian fit in the image plane of the $^{13}$CH$_{\rm 3}$OH moment 0 emission.
For CH$_{\rm 3}$OCH$_{\rm 3}$, the spatial distribution is similar but the emission between +8.8 and +11 km s$^{-1}$ peaks closer to VLA4B.
Acetaldehyde emission between 8.8 and 11 km s$^{-1}$ peaks closer to VLA4A. Finally, formamide, which is the only N-bearing species detected in our observations, is peaking towards VLA4A.

In Table \ref{Tab:lines} we report the integrated line intensities extracted on the continuum peak positions of VLA4A and VLA4B, respectively, and their intensity ratios. The intensities ratios are close to the value of 1 for CH$_{\rm 3}$OCH$_{\rm 3}$, confirming that dimethyl ether is present in both protostars. For methanol and acetaldehyde, intensity ratios vary from 1.3 to 3.2, while formamide abundances are higher in VLA4A by a factor 4 -- 7.
The intensity ratios suggest a chemical differentiation inside the system.
To further investigate the species spatial distribution,
we compare emission lines with similar E$_{\rm up}$ (between 57 and 81 K) in order to minimise excitation conditions effects.
Figure \ref{fig:profiles} shows the normalised integrated line profiles of CH$_{\rm 3}$OCH$_{\rm 3}$ and NH$_{\rm 2}$CHO, extracted along the horizontal axes connecting the two protostars (Fig. \ref{fig:iCOMs}). The x-axis reports the offset in au with respect to the position of VLA4A. Two vertical dashed lines indicate the positions of the two protostars. The green line is the residual emission obtained subtracting the NH$_{\rm 2}$CHO spectra to the CH$_{\rm 3}$OCH$_{\rm 3}$ emission. If we assume that NH$_{\rm 2}$CHO traces mainly VLA4A, the green profile is the additional emission from VLA4B. Figure \ref{fig:profiles} also shows the residual profiles of CH$_{\rm 3}$OCH$_{\rm 3}$, CH$_{\rm 3}$OH, $^{13}$CH$_{\rm 3}$OH and, CH$_{\rm 3}$CHO after subtracting the NH$_{\rm 2}$CHO emission. The figure highlights the emission of different species at the position of VLA4B.
Finally, Fig. \ref{fig:MOM1} shows the intensity-weighted peak velocity
(moment 1) maps of the brightest $^{13}$CH$_{\rm 3}$OH, CH$_{\rm 3}$OCHO and NH$_{\rm 2}$CHO lines. All the lines show velocity gradients roughly orthogonal to the outflow direction. Methanol shows the broadest velocity interval while formamide shows the tightest.

\begin{figure*}[ht]
\centering
\includegraphics[scale=0.9]{Fig-icoms-v2.eps}
\caption{Integrated emission from CH$_{\rm 3}$OH, $^{13}$CH$_{\rm 3}$OH, CH$_{\rm 3}$CHO, NH$_{\rm 2}$CHO, and CH$_{\rm 3}$OCH$_{\rm 3}$, in white contours, superposed to the dust emission in colour scale. The emission is integrated in the following velocity intervals: 4 -- 7.5 km s$^{-1}$ in the left panels (V$_{\rm sys}-$), 7.5 -- 8.7 km s$^{-1}$ in the middle panels (V$_{\rm sys}$), and 8.8 -- 12.0 km s$^{-1}$ in the right panels (V$_{\rm sys}+$). First contours and steps are 5$\sigma$, corresponding to 35 mJy beam$^{-1}$, 19 mJy beam$^{-1}$ and 29 mJy beam$^{-1}$, for CH$_{\rm 3}$OH; 34 mJy beam$^{-1}$, 21 mJy beam$^{-1}$ and 28 mJy beam$^{-1}$ for $^{13}$CH$_{\rm 3}$OH; 29 mJy beam$^{-1}$, 19 mJy beam$^{-1}$ and 26 mJy beam$^{-1}$ for CH$_{\rm 3}$CHO; 30 mJy beam$^{-1}$, 18 mJy beam$^{-1}$ and 29 mJy beam$^{-1}$ for CH$_{\rm 3}$OCH$_{\rm 3}$; 33 mJy beam$^{-1}$, 24 mJy beam$^{-1}$ and 27 mJy beam$^{-1}$ for NH$_{\rm 2}$CHO, respectively. The synthesised beams are reported in white in the lower left corner of each panel. The dashed line indicates the axes connecting VLA4A and VLA4B along which the line intensity profiles shown in Fig. \ref{fig:profiles} are extracted. On the right we report the spectra in brightness temperature units, extracted at the continuum peak position of VLA4A (black star) and VLA4B (red star). From $^{13}$CH$_{\rm 3}$OH spectra, we derived a systemic velocity of +7.7 km s$^{-1}$ for VLA4A (black vertical dashed line) and +8.5 km s$^{-1}$ for VLA4B (Red vertical dashed line). Spectra are smoothed at 0.3 km s$^{-1}$ resolution. On the left it is reported the upper level energy of each transition in K.
\label{fig:iCOMs}}
\end{figure*}

\begin{figure*}[ht]
\centering
\includegraphics[scale=0.8]{Final-plot-v2.eps}
\caption{\textit{Left Panel:} Normalised intensity profile of the NH$_{\rm 2}$CHO line at 243.521 GHz (blue) and the CH$_{\rm 3}$OCH$_{\rm 3}$ line at 241.946 GHz (orange) extracted along the line connecting VLA4A with VLA4B. The green line shows the redisuals obtained subtracting the formamide emission from the CH$_{\rm 3}$OCH$_{\rm 3}$ profile. The two vertical dashed lines show the position of VLA4A (black) and VLA4B (red). The offset in pixel is given with respect to the position of VLA4A. The pixel size correspond to 25 mas. \textit{Right Panel:} Residuals line profiles of CH$_{\rm 3}$OCH$_{\rm 3}$ (green), CH$_{\rm 3}$OH (orange), $^{13}$CH$_{\rm 3}$OH (blue), and CH$_{\rm 3}$CHO (magenta), after subtracting the formamide emission profile. The analysed lines are the CH$_{\rm 3}$OCH$_{\rm 3}$ line at 241.964 GHz, the CH$_{\rm 3}$OH line at 241.904 GHz, the $^{13}$CH$_{\rm 3}$OH line at 255.204 GHz, the two detected CH$_{\rm 3}$CHO lines at 242.106 GHz and 242.118 GHz, whose intensity is added and, the NH$_{\rm 2}$CHO line at 243.521 GHz.
\label{fig:profiles}}
\end{figure*}

\begin{table*}
\begin{center}

	\caption{Properties of
	the lines detected towards SVS13-A.}
	\label{Tab:lines}
	\begin{tabular}{lccccccc}
		\hline
Transition & $\nu$$^{\rm a}$ & E$_{\rm up}$$^{\rm a}$ & $S\mu^2$$^{\rm a}$ & \multicolumn{2}{c}{I$_{\rm int}$$^{\rm b}$}& \\
 & (GHz) & (K) & (D$^2$) & \multicolumn{2}{c}{(K km s$^{-1}$)}&\\
\hline
&&&& VLA4A & VLA4B& VLA4A/VLA4B\\
\hline
\vspace{0.25cm}
CH$_{\rm 3}$OH 25$_{\rm 3,22}$--25$_{\rm 2,23}$ A& 241.58876 & 804 & 102 & 251 (53) & 112 (26) & 2.2 (0.7) \\

CH$_{\rm 3}$OH 5$_{\rm 2,3}$--4$_{\rm 2,2}$ E & 241.904147 & 61 & 14 & \multirow{2}{*}{454 (95)} & \multirow{2}{*}{353 (74)} & \multirow{2}{*}{1.3 (0.4)}\\
\vspace{0.25cm}
CH$_{\rm 3}$OH 5$_{\rm -2,4}$--4$_{\rm -2,3}$ E & 241.904643 & 57 & 13\\
CH$_{\rm 3}$OH 16$_{\rm 3,14}$--16$_{\rm 2,15}$ A & 255.241888 & 365 & 59 & 410 (86) & 267 (56) & 1.5 (0.5)\\
\hline
$^{\rm 13}$CH$_{\rm 3}$OH 4$_{\rm 3,2}$--4$_{\rm 2,3}$ A  & 255.203728 & 73 & 3 & 138 (31) & 102 (23) & 1.4 (0.4)&\\
$^{\rm 13}$CH$_{\rm 3}$OH 3$_{\rm 3,0}$--3$_{\rm 2,1}$ A & 255.210605 & 64 & 2 & 110 (25) & 76 (18)&\\
$^{\rm 13}$CH$_{\rm 3}$OH 7$_{\rm 3,5}$--7$_{\rm 2,6}$  A & 255.214891 & 113 & 6 & 195 (42)  & 148 (32)&\\
$^{\rm 13}$CH$_{\rm 3}$OH 3$_{\rm 3,1}$--3$_{\rm 2,2}$ A$^{\rm c}$ & 255.220865 & 64 & 2 & $<$ 118 &  $<$ 80 & \\
$^{\rm 13}$CH$_{\rm 3}$OH 14$_{\rm 3,12}$--14$_{\rm 2,13}$ A & 256.826572 & 288 & 13 & 147 (32) &  91 (21)& 1.6 (0.5)\\
\hline
CH$_{\rm 3}$CHO 13$_{\rm 1,13}$--12$_{\rm 1,12}$ E  & 242.106020 & 84 & 163 & 161 (35) & 66 (16) & 2.4 (0.8)\\
CH$_{\rm 3}$CHO 13$_{\rm 1,13}$--12$_{\rm 1,12}$ A  & 242.118136 & 84 & 163 & 155 (35) & 48 (13) & 3.2 (1.1)\\

\hline

CH$_{\rm 3}$OCH$_{\rm 3}$ 5$_{\rm 3,2}$--4$_{\rm 2,3}$ AE  & 241.523808 & \multirow{4}{*}{26} & 28 & \multirow{4}{*}{$>$51$^{\rm d}$} & \multirow{4}{*}{$>$41$^{\rm d}$} & \\
CH$_{\rm 3}$OCH$_{\rm 3}$ 5$_{\rm 3,2}$--4$_{\rm 2,3}$ EA & 241.528318 &  & 15 &  & \\
CH$_{\rm 3}$OCH$_{\rm 3}$ 5$_{\rm 3,2}$--4$_{\rm 2,3}$ EE & 241.528719 &  & 69 &  & \\
\vspace{0.25cm}
CH$_{\rm 3}$OCH$_{\rm 3}$ 5$_{\rm 3,2}$--4$_{\rm 2,3}$ AA  & 241.531026 &  & 46 &  & \\

CH$_{\rm 3}$OCH$_{\rm 3}$ 21$_{\rm 3,18}$--20$_{\rm 4,17}$ AA  & 241.635773 & \multirow{4}{*}{226} & 61 & \multirow{4}{*}{$<$58 $^{\rm e}$} & \multirow{4}{*}{$<$60  $^{\rm e}$} & \\
CH$_{\rm 3}$OCH$_{\rm 3}$ 21$_{\rm 3,18}$--20$_{\rm 4,17}$ EE & 241.637303 &  & 97 &  & \\
CH$_{\rm 3}$OCH$_{\rm 3}$ 21$_{\rm 3,18}$--20$_{\rm 4,17}$ AE & 241.638831 &  & 37 &  & \\
\vspace{0.25cm}
CH$_{\rm 3}$OCH$_{\rm 3}$ 21$_{\rm 3,18}$--20$_{\rm 4,17}$ EA  & 241.638834 &  & 24 &  & \\

CH$_{\rm 3}$OCH$_{\rm 3}$ 13$_{\rm 1,13}$--12$_{\rm 0,12}$ EA  & 241.946249 & \multirow{4}{*}{81} & 34 & \multirow{4}{*}{131 (29)} & \multirow{4}{*}{136 (30)} &  \multirow{4}{*}{1.0 (0.3)}\\
CH$_{\rm 3}$OCH$_{\rm 3}$ 13$_{\rm 1,13}$--12$_{\rm 0,12}$ AE  & 241.946249 &  & 69 &  & \\
CH$_{\rm 3}$OCH$_{\rm 3}$ 13$_{\rm 1,13}$--12$_{\rm 0,12}$ EE & 241.946542 &  & 274 &  & \\
\vspace{0.25cm}
CH$_{\rm 3}$OCH$_{\rm 3}$ 13$_{\rm 1,13}$--12$_{\rm 0,12}$ AA  & 241.946835 &  & 103 &  & \\

CH$_{\rm 3}$OCH$_{\rm 3}$ 19$_{\rm 5,14}$--19$_{\rm 4,15}$ AE  & 256.135096 & \multirow{4}{*}{208} & 104 & \multirow{4}{*}{106 (25)} & \multirow{4}{*}{117 (27)} &  \multirow{4}{*}{0.9 (0.3)}\\
CH$_{\rm 3}$OCH$_{\rm 3}$ 19$_{\rm 5,14}$--19$_{\rm 4,15}$ EA  & 256.135164 &  & 69 &  & \\
CH$_{\rm 3}$OCH$_{\rm 3}$ 19$_{\rm 5,14}$--19$_{\rm 4,15}$ EE  & 256.137180 &  & 278 &  & \\
\vspace{0.25cm}
CH$_{\rm 3}$OCH$_{\rm 3}$ 19$_{\rm 5,14}$--19$_{\rm 4,15}$ AA  & 256.139230 &  & 174 &  & \\

\hline

NH$_{\rm 2}$CHO 12$_{\rm 1,12}$--11$_{\rm 1,11}$ & 243.521044  & 79 & 156 & 267 (59) & 40 (11) & 7 (2)\\

NH$_{\rm 2}$CHO 12$_{\rm 4,9}$--11$_{\rm 4,8}$ & 255.058533  & 127 & 139 & 160 (37) & 42 (12) & 4 (1) \\

NH$_{\rm 2}$CHO 12$_{\rm 4,8}$--11$_{\rm 4,7}$ &  255.078912 & 127 & 139 & $>$93$^{\rm f}$ & $>$39$^{\rm f}$ \\
\hline

\end{tabular}\\
\end{center}
$^{\rm a}$ Frequencies and spectroscopic parameters have been provided by
\citet[][and references therein]{Xu2008, Xu1997,Endres2009,Kukolich1971} for CH$_{\rm 3}$OH, $^{13}$CH$_{\rm 3}$OH, CH$_{\rm 3}$OCH$_{\rm 3}$, and NH$_{\rm 2}$CHO, respectively, and retrieved from the Cologne Database for Molecular Spectroscopy\footnote{\url{http://www.astro.uni-koeln.de/cdms/}} \citep{Muller2005}. They were provided by \citet{Kleiner1996} and retrieved from the Jet Propulsion Laboratory molecular database\footnote{\url{https://spec.jpl.nasa.gov/}} \citet{pickett1998} for CH$_{\rm 3}$CHO.
$^{\rm b}$ Errors on the integrated intensity include 20$\%$ of calibration.
$^{\rm c}$ Contaminated by the NH$_{\rm 2}$CHO 12$_{\rm 3,10}$--11$_{\rm 3,9}$ line at 255.225651 GHz.
$^{\rm d}$ The line profile is truncated as the line is close to the edge of the spectral window.
$^{\rm e}$ Tentatively detected (line peak below 3$\sigma$ detection limit).
$^{\rm f}$ The NH$_{\rm 2}$CHO 12$_{\rm 3,10}$--11$_{\rm 3,9}$ line at 255.225651 GHz is also detected but not considered for the analysis as strongly contaminated by $^{\rm 13}$CH$_{\rm 3}$OH (see $^{\rm c}$).
\end{table*}

\subsection{Column densities and abundances}\label{subsec:colum-dens}

In order to characterise the two hot corinos, we analysed their methanol emission on the dust-peaks (Table \ref{Tab:lines}) via the non-LTE LVG (Large Velocity Gradient) code \texttt{grelvg}, developed by \citet{Ceccarelli2003}.
We used the collisional coefficients with para-H$_2$, computed by \citet{Rabli2010} between 10 and 200 K for the first 256 levels and provided by the BASECOL database \citep{Dubernet2013}.
We assumed the A-/E- CH$_3$OH ratio equal to 1 \citep{Flower2006} and  $^{12}$C/$^{13}$C = 60 \citep[e.g.][]{Milam2005}.
To compute the line escape probability as a function of the line optical depth we adopted a semi-infinite slab geometry and a linewidth equal to 4 km s$^{-1}$, as measured.
We ran a large grid of models ($\sim 10000$) to cover the $\chi^2$ surface in the parameters space: the total (A- plus E- ) methanol column density N(CH$_{\rm 3}$OH) from $1\times 10^{13}$ to $2\times 10^{18}$ cm$^{-2}$, the H$_{\rm 2}$ density n$_{\rm H2}$ from $1\times 10^{5}$ to $\times 10^{10}$ cm$^{-3}$ and the temperature T from 40 to 200 K.
We fitted the measured $^{13}$CH$_3$OH-A line intensities by comparing them with those predicted by the model, leaving N($^{13}$CH$_{\rm 3}$OH), n$_{\rm H2}$ and T as free parameters.
We obtained a good fit ($\chi^2 = 1.1$) with the following parameters:
N($^{13}$CH$_{\rm 3}$OH) = ($1.0 \pm 0.2$) $\times 10^{17}$ cm$^{-2}$, T = ($140 \pm 40$) K and n$_{H2}$ = $3 \times 10^{8}$ cm$^{-3}$ with a lower limit of $2 \times 10^{7}$ cm$^{-3}$, indicating that the lines are LTE populated.\footnote{Note that the obtained values are in good agreement with those derived by the non-LTE analysis of eighteen $^{13}$CH$_{\rm 3}$OH lines detected by the IRAM-30m ASAI survey \citep{Bianchi2017a}.}
Line optical depths are estimated using the non-LTE predictions. The predicted opacity of the $^{13}$CH$_3$OH-A line is between 0.1 to 0.4.
Since the $^{12}$CH$_3$OH-E lines are predicted to be very optically thick ($\tau \sim$60), we derive the column density of the main isotopologue from the $^{13}$CH$_{\rm 3}$OH one, assuming the same T of 140 K and we obtain N(CH$_{\rm 3}$OH) =($6 \pm 1$) $\times 10^{18}$ cm$^{-2}$.
We repeated the same analysis also for VLA4B and obtained the following parameters (reduced $\chi^2 = 0.95$):
N(CH$_{\rm 3}$OH) = ($5 \pm 1$) $\times 10^{18}$ cm$^{-2}$, T = ($170 \pm 50$) K and n$_{\rm H2}$ = $3 \times 10^{8}$ cm$^{-3}$ with a lower limit of $2 \times 10^{7}$ cm$^{-3}$, again indicating that the lines are LTE populated.
Please note that the line with E$_{up}$= 800 K cannot be modeled by the non-LTE code because of the lack of collisional coefficients.
Assuming that the line upper level is LTE populated, the predicted intensity is about a factor 2 lower than the observed one\footnote{Note that we used the same beta escape probability $\beta$ as a function of the line opacity $\tau$ used in the non-LTE LVG code, namely $\beta=\frac{1-exp[-3\tau]}{3\tau}$ \citep{deJong1980}, where $\tau$ is estimated to be 0.3.}.
Yet, very likely this high-lying line is subthermally populated, so that the predicted intensity has even to be considered an upper limit.
It has been already found by other authors that high lying (with E$_{up}\geq$ 500 K) methanol lines are most likely due to radiatively populated methanol rather than collisionally populated, as discussed in \citet{Leurini2007}.

Since the methanol non-LTE analysis showed that both VLA4A and VLA4B hot corinos have large densities, we carried out a LTE rotational diagram analysis for the other iCOMs, assuming a rotational temperature of 140 K and 170 K for VLA4A and VLA4B, respectively,, as derived from the methanol analysis.
The results of the analysis are reported in Table \ref{Table:abundances}. Synthetic LTE spectra generated using \textit{Weeds} \citep{Maret2011} are reported in Figs. \ref{fig:weeds1}--\ref{fig:weeds4}. The column density ratios between VLA4A and VLA4B are consistent with the line intensity ratios reported in Table \ref{Tab:lines}.
In Table \ref{Table:abundances} we also report the column density ratios of the other iCOMs with respect to methanol, which are in agreement with the ASAI analysis \citep{Bianchi2019a}.

\begin{table*}
\caption{Results of the non-LTE LVG and LTE rotational diagram analysis of the iCOMs emission observed towards VLA4A and VLA4B.}
\begin{center}

\begin{tabular}{lccccccc}
  \hline
    \multicolumn{1}{c}{}&\multicolumn{3}{c}{VLA4A}&\multicolumn{3}{c}{VLA4B}& \multicolumn{1}{c}{VLA4A/VLA4B$^a$}\\
    \hline
     \hline

  \multicolumn{1}{c}{Species} &\multicolumn{1}{c}{T$_{\rm rot}$} &\multicolumn{1}{c}{N$_{\rm tot}$}& \multicolumn{1}{c}{X$_{\rm CH_3OH}$$^b$}&\multicolumn{1}{c}{T$_{\rm rot}$} &\multicolumn{1}{c}{N$_{\rm tot}$}& \multicolumn{1}{c}{  X$_{\rm CH_3OH}$$^b$}&  \multicolumn{1}{c}{}\\
  \multicolumn{1}{c}{} & \multicolumn{1}{c}{  (K)}&\multicolumn{1}{c}{(cm$^{-2}$)}& \multicolumn{1}{c}{}& \multicolumn{1}{c}{(K)}&\multicolumn{1}{c}{(cm$^{-2}$)}& \multicolumn{1}{c}{}&  \multicolumn{1}{c}{}\\
\hline
    \multicolumn{8}{c}{non-LTE analysis}\\
\hline
CH$_{\rm 3}$OH$^c$ & 140$^d$ & 6(1) $\times 10^{18}$ & -- & 170$^d$ & 5(1) $\times 10^{18}$ & -- &  \multicolumn{1}{c}{1.2 (0.3)}\\

$^{13}$CH$_3$OH & 140(40) & 1.0(0.2) $\times 10^{17}$ & -- & 170(50) & 8(2) $\times 10^{16}$& --&  \multicolumn{1}{c}{1.3 (0.4)}\\
  \hline
      \multicolumn{8}{c}{Rotational Diagram analysis}\\
\hline

  CH$_{\rm 3}$CHO  & 140$^d$ & 2.4(0.4) $\times 10^{16}$ & 4.0 (1.0) $\times 10^{-3}$ &170$^d$ &1.1(0.2) $\times 10^{16}$ & 2.2 (0.6) $\times 10^{-3}$&  \multicolumn{1}{c}{2.2 (0.5)}\\

  CH$_{\rm 3}$OCH$_{\rm 3}$  & 140$^d$ & 7.5(1.2) $\times 10^{16}$ & 1.3 (0.3) $\times 10^{-2}$& 170$^d$ & 1.0(0.2) $\times 10^{17}$ & 2.0 (0.6) $\times 10^{-3}$&  \multicolumn{1}{c}{0.8 (0.2)}\\

NH$_{\rm 2}$CHO & 140$^d$ & 5.9(0.9) $\times 10^{15}$ & 4.0 (0.9) $\times 10^{-3}$ & 170$^d$ &1.4(0.3) $\times 10^{15}$ & 2.8 (0.8) $\times 10^{-4}$ &  \multicolumn{1}{c}{4 (1)}\\

 \hline
\end{tabular}\\

$^a$ Column density ratios.
$^b$ Abundance ratio with respect to CH$_{\rm 3}$OH.
$^c$Derived from $^{13}$CH$_{\rm 3}$OH assuming $^{12}$C/$^{13}$C=60.
$^d$ Assumed, as derived by the methanol non-LTE analysis.
 \end{center}
\label{Table:abundances}
\end{table*}

\section{Discussion and Conclusions} \label{sec:disc}
\subsection{Accretion streamers and hot corinos} \label{subsec:morphology}

The three continuum arc-structure observed towards the south and the three-fingers towards the north could be either accretion streamers or alternatively, outflow cavity walls.
The brightest arc-like structure in the south has been reported on similar spatial scales by \citet{Tobin2018} in the 1.3 mm continuum emission and in blue-shifted C$^{18}$O(2--1) emission.
\citet{Tobin2018} stressed that this one-armed spiral pattern is similar to that
observed in L1448 IRAS3B \citep{Tobin2016} and associated with a
disk inclined by $\sim$ 45$\degr$ surrounding the triple system.
The SVS13-A disks are closer to edge-on (i= 67$\deg$ and 50$\deg$) than L1448 IRAS3B.
Although the contribution of cavities opened by the precessing
jets/outflows cannot be excluded,
recent studies have shown that accretion streamers feeding disks are a common phenomena from Class 0 to Class II objects \citep{Yen2019,Pineda2020,Garufi2021},
where planet formation is possibly already ongoing. Their presence may strongly affect the disk chemical composition, since they can produce slow shocks when impacting the disk. The chemistry occurring in the shocked gas could synthesise new molecules that would eventually accrete into the disk and, consequently, enrich it.
Further observations of typical shock tracers such as SO and SO$_{\rm 2}$ (e.g. \citealt{Garufi2021}) are needed to confirm the presence of accretion streamers in VLA4A and VLA4B.

On the other hand, iCOMs emission is compact
confirming the presence of two hot corinos, one in VLA4A and a second one in VLA4B.
The molecular emission sizes (0$\farcs$3--0$\farcs$5) are consistent with thermal sublimation of the icy mantles, namely the classical definition of hot corino \citep{Ceccarelli2004}.
The velocity gradient roughly perpendicular to the outflow direction (see Fig. \ref{fig:MOM1}) suggests the presence of rotating gas, either from two protostellar disks or from the inner portion of the infalling envelope.

Thanks to the superb angular resolution (0$\farcs$13 in the east-west direction), the blueshifted line emission appears to be elongated in the north direction up to $\sim$150 au, being spatially coincident with the northern accretion streamers (Fig. \ref{fig:maps1}--\ref{fig:maps5}). The iCOMs emission could be associated with material accreting from the streamer and inducing a slow shock in the protostellar disk, similarly to what found in e.g. L1527 \citep{Sakai2014a, Sakai2017, Oya2016}.
Moreover, we cannot exclude the possibility that the system has an higher multiplicity, including multiple unresolved cores.
Observations of different molecular tracers at extremely high-angular resolution (tens of au), as well as an accurate physical model of the system are necessary to conclude about the origin of iCOMs emission.

Finally, the data  suggest a chemical segregation between formamide, tracing mainly VLA4A and the rest of the observed iCOMs, in the inner 100 au of the system.
In Sec. \ref{subsec:opacity} we discuss the possibility that the observed chemical segregation is due to opacity effects. While dust and line opacity effects cannot completely be excluded, our data suggest a real chemical differentiation of the two hot corinos instead of temperature gradients or excitation effect.

\subsection{A real chemical segregation ?} \label{subsec:chem-segr}

A different spatial distribution between O-bearing and N-bearing molecules has been observed in Orion KL \citep[][and references therein]{Blake1987, Peng2013} and in other high-mass star forming regions on scales of thousands of au \citep{Allen2017, Csengeri2019}.
To investigate if a similar segregation is present also in the inner 100 au around low mass protostars is more complicated as only few system have been observed with enough angular resolution.
An intriguing chemical segregation between formamide and acetaldehyde has been observed in the jet-induced shock L1157-B1, at a distance $>$0.1 pc from the protostar \citep{Codella2017}. In this case, the dichotomy is well reproduced by chemical models which assume that the formamide formation is dominated by gas-phase reactions (chemistry effect).
A chemical differentiation has been also observed in the prototypical Class 0 binary system IRAS16293-2422 \citep{Manigand2019}.
The abundance relative to methanol of CH$_{\rm 3}$OCH$_{\rm 3}$ is similar in the two components of the IRAS16293-2422 system, while it differs by a factor 2 for CH$_{\rm 3}$CHO and 4 for NH$_{\rm 2}$CHO, similarly to what found in VLA4A and VLA4B. In IRAS16293-2422 the observed differences are interpreted as a result of the onion-like structure of the hot corino (physical effect).
In particular, the NH$_{\rm 2}$CHO rotational temperature is slightly higher (T $\sim$ 140 -- 300 K) than what derived for other iCOMs (T $\sim$ 100 K) \citep{Jorgensen2016,Jorgensen2018, Manigand2019}, suggesting that N-bearing species trace hotter gas, closer to the protostar. On the other hand, recent ALMA observations of other two Class 0 protostars, Perseus B1-c and Serpens S68N, do not show significant difference in the excitations conditions of N-bearing and O-bearing species \citep{Nazari2021, vanGelder2020}, leaving the question open.
Further observations in different N-bearing and O-bearing complex species are required to clarify the origin of the chemical segregation observed in SVS13-A and inferred in IRAS16293-2422 A and B, but not in other low-mass protostars.
The spatial distribution of iCOMs emission in SVS13-A supports the idea that formamide is formed in a compact region closer to the protostar and thus, contrarily to other iCOMs, can be more easily obscured by the dust. The fact that the dust emission of VLA4B is optically thicker than that of VLA4A supports this scenario.
Note also that the binding energy, recently computed by \citet{Ferrero2020}, of formamide (average $\sim$ 8400 K) is larger than the one of methanol (average $\sim$ 6200 K) in agreement with a possible onion-like structure of the two SVS13-A hot corinos.
Interestingly, \citet{Diaz2021} report the detection of ethylene glycol only towards VLA4A, suggesting that the observed chemical segregation in SVS13-A is not exclusive of formamide.
Since no binding energy of ethylene glycol is available in the literature, we carried out new ab initio quantum chemistry calculations to evaluate its binding energy over a 18-water cluster (see Appendix \ref{sec:quant-chem}).
In order to compare ethylene glycol with formamide, we also recalculated the binding energy of the latter.
We found that the binding energy of ethylene glycol has an average value of $\sim$7100 K, while that of formamide is equal to $\sim$4700 K. We emphasize that the difference with respect to \citet{Ferrero2020} is due to the different used water cluster. The important point here is the relative binding energy of ethylene glycol with respect to formamide, which is not expected to change with the used water cluster. This means that if the calculation by \citet{Ferrero2020} were performed for ethylene glycol, the binding energy would be even higher than that of formamide ($\sim$ 8400 K). This justify the similar spatial distribution of formamide and ethylene glycol, different from that of methanol.
Overall the new calculated binding energies support the hypothesis that the observed chemical differentiation is caused by the onion-like structure of the two SVS13-A hot corinos instead of a spatial segregation between O-bearing and N-bearing species.
Further observations at high-angular resolution (tens of au) with ALMA and at cm-wavelengths with JVLA (and, in perspective, with ngVLA and SKA) are needed to further investigate the chemical stratification inside the two hot corinos VLA4A and VLA4B, and to quantify the dust opacity effects.

\section*{Acknowledgements}
The authors thank the anonymous referee for the constructive comments which substantially helped improving the quality of the paper. This project has received funding from: 1) the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation program, for the Project "The Dawn of Organic Chemistry" (DOC), grant agreement No 741002; 2) the PRIN-INAF 2016 The Cradle of Life - GENESIS-SKA (General Conditions in Early Planetary Systems for the rise of life with SKA); 3) the European Union's Horizon 2020 research and innovation programs under projects "Astro-Chemistry Origins" (ACO), Grant No 811312.
This paper makes use of the following ALMA data: ADS/JAO.ALMA\#2018.1.01461.S. ALMA is a partnership of ESO (representing its member states), NSF (USA) and NINS (Japan), together with NRC (Canada), MOST and ASIAA (Taiwan), and KASI (Republic of Korea), in cooperation with the Republic of Chile. The Joint ALMA Observatory is operated by ESO, AUI/NRAO and NAOJ.
Most of the computations presented in this paper were performed using the GRICAD infrastructure (https://gricad.univ-grenoble-alpes.fr), which is partly supported by the Equip@Meso project (reference ANR-10-EQPX-29-01) of the programme Investissements d'Avenir supervised by the Agence Nationale pour la Recherche.\\
\textit{Software:} astropy \citep{Astropy1,Astropy2}, matplotlib \citep{Matplotlib}.

redpajama_set_name: RedPajamaArXiv


ROXY: so you are roses girlfriend right?
ROXY: is a matesprit the thing trolls call each other when they are girlfriends or boyfriends with each other?
ROXY: the answer is yes?
ROXY: man... three years was it?
ROXY: which was cool in its own way but it wasnt nearly as... social as your scene sounded?


Double Chocolate Loaf Cake loaded with chocolate chunks then topped with a creamy chocolate ganache icing!
Nothing beats a slice of chocolate cake. This chocolate loaf cake is one of my favorite desserts! Perfectly moist, dense and super rich with a nice thick topping of chocolate ganache.
To achieve the dense, soft texture I added in sour cream and substituted some of the granulated sugar for brown sugar.
For an ultra soft and moist cake I always bring the eggs, sour cream and butter to room temperature. I also add in hot coffee which amplifies the chocolate flavor and adds a nice silkiness to the batter. After I add the hot coffee I turn the mixer to the highest speed and whip the batter for a minute. This helps to get any last clumps as well as adds air to the batter.
After the cake cools I spread a generous layer of chocolate ganache on top. For the chocolate ganache I whisked together powdered sugar, unsweetened cocoa powder, vanilla and milk.
Once the chocolate ganache has set slice and enjoy!
Preheat oven to 325 degrees. Grease a 9 x 5 pan with cooking spray.
In a stand mixer with the paddle attachment cream butter and both sugars until combined and fluffy, 2-3 minutes.
Add in eggs one at a time, scraping the bowl between each addition.
Next add in vanilla and sour cream and mix until incorporated.
In a large bowl combine flour, baking soda and cocoa powder.
Add the hot coffee or hot water to the stand mixer and beat on high for 1 minute.
Fold in chocolate chips by hand and pour the batter into the prepared pan.
Place the cake on a cooling rack to cool completely.
Once cool run a knife along the sides to remove the cake.
Add all of the ingredients to a large bowl and whisk to combine.
Best Chocolate loaf cake! I tried others and they did not compare. This was dense, rich and basically perfect! I did not do the ganache because I am not a fan of any type of frosting.
I'm so glad you liked the chocolate loaf cake! Thank you for trying it, and for commenting!


text:
Q: Story of two children lost in time? I remember a book I read when I was about 12, and it was targeted to juveniles.  In it, there were two (maybe three) young siblings (brother and sister I think) lost in time trying to get home, I distinctly remember them running through a forest in pre-dinosaur age earth (the Cure's "Lost in a Forest" always makes me think of this book :).  I don't remember much more about it.  Can anyone id it?

A: A few stories that could possibly meet the description (in descending order of likelihood):
Joan Phipson's The Way Home (1973).
The story features 3 siblings (Prue, Peter and Richard) who survive a car accident in the Australian outback in which the driver is killed. Trying to find their way home they set off following a river but as they walk they find themselves passing through different times, including a prehistoric setting with volcanoes and such like.
Dinosaurs Before Dark by Mary Pope Osborne (1992)
Brother and sister Jack and Annie travel 65 million years into the past (not really pre-dinosaur, so much as just full-on dinosaur) through one of the books in their magical tree house.
If you were 12 somewhat more recently - it could be:
Timespinners by Luli Grey (2003).
The mother of two twins (Allie and Thaddeus) is in a coma, the twins end up going to the museum of natural history and falling into the past through one of the dioramas. Eventually they end up in Paleolithic France (which I realize is significantly later than `pre-dinosaur age earth')

redpajama_set_name: RedPajamaStackExchange


text:
Lotten Brenners ferier är en roman av den svenske författaren Hjalmar Bergman från 1928.

Handling
Ett av Bergmans lättare stycken som dock underhållande skildrar den mindre attraktiva men synnerligen självsäkra ungmön Lotten Brenner, vilken av vänner skickas på semester i förhoppningen om att hon ska träffa en man. Bland de figurer som förekommer i handlingen förekommer bland andra herr Markurells son Johan.

Externa länkar
Lotten Brenners ferier finns i fulltext på Göteborgs universitetsbibliotek och på Litteraturbanken.

Skönlitteratur 1928
Svenska romaner
Svenskspråkig skönlitteratur
Verk av Hjalmar Bergman

redpajama_set_name: RedPajamaWikipedia


text:
First same-sex marriage license signed in South Carolina
Charleston County councilwoman Colleen Condon and her fiance, Nichols Bleckley, were the first in line Wednesday morning to receive their marriage license.Copyright WCSC
A Charleston County judge has issued South Carolina's first same-sex marriage license as a rejected appeal to stop them goes on to the Supreme Court.Charleston County councilwoman Colleen Condon and her fiance, Nichols Bleckley, were the first in line Wednesday morning to receive their marriage license. They were the first couple to have their application for a marriage license accepted in Charleston County last month.Attorney John Nichols says Judge Irvin Condon will be issuing the licenses to the couples who applied before Condon was ordered to stop issuing licenses on Oct. 9.According to Nichols, Condon can issue the licenses due to a US district court ruling filed Tuesday that orders South Carolina to legally recognize same-sex marriages that were performed in other states where same-sex marriage is legal.Condon began issuing the licenses to applicants who met all qualifications starting Wednesday at 8:30 a.m. According to Nichols, Condon could have waited until Thursday at Noon to begin issuing licenses.All marriage applications require a 24-hour waiting period, which Nichols says has already passed in these cases."We're absolutely thrilled! We knew going into this we weren't doing it for ourselves but doing it for us, my son and for all the other people who really were afraid to take that step forward," said Condon shortly after the ruling came down Tuesday."I'm thrilled! I'm thrilled for everyone. Most importantly, I'm thrilled for our state. I do think it's a huge step for our state," said Bleckley.South Carolina Attorney General Alan Wilson's appeal of same-sex marriage approvals is now in the hands of the U.S. Supreme Court.This marks the first time that state officials have raised that issue before the high Court; it has been advanced in lower courts, but so far unsuccessfully.Because of this Greenville Co. Probate Judge Debora Faulkner says she will not be issuing same-sex marriage licenses.Faulkner says, "On the application form in South Carolina there is a statement which both applicants have to swear to under oath that says there is no legal impediment to them getting married."Right now, Judge Faulkner says that technically, until Chief Justice John Roberts or the U.S. Supreme Court as a whole makes a ruling, there is still a "legal impediment."A decision from the high court is expected very soon.WCSC contributed to this report.
CHARLESTON, SC (WCSC) —
A Charleston County judge has issued South Carolina's first same-sex marriage license as a rejected appeal to stop them goes on to the Supreme Court.
Charleston County councilwoman Colleen Condon and her fiance, Nichols Bleckley, were the first in line Wednesday morning to receive their marriage license. They were the first couple to have their application for a marriage license accepted in Charleston County last month.
Unitarian Universalist churches prepping for same-sex weddings
Attorney John Nichols says Judge Irvin Condon will be issuing the licenses to the couples who applied before Condon was ordered to stop issuing licenses on Oct. 9.
According to Nichols, Condon can issue the licenses due to a US district court ruling filed Tuesday that orders South Carolina to legally recognize same-sex marriages that were performed in other states where same-sex marriage is legal.
Condon began issuing the licenses to applicants who met all qualifications starting Wednesday at 8:30 a.m. According to Nichols, Condon could have waited until Thursday at Noon to begin issuing licenses.
All marriage applications require a 24-hour waiting period, which Nichols says has already passed in these cases.
"We're absolutely thrilled! We knew going into this we weren't doing it for ourselves but doing it for us, my son and for all the other people who really were afraid to take that step forward," said Condon shortly after the ruling came down Tuesday.
"I'm thrilled! I'm thrilled for everyone. Most importantly, I'm thrilled for our state. I do think it's a huge step for our state," said Bleckley.
South Carolina Attorney General Alan Wilson's appeal of same-sex marriage approvals is now in the hands of the U.S. Supreme Court.
This marks the first time that state officials have raised that issue before the high Court; it has been advanced in lower courts, but so far unsuccessfully.
Because of this Greenville Co. Probate Judge Debora Faulkner says she will not be issuing same-sex marriage licenses.
Faulkner says, "On the application form in South Carolina there is a statement which both applicants have to swear to under oath that says there is no legal impediment to them getting married."
Right now, Judge Faulkner says that technically, until Chief Justice John Roberts or the U.S. Supreme Court as a whole makes a ruling, there is still a "legal impediment."
A decision from the high court is expected very soon.
WCSC contributed to this report.


While archeological research confirms the presence of humans in the region over 125,000 years ago, Sharjah —as a city, an emirate and a member of a relatively young federation— is still in the process of imagining itself through education, culture, religion, heritage and science.
As the emirate's future history is written through urban development, heritage-site restoration, interdependent transnational economies and a diverse everyday culture, Sharjah Biennial 12: The past, the present, the possible invited fifty-one artists and groups to help imagine and reflect upon its ambitions, possibilities and being. A biennial can be a dynamic structure for such considerations, and SB12 embraced this provisional format with a focus on timely experimentation from present and past. Mobilising a host of new commissions and works juxtaposed with an ahistorical wealth of abstraction, The past, the present, the possible signaled a distrust of narrative certitude in favour of unexpected simultaneities and potential alliances.
Regarding the title, curator Eungie Joo said in an interview with Gerhard Haupt & Pat Binder: "It comes from a sentence in The Right to the City by Henri Lefebvre, 'The past, the present, the possible cannot be separated', but the idea for the Biennial came before I read the essay. It just matched the sentiment well. What Lefebvre is writing about in his approach to the city is very much related to what contemporary artists are thinking about right now—there is some kind of crossover in the way he puts everything in the present. One of the things that I thought about not only for Sharjah, but for the greater region usually called the Middle East and for the world, is how do we deal with history, how do we respect history, even share information about it, without being burdened by history, where we can't move."
The exhibition took place in Sharjah, crossing the Emirate to sites in and around the city, including warehouses at Port Khalid, the former restaurant Flying Saucer, as well as an abandoned ice factory in Khor Kalba, on the East Coast of the Emirate of Sharjah, at the Gulf of Oman.
The March Meeting, a vital component of Sharjah Art Foundation's annual programming, took place later from 11 - 15 May 2015. Curator Eungie Joo invited Kristine Khouri and Rasha Salti, Eric Baudelaire and Ayreen Anastas and Rene Gabri to conceptualise different sections of MM2015 as integral parts of their contributions to the Biennial, which included panel discussions, keynote addresses, talks and screenings pertaining to the respective programmes' conceptual concerns.


Treasure worth 40,000 (US$84,000) has been found in a sunken wreck off the east coast of New Zealand's North Island.
Background: Treasure worth 40,000 (US$84,000) has been found in a sunken wreck off the east coast of New Zealand's North Island.
The jewels belonged to Isadore Rothschild, a passenger on the SS Tasmania, when it sank in 105 feet (33 metres) of water off a remote stretch of the New Zealand coast in 1897.
Many attempts have been made to recover the treasure but it wasn't until December that New Zealand underwater explorer Kelly Tarlton succeeded in locating the elusive gold and precious stones.
He used a high pressure jet of water to wash away tons of rubble to find the treasure which had been scattered over the years.
After hundreds of dives and more than seven months of scrabbling in murky waters, Tarlton recovered jewellery in almost every handful of rubble. In one day alone he recovered jewellery worth a year's wages. He says when he brings it all to the surface, the treasure will be worth NZ$100,000 ($40,000 sterling).
All salvage work has been done from his 22 foot (7 metre) boat, "The Discoverer". It took six trips simply locating the wreck and uncovering the cabin before Kelly could start bringing the treasure to the surface.
The divers working with Kelly face the danger of sharks, and the high pressure of the deep. The nearest de-compression chamber is 300 miles (500 km) away so any case of the bends could kill.
SYNOPSIS: New Zealand underwater explorer Kelly Tarlton has discovered a fortune in precious jewels and gold in a sunken wreck off the North Island of New Zealand. The jewels belonged to Isadore Rothschild, a wholesale jeweller who was a passenger on the 'SS Tasmania' when it sank in a hundred and five feet of water off a remote stretch of the east coast of North Island, in eighteen ninety seven.
Several attempts had been made to recover the treasure, estimated at forty thousand pounds sterling. But is wasn't until December that Tarlton was able to start bringing up the treasure. Tarlton made six trips to the location of the wreck in his boat, the Discoverer, and after hundreds of dives, and seven months of searching in the cold murky waters he was able to start bringing the treasure to the surface.
To overcome the murkiness of the water, the divers attached a large fire hose to the outlet of the boat's jet unit. This pumped a stream of clear water onto the work area, giving the divers a small area of relatively good visibility. Conditions when this film was taken were remarkably good. Normally it would not have been possible to see past the outstretched hand. Once aboard the boat, the pieces of encrusted debris are sifted for traces of precious metal.
Tarlton now recovers jewellery and precious stones in almost every handful. In one day alone, he said he recovered treasure worth a year's wages. When the ship went down, the treasures was in a trunk in a cabin. But the case disintegrated years ago, and the ceaseless movement of sand and water spread the contents in all directions. But the determination of the divers over months of facing the dangers of sharks and the bends, has paid off.
Back in camp at evening, the week's findings are displayed for the camera. The bicycle was all the range in eighteen ninety seven. And this solid gold charm once hung from a lady's wrist. These few handfuls of riches are worth about four thousand dollars, but won't be sold if Tarlton can help it. He hopes to display them at his home.