text:
<?php

namespace Tests\Feature;

use App\Models\Label;
use App\Models\Location;
use App\Models\Product;
use App\Models\Section;
use App\Models\Warehouse;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;

class ProductTest extends TestCase
{
    use RefreshDatabase;

    /**
     * Test is in location returns true when a product is in a location
     *
     * @return void
     */
    public function testIsInLocationTrue()
    {
        // Setup two test products and locations
        $products = factory(Product::class, 2)->create();
        $locations = factory(Location::class, 2)->create();

        // Create one label for $products[0] in $locations[0] and make sure isInLocation reports true for
        // $products[0] in $locations[0]
        $products[0]->createLabels(1, $locations[0]);
        $this->assertTrue($products[0]->isInLocation($locations[0]->id));

        // Create two more labels for $products[0] in $locations[0] and make sure isInLocation still reports true
        // for $products[0] in $locations[0], this makes sure the number of labels has no effect on isInLocation
        $products[0]->createLabels(2, $locations[0]);
        $this->assertTrue($products[0]->isInLocation($locations[0]->id));

        // Create one label for $products[1] in $locations[1] and make sure it doesn't effect isInLocation for
        // $products[0] in $locations[0] also make sure $products[1] is now reported in $locations[1]
        // Create One more label in a different way and make sure the location quantity is updated correctly
        $label = new Label;
        $label->location_id = $locations[1]->id;
        $label->labelable_id = $products[1]->id;
        $label->labelable_type = $products[1]->labels()->getMorphClass();
        $label->save();
        $this->assertTrue($products[0]->isInLocation($locations[0]->id));
        $this->assertTrue($products[1]->isInLocation($locations[1]->id));

        // Create two more labels for $products[1] in $locations[1] and make sure it doesn't effect isInLocation for
        // $products[0] in $locations[0] or isInLocation for $products[1] in $locations[1]
        $products[1]->createLabels(2, $locations[1]);
        $this->assertTrue($products[0]->isInLocation($locations[0]->id));
        $this->assertTrue($products[1]->isInLocation($locations[1]->id));
    }

    /**
     * Test is in location returns false when a product is not in a location
     *
     * @return void
     */
    public function testIsInLocationFalse()
    {
        // Setup two test products and locations
        $products = factory(Product::class, 2)->create();
        $locations = factory(Location::class, 2)->create();

        // Make sure when no labels are created for either product that neither is considered in either location
        $this->assertFalse($products[0]->isInLocation($locations[0]->id));
        $this->assertFalse($products[0]->isInLocation($locations[1]->id));
        $this->assertFalse($products[1]->isInLocation($locations[0]->id));
        $this->assertFalse($products[1]->isInLocation($locations[1]->id));

        // Create one label for $products[0] in $locations[0] and make sure isInLocation reports false for
        // $products[0] in $locations[1] (its only in $locations[0]
        $products[0]->createLabels(1, $locations[0]);
        $this->assertFalse($products[0]->isInLocation($locations[1]->id));

        // Create two more labels for $products[0] in $locations[0] and make sure isInLocation still reports false
        // for $products[0] in $locations[1], this makes sure the number of labels has no effect on isInLocation
        $products[0]->createLabels(2, $locations[0]);
        $this->assertFalse($products[0]->isInLocation($locations[1]->id));

        // Create one label for $products[1] in $locations[1] and make sure it doesn't effect isInLocation for
        // $products[0] in $locations[1] also make sure $products[1] is not reported in $locations[0]
        $products[1]->createLabels(1, $locations[1]);
        $this->assertFalse($products[0]->isInLocation($locations[1]->id));
        $this->assertFalse($products[1]->isInLocation($locations[0]->id));

        // Create two more labels for $products[1] in $locations[1] and make sure isInLocation still reports false
        // for $products[0] in $locations[1], this makes sure the number of labels has no effect on isInLocation
        $products[1]->createLabels(2, $locations[1]);
        $this->assertFalse($products[0]->isInLocation($locations[1]->id));
        $this->assertFalse($products[1]->isInLocation($locations[0]->id));
    }

    /**
     * Test is in section returns true when a product is in a section
     *
     * @return void
     */
    public function testIsInSectionTrue()
    {
        // Setup two test products, locations, sections, and warehouses
        $products = factory(Product::class, 2)->create();
        // Need to create warehouses to avoid foreign key constraint violations on sections
        $warehouses = factory(Warehouse::class, 2)->create();
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[0]->id]);
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[1]->id]);
        // Create two locations and attach the first section to them
        $locations = factory(Location::class, 2)->create()->each(function ($location, $key) use ($sections) {
            // Attach section 0 to location 0 and section 1 to location 1
            if ($key == 0) {
                $location->section()->associate($sections[0])->save();
            } else {
                $location->section()->associate($sections[1])->save();
            }
        });

        // Create one label for $products[0] in $locations[0] and make sure isInSection reports true for
        // $products[0] in $sections[0]
        $products[0]->createLabels(1, $locations[0]);
        $this->assertTrue($products[0]->isInSection($sections[0]->id));

        // Create two more labels for $products[0] in $locations[0] and make sure isInSection still reports true
        // for $products[0] in $sections[0], this makes sure the number of labels has no effect on isInSection
        $products[0]->createLabels(2, $locations[0]);
        $this->assertTrue($products[0]->isInSection($sections[0]->id));

        // Create one label for $products[1] in $locations[1] and make sure it doesn't effect isInSection for
        // $products[0] in $sections[0] also make sure $products[1] is now reported in $sections[1]
        $label = new Label;
        $label->location_id = $locations[1]->id;
        $label->labelable_id = $products[1]->id;
        $label->labelable_type = $products[1]->labels()->getMorphClass();
        $label->save();
        $this->assertTrue($products[0]->isInSection($sections[0]->id));
        $this->assertTrue($products[1]->isInSection($sections[1]->id));

        // Create two more labels for $products[1] in $locations[1] and make sure it doesn't effect isInSection for
        // $products[0] in $sections[0] or isInSection for $products[1] in $sections[1]
        $products[1]->createLabels(2, $locations[1]);
        $this->assertTrue($products[0]->isInSection($sections[0]->id));
        $this->assertTrue($products[1]->isInSection($sections[1]->id));
    }

    /**
     * Test is in section returns false when a product is not in a section
     *
     * @return void
     */
    public function testIsInSectionFalse()
    {
        // Setup two test products, locations, sections, and warehouses
        $products = factory(Product::class, 2)->create();
        // Need to create warehouses to avoid foreign key constraint violations on sections
        $warehouses = factory(Warehouse::class, 2)->create();
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[0]->id]);
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[1]->id]);
        // Create two locations and attach the first section to them
        $locations = factory(Location::class, 2)->create()->each(function ($location, $key) use ($sections) {
            // Attach section 0 to location 0 and section 1 to location 1
            if ($key == 0) {
                $location->section()->associate($sections[0])->save();
            } else {
                $location->section()->associate($sections[1])->save();
            }
        });

        // Make sure when no labels are created for either product that neither is considered in either section
        $this->assertFalse($products[0]->isInSection($sections[0]->id));
        $this->assertFalse($products[0]->isInSection($sections[1]->id));
        $this->assertFalse($products[1]->isInSection($sections[0]->id));
        $this->assertFalse($products[1]->isInSection($sections[1]->id));

        // Create one label for $products[0] in $locations[0] and make sure isInSection reports false for
        // $products[0] in $sections[1] (its only in $sections[0]
        $products[0]->createLabels(1, $locations[0]);
        $this->assertFalse($products[0]->isInSection($sections[1]->id));

        // Create two more labels for $products[0] in $locations[0] and make sure isInSection still reports false
        // for $products[0] in $sections[1], this makes sure the number of labels has no effect on isInSection
        $products[0]->createLabels(2, $locations[0]);
        $this->assertFalse($products[0]->isInSection($sections[1]->id));

        // Create one label for $products[1] in $locations[1] and make sure it doesn't effect isInSection for
        // $products[0] in $sections[1] also make sure $products[1] is not reported in $sections[0]
        $products[1]->createLabels(1, $locations[1]);
        $this->assertFalse($products[0]->isInSection($sections[1]->id));
        $this->assertFalse($products[1]->isInSection($sections[0]->id));

        // Create two more labels for $products[1] in $locations[1] and make sure isInSection still reports false
        // for $products[0] in $sections[1], this makes sure the number of labels has no effect on isInSection
        $products[1]->createLabels(2, $locations[1]);
        $this->assertFalse($products[0]->isInSection($sections[1]->id));
        $this->assertFalse($products[1]->isInSection($sections[0]->id));
    }

    /**
     * Test is in warehouse returns true when a product is in a warehouse
     *
     * @return void
     */
    public function testIsInWarehouseTrue()
    {
        // Setup two test products, locations, sections, and warehouses
        $products = factory(Product::class, 2)->create();
        $warehouses = factory(Warehouse::class, 2)->create();
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[0]->id]);
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[1]->id]);
        // Create two locations and attach the first section to them
        $locations = factory(Location::class, 2)->create()->each(function ($location, $key) use ($sections) {
            // Attach section 0 to location 0 and section 1 to location 1
            if ($key == 0) {
                $location->section()->associate($sections[0])->save();
            } else {
                $location->section()->associate($sections[1])->save();
            }
        });

        // Create one label for $products[0] in $locations[0] and make sure isInWarehouse reports true for
        // $products[0] in $warehouses[0]
        $products[0]->createLabels(1, $locations[0]);
        $this->assertTrue($products[0]->isInWarehouse($warehouses[0]->id));

        // Create two more labels for $products[0] in $locations[0] and make sure isInWarehouse still reports true
        // for $products[0] in $warehouses[0], this makes sure the number of labels has no effect on isInWarehouse
        $products[0]->createLabels(2, $locations[0]);
        $this->assertTrue($products[0]->isInWarehouse($warehouses[0]->id));

        // Create one label for $products[1] in $locations[1] and make sure it doesn't effect isInWarehouse for
        // $products[0] in $warehouses[0] also make sure $products[1] is now reported in $warehouses[1]
        $label = new Label;
        $label->location_id = $locations[1]->id;
        $label->labelable_id = $products[1]->id;
        $label->labelable_type = $products[1]->labels()->getMorphClass();
        $label->save();
        $this->assertTrue($products[0]->isInWarehouse($warehouses[0]->id));
        $this->assertTrue($products[1]->isInWarehouse($warehouses[1]->id));

        // Create two more labels for $products[1] in $locations[1] and make sure it doesn't effect isInWarehouse for
        // $products[0] in $warehouses[0] or isInWarehouse for $products[1] in $warehouses[1]
        $products[1]->createLabels(2, $locations[1]);
        $this->assertTrue($products[0]->isInWarehouse($warehouses[0]->id));
        $this->assertTrue($products[1]->isInWarehouse($warehouses[1]->id));
    }

    /**
     * Test is in warehouse returns false when a product is not in a warehouse
     *
     * @return void
     */
    public function testIsInWarehouseFalse()
    {
        // Setup two test products, locations, sections, and warehouses
        $products = factory(Product::class, 2)->create();
        // Need to create warehouses to avoid foreign key constraint violations on sections
        $warehouses = factory(Warehouse::class, 2)->create();
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[0]->id]);
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[1]->id]);
        // Create two locations and attach the first section to them
        $locations = factory(Location::class, 2)->create()->each(function ($location, $key) use ($sections) {
            // Attach section 0 to location 0 and section 1 to location 1
            if ($key == 0) {
                $location->section()->associate($sections[0])->save();
            } else {
                $location->section()->associate($sections[1])->save();
            }
        });

        // Make sure when no labels are created for either product that neither is considered in either warehouse
        $this->assertFalse($products[0]->isInWarehouse($warehouses[0]->id));
        $this->assertFalse($products[0]->isInSection($warehouses[1]->id));
        $this->assertFalse($products[1]->isInSection($warehouses[0]->id));
        $this->assertFalse($products[1]->isInSection($warehouses[1]->id));

        // Create one label for $products[0] in $locations[0] and make sure isInWarehouse reports false for
        // $products[0] in $warehouses[1] (its only in $warehouses[0]
        $products[0]->createLabels(1, $locations[0]);
        $this->assertFalse($products[0]->isInWarehouse($warehouses[1]->id));

        // Create two more labels for $products[0] in $locations[0] and make sure isInWarehouse still reports false
        // for $products[0] in $warehouses[1], this makes sure the number of labels has no effect on isInWarehouse
        $products[0]->createLabels(2, $locations[0]);
        $this->assertFalse($products[0]->isInWarehouse($warehouses[1]->id));

        // Create one label for $products[1] in $locations[1] and make sure it doesn't effect isInWarehouse for
        // $products[0] in $warehouses[1] also make sure $products[1] is not reported in $warehouses[0]
        $products[1]->createLabels(1, $locations[1]);
        $this->assertFalse($products[0]->isInWarehouse($warehouses[1]->id));
        $this->assertFalse($products[1]->isInWarehouse($warehouses[0]->id));

        // Create two more labels for $products[1] in $locations[1] and make sure isInWarehouse still reports false
        // for $products[0] in $warehouses[1], this makes sure the number of labels has no effect on isInWarehouse
        $products[1]->createLabels(2, $locations[1]);
        $this->assertFalse($products[0]->isInWarehouse($warehouses[1]->id));
        $this->assertFalse($products[1]->isInWarehouse($warehouses[0]->id));
    }

    /**
     * Test that locations quantities are kept track of when increasing and decreasing in a variety of circumstances
     *
     * @return void
     */
    public function testLocationQuantity()
    {
        // Setup two test products and locations
        $products = factory(Product::class, 2)->create();
        $locations = factory(Location::class, 2)->create();

        // Create one label for $products[0] in $locations[0] and our product_locations records are correct
        // and have the correct quantity
        $products[0]->createLabels(1, $locations[0]);

        // We've created one label and put it in a given location so the location quantity for that should be stored
        // in the database at this point
        $this->assertDatabaseHas('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[0]->id,
            'quantity' => 1,
        ]);
        // There should be no record here at this point since there is no quantity in this location
        $this->assertDatabaseMissing('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[1]->id,
        ]);
        // There should be no record here at this point since we didn't create labels for this product
        $this->assertDatabaseMissing('product_locations', [
            'product_id' => $products[1]->id,
            'location_id' => $locations[0]->id,
        ]);

        // Create two more labels in the location and make sure the location quantity is updated correctly
        $products[0]->createLabels(2, $locations[0]);
        $this->assertDatabaseHas('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[0]->id,
            'quantity' => 3,
        ]);

        // Create One more label in a different way and make sure the location quantity is updated correctly
        $label = new Label;
        $label->location_id = $locations[0]->id;
        $label->labelable_id = $products[0]->id;
        $label->labelable_type = $products[0]->labels()->getMorphClass();
        $label->save();
        $this->assertDatabaseHas('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[0]->id,
            'quantity' => 4,
        ]);

        // Remove one of the labels and make sure the the quantity is updated correctly
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertDatabaseHas('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[0]->id,
            'quantity' => 3,
        ]);
        // Move a label and make sure the quantity is updated correctly
        $label = $products[0]->labels()->first();
        $label->location_id = $locations[1]->id;
        $label->save();
        $this->assertDatabaseHas('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[0]->id,
            'quantity' => 2,
        ]);
        $this->assertDatabaseHas('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[1]->id,
            'quantity' => 1,
        ]);

        // Now delete the remaining labels and make sure we are back to no quantities anywhere
        $label->delete();
        $this->assertDatabaseHas('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[0]->id,
            'quantity' => 2,
        ]);
        $this->assertDatabaseMissing('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[1]->id,
        ]);
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertDatabaseHas('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[0]->id,
            'quantity' => 1,
        ]);
        $this->assertDatabaseMissing('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[1]->id,
        ]);
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertDatabaseMissing('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[0]->id,
        ]);
        $this->assertDatabaseMissing('product_locations', [
            'product_id' => $products[0]->id,
            'location_id' => $locations[1]->id,
        ]);
    }

    /**
     * Test that sections quantities are kept track of when increasing and decreasing in a variety of circumstances
     *
     * @return void
     */
    public function testSectionQuantity()
    {
        // Setup two test products, locations, sections, and warehouses
        $products = factory(Product::class, 2)->create();
        // Need to create warehouses to avoid foreign key constraint violations on sections
        $warehouses = factory(Warehouse::class, 2)->create();
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[0]->id]);
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[1]->id]);
        // Create two locations and attach the first section to them
        $locations = factory(Location::class, 2)->create()->each(function ($location, $key) use ($sections) {
            // Attach section 0 to location 0 and section 1 to location 1
            if ($key == 0) {
                $location->section()->associate($sections[0])->save();
            } else {
                $location->section()->associate($sections[1])->save();
            }
        });

        // Create one label for $products[0] in $locations[0] and our product_sections records are correct
        // and have the correct quantity
        $products[0]->createLabels(1, $locations[0]);
        // We've created one label and put it in a given location so the section quantity for that should be stored
        // in the database at this point
        $this->assertDatabaseHas('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[0]->id,
            'quantity' => 1,
        ]);
        // There should be no record here at this point since there is no quantity in this section
        $this->assertDatabaseMissing('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[1]->id,
        ]);
        // There should be no record here at this point since we didn't create labels for this product
        $this->assertDatabaseMissing('product_sections', [
            'product_id' => $products[1]->id,
            'section_id' => $sections[0]->id,
        ]);

        // Create two more labels in the location and make sure the section quantity is updated correctly
        $products[0]->createLabels(2, $locations[0]);
        $this->assertDatabaseHas('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[0]->id,
            'quantity' => 3,
        ]);

        // Create One more label in a different way and make sure the section quantity is updated correctly
        $label = new Label;
        $label->location_id = $locations[0]->id;
        $label->labelable_id = $products[0]->id;
        $label->labelable_type = $products[0]->labels()->getMorphClass();
        $label->save();
        $this->assertDatabaseHas('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[0]->id,
            'quantity' => 4,
        ]);

        // Remove one of the labels and make sure the the quantity is updated correctly
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertDatabaseHas('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[0]->id,
            'quantity' => 3,
        ]);
        // Move a label and make sure the quantity is updated correctly
        $label = $products[0]->labels()->first();
        $label->location_id = $locations[1]->id;
        $label->save();
        $this->assertDatabaseHas('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[0]->id,
            'quantity' => 2,
        ]);
        $this->assertDatabaseHas('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[1]->id,
            'quantity' => 1,
        ]);

        // Now delete the remaining labels and make sure we are back to no quantities anywhere
        $label->delete();
        $this->assertDatabaseHas('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[0]->id,
            'quantity' => 2,
        ]);
        $this->assertDatabaseMissing('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[1]->id,
        ]);
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertDatabaseHas('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[0]->id,
            'quantity' => 1,
        ]);
        $this->assertDatabaseMissing('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[1]->id,
        ]);
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertDatabaseMissing('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[0]->id,
        ]);
        $this->assertDatabaseMissing('product_sections', [
            'product_id' => $products[0]->id,
            'section_id' => $sections[1]->id,
        ]);
    }

    /**
     * Test that sections quantities are kept track of when increasing and decreasing in a variety of circumstances
     *
     * @return void
     */
    public function testWarehouseQuantity()
    {
        // Setup two test products, locations, sections, and warehouses
        $products = factory(Product::class, 2)->create();
        // Need to create warehouses to avoid foreign key constraint violations on sections
        $warehouses = factory(Warehouse::class, 2)->create();
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[0]->id]);
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[1]->id]);
        // Create two locations and attach the first section to them
        $locations = factory(Location::class, 2)->create()->each(function ($location, $key) use ($sections) {
            // Attach section 0 to location 0 and section 1 to location 1
            if ($key == 0) {
                $location->section()->associate($sections[0])->save();
            } else {
                $location->section()->associate($sections[1])->save();
            }
        });

        // Create one label for $products[0] in $locations[0] and make sure our product_warehouses records are correct
        // and have the correct quantity
        $products[0]->createLabels(1, $locations[0]);
        // We've created one label and put it in a given location so the warehouse quantity for that should be stored
        // in the database at this point
        $this->assertDatabaseHas('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[0]->id,
            'quantity' => 1,
        ]);
        // There should be no record here at this point since there is no quantity in this warehouse
        $this->assertDatabaseMissing('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[1]->id,
        ]);
        // There should be no record here at this point since we didn't create labels for this product
        $this->assertDatabaseMissing('product_warehouses', [
            'product_id' => $products[1]->id,
            'warehouse_id' => $warehouses[0]->id,
        ]);

        // Create two more labels in the location and make sure the warehouse quantity is updated correctly
        $products[0]->createLabels(2, $locations[0]);
        $this->assertDatabaseHas('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[0]->id,
            'quantity' => 3,
        ]);

        // Create One more label in a different way and make sure the warehouse quantity is updated correctly
        $label = new Label;
        $label->location_id = $locations[0]->id;
        $label->labelable_id = $products[0]->id;
        $label->labelable_type = $products[0]->labels()->getMorphClass();
        $label->save();
        $this->assertDatabaseHas('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[0]->id,
            'quantity' => 4,
        ]);

        // Remove one of the labels and make sure the the quantity is updated correctly
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertDatabaseHas('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[0]->id,
            'quantity' => 3,
        ]);
        // Move a label and make sure the quantity is updated correctly
        $label = $products[0]->labels()->first();
        $label->location_id = $locations[1]->id;
        $label->save();
        $this->assertDatabaseHas('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[0]->id,
            'quantity' => 2,
        ]);
        $this->assertDatabaseHas('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[1]->id,
            'quantity' => 1,
        ]);

        // Now delete the remaining labels and make sure we are back to no quantities anywhere
        $label->delete();
        $this->assertDatabaseHas('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[0]->id,
            'quantity' => 2,
        ]);
        $this->assertDatabaseMissing('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[1]->id,
        ]);
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertDatabaseHas('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[0]->id,
            'quantity' => 1,
        ]);
        $this->assertDatabaseMissing('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[1]->id,
        ]);
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertDatabaseMissing('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[0]->id,
        ]);
        $this->assertDatabaseMissing('product_warehouses', [
            'product_id' => $products[0]->id,
            'warehouse_id' => $warehouses[1]->id,
        ]);
    }

    /**
     * Test that we can correctly get the location quantity
     *
     * @return void
     */
    public function testGetLocationQuantity()
    {
        // Setup two test products, locations, sections, and warehouses
        $products = factory(Product::class, 2)->create();
        // Need to create warehouses to avoid foreign key constraint violations on sections
        $warehouses = factory(Warehouse::class, 2)->create();
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[0]->id]);
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[1]->id]);
        // Create two locations and attach the first section to them
        $locations = factory(Location::class, 2)->create()->each(function ($location, $key) use ($sections) {
            // Attach section 0 to location 0 and section 1 to location 1
            if ($key == 0) {
                $location->section()->associate($sections[0])->save();
            } else {
                $location->section()->associate($sections[1])->save();
            }
        });

        // Should be 0 at this point since we haven't put any products in any locations
        $this->assertEquals(0, $products[0]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[0]->getLocationQuantity($locations[1]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[1]->id));

        // Create one label in the location and make sure the location quantity we get is correct
        $products[0]->createLabels(1, $locations[0]);
        $this->assertEquals(1, $products[0]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[0]->getLocationQuantity($locations[1]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[1]->id));

        // Create two more labels in the location and make sure the location quantity we get is correct
        $products[0]->createLabels(2, $locations[0]);
        $this->assertEquals(3, $products[0]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[0]->getLocationQuantity($locations[1]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[1]->id));

        // Create one more label in a different way and make sure the location quantity is correct
        $label = new Label;
        $label->location_id = $locations[0]->id;
        $label->labelable_id = $products[0]->id;
        $label->labelable_type = $products[0]->labels()->getMorphClass();
        $label->save();
        $this->assertEquals(4, $products[0]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[0]->getLocationQuantity($locations[1]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[1]->id));

        // Remove one of the labels and make sure the the quantity is correct
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertEquals(3, $products[0]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[0]->getLocationQuantity($locations[1]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[1]->id));

        // Move a label and make sure the quantity is correct
        $label = $products[0]->labels()->first();
        $label->location_id = $locations[1]->id;
        $label->save();
        $this->assertEquals(2, $products[0]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(1, $products[0]->getLocationQuantity($locations[1]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[1]->id));

        // Now delete the remaining labels and make sure we are back to no quantities anywhere
        $label->delete();
        $this->assertEquals(2, $products[0]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[0]->getLocationQuantity($locations[1]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[1]->id));
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertEquals(1, $products[0]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[0]->getLocationQuantity($locations[1]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[1]->id));
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertEquals(0, $products[0]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[0]->id));
        $this->assertEquals(0, $products[0]->getLocationQuantity($locations[1]->id));
        $this->assertEquals(0, $products[1]->getLocationQuantity($locations[1]->id));
    }

    /**
     * Test that we can correctly get the section quantity
     *
     * @return void
     */
    public function testGetSectionQuantity()
    {
        // Setup two test products, locations, sections, and warehouses
        $products = factory(Product::class, 2)->create();
        // Need to create warehouses to avoid foreign key constraint violations on sections
        $warehouses = factory(Warehouse::class, 2)->create();
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[0]->id]);
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[1]->id]);
        // Create two locations and attach the first section to them
        $locations = factory(Location::class, 3)->create()->each(function ($location, $key) use ($sections) {
            // Attach section 0 to location 0 and section 1 to location 1
            if ($key == 0) {
                $location->section()->associate($sections[0])->save();
            } else {
                $location->section()->associate($sections[1])->save();
            }
        });

        // Should be 0 at this point since we haven't put any products in any locations
        $this->assertEquals(0, $products[0]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[0]->getSectionQuantity($sections[1]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[1]->id));

        // Create one label in the location and make sure the section quantity we get is correct
        $products[0]->createLabels(1, $locations[0]);
        $this->assertEquals(1, $products[0]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[0]->getSectionQuantity($sections[1]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[1]->id));

        // Create two more labels in the location and make sure the section quantity we get is correct
        $products[0]->createLabels(2, $locations[0]);
        $this->assertEquals(3, $products[0]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[0]->getSectionQuantity($sections[1]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[1]->id));

        // Create one more label in a different way and make sure the section quantity is correct
        $label = new Label;
        $label->location_id = $locations[0]->id;
        $label->labelable_id = $products[0]->id;
        $label->labelable_type = $products[0]->labels()->getMorphClass();
        $label->save();
        $this->assertEquals(4, $products[0]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[0]->getSectionQuantity($sections[1]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[1]->id));

        // Remove one of the labels and make sure the the quantity is correct
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertEquals(3, $products[0]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[0]->getSectionQuantity($sections[1]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[1]->id));

        // Move a label and make sure the quantity is correct
        $label = $products[0]->labels()->first();
        $label->location_id = $locations[1]->id;
        $label->save();
        $this->assertEquals(2, $products[0]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(1, $products[0]->getSectionQuantity($sections[1]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[1]->id));

        $label = $products[0]->labels()->orderBy('id', 'desc')->first();
        $label->location_id = $locations[2]->id;
        $label->save();
        $this->assertEquals(1, $products[0]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(2, $products[0]->getSectionQuantity($sections[1]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[1]->id));

        // Now delete the remaining labels and make sure we are back to no quantities anywhere
        $label->delete();
        $this->assertEquals(1, $products[0]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(1, $products[0]->getSectionQuantity($sections[1]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[1]->id));
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertEquals(1, $products[0]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[0]->getSectionQuantity($sections[1]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[1]->id));
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertEquals(0, $products[0]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[0]->id));
        $this->assertEquals(0, $products[0]->getSectionQuantity($sections[1]->id));
        $this->assertEquals(0, $products[1]->getSectionQuantity($sections[1]->id));
    }

    /**
     * Test that we can correctly get warehouse quantity
     *
     * @return void
     */
    public function testGetWarehouseQuantity()
    {
        // Setup two test products, locations, sections, and warehouses
        $products = factory(Product::class, 2)->create();
        // Need to create warehouses to avoid foreign key constraint violations on sections
        $warehouses = factory(Warehouse::class, 2)->create();
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[0]->id]);
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[1]->id]);
        $sections[] = factory(Section::class)->create(['warehouse_id' => $warehouses[1]->id]);
        // Create two locations and attach the first section to them
        $locations = factory(Location::class, 3)->create()->each(function ($location, $key) use ($sections) {
            // Attach section 0 to location 0 and section 1 to location 1
            if ($key == 0) {
                $location->section()->associate($sections[0])->save();
            } elseif ($key == 1) {
                $location->section()->associate($sections[1])->save();
            } else {
                $location->section()->associate($sections[2])->save();
            }
        });

        // Should be 0 at this point since we haven't put any products in any warehouses
        $this->assertEquals(0, $products[0]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[0]->getWarehouseQuantity($warehouses[1]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[1]->id));

        // Create one label in the location and make sure the warehouse quantity we get is correct
        $products[0]->createLabels(1, $locations[0]);
        $this->assertEquals(1, $products[0]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[0]->getWarehouseQuantity($warehouses[1]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[1]->id));

        // Create two more labels in the location and make sure the warehouse quantity we get is correct
        $products[0]->createLabels(2, $locations[0]);
        $this->assertEquals(3, $products[0]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[0]->getWarehouseQuantity($warehouses[1]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[1]->id));

        // Create one more label in a different way and make sure the warehouse quantity is correct
        $label = new Label;
        $label->location_id = $locations[0]->id;
        $label->labelable_id = $products[0]->id;
        $label->labelable_type = $products[0]->labels()->getMorphClass();
        $label->save();
        $this->assertEquals(4, $products[0]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[0]->getWarehouseQuantity($warehouses[1]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[1]->id));

        // Remove one of the labels and make sure the the quantity is correct
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertEquals(3, $products[0]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[0]->getWarehouseQuantity($warehouses[1]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[1]->id));

        // Move a label and make sure the quantity is correct
        $label = $products[0]->labels()->first();
        $label->location_id = $locations[1]->id;
        $label->save();
        $this->assertEquals(2, $products[0]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(1, $products[0]->getWarehouseQuantity($warehouses[1]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[1]->id));

        $label = $products[0]->labels()->orderBy('id', 'desc')->first();
        $label->location_id = $locations[2]->id;
        $label->save();
        $this->assertEquals(1, $products[0]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(2, $products[0]->getWarehouseQuantity($warehouses[1]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[1]->id));

        // Now delete the remaining labels and make sure we are back to no quantities anywhere
        $label->delete();
        $this->assertEquals(1, $products[0]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(1, $products[0]->getWarehouseQuantity($warehouses[1]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[1]->id));
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertEquals(1, $products[0]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[0]->getWarehouseQuantity($warehouses[1]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[1]->id));
        $label = $products[0]->labels()->first();
        $label->delete();
        $this->assertEquals(0, $products[0]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[0]->id));
        $this->assertEquals(0, $products[0]->getWarehouseQuantity($warehouses[1]->id));
        $this->assertEquals(0, $products[1]->getWarehouseQuantity($warehouses[1]->id));
    }
}


By Steve and Becky Lyles. Discovered by Player FM and our community — copyright is owned by the publisher, not Player FM, and audio streamed directly from their servers.
Steve and Becky Lyles read stories, essays, poems, jokes and quotes to inspire and enliven your day. Becky writes award-winning fiction under the name Rebecca Carey Lyles and nonfiction under Becky Lyles, and Steve composes poems and vignettes of daily life. Becky's books include Winds of Wyoming, Winds of Freedom, It's a God Thing, On a Wing and a Prayer, and Passageways: A Short Story Collection. But they don't just read their own work. Each podcast also includes the stories and thoughts of other creative authors, all of which are guaranteed to entertain.
116 episodes available. A new episode about every 15 days averaging 40 mins duration .
Wyoming Wedding In podcast 104, we come to the end of "Elder Brown's Backslide," a long short story by Harry Stillwell Edwards. We also read the final chapter of "Winds of Wyoming" and treat you to several fun Kid Chuckles plus some Eugene Shea poetry.
Salesman and Sarsaparilla Steve reads part 2 of Elder Brown's story in podcast 103, Becky reads from Winds of Wyoming, and Steve concludes with a Roger Pond essay about phone salesmen.
End of Construction Insightful quotations from Billy Graham "bookend" this LMTYAS episode. In Michelle Netten's short story titled "Different Mirrors," we read about a governor's wife who runs away to Mexico. And in the "Winds of Wyoming" excerpt, Kate Neilson wishes she could run away.
A Small Mistake Our guest author, Lisa Michelle Hess, reads "A Small Mistake," a short story from the "Passageways" collection, Steve and Becky share the reading of Jack London's short story titled "Daughter of Aurora," and Becky closes with "Winds of Wyoming" chapter 27.
On April 25, 2017, I was privileged to be Patti Shene's guest author on "Step Into the Light," a Blog Talk Radio program. We had a good time talking about UFOs, addiction, the writing life, the ups and downs of my writing journey, our podcast, and my next series, Prisoners of Hope.
Start listening to Let Me Tell You a Story with Steve and Becky Lyles on your phone right now with Player FM's free mobile app, the best podcasting experience on both iPhone and Android. Your subcriptions will sync with your account on this website too. Podcast smart and easy with the app that refuses to compromise.


36% of girls in Liberia are married before their 18th birthday and 9% are married before the age of 15.
The lowest median ages of marriage are in Lofa, Bong and Bomi.
Poverty: Girls in Liberia's poorest households are more likely to marry than those in the richest households.
Level of education: Liberian girls with no education are more likely to marry before the age of 18.
Traditional customs: Some communities mark a girl's social transition from childhood to adolescence through initiation ceremonies. These are conducted by female sande secret societies that are responsible for initiating girls into adulthood, and mark their readiness to enter into unions with men.
Violence against girls: Some Liberian girls are married off to male "protectors" soon after puberty with the misguided perception that this will shield them from exposure to sexual predators. This is a customary practice that is particularly common during times of conflict.
Liberia has committed to eliminate child, early and forced marriage by 2030 in line with target 5.3 of the Sustainable Development Goals.
Liberia co-sponsored the 2015 Human Rights Council resolution to end child, early and forced marriage, recognising that it is a violation of human rights.
Liberia co-sponsored the 2013, 2014 and 2016 UN General Assembly resolutions on child, early and forced marriage, and signed a joint statement at the 2014 Human Rights Council calling for a resolution on child marriage.
Liberia ratified the Convention on the Rights of the Child in 1993, which sets a minimum age of marriage of 18, and acceded to the Convention on the Elimination of All Forms of Discrimination Against Women (CEDAW) in 1984, which obligates states to ensure free and full consent to marriage.
In December 2016, Liberia became the 18th country to launch the African Union campaign to end child marriage in Africa under the theme "We are children, not wives, save us from child marriage".
In 1992 Liberia signed, but has not yet ratified, the African Charter on the Rights and Welfare of the Child, including Article 21 regarding the prohibition of child marriage.
In 2007 Liberia ratified the African Charter on Human and People's Rights on the Rights of Women in Africa, including Article 6 which sets the minimum age for marriage as 18.
As a member of the Economic Community of West African States (ECOWAS), Liberia has adopted the Strategic Framework for Strengthening National Child Protection Systems under which protecting children from marriage is a priority.
During its 2015 Universal Periodic Review, Liberia agreed to examine recommendations to combat child marriage and increase support for girls in rural areas and from the poorest households who are most at risk.
In December 2016, the Government of Liberia through the Ministry of Gender, Children and Social Protection officially launched a campaign to end child marriage in the country.
The minimum legal age of marriage in Liberia is 18 years. There is no data available regarding exceptions to this minimum age.


text:
Милија Миковић (Бар, 25. март 1994) црногорски је кошаркаш. Игра на позицији крилног центра, а тренутно наступа за  Морнар из Бара.

Клупска каријера
Миковић је каријеру почео у Морнару из Бара. Током 2014. је био на проби у Партизану, али није потписао уговор. Екипу Морнара је напустио лета 2016. када је потписао уговор са словеначким прволигашем Шентјуром. Након ангажмана у Словенији, потписао је за сарајевску Босну, али у овом клубу се због финансијских проблема задржао тек неколико месеци. Након одласка из Босне, остатак сезоне 2017/18. је наступао за мађарски ЗТЕ.  Од сезоне 2019/20. је заиграо у хрватској Премијер лиги, наступајући првих годину дана за екипу Горице, а затим за екипу Шибенке, у чијем дресу је био најбољи стрелац хрватског првенства у сезони 2020/21. У јулу 2021. се вратио у Морнар из Бара.

Репрезентација
Наступао је за кадетску, а потом и за јуниорску селекцију Црне Горе. Био је 2013. године члан селекције до 20 година, која је на Европском првенству у Естонији заузела осмо место. Са истом узрасном категоријом, наредне 2014. године, на Европском првенству на Криту, Миковић је био други стрелац турнира, пошто је просечно бележио 18,3 поена, уз девет скокова по мечу.

За сениорску репрезентацију Црне Горе је дебитовао лета 2021. током претквалификација за Светско првенство 2023.

Референце

Спољашње везе

 Милија Миковић на сајту ABA Liga (језик: енглески)
 Милија Миковић на сајту RealGM (језик: енглески)

Рођени 1994.
Барани
Црногорски кошаркаши
Крилни центри
Кошаркаши барског Морнара
Кошаркаши Босне

redpajama_set_name: RedPajamaWikipedia


Dundalk's Leading Wallpaper & Paint store.
Speaking as an interior designer, the wall of colour in Kearneys Paint store makes it so easy for my client and I to choose the appropriate colour for whatever project they are undertaking.
Best quality wallpapers to hang and the proper adhesives to hang them with!
Before I found out about Kearneys, I used to have to go to different paint stores to get whatever supplies I needed, now I can get everything in the one place.
I've tried a few different brands of paint, but for me, painting kitchen units, Fleetwood Advanced Satinwood is the very best!
Fantastic range of products and everything under one roof,when it comes to mixing paint,the lads know their stuff.
Brilliant store to shop in,very professional and has everything for the painter.
At Kearney's Wallpaper & Paints, a combination of our in-store services and our experienced staff provide the benchmark for the high standards which we trade under—making it easier for you, as our customer, to complete your decorating project no matter how big or how small.
We stock all leading and high-spec. brands of paints and varnishes.
We supply the highest quality in products here are some of our many suppliers.


text:
Q: Pandas Dataframe New Column: if x in list I am creating new columns for a df but I would like to include an if statement while doing so. My df is just a column of dates.
      date
2020-01-01
2020-01-02
       ...

I want to check if a key is in a list. If yes the df[col] = 1, else 0. The key is equal to str(x + y + date)
for x in list1:

    for y in list2:

        df[col] = if str(x + y + df['date']) in keylist: 1, else: 0

What would be the best way to structure this?
Thank you!

A: you need to reorder your if statement. This should work:
df[col] = 1 if str(x + y + df['date']) in keylist else 0

Check out this post.

redpajama_set_name: RedPajamaStackExchange


As attorneys, you have spent your lives studying, understanding, and applying this nation's laws. You know that the Judeo-Christian principles—especially the precepts contained in the Ten Commandments—have influenced the United States legal system to some extent.
But how does that influence actually apply to our personal and public lives as individuals?
A specific thought or two on each of the Ten Commandments may help us understand why God's moral law all of our ethical responsibilities in our personal and public lives.
God is first. This means we should offer prophetic resistance to anything that would make itself a god, such as the totalitarian state.
We must have no mental or material images that we would worship as an idol. Our work can often become an idol when we look to it for security instead of to God.
Following God requires complete conviction. We should not take God's name in vain with respect to his worship, whether in language, in oaths, or in promises. Perhaps the worst sin is not profanity but lip service. Martin Luther once said that God is sometimes more pleased with the curses of the wicked than the hallelujahs of the pious.
We must set aside time for our Lord and for worship, fellowship, and devotion. This is essential if we are to integrate our faith and work and do our jobs for the glory of God.
Heritage is important. C.S. Lewis urged that we need to let the breezes of the centuries blow through our minds.
One way in which we can do this is to listen to the church leaders of the past. For example, many church leaders of the past have written about a theology of work and that can help us serve God more effectively and find more fulfillment in our jobs today.
Every person has dignity. The image of God is the only adequate basis on which murder can be condemned, because it provides the basis for our dignity.
The image of God is also a reason why we should help the poor. We help them not only because God commands it, but because they are made in the image of God.
Fidelity is important. Marriage and family are at the core of society. If they fail, society will become poorer economically and spiritually.
Stealing is evil because private property and ownership are good. This commandment and other passages like Exodus 21:28-36; 22: 1-15; Deuteronomy 22:1-4; 23:24-25; and Proverbs 22:28 and 23:1 all uphold ownership and property rights.
In our culture, "truth has fallen in the street" (Isaiah 59:14). Truth is replaced by rhetoric and spin. We are to be truthful because God is truthful. Above all, we must uphold the veracity, or truth, of God's word.
There is a difference between desire and greed. We can condemn greed and envy without prohibiting a healthy desire for relationships and things. Justly decrying greed does not negate the value of serving people through business and free markets, for instance.
These are just some of the ways the Ten Commandments can provide an ethical framework for our lives and work. They illustrate what an enormous impact God's law has on how we make wise decisions in our work, how we spend our money, and how we relate to other people in our communities and societies.


text:
Photo by Jade Brumfield
By Peyton Perez
As project managers at The ASK Academy are asked to reduce the amount of schoolwork that the scholars are given outside of class, scholars are beginning to feel more at ease.
In early November, the administrators at The ASK Academy asked project managers to reduce the amount of schoolwork that is given to scholars outside of class. With the reduction of schoolwork, many scholars feel less stressed and much more relaxed. "I am less stressed with less homework and schoolwork," says freshman Colter Watkins. Watkins said his grades have improved since he no longer has to worry about getting a large amount of work done in a short amount of time.
Freshman Gregory Gallegos can agree that the decrease in schoolwork has allowed him to be "more at ease." Even though Gallegos has felt a decrease in his stress levels due to the decline in schoolwork, he is still stressed and is still getting about the same amount of schoolwork in the class that affects him the most, Honors English. "I noticed that the Honors classes, like Honors English, are still giving the most intense work in my opinion, and since the new policy doesn't really apply to them. (The manager) still assigns about the same amount of homework." Gallegos said that it is the quantity of work that stresses him out rather than the content. He also finds that he struggles with procrastination as well as lack of motivation which increases his stress levels since he knows he has a lot to do last minute. Gallegos is feeling much better about online school however, he can still get stressed out when he has a lot of work to do.
Heightened stress levels due to school are still affecting scholars however many feel much more relaxed and at ease now that schoolwork has been reduced. For many project managers, this is a different story.
Some project managers at The ASK Academy have felt more stressed while teaching with an online format. They find it more difficult to teach online rather than in person and have had heightened stress levels since the beginning of the 2020-2021 school year.
Krista Pink, the assistant special educator and sixth grade resource teacher at The ASK Academy has had a very different experience while doing online teaching. Since the beginning of the school year, Pink has been much busier than she used to be, working about twelve hours a day.
"My day, my calendar is booked," she said.
The busier schedule surprised Pink since she originally believed that she would have more down time and would have a more free schedule. The constant working can stress her out but she believes that it is good stress rather than bad stress which pushes her to work harder for her scholars. If the stress gets overwhelming she will reach out to her fellow staff members as her support system.
"I think we have a really strong support system and I'm not afraid to use it," she said.
Even though online teaching has had its downfalls, Pink has been pushed to find new teaching methods and be much more creative. She has found many new and ffective ways to teach which she plans to use even outside of online school.
Bahador Mousavi, who teaches AP Calculus, Pre-Calculus and Algebra 2 has felt an increase in his stress levels since the very beginning of this school year. The stress that he feels stems from many things that occur during online school. Issues with technology, distractions, lack of communication and collaboration and a busier schedule all increase Mousavi's stress levels. Whenever Mousavi is stressed, he said he finds that it is helpful to give himself breaks as well as communicate things with his scholars.
"Being honest with my students and knowing that we have common and mutual problems I think prevents the stress," he said.
During online school, Mousavi has noticed a decrease in the efficiency of teaching which adds to the reasons why he dislikes online teaching. Mousavi would much rather be teaching in person.
Cheryl Walker, 12 grade English, tenth grade Honors English, and Yearbook teacher has also felt stressed about the online schooling. Like Mousavi, there are many things that cause Walker stress; for example, lack of communication and almost nonstop working will cause her stress. She provides herself with boundaries, giving herself set screen breaks and she will do things that she enjoys to get away from technology. Walker feels very disconnected with her fellow staff since it is more difficult to communicate and it isn't as spontaneous.
"We don't talk to each other that often and when we do it's a very structured time," she said.
Walker has also found it much more difficult to add creativity into her lessons and make her lessons engaging for her scholars over an online format. She spends much of her time thinking of new ways to teach making her day very busy.
"I have so much prep and homework grading and basically everything I do, I work nonstop almost all the time." Although Walker strongly dislikes online school, she is very glad it exists so that she can continue teaching.
The request for teachers to hand out less school work outside of class has affected project managers at The ASK Academy greatly. The amount of work handed out to students decreases, giving project managers less time to get their lessons out to students. This change has affected all three of Walker's classes.
"We read a lot of books in my classes which means that now a lot of class time has to be dedicated to reading books…it's like a race to the finish," she said.
There is an extra difficulty in her Yearbook class since there is so much to be done in so little time. "When is comes to yearbook its extra tricky cause there is so much visual arts, its hard to do the really creative stuff in the hour." There is now a cram for Walker to make sure that her scholars learn everything that they would normally before the semester ends. Mousavi has also been strongly affected by this change. Since everything is rushed and going quickly, Mousavi never knows if his students are actually understanding the work that he is giving.
"I feel that my scholars do not have a chance to understand my courses concepts deeply," he said. He also feels like he has more of a workload on his shoulders which adds to his stress levels. Even though the decrease in homework has helped scholars with their stress levels, it has added to the stress levels of the project managers.
As more time passes by, many project managers and scholars adjust more to the online school format. Stress, however, is still a prominent feeling amongst everyone at the academy. Although online school may not be ideal, many are glad that it is an option.
Homework, hybrid teaching, online teaching, Quarantine, stress, The ASK Academy, workload
← Podcast: Scholars Chat About Loona, Twice and GFriend
Medical Workers Discuss the Difficulties of Working During the Pandemic →

redpajama_set_name: RedPajamaCommonCrawl


text:
module Atlas
  class Trie

    # Create a new, empty Trie.
    #
    #   t = Containers::Trie.new
    #   t["hello"] = "world"
    #   t["hello] #=> "world"
    def initialize
      @root = nil
    end

    # Adds a key, value pair to the Trie, and returns the value if successful. The to_s method is
    # called on the parameter to turn it into a string.
    #
    # Complexity: O(m)
    #
    #   t = Containers::Trie.new
    #   t["hello"] = "world"
    #   t.push("hello", "world") # does the same thing
    #   t["hello"] #=> "world"
    #   t[1] = 1
    #   t[1] #=> 1
    def push(key, value)
      key = key.to_s
      return nil if key.empty?
      @root = push_recursive(@root, key, 0, value)
      value
    end
    alias_method :[]=, :push

    # Returns the value of the desired key, or nil if the key doesn't exist.
    #
    # Complexity: O(m) worst case
    #
    #   t = Containers::Trie.new
    #   t.get("hello") = "world"
    #   t.get("non-existant") #=> nil
    def get(key)
      key = key.to_s
      return nil if key.empty?
      node = get_recursive(@root, key, 0)
      node ? node.last : nil
    end
    alias_method :[], :get

    def start_with(prefix)
      if prefix_root = find(prefix)
        prefix_root.family.inject([]) do |values, node|
          values.push(*node.value) if node.last?
          values
        end.compact
      else
        []
      end
    end

    def count(prefix)
      if node = find(prefix)
        node.value_count
      else
        0
      end
    end

    def find(prefix)
      prefix = prefix.to_s
      return nil if prefix.empty?
      find_recursive(@root, prefix, 0)
    end

    def to_dot(options = {})
      "digraph G { #{@root.to_dot(options)} }"
    end

    def write_dot(filename, options = {})
      extension = File.extname(filename)[1..-1]
      if extension == "dot"
        File.open(filename, "w") { |f| f.write to_dot(options) }
      else
        IO.popen("dot -T#{extension} -o #{filename}","w") do |pipe|
          pipe.print to_dot(options)
          pipe.flush
        end
      end
    end

    class Node # :nodoc: all
      attr_accessor :left, :mid, :right, :char, :value, :end
      attr_accessor :value_count

      def initialize(char, value)
        @char = char
        @value = value
        @left = @mid = @right = nil
        @end = false
        @value_count = value ? 1 : 0
      end

      def children
        [ left, mid, right ].compact
      end

      def inspect
        value_string = value.to_s
        if value_string.size > 20
          value_string = value_string.first(20) + "..."
        end
        children_string = [ :left, :mid, :right ].collect! do |child_name|
          child = send child_name
          "#{child_name}=" + (child.nil? ? "nil" : child.char.chr)
        end.join(' ')
        "#<Node:#{char.chr} #{children_string} value=#{value_string}>"
      end

      def descendants
        children.inject([]) do |descendants, child|
          descendants << child
          descendants + child.descendants
        end
      end

      def family
        [self].tap do |family|
          if mid
            family.push mid
            family.push *mid.descendants
          end
        end
      end

      def last?
        @end == true
      end

      def dot_id
        object_id
      end

      def dot_child(child, options = {})
        if Symbol === child
          link_options = "[label=#{child}]"
          child = send(child)
        end
        "#{dot_id} -> #{child.dot_id} #{link_options}; #{child.to_dot(options)}" if child
      end

      def to_dot(options = {})
        [].tap do |definitions|
          definitions << "#{dot_id} [label=\"#{char.chr} (#{value_count})\"];"
          definitions << dot_child(:left, options)
          definitions << dot_child(:mid, options)
          definitions << dot_child(:right, options)
          if options[:with_value]
            definitions << "#{value.object_id} [label=\"#{value}\",shape=box]"
            definitions << "#{dot_id} -> #{value.object_id} [style=dotted]"
          end
        end.compact.join(' ')
      end

    end

    def push_recursive(node, string, index, value)
      char = string[index]
      node = Node.new(char, nil) if node.nil?
      if (char < node.char)
        node.left = push_recursive(node.left, string, index, value)
      elsif (char > node.char)
        node.right = push_recursive(node.right, string, index, value)
      elsif (index < string.length-1) # We're not at the end of the input string; add next char
        node.value_count += 1
        node.mid = push_recursive(node.mid, string, index+1, value)
      else
        node.value_count += 1
        node.end = true
        if node.value
          node.value << value
        else
          node.value = [value]
        end
      end
      node
    end

    # Returns [char, value] if found
    def get_recursive(node, string, index)
      return nil if node.nil?
      char = string[index]
      if (char < node.char)
        return get_recursive(node.left, string, index)
      elsif (char > node.char)
        return get_recursive(node.right, string, index)
      elsif (index < string.length-1) # We're not at the end of the input string; add next char
        return get_recursive(node.mid, string, index+1)
      else
        return node.last? ? [node.char, node.value] : nil
      end
    end

    def find_recursive(node, string, index)
      return nil if node.nil?
      char = string[index]
      if (char < node.char)
        return find_recursive(node.left, string, index)
      elsif (char > node.char)
        return find_recursive(node.right, string, index)
      elsif (index < string.length-1) # We're not at the end of the input string; add next char
        return find_recursive(node.mid, string, index+1)
      else
        return node
      end
    end

  end
end

redpajama_set_name: RedPajamaGithub


Located on the southern end of Madeira, in a naturally-formed 'amphitheatre' which looks out to the glistening blue of the Atlantic, cosmopolitan Funchal has grown up from its colonial past. With a dramatic mountain backdrop, and a lush peripheral stretch of banana plantations and flower gardens, the city certainly has a relaxed feel, but it doesn't try hard to hide its vibrant nightlife, buzzing café culture and abundance of sightseeing opportunities.
Discover Madeira's history with a walk through Funchal's Old Town – said to be the site of the very first settlements on the island. Narrow cobblestoned streets, 15th-century architecture, the impressive Corpo Santo Chapel, the 'Painted Doors', and a few quirky heritage shops (stop off at the 60-year old Fábrica de Chapéus (Hat Factory)) will give you a taste of what this city was like centuries ago. Enjoy a coffee with a slice of Madeiran honey cake in one of the many charming cafes, or a glass of Madeiran wine if the mood calls for it!
Meander through some of the local markets, where you can buy fresh fruit and vegetables, flowers, or try delicious local cuisine – try bolo de caco bread, or the grilled chicken and wheat soup to take away! Mercado dos Lavradores is the most popular of them all, located in Funchal's Old Town, it's open Monday to Saturday for all your exploring needs.
Deserving of the nickname 'floating garden in the Atlantic', Madeira is fiercely proud of its natural beauty and abundance of plant life. Although there are numerous parks and gardens throughout Funchal, visitors simply need to make a stop off at the verdant Botanical Gardens; established in 1960, the gardens boast more than 2000 species and also offers incredible views over Funchal city.
In the year 2000, Funchal won the award of 'European Flowering City' – a revered award for all things horticultural. Madeira's stunning floral offerings have also been placed amongst peers like cherry blossoms from Tokyo, bougainvillea from the Amalfi Coast, cloud forests from Costa Rica and the Alpine Flowers of the Swiss Alps. Plan your visit for April – May, when the Madeira Flower Festival is in full bloom.
For more spectacular views over the Atlantic and this sprawling city, take the cable car from the lower section of Funchal to the relaxed suburb of Monte. Board at Almirante Reis Park, located in the old part of Funchal town, and fly over the city admiring a mirage of blues, greens and reds. At the top, take a look around Monte village. Formerly the site of a health resort for Europe's high society, it's full of wonderful examples of classic colonial architecture. A walk around the parish will undoubtedly lead you to the Monte Palace Tropical Garden and its staggering 10,000 exotic plant species. A festival in mid-August, Nossa Senhora do Monte (Our Lady of Monte), is an ideal time to make the trip as you can sample some incredible Madeiran gastronomy and enjoy local music.
Madeira Island boasts an impressive 30 beaches, each with unique properties. Pebbles, black volcanic sand and impressive natural landscapes will impress anyone who is open-minded and ready to forgo the typical stereotype of golden sands and palm trees.
Praia Formosa, Calheta, and the impressive 9-mile Porto Santo are all within close proximity to Funchal and all offer modern comforts, such as public bathrooms, showers, beachside eateries and shady parts for when the sun gets a little too strong. Praia Formosa, as the most popular, also boasts a new coastal promenade with uninterrupted ocean views.
Try your hand at some water sports while you're here too. Canoeing, windsurfing, catamaran rental and more are easily organisable almost along any stretch.
Café-bars, pubs, bars, nightclubs, dinner shows, live entertainment and even casinos - Funchal has it all! A buzzing nightlife scene is on hand to entertain any visitors to this incredible European city, whatever their taste.
Enjoy live performances of fado, traditional Portuguese ballad music, over a typical Madeiran dinner in the heart of the Old Town. Try your luck at the Funchal Casino which is free to enter. Let your hair down at numerous clubs, some of them al fresco. Visit in February for a taste of Carnival, running at the same time as the famous Rio de Janeiro Carnival. Whatever your vibe, Funchal's certain to delight!


I think the first concert I went to was a Forgotten Rebels show in Hamilton Ontario at a crappy little Sports Bar (which is a weird place for them to play). The Forgotten Rebels are this punk band from Hamilton. I use to like them but now I just find them funny.
No favorites. I have too many CDs and listen to too many bands to try and pick favorites from.
At the moment I love "You Were Right" by Badly Drawn Boy. Though this will probably change in a couple of days. Last week it was about half of the songs off of the first disc of the Magnetic Fields "69 Love Songs" album. (Note of interest: I just realized that Lemony Snicket plays accordion and occasional keyboard on a couple of songs on the 69 Love Songs album – cool).
I'd like to know how to play the piano. I think the piano is one of the few instruments that sounds amazing either solo or as accompaniment. It is also very easy to hear the emotion of the pianist when they play.
Interesting question. I think I would like to meet Louis Armstrong. Don't really know why. I think he would have some interesting views on the world and from everything I've heard of him he just seemed like a cheerful, warm person.
yea!! a new layout!! i'm excited!!!!
That last comment is from me, geez, this is why I don't comment….
I figured it was either from you or Iain. And I saw them with Chuck in Hamilton a year or so before the Embassy show and then I saw them again with John and Carrie in Kitchener about a year after that.


text:
Riot Material
Art. Word. Thought.
Cinema Disordinaire
Riot Sounds
The New Word
The Mother Tongue
That Evening Sun
From The Shelf
FR/BLCK/PR
Jazz Reviews
Riot Cinema
James Dickey's Black Mask: Deliverance as a Runaway Slave Narrative
December 5, 2018 By Riot Material Leave a Comment
When Burt Reynolds died last August, the obits recounted the strange life of an iconic American actor. Particularly weird was how Reynolds often lied about where he was born. He said he was born Waycross, Georgia. Why anyone born in Lansing, Michigan would want to be from Waycross, Georgia is a baffling question. What we do know is that Reynolds, who always identified as southern, and even affected a twang to fit the image, was, with this odd fib, participating in a cultural practice with roots dating back to nineteenth-century plantation culture. Burt Reynolds was "storying."
To best understand storying one could do worse than turn to Kevin Young's The Grey Album. Slaves, denied evidence of their heritage, resorted to counterfeiting tactics to recover a sense of identity and community. The trickster, separated from self, society, and family, storied his way to survival. It was a strategic embellishment, a move that allowed enslaved African Americans and their descendants to "forge their own traditions . . . even their own freedom." Ultimately, it was a habit of mind, one most urgently cultivated in the hothouse of necessity—usually underground, down in the hole, trying to escape the master.
If Reynolds' penchant for storying led him to identify as southern, his role in the 1972 movie Deliverance, based on the novel of the same name, allowed that penchant to intersect with art. Based on the novel by the Georgia writer James Dickey (who also wrote the screenplay), Deliverance is an underappreciated and misunderstood film, one in which Reynolds clearly thrived as a swarthy Lewis Medlock. The movie is typically characterized as a thriller, or (more generously) as a psychological and physical journey undertaken by four Atlanta suburbanites on a canoe trip down North Georgia's Coossawattee River.
All illustrations courtesy of Shaun Lowndes. Lowndes is a freelance illustrator living in the UK: https://shaunlowndes.portfoliobox.net
But it's so much more than that. To start figuring why, one should recall that Dickey himself was notoriously well versed in the storying habit. According to a close friend, Dickey "believed in the creative potential of the lie." His biography, by Henry Hart, is titled, James Dickey: The World as a Lie. The big lie, in this case, was that Deliverance was solely an adventure tale about four white guys trying to avoid being killed by a gang of horny hillbillies. Take the mask off that old storyline and Deliverance reveals something else altogether: an inverted slave narrative.
The novel is the better place to make this case. The book begins with Lewis convincing his three suburbanite buddies to leave their bourgeoisie lives and make the three-day trip into the hills and hollows as a chance to revive their wither
ing manhood. When they arrive, emboldened by the perceived primitiveness of the rural South, they act as arrogant conquistadors bent on exploiting natural resources for their own adventure. When Lewis sets up camp for the men on the first night, Ed, who narrates the novel, explains, "we had colonized the place." Their venture, in Lewis's prescient observation, hinged on the sense "that the whole thing is going to be reduced to the human body, once and for all." This was a test—the resilience of the human body—they felt they needed.
Their attitude toward the locals reiterates the colonizing arrogance of the conquistador suburbanites. The nothing of a town where they put in their canoes—Oree (French for the edge of a forest)—is described by Ed as "sleepy and hookwormy and ugly . . . Nobody worth a damn could ever come from this place." He then adds, "there is always something wrong with people in the country." A deeper reading suggests that the Oree residents we meet represent something other than the illiterate drooling rednecks Ed first caricatures. These hillbillies, if only metaphorically, are slaves. They, too, need an escape—deliverance.
The first reference to slavery comes when Lewis and his men camp in the woods after their first day on river. Lewis, who otherwise shows no inclination toward being a naturalist, randomly launches into a speech on the linden moth larva populating the area's trees. "You can see a mass hanging," he says. "They let themselves down on threads. You can look anywhere you like and see them wringing and twisting on the ends of the threads like men that can't die. Some of them are black and some are brown." Ed follows up Lewis's lynching suggestion with the thought that, "In the comparatively few times I had ever been in the rural South, I had been struck by the number of missing fingers. Offhand [pun?], I had counted around twenty, at least." This detail seems arbitrary, until you realize that plantation masters in the Deep South routinely cut off slave fingers to both punish and identify slaves should they escape.
Perhaps the best indication of the hillbillies' enslavement to the suburbanite colonizers is the book's (and more so the movie's) second most remembered moment: the banjo scene. Easily misunderstood as an expression of Appalachian freakishness, the albino virtuoso (his extreme whiteness making the racial inversion complete) who rips through "dueling banjoes" (with Drew unable to keep pace) is ultimately belied by his instrument. The banjo as we know it originated on the southern slave plantation. Originally made in Africa with gourd heads and three or four vine strings, it was (according to The Birth of the Banjo by Bob Carlin) quickly modified by slaves in the South to have a wooden frame and a fifth string. This innovation altered the sound of the banjo enough for the Texas folklorists John and Alan Lomax to call it "America's only original folk instrument." Drew channels the spirit of his interaction with the albino by playing, among other songs, "Mr. Easy Tom," a song made famous by the one black man whites (via John Lomax) consulted for a more raw version of the slave experience—Leadbelly.
The next day, as the suburbanites prepare to re-enter "the complicated urgency of the current," it's Ed's turn to be portentous. "I was in a place," he thought, "where none—or almost none—of my daily ways of living my life would work; there was no other habit I could call on. Is this freedom? I wondered." The answer would come in the movie's most famous scene.
Ed and Bobby disembark on a thickly wooded bank before Lewis and Drew arrive. They soon encounter two hillbillies whom they assume are bootleggers—a common slave underground activity. The hillbillies, armed with a rifle and knife, quickly have Ed fast up against a tree, gun at his chest. With a belt serving as a noose, Ed is secured to the tree and, with that, a reversal of power is underway. Then, in one of the most degrading scenes I know of in American literature, Bobby is bent over a log and raped. The hillbillies, power swelling within them, return to Ed and prepare to castrate him. The scene ends with the well-timed arrival of Lewis, who shoots the rifle-wielding hillbilly clear through the chest with a steel-tipped arrow, saving Ed from certain dismemberment and death. The other hillbilly escapes into the woods.
from Deliverance (1972)
With this scene, the carnival is on. The shift from master to slave is swift and complete. Freedom is now gone for the suburbanites. The colonizers are now more than murderers on the lam, they're slaves on the run, following a river under moonlight to freedom. The lone hillbilly, if only through the fear he has instilled, owns them; and he now pursues them, patrolling the river from bluffs like an overseer on horseback. Dickey marks this radical transition in power with at least three references to slave brutality common in the South: rape, castration, and lynching.
Lewis soon breaks a leg after his canoe capsizes. Drew is shot through the neck and killed while rowing. This leaves Ed and Bobby—who now are the metaphorical slaves—to grope their way toward freedom. Lewis, flat on his back in the canoe, lectures Bobby and Ed about what exactly this means: "you're wrong when you say that there's nothing like a game connected with the position we're in now. It may be the most serious kind of game there is, but if you don't see it as a game, you're missing an important point." To escape, to avoid what will amount to two murder charges, they will, as Lewis says, have "to act it through." They will, in other words, have to story their way out this trap.
On the next day, Ed leaves the river and rock-climbs out of a gorge to murder the hillbilly who killed Drew. This long stretch of story, most of which plays out in the woods that loom over the Coossawattee, mirrors what may be the most significant trope of the slave escape narrative: physical adroitness in an unknown wilderness. In Ride Out the Wilderness: Geography and Identity in Afro-American Literature, Melvin Dixon quotes an old slave song to this affect: I found free grace in de wilderness / in de wilderness, in the de wilderness / I found free grace in the wilderness / For I'm a-going home. Dixon also quotes the runaway slave Henry Bibb, who recalled about the woods he escaped through, "I travelled all that day without any knowledge of the country whatever."
Ed reacts similarly. Alone in the woods, he thought, "Nobody in the world knows where I am." But this moment in "de wilderness" empowers him at the same time. "Something," he thinks, "came to an edge in me." Recall that Oree literally meant the edge of the woods. Ed crossed that barrier when he left Oree and, when he did, "the leaves glittered, all mysterious points, and the river and the light on it were nothing but pure energy." He thought, "I had never lived sheerly on nerves before and a gigantic steadiness took me over."
Likewise, Bibb, as an actual runaway slave, recounted how "I had nothing to travel by but the sun by day, and the moon and stars by night." But, as Dixon explains, "the wilderness revealed man's place in the natural harmony of the world," an assessment confirmed by Bibb's noting that, once in "my hiding place in the woods . . . I thought of all the fishes of the water, the fowls of the air, the wild beasts of the forest, all appeared to be free." His deliverance, too, was imminent.
Eventually Ed, Bobby, and Lewis reach Aintry, their stopping point. They have a lot to answer for. The murdered hillbillies have been reported missing. In preparation for the inevitable interrogation, Ed and his trickster companions have arranged their lies with masterful coordination. They lie all over the place and they lie well. At one point Ed is so enthralled with his own storying habit that, as if feeling his repressed colonizer coming back to life, he winks at Bobby. He then thinks to himself, "My lies seemed better, more and more like the truth."
The cop who hears this spell of storying is, in the movie, none other than the notorious storyteller himself James Dickey. He nods. But he knows. In the move he pleads with the men to leave, to go back to the big city and let "this town die peaceful." In the book, the sheriff, who recognizes storying when he sees storying, looks at Ed and, as if with grudging admiration, says, "You done good."
James McWilliams is an historian and writer based in Austin, Texas. His books include The Modern Savage: Our Unthinking Decision to Eat Animals (Thomas Dunne Books), Just Food: Where Locavores Get It Wrong and How We Can Truly Eat Responsibly (Little, Brown) and A Revolution in Eating: How the Quest for Food Shaped America (Columbia University Press). His
writings have appeared in The Paris Review daily, The New Yorker.com, The New York Times, Harper's, The Washington Post, Slate, The American Scholar, Texas Monthly, The Atlantic, and The Virginia Quarterly Review. He is a contributing writer at Pacific Standard, and his literary non-fiction has appeared in The Millions, Quarterly Conversation, The New York Times Book Review, and The Hedgehog Review.
Filed Under: The Line, Thought, Word
Oiling The Fixed Bones With Nosaj Thing's "Shower"
From Timetable Vol. 2
https://www.riotmaterial.com/wp-content/uploads/2019/07/Timetable-Records-Nosaj-Thing-Shower.mp3
on Timetable Records
New Afro-Beat, Remix And Regular, From Rex Suru: "Na Control"
https://www.riotmaterial.com/wp-content/uploads/2019/07/04-Na-Control-Alex-Phountzi-Remix.m4a
Na Control (Alex Phountzi Remix)
https://www.riotmaterial.com/wp-content/uploads/2019/07/01-Na-Control.m4a
Na Control
out today on Bik Records
"You're So Fine" Is Fine Forty+ Years On. And Fresh As New!
(no, truly, this is brand new!!)
by Papa Bear & His Cubs
https://www.riotmaterial.com/wp-content/uploads/2019/07/01-Youre-so-Fine.m4a
on Athens of the North
Ross Bleckner's Burnt Offerings
Pharmaceutria at Petzel Gallery, NYC (through June 15) Reviewed by Phoebe Hoban Ross Bleckner's luminous canvases of the 1980s and 90s, often rendered in grey and evoking distant galaxies, possess an otherworldly light, which is apt, since many of his paintings of that time memorialize those lost to the relentless onslaught of AIDS. Bleckner, whose […]
Old Smoke Fuels The Sound Fury Of Theoretical Spontaneity
Baczkowski/Lopez/Corzano's Old Smoke on Relative Pitch Records Reviewed by Henry Cherry Because of his self-anointed position as the ambassador of all jazz, Wynton Marsalis served as musical advisor on Ken Burns's episodic documentary on the genre for PBS. By deleting any real discussion of the music's experimental arm, it was understood to be a death […]
The Disorienting, Confounding And Enthralling New Work Of Guillermo Kuitca
at Hauser & Wirth, Los Angeles (through August 11) Reviewed by Genie Davis As if dreams of buildings, rooms, floor plans, and landscape had landed within his abstract works, Guillermo Kuitca's often mysterious images take viewers into a world entirely different from our own. At LA's Hauser & Wirth, Kuitca's works collapse, repeat, and spatially shift […]
Deborah Roberts Explores The Fragility of Black Masculinity in Native Sons
Native Sons: Many thousands gone at Susanne Vielmetter Los Angeles Projects (through June 8) Reviewed by Lita Barrie Deborah Roberts' impassioned exhibition memorializes Black boys who lost their lives from the social injustices of false accusations for murders they did not commit. This solemn exhibition is predicated on African American literature and takes its title […]
Exploring Scenic Contemporary Ceramics in Keshiki
at Japan House Gallery, Los Angeles (through June 20th) Reviewed by Annabel Osberg A rustic single-handled basket stands before me and a wintry spring surrounded by rocks with rough faces dusted in snow. Emerald colored water, possibly melted precipitation tinted by algae, has pooled inside the basket's basin. This impression of nature is strong; but […]
Squeak Carnwath: How the Mind Works
at Frederick R. Weisman Museum, Pepperdine University Rewiewed by Nancy Kay Turner The idiosyncratic, stream-of-consciousness, large-scale oil paintings by the Bay Area painter Squeak Carnwath are personal ruminations on everything from politics to urban anxieties and parental concerns ("PAReNTS BEWARE homework is BAD") [sic], to name just a few of the issues that rise to […]
Garry Winogrand: Color
at Brooklyn Museum, NYC (through December 8) Reviewed by John Haber Garry Winogrand: Color contains a monster four hundred and fifty photographs. They play, though as a digital slideshow in sixteen tall channels on facing walls. As the very heart of the exhibition, they become a single immersive installation.
Into The Mythic With Rebecca Farr's Animal Love Thyself
at Klowden Mann (through June 15) Reviewed by Ellen C. Caldwell When I wrote about Rebecca Farr's fourth solo exhibit in November of 2016, I said it was everything. I saw the show immediately following the 2016 presidential election and Farr's show created a nurturing embrace and a place for soul-and nation-searching. In her fifth solo exhibit […]
A Conflation of Dueling Sentiments In Alexandra Grant's Born to Love
at Lowell Ryan Projects, Los Angeles (through July 6) Reviewed by Eve Wood Artist Alexandra Grant refers to herself as a "radical collaborator," a dualistic thinker, a synthesizer of textual images into visual form as for many years she has worked closely with both writers and scholars to create luminous paintings that both incorporate and re […]
Our Future Revisited In Paula Rego's Untitled: The Abortion Pastels
by Ellen C. Caldwell During a time in which eight U.S. states have passed bills to limit women's rights to abortions, Paula Rego's Untitled: The Abortion Pastels seems timely and relevant. Made between July 1998 and February 1999, this series of ten works features personal and quietly anguished portraits of women who have just undergone or are […]
The Flawed Yet Fine Gem Of All Creatures Here Below
By Jeannette Catsoulis All Creatures Here Below is a Midwestern tragedy that, scene by scene, grows incrementally more horrific. Tearing open the wounds of childhood trauma, the director, Collin Schiffli, and his writer, David Dastmalchian, immerse us in the desperate acts of a young runaway couple, then dare us to condemn them.
Dreaming Toward Redemption In A Great Lamp
Festival Winner at the Mammoth Lakes Film Festival Opens July 8 at the Arclight by Genie Davis The narrative feature A Great Lamp is a beautiful black and white film from director Saad Qureshi and his highly collaborative cast and crew. The film has a real heart as well as a beautifully defined artistic aesthetic. It's the […]
Remembrance IncARnaTe In Inherited Memories
at Castelli Art Space, Los Angeles Reviewed by Genie Davis Inherited Memories, at Castelli Art Space in Culver City, is a graceful, poignant, intensely moving exhibition from Shula Singer Arbel, Dwora Fried, and Malka Nedivi. Each of the three artists has created powerful, transcendent work that deals with the fact their mothers survived the Holocaust. They […]
Beauty and the Beast Both Defines And Defies The Figurative
at Launch Gallery, Los Angeles (through June 8) Reviewed by Genie Davis Beauty and the Beast is a compelling two-person show that both upends and celebrates formal figurative tradition. It is an exhibition of contrasts: the personal and the political, the interior and the external. The two artists, Jorg Dubin and Andrea Patrie, are disparate in style […]
Marnie: An Opera In Two Acts
at the Metropolitan Opera, New York Reviewed by Donald Lindeman Nico Muhly, Composer; Nicholas Wright, Librettist; Directed by Michael Mayer; Conductor, Robert Spano. The Metropolitan Opera in New York, to its credit, has become a steadfast supporter of new operas, engaging in patronage and risk in the name of the advancement of young composers […]